Mercurial > vim
annotate src/testdir/test_winfixbuf.vim @ 34667:968626cf50fa v9.1.0216
patch 9.1.0216: Error on exit with EXITFREE and 'winfixbuf'
Commit: https://github.com/vim/vim/commit/620e85265ce04654053c64f8058914ecafe4eb38
Author: zeertzjq <zeertzjq@outlook.com>
Date: Thu Mar 28 10:11:57 2024 +0100
patch 9.1.0216: Error on exit with EXITFREE and 'winfixbuf'
Problem: Error on exit with EXITFREE and 'winfixbuf'.
Solution: Handle DT_FREE before checking for 'winfixbuf'.
(zeertzjq)
closes: #14314
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 28 Mar 2024 10:15:10 +0100 |
parents | 224d4a792264 |
children | c507111b5c80 |
rev | line source |
---|---|
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Test 'winfixbuf' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 source check.vim |
34667
968626cf50fa
patch 9.1.0216: Error on exit with EXITFREE and 'winfixbuf'
Christian Brabandt <cb@256bit.org>
parents:
34658
diff
changeset
|
4 source shared.vim |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 " Find the number of open windows in the current tab |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 func s:get_windows_count() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 return tabpagewinnr(tabpagenr(), '$') |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 " Create some unnamed buffers. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 func s:make_buffers_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 file first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 let l:first = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 file middle |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 let l:middle = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 file last |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 let l:last = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 return [l:first, l:last] |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 " Create some unnamed buffers and add them to an args list |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 func s:make_args_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 let [l:first, l:last] = s:make_buffers_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 args! first middle last |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 return [l:first, l:last] |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 " Create two buffers and then set the window to 'winfixbuf' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 func s:make_buffer_pairs(...) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 let l:reversed = get(a:, 1, 0) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 if l:reversed == 1 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 file original |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 enew! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 file other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 let l:other = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 return l:other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 endif |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 file other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 let l:other = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 file current |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 return l:other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 " Create 3 quick buffers and set the window to 'winfixbuf' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 func s:make_buffer_trio() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 edit first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
71 let l:first = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 edit second |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 let l:second = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
76 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 edit! third |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 let l:third = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 execute ":buffer! " . l:second |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 return [l:first, l:second, l:third] |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
83 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
84 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
85 " Create a location list with at least 2 entries + a 'winfixbuf' window. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
86 func s:make_simple_location_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 file middle |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
89 let l:middle = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
90 call append(0, ["winfix search-term", "another line"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
91 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
92 enew! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
93 file first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
94 let l:first = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
95 call append(0, "first search-term") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
96 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
97 enew! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
98 file last |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
99 let l:last = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
100 call append(0, "last search-term") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
101 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
102 call setloclist( |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
103 \ 0, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
104 \ [ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
105 \ { |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
106 \ "filename": "first", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
107 \ "bufnr": l:first, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
108 \ "lnum": 1, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
109 \ }, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
110 \ { |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
111 \ "filename": "middle", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
112 \ "bufnr": l:middle, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
113 \ "lnum": 1, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
114 \ }, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
115 \ { |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
116 \ "filename": "middle", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
117 \ "bufnr": l:middle, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
118 \ "lnum": 2, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
119 \ }, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
120 \ { |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
121 \ "filename": "last", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
122 \ "bufnr": l:last, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
123 \ "lnum": 1, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
124 \ }, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
125 \ ] |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
126 \) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
127 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
128 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
129 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
130 return [l:first, l:middle, l:last] |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
131 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
132 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
133 " Create a quickfix with at least 2 entries that are in the current 'winfixbuf' window. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
134 func s:make_simple_quickfix() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
135 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
136 file current |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
137 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
138 call append(0, ["winfix search-term", "another line"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
139 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
140 enew! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
141 file first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
142 let l:first = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
143 call append(0, "first search-term") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
144 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
145 enew! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
146 file last |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
147 let l:last = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
148 call append(0, "last search-term") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
149 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
150 call setqflist( |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
151 \ [ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
152 \ { |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
153 \ "filename": "first", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
154 \ "bufnr": l:first, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
155 \ "lnum": 1, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
156 \ }, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
157 \ { |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
158 \ "filename": "current", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
159 \ "bufnr": l:current, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
160 \ "lnum": 1, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
161 \ }, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
162 \ { |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
163 \ "filename": "current", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
164 \ "bufnr": l:current, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
165 \ "lnum": 2, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
166 \ }, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
167 \ { |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
168 \ "filename": "last", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
169 \ "bufnr": l:last, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
170 \ "lnum": 1, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
171 \ }, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
172 \ ] |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
173 \) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
174 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
175 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
176 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
177 return [l:current, l:last] |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
178 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
179 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
180 " Create a quickfix with at least 2 entries that are in the current 'winfixbuf' window. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
181 func s:make_quickfix_windows() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
182 let [l:current, _] = s:make_simple_quickfix() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
183 execute "buffer! " . l:current |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
184 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
185 split |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
186 let l:first_window = win_getid() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
187 execute "normal \<C-w>j" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
188 let l:winfix_window = win_getid() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
189 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
190 " Open the quickfix in a separate split and go to it |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
191 copen |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
192 let l:quickfix_window = win_getid() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
193 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
194 return [l:first_window, l:winfix_window, l:quickfix_window] |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
195 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
196 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
197 " Revert all changes that occurred in any past test |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
198 func s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
199 %bwipeout! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
200 set nowinfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
201 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
202 call setqflist([]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
203 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
204 for l:window_info in getwininfo() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
205 call setloclist(l:window_info["winid"], []) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
206 endfor |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
207 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
208 delmarks A-Z0-9 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
209 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
210 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
211 " Find and set the first quickfix entry that points to `buffer` |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
212 func s:set_quickfix_by_buffer(buffer) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
213 let l:index = 1 " quickfix indices start at 1 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
214 for l:entry in getqflist() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
215 if l:entry["bufnr"] == a:buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
216 execute l:index . "cc" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
217 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
218 return |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
219 endif |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
220 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
221 let l:index += 1 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
222 endfor |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
223 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
224 echoerr 'No quickfix entry matching "' . a:buffer . '" could be found.' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
225 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
226 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
227 " Fail to call :Next on a 'winfixbuf' window unless :Next! is used. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
228 func Test_Next() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
229 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
230 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
231 let [l:first, _] = s:make_args_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
232 next! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
233 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
234 call assert_fails("Next", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
235 call assert_notequal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
236 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
237 Next! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
238 call assert_equal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
239 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
240 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
241 " Call :argdo and choose the next available 'nowinfixbuf' window. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
242 func Test_argdo_choose_available_window() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
243 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
244 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
245 let [_, l:last] = s:make_args_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
246 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
247 " Make a split window that is 'nowinfixbuf' but make it the second-to-last |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
248 " window so that :argdo will first try the 'winfixbuf' window, pass over it, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
249 " and prefer the other 'nowinfixbuf' window, instead. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
250 " |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
251 " +-------------------+ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
252 " | 'nowinfixbuf' | |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
253 " +-------------------+ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
254 " | 'winfixbuf' | <-- Cursor is here |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
255 " +-------------------+ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
256 split |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
257 let l:nowinfixbuf_window = win_getid() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
258 " Move to the 'winfixbuf' window now |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
259 execute "normal \<C-w>j" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
260 let l:winfixbuf_window = win_getid() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
261 let l:expected_windows = s:get_windows_count() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
262 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
263 argdo echo '' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
264 call assert_equal(l:nowinfixbuf_window, win_getid()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
265 call assert_equal(l:last, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
266 call assert_equal(l:expected_windows, s:get_windows_count()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
267 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
268 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
269 " Call :argdo and create a new split window if all available windows are 'winfixbuf'. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
270 func Test_argdo_make_new_window() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
271 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
272 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
273 let [l:first, l:last] = s:make_args_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
274 let l:current = win_getid() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
275 let l:current_windows = s:get_windows_count() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
276 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
277 argdo echo '' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
278 call assert_notequal(l:current, win_getid()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
279 call assert_equal(l:last, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
280 execute "normal \<C-w>j" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
281 call assert_equal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
282 call assert_equal(l:current_windows + 1, s:get_windows_count()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
283 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
284 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
285 " Fail :argedit but :argedit! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
286 func Test_argedit() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
287 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
288 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
289 args! first middle last |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
290 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
291 file first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
292 let l:first = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
293 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
294 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
295 file middle |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
296 let l:middle = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
297 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
298 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
299 file last |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
300 let l:last = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
301 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
302 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
303 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
304 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
305 call assert_fails("argedit first middle last", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
306 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
307 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
308 argedit! first middle last |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
309 call assert_equal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
310 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
311 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
312 " Fail :arglocal but :arglocal! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
313 func Test_arglocal() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
314 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
315 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
316 let l:other = s:make_buffer_pairs() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
317 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
318 argglobal! other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
319 execute "buffer! " . l:current |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
320 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
321 call assert_fails("arglocal other", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
322 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
323 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
324 arglocal! other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
325 call assert_equal(l:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
326 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
327 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
328 " Fail :argglobal but :argglobal! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
329 func Test_argglobal() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
330 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
331 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
332 let l:other = s:make_buffer_pairs() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
333 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
334 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
335 call assert_fails("argglobal other", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
336 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
337 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
338 argglobal! other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
339 call assert_equal(l:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
340 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
341 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
342 " Fail :args but :args! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
343 func Test_args() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
344 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
345 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
346 let [l:first, _] = s:make_buffers_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
347 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
348 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
349 call assert_fails("args first middle last", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
350 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
351 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
352 args! first middle last |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
353 call assert_equal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
354 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
355 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
356 " Fail :bNext but :bNext! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
357 func Test_bNext() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
358 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
359 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
360 let l:other = s:make_buffer_pairs() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
361 call assert_fails("bNext", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
362 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
363 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
364 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
365 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
366 bNext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
367 call assert_equal(l:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
368 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
369 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
370 " Allow :badd because it doesn't actually change the current window's buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
371 func Test_badd() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
372 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
373 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
374 call s:make_buffer_pairs() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
375 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
376 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
377 badd other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
378 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
379 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
380 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
381 " Allow :balt because it doesn't actually change the current window's buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
382 func Test_balt() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
383 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
384 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
385 call s:make_buffer_pairs() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
386 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
387 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
388 balt other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
389 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
390 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
391 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
392 " Fail :bfirst but :bfirst! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
393 func Test_bfirst() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
394 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
395 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
396 let l:other = s:make_buffer_pairs() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
397 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
398 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
399 call assert_fails("bfirst", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
400 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
401 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
402 bfirst! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
403 call assert_equal(l:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
404 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
405 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
406 " Fail :blast but :blast! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
407 func Test_blast() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
408 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
409 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
410 let l:other = s:make_buffer_pairs(1) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
411 bfirst! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
412 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
413 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
414 call assert_fails("blast", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
415 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
416 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
417 blast! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
418 call assert_equal(l:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
419 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
420 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
421 " Fail :bmodified but :bmodified! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
422 func Test_bmodified() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
423 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
424 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
425 let l:other = s:make_buffer_pairs() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
426 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
427 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
428 execute "buffer! " . l:other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
429 set modified |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
430 execute "buffer! " . l:current |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
431 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
432 call assert_fails("bmodified", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
433 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
434 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
435 bmodified! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
436 call assert_equal(l:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
437 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
438 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
439 " Fail :bnext but :bnext! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
440 func Test_bnext() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
441 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
442 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
443 let l:other = s:make_buffer_pairs() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
444 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
445 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
446 call assert_fails("bnext", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
447 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
448 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
449 bnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
450 call assert_equal(l:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
451 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
452 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
453 " Fail :bprevious but :bprevious! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
454 func Test_bprevious() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
455 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
456 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
457 let l:other = s:make_buffer_pairs() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
458 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
459 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
460 call assert_fails("bprevious", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
461 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
462 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
463 bprevious! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
464 call assert_equal(l:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
465 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
466 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
467 " Fail :brewind but :brewind! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
468 func Test_brewind() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
469 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
470 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
471 let l:other = s:make_buffer_pairs() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
472 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
473 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
474 call assert_fails("brewind", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
475 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
476 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
477 brewind! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
478 call assert_equal(l:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
479 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
480 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
481 " Fail :browse edit but :browse edit! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
482 func Test_browse_edit_fail() |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
483 " A GUI dialog may stall the test. |
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
484 CheckNotGui |
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
485 |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
486 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
487 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
488 let l:other = s:make_buffer_pairs() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
489 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
490 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
491 call assert_fails("browse edit other", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
492 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
493 |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
494 try |
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
495 browse edit! other |
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
496 call assert_equal(l:other, bufnr()) |
34554
495218030237
patch 9.1.0178: E1513 might be confusing
Christian Brabandt <cb@256bit.org>
parents:
34500
diff
changeset
|
497 catch /^Vim\%((\a\+)\)\=:E338:/ |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
498 " Ignore E338, which occurs if console Vim is built with +browse. |
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
499 " Console Vim without +browse will treat this as a regular :edit. |
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
500 endtry |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
501 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
502 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
503 " Allow :browse w because it doesn't change the buffer in the current file |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
504 func Test_browse_edit_pass() |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
505 " A GUI dialog may stall the test. |
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
506 CheckNotGui |
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
507 |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
508 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
509 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
510 let l:other = s:make_buffer_pairs() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
511 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
512 |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
513 try |
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
514 browse write other |
34554
495218030237
patch 9.1.0178: E1513 might be confusing
Christian Brabandt <cb@256bit.org>
parents:
34500
diff
changeset
|
515 catch /^Vim\%((\a\+)\)\=:E338:/ |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
516 " Ignore E338, which occurs if console Vim is built with +browse. |
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
517 " Console Vim without +browse will treat this as a regular :write. |
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
518 endtry |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
519 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
520 call delete("other") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
521 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
522 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
523 " Call :bufdo and choose the next available 'nowinfixbuf' window. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
524 func Test_bufdo_choose_available_window() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
525 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
526 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
527 let l:other = s:make_buffer_pairs() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
528 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
529 " Make a split window that is 'nowinfixbuf' but make it the second-to-last |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
530 " window so that :bufdo will first try the 'winfixbuf' window, pass over it, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
531 " and prefer the other 'nowinfixbuf' window, instead. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
532 " |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
533 " +-------------------+ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
534 " | 'nowinfixbuf' | |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
535 " +-------------------+ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
536 " | 'winfixbuf' | <-- Cursor is here |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
537 " +-------------------+ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
538 split |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
539 let l:nowinfixbuf_window = win_getid() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
540 " Move to the 'winfixbuf' window now |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
541 execute "normal \<C-w>j" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
542 let l:winfixbuf_window = win_getid() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
543 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
544 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
545 let l:expected_windows = s:get_windows_count() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
546 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
547 call assert_notequal(l:current, l:other) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
548 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
549 bufdo echo '' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
550 call assert_equal(l:nowinfixbuf_window, win_getid()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
551 call assert_notequal(l:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
552 call assert_equal(l:expected_windows, s:get_windows_count()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
553 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
554 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
555 " Call :bufdo and create a new split window if all available windows are 'winfixbuf'. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
556 func Test_bufdo_make_new_window() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
557 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
558 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
559 let [l:first, l:last] = s:make_buffers_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
560 execute "buffer! " . l:first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
561 let l:current = win_getid() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
562 let l:current_windows = s:get_windows_count() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
563 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
564 bufdo echo '' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
565 call assert_notequal(l:current, win_getid()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
566 call assert_equal(l:last, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
567 execute "normal \<C-w>j" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
568 call assert_equal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
569 call assert_equal(l:current_windows + 1, s:get_windows_count()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
570 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
571 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
572 " Fail :buffer but :buffer! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
573 func Test_buffer() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
574 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
575 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
576 let l:other = s:make_buffer_pairs() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
577 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
578 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
579 call assert_fails("buffer " . l:other, "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
580 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
581 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
582 execute "buffer! " . l:other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
583 call assert_equal(l:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
584 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
585 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
586 " Allow :buffer on a 'winfixbuf' window if there is no change in buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
587 func Test_buffer_same_buffer() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
588 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
589 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
590 call s:make_buffer_pairs() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
591 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
592 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
593 execute "buffer " . l:current |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
594 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
595 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
596 execute "buffer! " . l:current |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
597 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
598 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
599 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
600 " Allow :cNext but the 'nowinfixbuf' window is selected, instead |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
601 func Test_cNext() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
602 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
603 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
604 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
605 let [l:first_window, l:winfix_window, l:quickfix_window] = s:make_quickfix_windows() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
606 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
607 " The call to `:cNext` succeeds but it selects the window with 'nowinfixbuf' instead |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
608 call s:set_quickfix_by_buffer(winbufnr(l:winfix_window)) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
609 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
610 " Make sure the previous window has 'winfixbuf' so we can test that our |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
611 " "skip 'winfixbuf' window" logic works. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
612 call win_gotoid(l:winfix_window) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
613 call win_gotoid(l:quickfix_window) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
614 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
615 cNext |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
616 call assert_equal(l:first_window, win_getid()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
617 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
618 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
619 " Allow :cNfile but the 'nowinfixbuf' window is selected, instead |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
620 func Test_cNfile() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
621 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
622 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
623 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
624 let [l:first_window, l:winfix_window, l:quickfix_window] = s:make_quickfix_windows() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
625 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
626 " The call to `:cNfile` succeeds but it selects the window with 'nowinfixbuf' instead |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
627 call s:set_quickfix_by_buffer(winbufnr(l:winfix_window)) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
628 cnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
629 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
630 " Make sure the previous window has 'winfixbuf' so we can test that our |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
631 " "skip 'winfixbuf' window" logic works. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
632 call win_gotoid(l:winfix_window) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
633 call win_gotoid(l:quickfix_window) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
634 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
635 cNfile |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
636 call assert_equal(l:first_window, win_getid()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
637 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
638 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
639 " Allow :caddexpr because it doesn't change the current buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
640 func Test_caddexpr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
641 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
642 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
643 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
644 let l:file_path = tempname() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
645 call writefile(["Error - bad-thing-found"], l:file_path) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
646 execute "edit " . l:file_path |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
647 let l:file_buffer = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
648 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
649 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
650 edit first.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
651 call append(0, ["some-search-term bad-thing-found"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
652 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
653 edit! other.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
654 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
655 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
656 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
657 execute "buffer! " . l:file_buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
658 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
659 execute 'caddexpr expand("%") .. ":" .. line(".") .. ":" .. getline(".")' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
660 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
661 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
662 call delete(l:file_path) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
663 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
664 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
665 " Fail :cbuffer but :cbuffer! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
666 func Test_cbuffer() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
667 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
668 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
669 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
670 let l:file_path = tempname() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
671 call writefile(["first.unittest:1:Error - bad-thing-found"], l:file_path) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
672 execute "edit " . l:file_path |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
673 let l:file_buffer = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
674 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
675 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
676 edit first.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
677 call append(0, ["some-search-term bad-thing-found"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
678 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
679 edit! other.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
680 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
681 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
682 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
683 execute "buffer! " . l:file_buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
684 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
685 call assert_fails("cbuffer " . l:file_buffer) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
686 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
687 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
688 execute "cbuffer! " . l:file_buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
689 call assert_equal("first.unittest", expand("%:t")) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
690 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
691 call delete(l:file_path) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
692 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
693 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
694 " Allow :cc but the 'nowinfixbuf' window is selected, instead |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
695 func Test_cc() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
696 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
697 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
698 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
699 let [l:first_window, l:winfix_window, l:quickfix_window] = s:make_quickfix_windows() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
700 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
701 " The call to `:cnext` succeeds but it selects the window with 'nowinfixbuf' instead |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
702 call s:set_quickfix_by_buffer(winbufnr(l:winfix_window)) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
703 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
704 " Make sure the previous window has 'winfixbuf' so we can test that our |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
705 " "skip 'winfixbuf' window" logic works. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
706 call win_gotoid(l:winfix_window) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
707 call win_gotoid(l:quickfix_window) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
708 " Go up one line in the quickfix window to an quickfix entry that doesn't |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
709 " point to a winfixbuf buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
710 normal k |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
711 " Attempt to make the previous window, winfixbuf buffer, to go to the |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
712 " non-winfixbuf quickfix entry |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
713 .cc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
714 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
715 " Confirm that :.cc did not change the winfixbuf-enabled window |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
716 call assert_equal(l:first_window, win_getid()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
717 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
718 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
719 " Call :cdo and choose the next available 'nowinfixbuf' window. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
720 func Test_cdo_choose_available_window() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
721 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
722 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
723 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
724 let [l:current, l:last] = s:make_simple_quickfix() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
725 execute "buffer! " . l:current |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
726 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
727 " Make a split window that is 'nowinfixbuf' but make it the second-to-last |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
728 " window so that :cdo will first try the 'winfixbuf' window, pass over it, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
729 " and prefer the other 'nowinfixbuf' window, instead. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
730 " |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
731 " +-------------------+ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
732 " | 'nowinfixbuf' | |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
733 " +-------------------+ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
734 " | 'winfixbuf' | <-- Cursor is here |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
735 " +-------------------+ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
736 split |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
737 let l:nowinfixbuf_window = win_getid() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
738 " Move to the 'winfixbuf' window now |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
739 execute "normal \<C-w>j" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
740 let l:winfixbuf_window = win_getid() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
741 let l:expected_windows = s:get_windows_count() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
742 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
743 cdo echo '' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
744 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
745 call assert_equal(l:nowinfixbuf_window, win_getid()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
746 call assert_equal(l:last, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
747 execute "normal \<C-w>j" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
748 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
749 call assert_equal(l:expected_windows, s:get_windows_count()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
750 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
751 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
752 " Call :cdo and create a new split window if all available windows are 'winfixbuf'. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
753 func Test_cdo_make_new_window() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
754 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
755 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
756 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
757 let [l:current_buffer, l:last] = s:make_simple_quickfix() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
758 execute "buffer! " . l:current_buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
759 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
760 let l:current_window = win_getid() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
761 let l:current_windows = s:get_windows_count() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
762 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
763 cdo echo '' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
764 call assert_notequal(l:current_window, win_getid()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
765 call assert_equal(l:last, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
766 execute "normal \<C-w>j" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
767 call assert_equal(l:current_buffer, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
768 call assert_equal(l:current_windows + 1, s:get_windows_count()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
769 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
770 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
771 " Fail :cexpr but :cexpr! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
772 func Test_cexpr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
773 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
774 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
775 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
776 let l:file = tempname() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
777 let l:entry = '["' . l:file . ':1:bar"]' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
778 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
779 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
780 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
781 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
782 call assert_fails("cexpr " . l:entry) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
783 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
784 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
785 execute "cexpr! " . l:entry |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
786 call assert_equal(fnamemodify(l:file, ":t"), expand("%:t")) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
787 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
788 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
789 " Call :cfdo and choose the next available 'nowinfixbuf' window. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
790 func Test_cfdo_choose_available_window() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
791 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
792 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
793 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
794 let [l:current, l:last] = s:make_simple_quickfix() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
795 execute "buffer! " . l:current |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
796 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
797 " Make a split window that is 'nowinfixbuf' but make it the second-to-last |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
798 " window so that :cfdo will first try the 'winfixbuf' window, pass over it, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
799 " and prefer the other 'nowinfixbuf' window, instead. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
800 " |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
801 " +-------------------+ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
802 " | 'nowinfixbuf' | |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
803 " +-------------------+ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
804 " | 'winfixbuf' | <-- Cursor is here |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
805 " +-------------------+ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
806 split |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
807 let l:nowinfixbuf_window = win_getid() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
808 " Move to the 'winfixbuf' window now |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
809 execute "normal \<C-w>j" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
810 let l:winfixbuf_window = win_getid() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
811 let l:expected_windows = s:get_windows_count() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
812 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
813 cfdo echo '' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
814 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
815 call assert_equal(l:nowinfixbuf_window, win_getid()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
816 call assert_equal(l:last, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
817 execute "normal \<C-w>j" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
818 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
819 call assert_equal(l:expected_windows, s:get_windows_count()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
820 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
821 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
822 " Call :cfdo and create a new split window if all available windows are 'winfixbuf'. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
823 func Test_cfdo_make_new_window() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
824 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
825 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
826 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
827 let [l:current_buffer, l:last] = s:make_simple_quickfix() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
828 execute "buffer! " . l:current_buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
829 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
830 let l:current_window = win_getid() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
831 let l:current_windows = s:get_windows_count() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
832 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
833 cfdo echo '' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
834 call assert_notequal(l:current_window, win_getid()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
835 call assert_equal(l:last, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
836 execute "normal \<C-w>j" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
837 call assert_equal(l:current_buffer, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
838 call assert_equal(l:current_windows + 1, s:get_windows_count()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
839 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
840 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
841 " Fail :cfile but :cfile! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
842 func Test_cfile() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
843 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
844 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
845 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
846 edit first.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
847 call append(0, ["some-search-term bad-thing-found"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
848 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
849 let l:first = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
850 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
851 edit! second.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
852 call append(0, ["some-search-term"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
853 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
854 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
855 let l:file = tempname() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
856 call writefile(["first.unittest:1:Error - bad-thing-found was detected"], l:file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
857 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
858 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
859 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
860 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
861 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
862 call assert_fails(":cfile " . l:file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
863 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
864 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
865 execute ":cfile! " . l:file |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
866 call assert_equal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
867 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
868 call delete(l:file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
869 call delete("first.unittest") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
870 call delete("second.unittest") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
871 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
872 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
873 " Allow :cfirst but the 'nowinfixbuf' window is selected, instead |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
874 func Test_cfirst() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
875 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
876 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
877 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
878 let [l:first_window, l:winfix_window, l:quickfix_window] = s:make_quickfix_windows() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
879 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
880 " The call to `:cfirst` succeeds but it selects the window with 'nowinfixbuf' instead |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
881 call s:set_quickfix_by_buffer(winbufnr(l:winfix_window)) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
882 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
883 " Make sure the previous window has 'winfixbuf' so we can test that our |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
884 " "skip 'winfixbuf' window" logic works. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
885 call win_gotoid(l:winfix_window) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
886 call win_gotoid(l:quickfix_window) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
887 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
888 cfirst |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
889 call assert_equal(l:first_window, win_getid()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
890 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
891 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
892 " Allow :clast but the 'nowinfixbuf' window is selected, instead |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
893 func Test_clast() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
894 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
895 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
896 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
897 let [l:first_window, l:winfix_window, l:quickfix_window] = s:make_quickfix_windows() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
898 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
899 " The call to `:clast` succeeds but it selects the window with 'nowinfixbuf' instead |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
900 call s:set_quickfix_by_buffer(winbufnr(l:winfix_window)) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
901 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
902 " Make sure the previous window has 'winfixbuf' so we can test that our |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
903 " "skip 'winfixbuf' window" logic works. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
904 call win_gotoid(l:winfix_window) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
905 call win_gotoid(l:quickfix_window) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
906 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
907 clast |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
908 call assert_equal(l:first_window, win_getid()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
909 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
910 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
911 " Allow :cnext but the 'nowinfixbuf' window is selected, instead |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
912 " Make sure no new windows are created and previous windows are reused |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
913 func Test_cnext() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
914 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
915 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
916 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
917 let [l:first_window, l:winfix_window, l:quickfix_window] = s:make_quickfix_windows() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
918 let l:expected = s:get_windows_count() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
919 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
920 " The call to `:cnext` succeeds but it selects the window with 'nowinfixbuf' instead |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
921 call s:set_quickfix_by_buffer(winbufnr(l:winfix_window)) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
922 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
923 cnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
924 call assert_equal(l:expected, s:get_windows_count()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
925 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
926 " Make sure the previous window has 'winfixbuf' so we can test that our |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
927 " "skip 'winfixbuf' window" logic works. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
928 call win_gotoid(l:winfix_window) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
929 call win_gotoid(l:quickfix_window) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
930 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
931 cnext |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
932 call assert_equal(l:first_window, win_getid()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
933 call assert_equal(l:expected, s:get_windows_count()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
934 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
935 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
936 " Make sure :cnext creates a split window if no previous window exists |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
937 func Test_cnext_no_previous_window() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
938 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
939 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
940 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
941 let [l:current, _] = s:make_simple_quickfix() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
942 execute "buffer! " . l:current |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
943 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
944 let l:expected = s:get_windows_count() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
945 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
946 " Open the quickfix in a separate split and go to it |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
947 copen |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
948 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
949 call assert_equal(l:expected + 1, s:get_windows_count()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
950 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
951 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
952 " Allow :cnext and create a 'nowinfixbuf' window if none exists |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
953 func Test_cnext_make_new_window() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
954 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
955 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
956 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
957 let [l:current, _] = s:make_simple_quickfix() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
958 let l:current = win_getid() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
959 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
960 cfirst! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
961 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
962 let l:windows = s:get_windows_count() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
963 let l:expected = l:windows + 1 " We're about to create a new split window |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
964 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
965 cnext |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
966 call assert_equal(l:expected, s:get_windows_count()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
967 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
968 cnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
969 call assert_equal(l:expected, s:get_windows_count()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
970 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
971 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
972 " Allow :cprevious but the 'nowinfixbuf' window is selected, instead |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
973 func Test_cprevious() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
974 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
975 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
976 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
977 let [l:first_window, l:winfix_window, l:quickfix_window] = s:make_quickfix_windows() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
978 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
979 " The call to `:cprevious` succeeds but it selects the window with 'nowinfixbuf' instead |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
980 call s:set_quickfix_by_buffer(winbufnr(l:winfix_window)) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
981 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
982 " Make sure the previous window has 'winfixbuf' so we can test that our |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
983 " "skip 'winfixbuf' window" logic works. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
984 call win_gotoid(l:winfix_window) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
985 call win_gotoid(l:quickfix_window) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
986 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
987 cprevious |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
988 call assert_equal(l:first_window, win_getid()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
989 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
990 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
991 " Allow :cnfile but the 'nowinfixbuf' window is selected, instead |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
992 func Test_cnfile() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
993 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
994 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
995 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
996 let [l:first_window, l:winfix_window, l:quickfix_window] = s:make_quickfix_windows() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
997 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
998 " The call to `:cnfile` succeeds but it selects the window with 'nowinfixbuf' instead |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
999 call s:set_quickfix_by_buffer(winbufnr(l:winfix_window)) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1000 cnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1001 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1002 " Make sure the previous window has 'winfixbuf' so we can test that our |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1003 " "skip 'winfixbuf' window" logic works. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1004 call win_gotoid(l:winfix_window) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1005 call win_gotoid(l:quickfix_window) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1006 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1007 cnfile |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1008 call assert_equal(l:first_window, win_getid()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1009 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1010 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1011 " Allow :cpfile but the 'nowinfixbuf' window is selected, instead |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1012 func Test_cpfile() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1013 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1014 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1015 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1016 let [l:first_window, l:winfix_window, l:quickfix_window] = s:make_quickfix_windows() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1017 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1018 " The call to `:cpfile` succeeds but it selects the window with 'nowinfixbuf' instead |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1019 call s:set_quickfix_by_buffer(winbufnr(l:winfix_window)) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1020 cnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1021 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1022 " Make sure the previous window has 'winfixbuf' so we can test that our |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1023 " "skip 'winfixbuf' window" logic works. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1024 call win_gotoid(l:winfix_window) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1025 call win_gotoid(l:quickfix_window) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1026 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1027 cpfile |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1028 call assert_equal(l:first_window, win_getid()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1029 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1030 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1031 " Allow :crewind but the 'nowinfixbuf' window is selected, instead |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1032 func Test_crewind() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1033 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1034 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1035 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1036 let [l:first_window, l:winfix_window, l:quickfix_window] = s:make_quickfix_windows() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1037 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1038 " The call to `:crewind` succeeds but it selects the window with 'nowinfixbuf' instead |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1039 call s:set_quickfix_by_buffer(winbufnr(l:winfix_window)) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1040 cnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1041 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1042 " Make sure the previous window has 'winfixbuf' so we can test that our |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1043 " "skip 'winfixbuf' window" logic works. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1044 call win_gotoid(l:winfix_window) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1045 call win_gotoid(l:quickfix_window) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1046 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1047 crewind |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1048 call assert_equal(l:first_window, win_getid()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1049 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1050 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1051 " Allow <C-w>f because it opens in a new split |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1052 func Test_ctrl_w_f() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1053 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1054 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1055 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1056 let l:file_name = tempname() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1057 call writefile([], l:file_name) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1058 let l:file_buffer = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1059 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1060 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1061 file other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1062 let l:other_buffer = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1063 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1064 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1065 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1066 call setline(1, l:file_name) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1067 let l:current_windows = s:get_windows_count() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1068 execute "normal \<C-w>f" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1069 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1070 call assert_equal(l:current_windows + 1, s:get_windows_count()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1071 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1072 call delete(l:file_name) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1073 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1074 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1075 " Fail :djump but :djump! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1076 func Test_djump() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1077 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1078 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1079 let l:include_file = tempname() . ".h" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1080 call writefile(["min(1, 12);", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1081 \ '#include "' . l:include_file . '"' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1082 \ ], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1083 \ "main.c") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1084 call writefile(["#define min(X, Y) ((X) < (Y) ? (X) : (Y))"], l:include_file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1085 edit main.c |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1086 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1087 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1088 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1089 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1090 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1091 call assert_fails("djump 1 /min/", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1092 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1093 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1094 djump! 1 /min/ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1095 call assert_notequal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1096 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1097 call delete("main.c") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1098 call delete(l:include_file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1099 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1100 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1101 " Fail :drop but :drop! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1102 func Test_drop() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1103 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1104 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1105 let l:other = s:make_buffer_pairs() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1106 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1107 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1108 call assert_fails("drop other", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1109 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1110 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1111 drop! other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1112 call assert_equal(l:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1113 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1114 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1115 " Fail :edit but :edit! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1116 func Test_edit() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1117 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1118 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1119 let l:other = s:make_buffer_pairs() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1120 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1121 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1122 call assert_fails("edit other", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1123 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1124 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1125 edit! other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1126 call assert_equal(l:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1127 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1128 |
34647
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1129 " Fail :e when selecting a buffer from a relative path if in a different folder |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1130 " |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1131 " In this tests there's 2 buffers |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1132 " |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1133 " foo - lives on disk, in some folder. e.g. /tmp/foo |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1134 " foo - an in-memory buffer that has not been saved to disk. If saved, it |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1135 " would live in a different folder, /other/foo. |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1136 " |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1137 " The 'winfixbuf' is looking at the in-memory buffer and trying to switch to |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1138 " the buffer on-disk (and fails, because it's a different buffer) |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1139 func Test_edit_different_buffer_on_disk_and_relative_path_to_disk() |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1140 call s:reset_all_buffers() |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1141 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1142 let l:file_on_disk = tempname() |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1143 let l:directory_on_disk1 = fnamemodify(l:file_on_disk, ":p:h") |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1144 let l:name = fnamemodify(l:file_on_disk, ":t") |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1145 execute "edit " . l:file_on_disk |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1146 write! |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1147 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1148 let l:directory_on_disk2 = l:directory_on_disk1 . "_something_else" |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1149 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1150 if !isdirectory(l:directory_on_disk2) |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1151 call mkdir(l:directory_on_disk2) |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1152 endif |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1153 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1154 execute "cd " . l:directory_on_disk2 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1155 execute "edit " l:name |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1156 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1157 let l:current = bufnr() |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1158 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1159 call assert_equal(l:current, bufnr()) |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1160 set winfixbuf |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1161 call assert_fails("edit " . l:file_on_disk, "E1513:") |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1162 call assert_equal(l:current, bufnr()) |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1163 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1164 call delete(l:directory_on_disk1) |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1165 call delete(l:directory_on_disk2) |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1166 endfunc |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1167 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1168 " Fail :e when selecting a buffer from a relative path if in a different folder |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1169 " |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1170 " In this tests there's 2 buffers |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1171 " |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1172 " foo - lives on disk, in some folder. e.g. /tmp/foo |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1173 " foo - an in-memory buffer that has not been saved to disk. If saved, it |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1174 " would live in a different folder, /other/foo. |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1175 " |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1176 " The 'winfixbuf' is looking at the on-disk buffer and trying to switch to |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1177 " the in-memory buffer (and fails, because it's a different buffer) |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1178 func Test_edit_different_buffer_on_disk_and_relative_path_to_memory() |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1179 call s:reset_all_buffers() |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1180 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1181 let l:file_on_disk = tempname() |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1182 let l:directory_on_disk1 = fnamemodify(l:file_on_disk, ":p:h") |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1183 let l:name = fnamemodify(l:file_on_disk, ":t") |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1184 execute "edit " . l:file_on_disk |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1185 write! |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1186 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1187 let l:directory_on_disk2 = l:directory_on_disk1 . "_something_else" |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1188 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1189 if !isdirectory(l:directory_on_disk2) |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1190 call mkdir(l:directory_on_disk2) |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1191 endif |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1192 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1193 execute "cd " . l:directory_on_disk2 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1194 execute "edit " l:name |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1195 execute "cd " . l:directory_on_disk1 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1196 execute "edit " l:file_on_disk |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1197 execute "cd " . l:directory_on_disk2 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1198 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1199 let l:current = bufnr() |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1200 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1201 call assert_equal(l:current, bufnr()) |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1202 set winfixbuf |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1203 call assert_fails("edit " . l:name, "E1513:") |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1204 call assert_equal(l:current, bufnr()) |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1205 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1206 call delete(l:directory_on_disk1) |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1207 call delete(l:directory_on_disk2) |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1208 endfunc |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1209 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1210 " Fail to call `:e first` if called from a starting, in-memory buffer |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1211 func Test_edit_first_buffer() |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1212 call s:reset_all_buffers() |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1213 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1214 set winfixbuf |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1215 let l:current = bufnr() |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1216 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1217 call assert_fails("edit first", "E1513:") |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1218 call assert_equal(l:current, bufnr()) |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1219 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1220 edit! first |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1221 call assert_equal(l:current, bufnr()) |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1222 edit! somewhere_else |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1223 call assert_notequal(l:current, bufnr()) |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1224 endfunc |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1225 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1226 " Allow reloading a buffer using :e |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1227 func Test_edit_no_arguments() |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1228 call s:reset_all_buffers() |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1229 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1230 let l:current = bufnr() |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1231 file some_buffer |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1232 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1233 call assert_equal(l:current, bufnr()) |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1234 set winfixbuf |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1235 edit |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1236 call assert_equal(l:current, bufnr()) |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1237 endfunc |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1238 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1239 " Allow :e selecting the current buffer |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1240 func Test_edit_same_buffer_in_memory() |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1241 call s:reset_all_buffers() |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1242 |
34656
3b29a2cdbf74
patch 9.1.0212: CI: MS-Windows fails in test_winfixbuf
Christian Brabandt <cb@256bit.org>
parents:
34647
diff
changeset
|
1243 let current = bufnr() |
34647
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1244 file same_buffer |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1245 |
34656
3b29a2cdbf74
patch 9.1.0212: CI: MS-Windows fails in test_winfixbuf
Christian Brabandt <cb@256bit.org>
parents:
34647
diff
changeset
|
1246 call assert_equal(current, bufnr()) |
34647
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1247 set winfixbuf |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1248 edit same_buffer |
34656
3b29a2cdbf74
patch 9.1.0212: CI: MS-Windows fails in test_winfixbuf
Christian Brabandt <cb@256bit.org>
parents:
34647
diff
changeset
|
1249 call assert_equal(current, bufnr()) |
3b29a2cdbf74
patch 9.1.0212: CI: MS-Windows fails in test_winfixbuf
Christian Brabandt <cb@256bit.org>
parents:
34647
diff
changeset
|
1250 set nowinfixbuf |
34647
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1251 endfunc |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1252 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1253 " Allow :e selecting the current buffer as a full path |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1254 func Test_edit_same_buffer_on_disk_absolute_path() |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1255 call s:reset_all_buffers() |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1256 |
34656
3b29a2cdbf74
patch 9.1.0212: CI: MS-Windows fails in test_winfixbuf
Christian Brabandt <cb@256bit.org>
parents:
34647
diff
changeset
|
1257 let file = tempname() |
34658
224d4a792264
patch 9.1.0213: CI: MS-Windows fails in test_winfixbuf
Christian Brabandt <cb@256bit.org>
parents:
34656
diff
changeset
|
1258 " file must exist for expansion of 8.3 paths to succeed |
224d4a792264
patch 9.1.0213: CI: MS-Windows fails in test_winfixbuf
Christian Brabandt <cb@256bit.org>
parents:
34656
diff
changeset
|
1259 call writefile([], file, 'D') |
224d4a792264
patch 9.1.0213: CI: MS-Windows fails in test_winfixbuf
Christian Brabandt <cb@256bit.org>
parents:
34656
diff
changeset
|
1260 let file = fnamemodify(file, ':p') |
34656
3b29a2cdbf74
patch 9.1.0212: CI: MS-Windows fails in test_winfixbuf
Christian Brabandt <cb@256bit.org>
parents:
34647
diff
changeset
|
1261 let current = bufnr() |
3b29a2cdbf74
patch 9.1.0212: CI: MS-Windows fails in test_winfixbuf
Christian Brabandt <cb@256bit.org>
parents:
34647
diff
changeset
|
1262 execute "edit " . file |
34647
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1263 write! |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1264 |
34656
3b29a2cdbf74
patch 9.1.0212: CI: MS-Windows fails in test_winfixbuf
Christian Brabandt <cb@256bit.org>
parents:
34647
diff
changeset
|
1265 call assert_equal(current, bufnr()) |
34647
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1266 set winfixbuf |
34656
3b29a2cdbf74
patch 9.1.0212: CI: MS-Windows fails in test_winfixbuf
Christian Brabandt <cb@256bit.org>
parents:
34647
diff
changeset
|
1267 execute "edit " file |
3b29a2cdbf74
patch 9.1.0212: CI: MS-Windows fails in test_winfixbuf
Christian Brabandt <cb@256bit.org>
parents:
34647
diff
changeset
|
1268 call assert_equal(current, bufnr()) |
3b29a2cdbf74
patch 9.1.0212: CI: MS-Windows fails in test_winfixbuf
Christian Brabandt <cb@256bit.org>
parents:
34647
diff
changeset
|
1269 |
3b29a2cdbf74
patch 9.1.0212: CI: MS-Windows fails in test_winfixbuf
Christian Brabandt <cb@256bit.org>
parents:
34647
diff
changeset
|
1270 set nowinfixbuf |
34647
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1271 endfunc |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1272 |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1273 " Fail :enew but :enew! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1274 func Test_enew() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1275 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1276 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1277 let l:other = s:make_buffer_pairs() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1278 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1279 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1280 call assert_fails("enew", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1281 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1282 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1283 enew! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1284 call assert_notequal(l:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1285 call assert_notequal(3, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1286 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1287 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1288 " Fail :ex but :ex! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1289 func Test_ex() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1290 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1291 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1292 let l:other = s:make_buffer_pairs() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1293 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1294 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1295 call assert_fails("ex other", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1296 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1297 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1298 ex! other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1299 call assert_equal(l:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1300 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1301 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1302 " Fail :find but :find! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1303 func Test_find() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1304 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1305 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1306 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1307 let l:file = tempname() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1308 call writefile([], l:file) |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
1309 let l:file = fnamemodify(l:file, ':p') " In case it's Windows 8.3-style. |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1310 let l:directory = fnamemodify(l:file, ":p:h") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1311 let l:name = fnamemodify(l:file, ":p:t") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1312 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1313 let l:original_path = &path |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1314 execute "set path=" . l:directory |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1315 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1316 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1317 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1318 call assert_fails("execute 'find " . l:name . "'", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1319 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1320 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1321 execute "find! " . l:name |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1322 call assert_equal(l:file, expand("%:p")) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1323 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1324 execute "set path=" . l:original_path |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1325 call delete(l:file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1326 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1327 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1328 " Fail :first but :first! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1329 func Test_first() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1330 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1331 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1332 let [l:first, _] = s:make_args_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1333 next! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1334 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1335 call assert_fails("first", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1336 call assert_notequal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1337 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1338 first! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1339 call assert_equal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1340 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1341 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1342 " Fail :grep but :grep! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1343 func Test_grep() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1344 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1345 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1346 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1347 edit first.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1348 call append(0, ["some-search-term"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1349 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1350 let l:first = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1351 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1352 edit current.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1353 call append(0, ["some-search-term"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1354 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1355 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1356 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1357 edit! last.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1358 call append(0, ["some-search-term"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1359 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1360 let l:last = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1361 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1362 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1363 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1364 buffer! current.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1365 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1366 call assert_fails("silent! grep some-search-term *.unittest", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1367 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1368 execute "edit! " . l:first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1369 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1370 silent! grep! some-search-term *.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1371 call assert_notequal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1372 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1373 call delete("first.unittest") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1374 call delete("current.unittest") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1375 call delete("last.unittest") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1376 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1377 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1378 " Fail :ijump but :ijump! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1379 func Test_ijump() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1380 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1381 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1382 let l:include_file = tempname() . ".h" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1383 call writefile([ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1384 \ '#include "' . l:include_file . '"' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1385 \ ], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1386 \ "main.c") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1387 call writefile(["#define min(X, Y) ((X) < (Y) ? (X) : (Y))"], l:include_file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1388 edit main.c |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1389 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1390 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1391 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1392 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1393 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1394 set define=^\\s*#\\s*define |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1395 set include=^\\s*#\\s*include |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1396 set path=.,/usr/include,, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1397 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1398 call assert_fails("ijump /min/", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1399 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1400 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1401 set nowinfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1402 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1403 ijump! /min/ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1404 call assert_notequal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1405 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1406 set define& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1407 set include& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1408 set path& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1409 call delete("main.c") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1410 call delete(l:include_file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1411 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1412 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1413 " Fail :lNext but :lNext! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1414 func Test_lNext() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1415 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1416 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1417 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1418 let [l:first, l:middle, _] = s:make_simple_location_list() |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1419 call assert_equal(1, getloclist(0, #{idx: 0}).idx) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1420 |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1421 lnext! |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1422 call assert_equal(2, getloclist(0, #{idx: 0}).idx) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1423 call assert_equal(l:middle, bufnr()) |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1424 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1425 call assert_fails("lNext", "E1513:") |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1426 " Ensure the entry didn't change. |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1427 call assert_equal(2, getloclist(0, #{idx: 0}).idx) |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1428 call assert_equal(l:middle, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1429 |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1430 lnext! |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1431 call assert_equal(3, getloclist(0, #{idx: 0}).idx) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1432 call assert_equal(l:middle, bufnr()) |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1433 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1434 lNext! |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1435 call assert_equal(2, getloclist(0, #{idx: 0}).idx) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1436 call assert_equal(l:middle, bufnr()) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1437 |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1438 lNext! |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1439 call assert_equal(1, getloclist(0, #{idx: 0}).idx) |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1440 call assert_equal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1441 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1442 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1443 " Fail :lNfile but :lNfile! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1444 func Test_lNfile() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1445 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1446 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1447 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1448 let [l:first, l:current, _] = s:make_simple_location_list() |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1449 call assert_equal(1, getloclist(0, #{idx: 0}).idx) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1450 |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1451 lnext! |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1452 call assert_equal(2, getloclist(0, #{idx: 0}).idx) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1453 call assert_equal(l:current, bufnr()) |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1454 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1455 call assert_fails("lNfile", "E1513:") |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1456 " Ensure the entry didn't change. |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1457 call assert_equal(2, getloclist(0, #{idx: 0}).idx) |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1458 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1459 |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1460 lnext! |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1461 call assert_equal(3, getloclist(0, #{idx: 0}).idx) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1462 call assert_equal(l:current, bufnr()) |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1463 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1464 lNfile! |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1465 call assert_equal(1, getloclist(0, #{idx: 0}).idx) |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1466 call assert_equal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1467 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1468 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1469 " Allow :laddexpr because it doesn't change the current buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1470 func Test_laddexpr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1471 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1472 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1473 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1474 let l:file_path = tempname() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1475 call writefile(["Error - bad-thing-found"], l:file_path) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1476 execute "edit " . l:file_path |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1477 let l:file_buffer = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1478 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1479 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1480 edit first.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1481 call append(0, ["some-search-term bad-thing-found"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1482 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1483 edit! other.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1484 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1485 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1486 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1487 execute "buffer! " . l:file_buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1488 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1489 execute 'laddexpr expand("%") .. ":" .. line(".") .. ":" .. getline(".")' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1490 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1491 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1492 call delete(l:file_path) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1493 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1494 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1495 " Fail :last but :last! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1496 func Test_last() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1497 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1498 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1499 let [_, l:last] = s:make_args_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1500 next! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1501 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1502 call assert_fails("last", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1503 call assert_notequal(l:last, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1504 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1505 last! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1506 call assert_equal(l:last, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1507 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1508 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1509 " Fail :lbuffer but :lbuffer! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1510 func Test_lbuffer() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1511 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1512 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1513 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1514 let l:file_path = tempname() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1515 call writefile(["first.unittest:1:Error - bad-thing-found"], l:file_path) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1516 execute "edit " . l:file_path |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1517 let l:file_buffer = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1518 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1519 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1520 edit first.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1521 call append(0, ["some-search-term bad-thing-found"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1522 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1523 edit! other.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1524 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1525 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1526 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1527 execute "buffer! " . l:file_buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1528 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1529 call assert_fails("lbuffer " . l:file_buffer) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1530 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1531 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1532 execute "lbuffer! " . l:file_buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1533 call assert_equal("first.unittest", expand("%:t")) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1534 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1535 call delete(l:file_path) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1536 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1537 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1538 " Fail :ldo but :ldo! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1539 func Test_ldo() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1540 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1541 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1542 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1543 let [l:first, l:middle, l:last] = s:make_simple_location_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1544 lnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1545 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1546 call assert_fails('execute "ldo buffer ' . l:first . '"', "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1547 call assert_equal(l:middle, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1548 execute "ldo! buffer " . l:first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1549 call assert_notequal(l:last, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1550 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1551 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1552 " Fail :lfdo but :lfdo! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1553 func Test_lexpr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1554 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1555 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1556 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1557 let l:file = tempname() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1558 let l:entry = '["' . l:file . ':1:bar"]' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1559 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1560 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1561 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1562 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1563 call assert_fails("lexpr " . l:entry) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1564 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1565 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1566 execute "lexpr! " . l:entry |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1567 call assert_equal(fnamemodify(l:file, ":t"), expand("%:t")) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1568 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1569 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1570 " Fail :lfdo but :lfdo! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1571 func Test_lfdo() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1572 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1573 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1574 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1575 let [l:first, l:middle, l:last] = s:make_simple_location_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1576 lnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1577 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1578 call assert_fails('execute "lfdo buffer ' . l:first . '"', "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1579 call assert_equal(l:middle, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1580 execute "lfdo! buffer " . l:first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1581 call assert_notequal(l:last, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1582 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1583 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1584 " Fail :lfile but :lfile! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1585 func Test_lfile() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1586 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1587 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1588 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1589 edit first.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1590 call append(0, ["some-search-term bad-thing-found"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1591 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1592 let l:first = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1593 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1594 edit! second.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1595 call append(0, ["some-search-term"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1596 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1597 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1598 let l:file = tempname() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1599 call writefile(["first.unittest:1:Error - bad-thing-found was detected"], l:file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1600 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1601 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1602 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1603 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1604 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1605 call assert_fails(":lfile " . l:file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1606 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1607 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1608 execute ":lfile! " . l:file |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1609 call assert_equal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1610 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1611 call delete(l:file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1612 call delete("first.unittest") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1613 call delete("second.unittest") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1614 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1615 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1616 " Fail :ll but :ll! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1617 func Test_ll() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1618 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1619 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1620 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1621 let [l:first, l:middle, l:last] = s:make_simple_location_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1622 lopen |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1623 lfirst! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1624 execute "normal \<C-w>j" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1625 normal j |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1626 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1627 call assert_fails(".ll", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1628 execute "normal \<C-w>k" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1629 call assert_equal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1630 execute "normal \<C-w>j" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1631 .ll! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1632 execute "normal \<C-w>k" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1633 call assert_equal(l:middle, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1634 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1635 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1636 " Fail :llast but :llast! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1637 func Test_llast() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1638 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1639 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1640 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1641 let [l:first, _, l:last] = s:make_simple_location_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1642 lfirst! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1643 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1644 call assert_fails("llast", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1645 call assert_equal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1646 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1647 llast! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1648 call assert_equal(l:last, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1649 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1650 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1651 " Fail :lnext but :lnext! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1652 func Test_lnext() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1653 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1654 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1655 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1656 let [l:first, l:middle, l:last] = s:make_simple_location_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1657 ll! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1658 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1659 call assert_fails("lnext", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1660 call assert_equal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1661 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1662 lnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1663 call assert_equal(l:middle, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1664 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1665 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1666 " Fail :lnfile but :lnfile! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1667 func Test_lnfile() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1668 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1669 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1670 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1671 let [_, l:current, l:last] = s:make_simple_location_list() |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1672 call assert_equal(1, getloclist(0, #{idx: 0}).idx) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1673 |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1674 lnext! |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1675 call assert_equal(2, getloclist(0, #{idx: 0}).idx) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1676 call assert_equal(l:current, bufnr()) |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1677 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1678 call assert_fails("lnfile", "E1513:") |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
1679 " Ensure the entry didn't change. |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1680 call assert_equal(2, getloclist(0, #{idx: 0}).idx) |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1681 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1682 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1683 lnfile! |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1684 call assert_equal(4, getloclist(0, #{idx: 0}).idx) |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1685 call assert_equal(l:last, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1686 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1687 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1688 " Fail :lpfile but :lpfile! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1689 func Test_lpfile() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1690 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1691 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1692 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1693 let [l:first, l:current, _] = s:make_simple_location_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1694 lnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1695 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1696 call assert_fails("lpfile", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1697 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1698 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1699 lnext! " Reset for the next test call |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1700 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1701 lpfile! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1702 call assert_equal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1703 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1704 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1705 " Fail :lprevious but :lprevious! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1706 func Test_lprevious() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1707 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1708 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1709 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1710 let [l:first, l:middle, _] = s:make_simple_location_list() |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1711 call assert_equal(1, getloclist(0, #{idx: 0}).idx) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1712 |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1713 lnext! |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1714 call assert_equal(2, getloclist(0, #{idx: 0}).idx) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1715 call assert_equal(l:middle, bufnr()) |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1716 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1717 call assert_fails("lprevious", "E1513:") |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1718 " Ensure the entry didn't change. |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1719 call assert_equal(2, getloclist(0, #{idx: 0}).idx) |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1720 call assert_equal(l:middle, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1721 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1722 lprevious! |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1723 call assert_equal(1, getloclist(0, #{idx: 0}).idx) |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1724 call assert_equal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1725 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1726 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1727 " Fail :lrewind but :lrewind! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1728 func Test_lrewind() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1729 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1730 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1731 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1732 let [l:first, l:middle, _] = s:make_simple_location_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1733 lnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1734 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1735 call assert_fails("lrewind", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1736 call assert_equal(l:middle, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1737 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1738 lrewind! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1739 call assert_equal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1740 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1741 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1742 " Fail :ltag but :ltag! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1743 func Test_ltag() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1744 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1745 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1746 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1747 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1748 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1749 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1750 \ "two\tXfile\t2"], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1751 \ "Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1752 call writefile(["one", "two", "three"], "Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1753 call writefile(["one"], "Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1754 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1755 execute "normal \<C-]>" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1756 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1757 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1758 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1759 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1760 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1761 call assert_fails("ltag one", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1762 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1763 ltag! one |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1764 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1765 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1766 call delete("Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1767 call delete("Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1768 call delete("Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1769 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1770 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1771 " Fail vim.command if we try to change buffers while 'winfixbuf' is set |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1772 func Test_lua_command() |
34479
2cf84e8dc58b
patch 9.1.0149: null pointer member access when accessing 'winfixbuf' property
Christian Brabandt <cb@256bit.org>
parents:
34470
diff
changeset
|
1773 CheckFeature lua |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1774 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1775 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1776 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1777 file first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1778 let l:previous = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1779 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1780 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1781 file second |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1782 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1783 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1784 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1785 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1786 call assert_fails('lua vim.command("buffer " .. ' . l:previous . ')') |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1787 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1788 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1789 execute 'lua vim.command("buffer! " .. ' . l:previous . ')' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1790 call assert_equal(l:previous, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1791 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1792 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1793 " Fail :lvimgrep but :lvimgrep! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1794 func Test_lvimgrep() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1795 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1796 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1797 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1798 edit first.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1799 call append(0, ["some-search-term"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1800 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1801 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1802 edit winfix.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1803 call append(0, ["some-search-term"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1804 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1805 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1806 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1807 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1808 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1809 edit! last.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1810 call append(0, ["some-search-term"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1811 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1812 let l:last = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1813 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1814 buffer! winfix.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1815 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1816 call assert_fails("lvimgrep /some-search-term/ *.unittest", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1817 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1818 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1819 lvimgrep! /some-search-term/ *.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1820 call assert_notequal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1821 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1822 call delete("first.unittest") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1823 call delete("winfix.unittest") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1824 call delete("last.unittest") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1825 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1826 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1827 " Fail :lvimgrepadd but :lvimgrepadd! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1828 func Test_lvimgrepadd() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1829 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1830 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1831 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1832 edit first.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1833 call append(0, ["some-search-term"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1834 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1835 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1836 edit winfix.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1837 call append(0, ["some-search-term"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1838 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1839 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1840 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1841 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1842 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1843 edit! last.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1844 call append(0, ["some-search-term"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1845 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1846 let l:last = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1847 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1848 buffer! winfix.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1849 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1850 call assert_fails("lvimgrepadd /some-search-term/ *.unittest") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1851 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1852 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1853 lvimgrepadd! /some-search-term/ *.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1854 call assert_notequal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1855 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1856 call delete("first.unittest") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1857 call delete("winfix.unittest") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1858 call delete("last.unittest") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1859 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1860 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1861 " Don't allow global marks to change the current 'winfixbuf' window |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1862 func Test_marks_mappings_fail() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1863 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1864 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1865 let l:other = s:make_buffer_pairs() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1866 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1867 execute "buffer! " . l:other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1868 normal mA |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1869 execute "buffer! " . l:current |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1870 normal mB |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1871 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1872 call assert_fails("normal `A", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1873 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1874 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1875 call assert_fails("normal 'A", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1876 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1877 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1878 set nowinfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1879 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1880 normal `A |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1881 call assert_equal(l:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1882 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1883 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1884 " Allow global marks in a 'winfixbuf' window if the jump is the same buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1885 func Test_marks_mappings_pass_intra_move() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1886 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1887 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1888 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1889 call append(0, ["some line", "another line"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1890 normal mA |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1891 normal j |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1892 normal mB |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1893 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1894 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1895 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1896 normal `A |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1897 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1898 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1899 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1900 " Fail :next but :next! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1901 func Test_next() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1902 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1903 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1904 let [l:first, _] = s:make_args_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1905 first! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1906 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1907 call assert_fails("next", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1908 call assert_equal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1909 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1910 next! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1911 call assert_notequal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1912 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1913 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1914 " Ensure :mksession saves 'winfixbuf' details |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1915 func Test_mksession() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1916 CheckFeature mksession |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1917 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1918 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1919 set sessionoptions+=options |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1920 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1921 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1922 mksession test_winfixbuf_Test_mksession.vim |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1923 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1924 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1925 let l:winfixbuf = &winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1926 call assert_equal(0, l:winfixbuf) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1927 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1928 source test_winfixbuf_Test_mksession.vim |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1929 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1930 let l:winfixbuf = &winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1931 call assert_equal(1, l:winfixbuf) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1932 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1933 set sessionoptions& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1934 call delete("test_winfixbuf_Test_mksession.vim") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1935 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1936 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1937 " Allow :next if the next index is the same as the current buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1938 func Test_next_same_buffer() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1939 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1940 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1941 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1942 file foo |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1943 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1944 file bar |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1945 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1946 file fizz |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1947 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1948 file buzz |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1949 args foo foo bar fizz buzz |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1950 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1951 edit foo |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1952 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1953 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1954 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1955 " Allow :next because the args list is `[foo] foo bar fizz buzz |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1956 next |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1957 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1958 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1959 " Fail :next because the args list is `foo [foo] bar fizz buzz |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1960 " and the next buffer would be bar, which is a different buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1961 call assert_fails("next", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1962 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1963 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1964 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1965 " Fail to jump to a tag with g<C-]> if 'winfixbuf' is enabled |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1966 func Test_normal_g_ctrl_square_bracket_right() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1967 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1968 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1969 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1970 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1971 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1972 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1973 \ "two\tXfile\t2"], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1974 \ "Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1975 call writefile(["one", "two", "three"], "Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1976 call writefile(["one"], "Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1977 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1978 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1979 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1980 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1981 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1982 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1983 call assert_fails("normal g\<C-]>", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1984 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1985 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1986 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1987 call delete("Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1988 call delete("Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1989 call delete("Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1990 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1991 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1992 " Fail to jump to a tag with g<RightMouse> if 'winfixbuf' is enabled |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1993 func Test_normal_g_rightmouse() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1994 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1995 set mouse=n |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1996 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1997 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1998 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1999 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2000 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2001 \ "two\tXfile\t2"], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2002 \ "Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2003 call writefile(["one", "two", "three"], "Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2004 call writefile(["one"], "Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2005 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2006 execute "normal \<C-]>" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2007 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2008 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2009 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2010 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2011 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2012 call assert_fails("normal g\<RightMouse>", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2013 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2014 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2015 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2016 set mouse& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2017 call delete("Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2018 call delete("Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2019 call delete("Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2020 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2021 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2022 " Fail to jump to a tag with g] if 'winfixbuf' is enabled |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2023 func Test_normal_g_square_bracket_right() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2024 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2025 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2026 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2027 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2028 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2029 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2030 \ "two\tXfile\t2"], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2031 \ "Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2032 call writefile(["one", "two", "three"], "Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2033 call writefile(["one"], "Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2034 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2035 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2036 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2037 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2038 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2039 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2040 call assert_fails("normal g]", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2041 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2042 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2043 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2044 call delete("Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2045 call delete("Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2046 call delete("Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2047 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2048 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2049 " Fail to jump to a tag with <C-RightMouse> if 'winfixbuf' is enabled |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2050 func Test_normal_ctrl_rightmouse() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2051 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2052 set mouse=n |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2053 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2054 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2055 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2056 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2057 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2058 \ "two\tXfile\t2"], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2059 \ "Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2060 call writefile(["one", "two", "three"], "Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2061 call writefile(["one"], "Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2062 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2063 execute "normal \<C-]>" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2064 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2065 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2066 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2067 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2068 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2069 call assert_fails("normal \<C-RightMouse>", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2070 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2071 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2072 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2073 set mouse& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2074 call delete("Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2075 call delete("Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2076 call delete("Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2077 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2078 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2079 " Fail to jump to a tag with <C-t> if 'winfixbuf' is enabled |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2080 func Test_normal_ctrl_t() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2081 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2082 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2083 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2084 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2085 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2086 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2087 \ "two\tXfile\t2"], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2088 \ "Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2089 call writefile(["one", "two", "three"], "Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2090 call writefile(["one"], "Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2091 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2092 execute "normal \<C-]>" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2093 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2094 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2095 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2096 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2097 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2098 call assert_fails("normal \<C-t>", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2099 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2100 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2101 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2102 call delete("Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2103 call delete("Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2104 call delete("Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2105 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2106 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2107 " Disallow <C-^> in 'winfixbuf' windows |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2108 func Test_normal_ctrl_hat() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2109 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2110 clearjumps |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2111 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2112 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2113 file first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2114 let l:first = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2115 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2116 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2117 file current |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2118 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2119 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2120 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2121 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2122 call assert_fails("normal \<C-^>", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2123 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2124 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2125 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2126 " Allow <C-i> in 'winfixbuf' windows if the movement stays within the buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2127 func Test_normal_ctrl_i_pass() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2128 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2129 clearjumps |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2130 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2131 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2132 file first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2133 let l:first = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2134 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2135 enew! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2136 file current |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2137 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2138 " Add some lines so we can populate a jumplist" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2139 call append(0, ["some line", "another line"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2140 " Add an entry to the jump list |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2141 " Go up another line |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2142 normal m` |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2143 normal k |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2144 execute "normal \<C-o>" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2145 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2146 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2147 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2148 let l:line = getcurpos()[1] |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2149 execute "normal 1\<C-i>" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2150 call assert_notequal(l:line, getcurpos()[1]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2151 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2152 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2153 " Disallow <C-o> in 'winfixbuf' windows if it would cause the buffer to switch |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2154 func Test_normal_ctrl_o_fail() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2155 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2156 clearjumps |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2157 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2158 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2159 file first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2160 let l:first = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2161 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2162 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2163 file current |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2164 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2165 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2166 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2167 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2168 call assert_fails("normal \<C-o>", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2169 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2170 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2171 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2172 " Allow <C-o> in 'winfixbuf' windows if the movement stays within the buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2173 func Test_normal_ctrl_o_pass() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2174 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2175 clearjumps |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2176 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2177 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2178 file first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2179 let l:first = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2180 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2181 enew! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2182 file current |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2183 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2184 " Add some lines so we can populate a jumplist |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2185 call append(0, ["some line", "another line"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2186 " Add an entry to the jump list |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2187 " Go up another line |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2188 normal m` |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2189 normal k |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2190 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2191 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2192 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2193 execute "normal \<C-o>" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2194 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2195 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2196 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2197 " Fail to jump to a tag with <C-]> if 'winfixbuf' is enabled |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2198 func Test_normal_ctrl_square_bracket_right() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2199 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2200 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2201 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2202 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2203 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2204 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2205 \ "two\tXfile\t2"], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2206 \ "Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2207 call writefile(["one", "two", "three"], "Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2208 call writefile(["one"], "Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2209 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2210 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2211 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2212 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2213 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2214 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2215 call assert_fails("normal \<C-]>", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2216 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2217 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2218 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2219 call delete("Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2220 call delete("Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2221 call delete("Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2222 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2223 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2224 " Allow <C-w><C-]> with 'winfixbuf' enabled because it runs in a new, split window |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2225 func Test_normal_ctrl_w_ctrl_square_bracket_right() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2226 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2227 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2228 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2229 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2230 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2231 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2232 \ "two\tXfile\t2"], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2233 \ "Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2234 call writefile(["one", "two", "three"], "Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2235 call writefile(["one"], "Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2236 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2237 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2238 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2239 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2240 let l:current_windows = s:get_windows_count() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2241 execute "normal \<C-w>\<C-]>" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2242 call assert_equal(l:current_windows + 1, s:get_windows_count()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2243 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2244 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2245 call delete("Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2246 call delete("Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2247 call delete("Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2248 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2249 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2250 " Allow <C-w>g<C-]> with 'winfixbuf' enabled because it runs in a new, split window |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2251 func Test_normal_ctrl_w_g_ctrl_square_bracket_right() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2252 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2253 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2254 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2255 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2256 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2257 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2258 \ "two\tXfile\t2"], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2259 \ "Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2260 call writefile(["one", "two", "three"], "Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2261 call writefile(["one"], "Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2262 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2263 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2264 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2265 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2266 let l:current_windows = s:get_windows_count() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2267 execute "normal \<C-w>g\<C-]>" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2268 call assert_equal(l:current_windows + 1, s:get_windows_count()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2269 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2270 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2271 call delete("Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2272 call delete("Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2273 call delete("Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2274 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2275 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2276 " Fail to jump to a tag with <C-]> if 'winfixbuf' is enabled |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2277 func Test_normal_gt() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2278 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2279 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2280 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2281 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2282 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2283 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2284 \ "two\tXfile\t2"], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2285 \ "Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2286 call writefile(["one", "two", "three"], "Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2287 call writefile(["one", "two", "three"], "Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2288 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2289 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2290 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2291 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2292 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2293 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2294 call assert_fails("normal \<C-]>", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2295 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2296 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2297 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2298 call delete("Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2299 call delete("Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2300 call delete("Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2301 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2302 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2303 " Prevent gF from switching a 'winfixbuf' window's buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2304 func Test_normal_gF() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2305 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2306 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2307 let l:file = tempname() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2308 call append(0, [l:file]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2309 call writefile([], l:file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2310 " Place the cursor onto the line that has `l:file` |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2311 normal gg |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2312 " Prevent Vim from erroring with "No write since last change @ command |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2313 " line" when we try to call gF, later. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2314 set hidden |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2315 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2316 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2317 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2318 let l:buffer = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2319 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2320 call assert_fails("normal gF", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2321 call assert_equal(l:buffer, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2322 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2323 set nowinfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2324 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2325 normal gF |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2326 call assert_notequal(l:buffer, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2327 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2328 call delete(l:file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2329 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2330 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2331 " Prevent gf from switching a 'winfixbuf' window's buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2332 func Test_normal_gf() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2333 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2334 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2335 let l:file = tempname() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2336 call append(0, [l:file]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2337 call writefile([], l:file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2338 " Place the cursor onto the line that has `l:file` |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2339 normal gg |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2340 " Prevent Vim from erroring with "No write since last change @ command |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2341 " line" when we try to call gf, later. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2342 set hidden |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2343 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2344 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2345 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2346 let l:buffer = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2347 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2348 call assert_fails("normal gf", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2349 call assert_equal(l:buffer, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2350 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2351 set nowinfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2352 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2353 normal gf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2354 call assert_notequal(l:buffer, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2355 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2356 call delete(l:file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2357 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2358 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2359 " Fail "goto file under the cursor" (using [f, which is the same as `:normal gf`) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2360 func Test_normal_square_bracket_left_f() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2361 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2362 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2363 let l:file = tempname() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2364 call append(0, [l:file]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2365 call writefile([], l:file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2366 " Place the cursor onto the line that has `l:file` |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2367 normal gg |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2368 " Prevent Vim from erroring with "No write since last change @ command |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2369 " line" when we try to call gf, later. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2370 set hidden |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2371 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2372 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2373 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2374 let l:buffer = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2375 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2376 call assert_fails("normal [f", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2377 call assert_equal(l:buffer, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2378 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2379 set nowinfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2380 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2381 normal [f |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2382 call assert_notequal(l:buffer, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2383 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2384 call delete(l:file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2385 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2386 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2387 " Fail to go to a C macro with [<C-d> if 'winfixbuf' is enabled |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2388 func Test_normal_square_bracket_left_ctrl_d() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2389 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2390 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2391 let l:include_file = tempname() . ".h" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2392 call writefile(["min(1, 12);", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2393 \ '#include "' . l:include_file . '"' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2394 \ ], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2395 \ "main.c") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2396 call writefile(["#define min(X, Y) ((X) < (Y) ? (X) : (Y))"], l:include_file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2397 edit main.c |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2398 normal ]\<C-d> |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2399 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2400 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2401 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2402 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2403 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2404 call assert_fails("normal [\<C-d>", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2405 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2406 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2407 set nowinfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2408 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2409 execute "normal [\<C-d>" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2410 call assert_notequal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2411 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2412 call delete("main.c") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2413 call delete(l:include_file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2414 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2415 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2416 " Fail to go to a C macro with ]<C-d> if 'winfixbuf' is enabled |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2417 func Test_normal_square_bracket_right_ctrl_d() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2418 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2419 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2420 let l:include_file = tempname() . ".h" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2421 call writefile(["min(1, 12);", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2422 \ '#include "' . l:include_file . '"' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2423 \ ], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2424 \ "main.c") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2425 call writefile(["#define min(X, Y) ((X) < (Y) ? (X) : (Y))"], l:include_file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2426 edit main.c |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2427 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2428 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2429 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2430 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2431 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2432 call assert_fails("normal ]\<C-d>", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2433 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2434 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2435 set nowinfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2436 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2437 execute "normal ]\<C-d>" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2438 call assert_notequal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2439 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2440 call delete("main.c") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2441 call delete(l:include_file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2442 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2443 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2444 " Fail to go to a C macro with [<C-i> if 'winfixbuf' is enabled |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2445 func Test_normal_square_bracket_left_ctrl_i() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2446 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2447 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2448 let l:include_file = tempname() . ".h" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2449 call writefile(['#include "' . l:include_file . '"', |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2450 \ "min(1, 12);", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2451 \ ], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2452 \ "main.c") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2453 call writefile(["#define min(X, Y) ((X) < (Y) ? (X) : (Y))"], l:include_file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2454 edit main.c |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2455 " Move to the line with `min(1, 12);` on it" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2456 normal j |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2457 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2458 set define=^\\s*#\\s*define |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2459 set include=^\\s*#\\s*include |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2460 set path=.,/usr/include,, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2461 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2462 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2463 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2464 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2465 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2466 call assert_fails("normal [\<C-i>", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2467 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2468 set nowinfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2469 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2470 execute "normal [\<C-i>" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2471 call assert_notequal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2472 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2473 set define& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2474 set include& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2475 set path& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2476 call delete("main.c") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2477 call delete(l:include_file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2478 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2479 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2480 " Fail to go to a C macro with ]<C-i> if 'winfixbuf' is enabled |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2481 func Test_normal_square_bracket_right_ctrl_i() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2482 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2483 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2484 let l:include_file = tempname() . ".h" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2485 call writefile(["min(1, 12);", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2486 \ '#include "' . l:include_file . '"' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2487 \ ], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2488 \ "main.c") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2489 call writefile(["#define min(X, Y) ((X) < (Y) ? (X) : (Y))"], l:include_file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2490 edit main.c |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2491 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2492 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2493 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2494 set define=^\\s*#\\s*define |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2495 set include=^\\s*#\\s*include |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2496 set path=.,/usr/include,, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2497 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2498 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2499 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2500 call assert_fails("normal ]\<C-i>", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2501 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2502 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2503 set nowinfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2504 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2505 execute "normal ]\<C-i>" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2506 call assert_notequal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2507 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2508 set define& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2509 set include& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2510 set path& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2511 call delete("main.c") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2512 call delete(l:include_file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2513 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2514 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2515 " Fail "goto file under the cursor" (using ]f, which is the same as `:normal gf`) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2516 func Test_normal_square_bracket_right_f() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2517 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2518 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2519 let l:file = tempname() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2520 call append(0, [l:file]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2521 call writefile([], l:file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2522 " Place the cursor onto the line that has `l:file` |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2523 normal gg |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2524 " Prevent Vim from erroring with "No write since last change @ command |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2525 " line" when we try to call gf, later. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2526 set hidden |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2527 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2528 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2529 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2530 let l:buffer = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2531 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2532 call assert_fails("normal ]f", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2533 call assert_equal(l:buffer, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2534 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2535 set nowinfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2536 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2537 normal ]f |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2538 call assert_notequal(l:buffer, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2539 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2540 call delete(l:file) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2541 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2542 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2543 " Fail to jump to a tag with v<C-]> if 'winfixbuf' is enabled |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2544 func Test_normal_v_ctrl_square_bracket_right() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2545 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2546 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2547 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2548 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2549 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2550 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2551 \ "two\tXfile\t2"], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2552 \ "Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2553 call writefile(["one", "two", "three"], "Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2554 call writefile(["one"], "Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2555 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2556 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2557 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2558 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2559 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2560 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2561 call assert_fails("normal v\<C-]>", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2562 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2563 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2564 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2565 call delete("Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2566 call delete("Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2567 call delete("Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2568 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2569 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2570 " Fail to jump to a tag with vg<C-]> if 'winfixbuf' is enabled |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2571 func Test_normal_v_g_ctrl_square_bracket_right() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2572 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2573 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2574 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2575 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2576 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2577 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2578 \ "two\tXfile\t2"], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2579 \ "Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2580 call writefile(["one", "two", "three"], "Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2581 call writefile(["one"], "Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2582 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2583 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2584 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2585 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2586 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2587 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2588 call assert_fails("normal vg\<C-]>", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2589 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2590 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2591 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2592 call delete("Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2593 call delete("Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2594 call delete("Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2595 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2596 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2597 " Allow :pedit because, unlike :edit, it uses a separate window |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2598 func Test_pedit() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2599 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2600 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2601 let l:other = s:make_buffer_pairs() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2602 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2603 pedit other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2604 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2605 execute "normal \<C-w>w" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2606 call assert_equal(l:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2607 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2608 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2609 " Fail :pop but :pop! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2610 func Test_pop() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2611 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2612 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2613 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2614 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2615 \ "thesame\tXfile\t1;\"\td\tfile:", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2616 \ "thesame\tXfile\t2;\"\td\tfile:", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2617 \ "thesame\tXfile\t3;\"\td\tfile:", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2618 \ ], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2619 \ "Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2620 call writefile(["thesame one", "thesame two", "thesame three"], "Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2621 call writefile(["thesame one"], "Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2622 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2623 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2624 tag thesame |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2625 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2626 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2627 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2628 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2629 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2630 call assert_fails("pop", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2631 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2632 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2633 pop! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2634 call assert_notequal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2635 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2636 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2637 call delete("Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2638 call delete("Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2639 call delete("Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2640 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2641 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2642 " Fail :previous but :previous! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2643 func Test_previous() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2644 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2645 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2646 let [l:first, _] = s:make_args_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2647 next! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2648 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2649 call assert_fails("previous", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2650 call assert_notequal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2651 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2652 previous! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2653 call assert_equal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2654 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2655 |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
2656 " Fail pyxdo if it changes a window with 'winfixbuf' is set |
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
2657 func Test_pythonx_pyxdo() |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2658 CheckFeature pythonx |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2659 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2660 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2661 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2662 file first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2663 let g:_previous_buffer = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2664 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2665 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2666 file second |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2667 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2668 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2669 |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
2670 pythonx << EOF |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2671 import vim |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2672 |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
2673 def test_winfixbuf_Test_pythonx_pyxdo_set_buffer(): |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2674 buffer = vim.vars['_previous_buffer'] |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2675 vim.current.buffer = vim.buffers[buffer] |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2676 EOF |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2677 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2678 try |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
2679 pyxdo test_winfixbuf_Test_pythonx_pyxdo_set_buffer() |
34554
495218030237
patch 9.1.0178: E1513 might be confusing
Christian Brabandt <cb@256bit.org>
parents:
34500
diff
changeset
|
2680 catch /Vim\%((\a\+)\)\=:E1513:/ |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2681 let l:caught = 1 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2682 endtry |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2683 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2684 call assert_equal(1, l:caught) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2685 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2686 unlet g:_previous_buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2687 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2688 |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
2689 " Fail pyxfile if it changes a window with 'winfixbuf' is set |
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
2690 func Test_pythonx_pyxfile() |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2691 CheckFeature pythonx |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2692 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2693 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2694 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2695 file first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2696 let g:_previous_buffer = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2697 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2698 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2699 file second |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2700 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2701 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2702 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2703 call writefile(["import vim", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2704 \ "buffer = vim.vars['_previous_buffer']", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2705 \ "vim.current.buffer = vim.buffers[buffer]", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2706 \ ], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2707 \ "file.py") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2708 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2709 try |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
2710 pyxfile file.py |
34554
495218030237
patch 9.1.0178: E1513 might be confusing
Christian Brabandt <cb@256bit.org>
parents:
34500
diff
changeset
|
2711 catch /Vim\%((\a\+)\)\=:E1513:/ |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2712 let l:caught = 1 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2713 endtry |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2714 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2715 call assert_equal(1, l:caught) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2716 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2717 call delete("file.py") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2718 unlet g:_previous_buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2719 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2720 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2721 " Fail vim.current.buffer if 'winfixbuf' is set |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
2722 func Test_pythonx_vim_current_buffer() |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2723 CheckFeature pythonx |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2724 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2725 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2726 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2727 file first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2728 let g:_previous_buffer = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2729 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2730 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2731 file second |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2732 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2733 let l:caught = 0 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2734 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2735 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2736 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2737 try |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
2738 pythonx << EOF |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2739 import vim |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2740 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2741 buffer = vim.vars["_previous_buffer"] |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2742 vim.current.buffer = vim.buffers[buffer] |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2743 EOF |
34554
495218030237
patch 9.1.0178: E1513 might be confusing
Christian Brabandt <cb@256bit.org>
parents:
34500
diff
changeset
|
2744 catch /Vim\%((\a\+)\)\=:E1513:/ |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2745 let l:caught = 1 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2746 endtry |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2747 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2748 call assert_equal(1, l:caught) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2749 unlet g:_previous_buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2750 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2751 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2752 " Ensure remapping to a disabled action still triggers failures |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2753 func Test_remap_key_fail() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2754 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2755 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2756 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2757 file first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2758 let l:first = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2759 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2760 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2761 file current |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2762 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2763 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2764 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2765 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2766 nnoremap g <C-^> |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2767 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2768 call assert_fails("normal g", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2769 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2770 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2771 nunmap g |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2772 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2773 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2774 " Ensure remapping a disabled key to something valid does trigger any failures |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2775 func Test_remap_key_pass() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2776 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2777 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2778 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2779 file first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2780 let l:first = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2781 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2782 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2783 file current |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2784 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2785 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2786 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2787 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2788 call assert_fails("normal \<C-^>", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2789 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2790 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2791 " Disallow <C-^> by default but allow it if the command does something else |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2792 nnoremap <C-^> :echo "hello!" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2793 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2794 execute "normal \<C-^>" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2795 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2796 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2797 nunmap <C-^> |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2798 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2799 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2800 " Fail :rewind but :rewind! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2801 func Test_rewind() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2802 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2803 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2804 let [l:first, _] = s:make_args_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2805 next! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2806 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2807 call assert_fails("rewind", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2808 call assert_notequal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2809 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2810 rewind! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2811 call assert_equal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2812 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2813 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2814 " Allow :sblast because it opens the buffer in a new, split window |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2815 func Test_sblast() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2816 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2817 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2818 let l:other = s:make_buffer_pairs(1) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2819 bfirst! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2820 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2821 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2822 sblast |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2823 call assert_equal(l:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2824 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2825 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2826 " Fail :sbprevious but :sbprevious! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2827 func Test_sbprevious() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2828 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2829 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2830 let l:other = s:make_buffer_pairs() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2831 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2832 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2833 sbprevious |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2834 call assert_equal(l:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2835 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2836 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2837 " Make sure 'winfixbuf' can be set using 'winfixbuf' or 'wfb' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2838 func Test_short_option() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2839 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2840 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2841 call s:make_buffer_pairs() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2842 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2843 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2844 call assert_fails("edit something_else", "E1513") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2845 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2846 set nowinfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2847 set wfb |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2848 call assert_fails("edit another_place", "E1513") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2849 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2850 set nowfb |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2851 edit last_place |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2852 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2853 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2854 " Allow :snext because it makes a new window |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2855 func Test_snext() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2856 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2857 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2858 let [l:first, _] = s:make_args_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2859 first! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2860 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2861 let l:current_window = win_getid() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2862 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2863 snext |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2864 call assert_notequal(l:current_window, win_getid()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2865 call assert_notequal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2866 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2867 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2868 " Ensure the first has 'winfixbuf' and a new split window is 'nowinfixbuf' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2869 func Test_split_window() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2870 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2871 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2872 split |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2873 execute "normal \<C-w>j" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2874 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2875 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2876 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2877 let l:winfix_window_1 = win_getid() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2878 vsplit |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2879 let l:winfix_window_2 = win_getid() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2880 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2881 call assert_equal(1, getwinvar(l:winfix_window_1, "&winfixbuf")) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2882 call assert_equal(0, getwinvar(l:winfix_window_2, "&winfixbuf")) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2883 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2884 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2885 " Fail :tNext but :tNext! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2886 func Test_tNext() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2887 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2888 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2889 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2890 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2891 \ "thesame\tXfile\t1;\"\td\tfile:", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2892 \ "thesame\tXfile\t2;\"\td\tfile:", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2893 \ "thesame\tXfile\t3;\"\td\tfile:", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2894 \ ], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2895 \ "Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2896 call writefile(["thesame one", "thesame two", "thesame three"], "Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2897 call writefile(["thesame one"], "Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2898 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2899 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2900 tag thesame |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2901 execute "normal \<C-^>" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2902 tnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2903 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2904 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2905 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2906 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2907 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2908 call assert_fails("tNext", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2909 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2910 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2911 tNext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2912 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2913 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2914 call delete("Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2915 call delete("Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2916 call delete("Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2917 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2918 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2919 " Call :tabdo and choose the next available 'nowinfixbuf' window. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2920 func Test_tabdo_choose_available_window() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2921 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2922 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2923 let [l:first, _] = s:make_args_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2924 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2925 " Make a split window that is 'nowinfixbuf' but make it the second-to-last |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2926 " window so that :tabdo will first try the 'winfixbuf' window, pass over it, |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2927 " and prefer the other 'nowinfixbuf' window, instead. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2928 " |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2929 " +-------------------+ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2930 " | 'nowinfixbuf' | |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2931 " +-------------------+ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2932 " | 'winfixbuf' | <-- Cursor is here |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2933 " +-------------------+ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2934 split |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2935 let l:nowinfixbuf_window = win_getid() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2936 " Move to the 'winfixbuf' window now |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2937 execute "normal \<C-w>j" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2938 let l:winfixbuf_window = win_getid() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2939 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2940 let l:expected_windows = s:get_windows_count() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2941 tabdo echo '' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2942 call assert_equal(l:nowinfixbuf_window, win_getid()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2943 call assert_equal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2944 call assert_equal(l:expected_windows, s:get_windows_count()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2945 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2946 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2947 " Call :tabdo and create a new split window if all available windows are 'winfixbuf'. |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2948 func Test_tabdo_make_new_window() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2949 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2950 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2951 let [l:first, _] = s:make_buffers_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2952 execute "buffer! " . l:first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2953 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2954 let l:current = win_getid() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2955 let l:current_windows = s:get_windows_count() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2956 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2957 tabdo echo '' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2958 call assert_notequal(l:current, win_getid()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2959 call assert_equal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2960 execute "normal \<C-w>j" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2961 call assert_equal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2962 call assert_equal(l:current_windows + 1, s:get_windows_count()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2963 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2964 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2965 " Fail :tag but :tag! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2966 func Test_tag() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2967 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2968 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2969 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2970 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2971 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2972 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2973 \ "two\tXfile\t2"], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2974 \ "Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2975 call writefile(["one", "two", "three"], "Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2976 call writefile(["one"], "Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2977 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2978 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2979 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2980 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2981 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2982 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2983 call assert_fails("tag one", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2984 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2985 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2986 tag! one |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2987 call assert_notequal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2988 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2989 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2990 call delete("Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2991 call delete("Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2992 call delete("Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2993 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2994 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2995 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2996 " Fail :tfirst but :tfirst! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2997 func Test_tfirst() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2998 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2999 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3000 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3001 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3002 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3003 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3004 \ "two\tXfile\t2"], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3005 \ "Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3006 call writefile(["one", "two", "three"], "Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3007 call writefile(["one"], "Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3008 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3009 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3010 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3011 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3012 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3013 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3014 call assert_fails("tfirst", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3015 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3016 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3017 tfirst! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3018 call assert_notequal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3019 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3020 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3021 call delete("Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3022 call delete("Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3023 call delete("Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3024 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3025 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3026 " Fail :tjump but :tjump! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3027 func Test_tjump() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3028 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3029 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3030 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3031 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3032 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3033 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3034 \ "two\tXfile\t2"], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3035 \ "Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3036 call writefile(["one", "two", "three"], "Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3037 call writefile(["one"], "Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3038 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3039 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3040 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3041 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3042 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3043 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3044 call assert_fails("tjump one", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3045 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3046 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3047 tjump! one |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3048 call assert_notequal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3049 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3050 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3051 call delete("Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3052 call delete("Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3053 call delete("Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3054 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3055 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3056 " Fail :tlast but :tlast! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3057 func Test_tlast() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3058 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3059 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3060 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3061 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3062 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3063 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3064 \ "two\tXfile\t2"], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3065 \ "Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3066 call writefile(["one", "two", "three"], "Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3067 edit Xfile |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3068 tjump one |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3069 edit Xfile |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3070 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3071 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3072 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3073 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3074 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3075 call assert_fails("tlast", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3076 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3077 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3078 tlast! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3079 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3080 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3081 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3082 call delete("Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3083 call delete("Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3084 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3085 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3086 " Fail :tnext but :tnext! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3087 func Test_tnext() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3088 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3089 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3090 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3091 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3092 \ "thesame\tXfile\t1;\"\td\tfile:", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3093 \ "thesame\tXfile\t2;\"\td\tfile:", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3094 \ "thesame\tXfile\t3;\"\td\tfile:", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3095 \ ], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3096 \ "Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3097 call writefile(["thesame one", "thesame two", "thesame three"], "Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3098 call writefile(["thesame one"], "Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3099 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3100 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3101 tag thesame |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3102 execute "normal \<C-^>" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3103 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3104 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3105 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3106 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3107 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3108 call assert_fails("tnext", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3109 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3110 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3111 tnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3112 call assert_notequal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3113 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3114 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3115 call delete("Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3116 call delete("Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3117 call delete("Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3118 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3119 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3120 " Fail :tprevious but :tprevious! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3121 func Test_tprevious() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3122 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3123 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3124 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3125 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3126 \ "thesame\tXfile\t1;\"\td\tfile:", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3127 \ "thesame\tXfile\t2;\"\td\tfile:", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3128 \ "thesame\tXfile\t3;\"\td\tfile:", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3129 \ ], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3130 \ "Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3131 call writefile(["thesame one", "thesame two", "thesame three"], "Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3132 call writefile(["thesame one"], "Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3133 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3134 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3135 tag thesame |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3136 execute "normal \<C-^>" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3137 tnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3138 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3139 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3140 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3141 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3142 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3143 call assert_fails("tprevious", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3144 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3145 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3146 tprevious! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3147 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3148 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3149 call delete("Xtags") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3150 call delete("Xfile") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3151 call delete("Xother") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3152 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3153 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3154 " Fail :view but :view! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3155 func Test_view() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3156 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3157 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3158 let l:other = s:make_buffer_pairs() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3159 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3160 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3161 call assert_fails("view other", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3162 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3163 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3164 view! other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3165 call assert_equal(l:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3166 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3167 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3168 " Fail :visual but :visual! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3169 func Test_visual() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3170 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3171 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3172 let l:other = s:make_buffer_pairs() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3173 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3174 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3175 call assert_fails("visual other", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3176 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3177 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3178 visual! other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3179 call assert_equal(l:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3180 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3181 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3182 " Fail :vimgrep but :vimgrep! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3183 func Test_vimgrep() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3184 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3185 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3186 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3187 edit first.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3188 call append(0, ["some-search-term"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3189 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3190 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3191 edit winfix.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3192 call append(0, ["some-search-term"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3193 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3194 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3195 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3196 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3197 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3198 edit! last.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3199 call append(0, ["some-search-term"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3200 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3201 let l:last = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3202 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3203 buffer! winfix.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3204 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3205 call assert_fails("vimgrep /some-search-term/ *.unittest") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3206 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3207 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3208 " Don't error and also do swap to the first match because ! was included |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3209 vimgrep! /some-search-term/ *.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3210 call assert_notequal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3211 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3212 call delete("first.unittest") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3213 call delete("winfix.unittest") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3214 call delete("last.unittest") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3215 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3216 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3217 " Fail :vimgrepadd but ::vimgrepadd! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3218 func Test_vimgrepadd() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3219 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3220 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3221 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3222 edit first.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3223 call append(0, ["some-search-term"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3224 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3225 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3226 edit winfix.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3227 call append(0, ["some-search-term"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3228 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3229 let l:current = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3230 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3231 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3232 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3233 edit! last.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3234 call append(0, ["some-search-term"]) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3235 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3236 let l:last = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3237 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3238 buffer! winfix.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3239 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3240 call assert_fails("vimgrepadd /some-search-term/ *.unittest") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3241 call assert_equal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3242 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3243 vimgrepadd! /some-search-term/ *.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3244 call assert_notequal(l:current, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3245 call delete("first.unittest") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3246 call delete("winfix.unittest") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3247 call delete("last.unittest") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3248 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3249 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3250 " Fail :wNext but :wNext! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3251 func Test_wNext() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3252 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3253 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3254 let [l:first, _] = s:make_args_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3255 next! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3256 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3257 call assert_fails("wNext", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3258 call assert_notequal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3259 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3260 wNext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3261 call assert_equal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3262 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3263 call delete("first") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3264 call delete("middle") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3265 call delete("last") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3266 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3267 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3268 " Allow :windo unless `:windo foo` would change a 'winfixbuf' window's buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3269 func Test_windo() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3270 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3271 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3272 let l:current_window = win_getid() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3273 let l:current_buffer = bufnr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3274 split |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3275 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3276 file some_other_buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3277 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3278 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3279 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3280 let l:current = win_getid() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3281 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3282 windo echo '' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3283 call assert_equal(l:current_window, win_getid()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3284 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3285 call assert_fails('execute "windo buffer ' . l:current_buffer . '"', "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3286 call assert_equal(l:current_window, win_getid()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3287 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3288 execute "windo buffer! " . l:current_buffer |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3289 call assert_equal(l:current_window, win_getid()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3290 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3291 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3292 " Fail :wnext but :wnext! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3293 func Test_wnext() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3294 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3295 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3296 let [_, l:last] = s:make_args_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3297 next! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3298 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3299 call assert_fails("wnext", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3300 call assert_notequal(l:last, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3301 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3302 wnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3303 call assert_equal(l:last, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3304 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3305 call delete("first") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3306 call delete("middle") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3307 call delete("last") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3308 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3309 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3310 " Fail :wprevious but :wprevious! is allowed |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3311 func Test_wprevious() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3312 call s:reset_all_buffers() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3313 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3314 let [l:first, _] = s:make_args_list() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3315 next! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3316 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3317 call assert_fails("wprevious", "E1513:") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3318 call assert_notequal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3319 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3320 wprevious! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3321 call assert_equal(l:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3322 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3323 call delete("first") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3324 call delete("middle") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3325 call delete("last") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3326 endfunc |
34479
2cf84e8dc58b
patch 9.1.0149: null pointer member access when accessing 'winfixbuf' property
Christian Brabandt <cb@256bit.org>
parents:
34470
diff
changeset
|
3327 |
2cf84e8dc58b
patch 9.1.0149: null pointer member access when accessing 'winfixbuf' property
Christian Brabandt <cb@256bit.org>
parents:
34470
diff
changeset
|
3328 func Test_quickfix_switchbuf_invalid_prevwin() |
2cf84e8dc58b
patch 9.1.0149: null pointer member access when accessing 'winfixbuf' property
Christian Brabandt <cb@256bit.org>
parents:
34470
diff
changeset
|
3329 call s:reset_all_buffers() |
2cf84e8dc58b
patch 9.1.0149: null pointer member access when accessing 'winfixbuf' property
Christian Brabandt <cb@256bit.org>
parents:
34470
diff
changeset
|
3330 |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3331 call s:make_simple_quickfix() |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3332 call assert_equal(1, getqflist(#{idx: 0}).idx) |
34479
2cf84e8dc58b
patch 9.1.0149: null pointer member access when accessing 'winfixbuf' property
Christian Brabandt <cb@256bit.org>
parents:
34470
diff
changeset
|
3333 |
2cf84e8dc58b
patch 9.1.0149: null pointer member access when accessing 'winfixbuf' property
Christian Brabandt <cb@256bit.org>
parents:
34470
diff
changeset
|
3334 set switchbuf=uselast |
2cf84e8dc58b
patch 9.1.0149: null pointer member access when accessing 'winfixbuf' property
Christian Brabandt <cb@256bit.org>
parents:
34470
diff
changeset
|
3335 split |
2cf84e8dc58b
patch 9.1.0149: null pointer member access when accessing 'winfixbuf' property
Christian Brabandt <cb@256bit.org>
parents:
34470
diff
changeset
|
3336 copen |
2cf84e8dc58b
patch 9.1.0149: null pointer member access when accessing 'winfixbuf' property
Christian Brabandt <cb@256bit.org>
parents:
34470
diff
changeset
|
3337 execute winnr('#') 'quit' |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3338 call assert_equal(2, winnr('$')) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3339 |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3340 cnext " Would've triggered a null pointer member access |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3341 call assert_equal(2, getqflist(#{idx: 0}).idx) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3342 |
34479
2cf84e8dc58b
patch 9.1.0149: null pointer member access when accessing 'winfixbuf' property
Christian Brabandt <cb@256bit.org>
parents:
34470
diff
changeset
|
3343 set switchbuf& |
2cf84e8dc58b
patch 9.1.0149: null pointer member access when accessing 'winfixbuf' property
Christian Brabandt <cb@256bit.org>
parents:
34470
diff
changeset
|
3344 endfunc |
2cf84e8dc58b
patch 9.1.0149: null pointer member access when accessing 'winfixbuf' property
Christian Brabandt <cb@256bit.org>
parents:
34470
diff
changeset
|
3345 |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3346 func Test_listdo_goto_prevwin() |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3347 call s:reset_all_buffers() |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3348 call s:make_buffers_list() |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3349 |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3350 new |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3351 call assert_equal(0, &winfixbuf) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3352 wincmd p |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3353 call assert_equal(1, &winfixbuf) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3354 call assert_notequal(bufnr(), bufnr('#')) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3355 |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3356 augroup ListDoGotoPrevwin |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3357 au! |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3358 au BufLeave * let s:triggered = 1 |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3359 \| call assert_equal(bufnr(), winbufnr(winnr())) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3360 augroup END |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3361 " Should correctly switch to the window without 'winfixbuf', and curbuf should |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3362 " be consistent with curwin->w_buffer for autocommands. |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3363 bufdo " |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3364 call assert_equal(0, &winfixbuf) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3365 call assert_equal(1, s:triggered) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3366 unlet! s:triggered |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3367 au! ListDoGotoPrevwin |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3368 |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3369 set winfixbuf |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3370 wincmd p |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3371 call assert_equal(2, winnr('$')) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3372 " Both curwin and prevwin have 'winfixbuf' set, so should split a new window |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3373 " without it set. |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3374 bufdo " |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3375 call assert_equal(0, &winfixbuf) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3376 call assert_equal(3, winnr('$')) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3377 |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3378 quit |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3379 call assert_equal(2, winnr('$')) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3380 call assert_equal(1, &winfixbuf) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3381 augroup ListDoGotoPrevwin |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3382 au! |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3383 au WinEnter * ++once set winfixbuf |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3384 augroup END |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3385 " Same as before, but naughty autocommands set 'winfixbuf' for the new window. |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3386 " :bufdo should give up in this case. |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3387 call assert_fails('bufdo "', 'E1513:') |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3388 |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3389 au! ListDoGotoPrevwin |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3390 augroup! ListDoGotoPrevwin |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3391 endfunc |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3392 |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3393 func Test_quickfix_changed_split_failed() |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3394 call s:reset_all_buffers() |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3395 |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3396 call s:make_simple_quickfix() |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3397 call assert_equal(1, winnr('$')) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3398 |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3399 " Quickfix code will open a split in an attempt to get a 'nowinfixbuf' window |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3400 " to switch buffers in. Interfere with things by setting 'winfixbuf' in it. |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3401 augroup QfChanged |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3402 au! |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3403 au WinEnter * ++once call assert_equal(2, winnr('$')) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3404 \| set winfixbuf | call setqflist([], 'f') |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3405 augroup END |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3406 call assert_fails('cnext', ['E1513:', 'E925:']) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3407 " Check that the split was automatically closed. |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3408 call assert_equal(1, winnr('$')) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3409 |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3410 au! QfChanged |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3411 augroup! QfChanged |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3412 endfunc |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3413 |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
3414 func Test_bufdo_cnext_splitwin_fails() |
34489
4dd6d243e4f7
patch 9.1.0152: Coverity complains about ignoring return value
Christian Brabandt <cb@256bit.org>
parents:
34485
diff
changeset
|
3415 call s:reset_all_buffers() |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
3416 call s:make_simple_quickfix() |
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
3417 call assert_equal(1, getqflist(#{idx: 0}).idx) |
34489
4dd6d243e4f7
patch 9.1.0152: Coverity complains about ignoring return value
Christian Brabandt <cb@256bit.org>
parents:
34485
diff
changeset
|
3418 " Make sure there is not enough room to |
4dd6d243e4f7
patch 9.1.0152: Coverity complains about ignoring return value
Christian Brabandt <cb@256bit.org>
parents:
34485
diff
changeset
|
3419 " split the winfixedbuf window |
4dd6d243e4f7
patch 9.1.0152: Coverity complains about ignoring return value
Christian Brabandt <cb@256bit.org>
parents:
34485
diff
changeset
|
3420 let &winheight=&lines |
4dd6d243e4f7
patch 9.1.0152: Coverity complains about ignoring return value
Christian Brabandt <cb@256bit.org>
parents:
34485
diff
changeset
|
3421 let &winminheight=&lines-2 |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
3422 " Still want E1513, or it may not be clear why a split was attempted and why |
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
3423 " it failing caused the commands to abort. |
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
3424 call assert_fails(':bufdo echo 1', ['E36:', 'E1513:']) |
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
3425 call assert_fails(':cnext', ['E36:', 'E1513:']) |
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
3426 " Ensure the entry didn't change. |
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
3427 call assert_equal(1, getqflist(#{idx: 0}).idx) |
34489
4dd6d243e4f7
patch 9.1.0152: Coverity complains about ignoring return value
Christian Brabandt <cb@256bit.org>
parents:
34485
diff
changeset
|
3428 set winminheight&vim winheight&vim |
4dd6d243e4f7
patch 9.1.0152: Coverity complains about ignoring return value
Christian Brabandt <cb@256bit.org>
parents:
34485
diff
changeset
|
3429 endfunc |
4dd6d243e4f7
patch 9.1.0152: Coverity complains about ignoring return value
Christian Brabandt <cb@256bit.org>
parents:
34485
diff
changeset
|
3430 |
34667
968626cf50fa
patch 9.1.0216: Error on exit with EXITFREE and 'winfixbuf'
Christian Brabandt <cb@256bit.org>
parents:
34658
diff
changeset
|
3431 " Test that exiting with 'winfixbuf' and EXITFREE doesn't cause an error. |
968626cf50fa
patch 9.1.0216: Error on exit with EXITFREE and 'winfixbuf'
Christian Brabandt <cb@256bit.org>
parents:
34658
diff
changeset
|
3432 func Test_exitfree_no_error() |
968626cf50fa
patch 9.1.0216: Error on exit with EXITFREE and 'winfixbuf'
Christian Brabandt <cb@256bit.org>
parents:
34658
diff
changeset
|
3433 let lines =<< trim END |
968626cf50fa
patch 9.1.0216: Error on exit with EXITFREE and 'winfixbuf'
Christian Brabandt <cb@256bit.org>
parents:
34658
diff
changeset
|
3434 set winfixbuf |
968626cf50fa
patch 9.1.0216: Error on exit with EXITFREE and 'winfixbuf'
Christian Brabandt <cb@256bit.org>
parents:
34658
diff
changeset
|
3435 qall! |
968626cf50fa
patch 9.1.0216: Error on exit with EXITFREE and 'winfixbuf'
Christian Brabandt <cb@256bit.org>
parents:
34658
diff
changeset
|
3436 END |
968626cf50fa
patch 9.1.0216: Error on exit with EXITFREE and 'winfixbuf'
Christian Brabandt <cb@256bit.org>
parents:
34658
diff
changeset
|
3437 call writefile(lines, 'Xwfb_exitfree', 'D') |
968626cf50fa
patch 9.1.0216: Error on exit with EXITFREE and 'winfixbuf'
Christian Brabandt <cb@256bit.org>
parents:
34658
diff
changeset
|
3438 call assert_notmatch('E1513:', |
968626cf50fa
patch 9.1.0216: Error on exit with EXITFREE and 'winfixbuf'
Christian Brabandt <cb@256bit.org>
parents:
34658
diff
changeset
|
3439 \ system(GetVimCommandClean() .. ' -X -S Xwfb_exitfree')) |
968626cf50fa
patch 9.1.0216: Error on exit with EXITFREE and 'winfixbuf'
Christian Brabandt <cb@256bit.org>
parents:
34658
diff
changeset
|
3440 endfunc |
968626cf50fa
patch 9.1.0216: Error on exit with EXITFREE and 'winfixbuf'
Christian Brabandt <cb@256bit.org>
parents:
34658
diff
changeset
|
3441 |
34479
2cf84e8dc58b
patch 9.1.0149: null pointer member access when accessing 'winfixbuf' property
Christian Brabandt <cb@256bit.org>
parents:
34470
diff
changeset
|
3442 " vim: shiftwidth=2 sts=2 expandtab |