Mercurial > vim
annotate src/testdir/test_winfixbuf.vim @ 36187:af8a1a6a7276 draft default tip
runtime(doc): fix typo in :h dos-colors
Commit: https://github.com/vim/vim/commit/ac8a10ab7672aa5fd359f76d34d8b0187728b92d
Author: Christian Brabandt <cb@256bit.org>
Date: Tue Sep 24 16:35:57 2024 +0200
runtime(doc): fix typo in :h dos-colors
related: https://github.com/vim/vim/issues/15723
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 24 Sep 2024 16:45:07 +0200 |
parents | 814fcbca4d8d |
children |
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([]) |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
203 call setloclist(0, [], 'f') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
204 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
205 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
|
206 endfunc |
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 " 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
|
209 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
|
210 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
|
211 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
|
212 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
|
213 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
|
214 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
215 return |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
216 endif |
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 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
|
219 endfor |
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 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
|
222 endfunc |
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 " 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
|
225 func Test_Next() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
226 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
|
227 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
228 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
|
229 next! |
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 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
|
232 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
|
233 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
234 Next! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
235 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
|
236 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
237 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
238 " 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
|
239 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
|
240 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
|
241 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
242 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
|
243 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
244 " 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
|
245 " 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
|
246 " 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
|
247 " |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
248 " +-------------------+ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
249 " | 'nowinfixbuf' | |
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 " | '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
|
252 " +-------------------+ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
253 split |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
254 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
|
255 " 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
|
256 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
|
257 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
|
258 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
|
259 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
260 argdo echo '' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
261 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
|
262 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
|
263 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
|
264 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
265 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
266 " 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
|
267 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
|
268 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
|
269 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
270 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
|
271 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
|
272 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
|
273 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
274 argdo echo '' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
275 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
|
276 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
|
277 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
|
278 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
|
279 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
|
280 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
281 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
282 " 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
|
283 func Test_argedit() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
284 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
|
285 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
286 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
|
287 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
288 file first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
289 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
|
290 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
291 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
292 file middle |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
293 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
|
294 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
295 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
296 file last |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
297 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
|
298 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
299 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
300 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
301 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
|
302 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
|
303 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
|
304 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
305 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
|
306 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
|
307 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
308 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
309 " 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
|
310 func Test_arglocal() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
311 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
|
312 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
313 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
|
314 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
|
315 argglobal! other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
316 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
|
317 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
318 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
|
319 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
|
320 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
321 arglocal! other |
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:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
323 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
324 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
325 " 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
|
326 func Test_argglobal() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
327 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
|
328 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
329 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
|
330 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
|
331 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
332 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
|
333 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
|
334 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
335 argglobal! other |
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:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
337 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
338 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
339 " 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
|
340 func Test_args() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
341 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
|
342 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
343 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
|
344 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
|
345 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
346 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
|
347 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
|
348 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
349 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
|
350 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
|
351 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
352 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
353 " 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
|
354 func Test_bNext() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
355 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
|
356 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
357 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
|
358 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
|
359 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
|
360 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
361 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
|
362 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
363 bNext! |
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:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
365 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
366 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
367 " 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
|
368 func Test_badd() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
369 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
|
370 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
371 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
|
372 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
|
373 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
374 badd other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
375 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
|
376 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
377 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
378 " 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
|
379 func Test_balt() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
380 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
|
381 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
382 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
|
383 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
|
384 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
385 balt other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
386 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
|
387 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
388 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
389 " 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
|
390 func Test_bfirst() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
391 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
|
392 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
393 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
|
394 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
|
395 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
396 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
|
397 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
|
398 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
399 bfirst! |
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:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
401 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
402 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
403 " 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
|
404 func Test_blast() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
405 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
|
406 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
407 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
|
408 bfirst! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
409 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
|
410 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
411 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
|
412 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
|
413 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
414 blast! |
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:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
416 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
417 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
418 " 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
|
419 func Test_bmodified() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
420 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
|
421 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
422 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
|
423 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
|
424 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
425 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
|
426 set modified |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
427 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
|
428 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
429 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
|
430 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
|
431 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
432 bmodified! |
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:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
434 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
435 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
436 " 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
|
437 func Test_bnext() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
438 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
|
439 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
440 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
|
441 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
|
442 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
443 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
|
444 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
|
445 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
446 bnext! |
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:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
448 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
449 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
450 " 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
|
451 func Test_bprevious() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
452 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
|
453 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
454 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
|
455 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
|
456 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
457 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
|
458 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
|
459 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
460 bprevious! |
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:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
462 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
463 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
464 " 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
|
465 func Test_brewind() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
466 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
|
467 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
468 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
|
469 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
|
470 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
471 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
|
472 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
|
473 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
474 brewind! |
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:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
476 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
477 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
478 " 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
|
479 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
|
480 " 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
|
481 CheckNotGui |
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
482 |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
483 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
|
484 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
485 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
|
486 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
|
487 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
488 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
|
489 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
|
490 |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
491 try |
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
492 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
|
493 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
|
494 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
|
495 " 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
|
496 " 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
|
497 endtry |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
498 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
499 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
500 " 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
|
501 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
|
502 " 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
|
503 CheckNotGui |
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
504 |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
505 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
|
506 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
507 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
|
508 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
|
509 |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
510 try |
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
511 browse write other |
34554
495218030237
patch 9.1.0178: E1513 might be confusing
Christian Brabandt <cb@256bit.org>
parents:
34500
diff
changeset
|
512 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
|
513 " 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
|
514 " 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
|
515 endtry |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
516 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
517 call delete("other") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
518 endfunc |
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 :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
|
521 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
|
522 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
|
523 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
524 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
|
525 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
526 " 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
|
527 " 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
|
528 " 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
|
529 " |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
530 " +-------------------+ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
531 " | 'nowinfixbuf' | |
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 " | '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
|
534 " +-------------------+ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
535 split |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
536 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
|
537 " 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
|
538 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
|
539 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
|
540 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
541 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
|
542 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
|
543 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
544 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
|
545 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
546 bufdo echo '' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
547 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
|
548 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
|
549 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
|
550 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
551 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
552 " 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
|
553 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
|
554 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
|
555 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
556 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
|
557 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
|
558 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
|
559 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
|
560 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
561 bufdo echo '' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
562 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
|
563 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
|
564 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
|
565 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
|
566 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
|
567 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
568 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
569 " 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
|
570 func Test_buffer() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
571 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
|
572 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
573 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
|
574 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
|
575 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
576 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
|
577 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
|
578 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
579 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
|
580 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
|
581 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
582 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
583 " 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
|
584 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
|
585 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
|
586 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
587 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
|
588 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
|
589 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
590 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
|
591 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
|
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 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
596 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
597 " 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
|
598 func Test_cNext() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
599 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
600 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
|
601 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
602 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
|
603 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
604 " 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
|
605 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
|
606 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
607 " 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
|
608 " "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
|
609 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
|
610 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
|
611 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
612 cNext |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
613 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
|
614 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
615 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
616 " 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
|
617 func Test_cNfile() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
618 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
619 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
|
620 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
621 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
|
622 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
623 " 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
|
624 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
|
625 cnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
626 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
627 " 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
|
628 " "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
|
629 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
|
630 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
|
631 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
632 cNfile |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
633 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
|
634 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
635 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
636 " 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
|
637 func Test_caddexpr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
638 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
639 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
|
640 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
641 let l:file_path = tempname() |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
642 call writefile(["Error - bad-thing-found"], l:file_path, 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
643 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
|
644 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
|
645 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
|
646 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
647 edit first.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
648 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
|
649 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
650 edit! other.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
651 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
652 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
653 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
654 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
|
655 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
656 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
|
657 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
|
658 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
659 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
660 " 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
|
661 func Test_cbuffer() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
662 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
663 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
|
664 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
665 let l:file_path = tempname() |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
666 call writefile(["first.unittest:1:Error - bad-thing-found"], l:file_path, 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
667 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
|
668 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
|
669 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
|
670 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
671 edit first.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
672 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
|
673 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
674 edit! other.unittest |
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 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
677 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
678 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
|
679 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
680 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
|
681 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
|
682 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
683 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
|
684 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
|
685 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
686 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
687 " 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
|
688 func Test_cc() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
689 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
690 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
|
691 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
692 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
|
693 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
694 " 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
|
695 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
|
696 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
697 " 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
|
698 " "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
|
699 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
|
700 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
|
701 " 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
|
702 " 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
|
703 normal k |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
704 " 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
|
705 " 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
|
706 .cc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
707 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
708 " 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
|
709 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
|
710 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
711 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
712 " 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
|
713 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
|
714 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
715 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
|
716 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
717 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
|
718 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
|
719 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
720 " 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
|
721 " 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
|
722 " 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
|
723 " |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
724 " +-------------------+ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
725 " | 'nowinfixbuf' | |
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 " | '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
|
728 " +-------------------+ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
729 split |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
730 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
|
731 " 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
|
732 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
|
733 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
|
734 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
|
735 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
736 cdo echo '' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
737 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
738 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
|
739 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
|
740 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
|
741 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
|
742 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
|
743 endfunc |
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 :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
|
746 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
|
747 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
748 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
|
749 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
750 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
|
751 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
|
752 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
753 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
|
754 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
|
755 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
756 cdo echo '' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
757 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
|
758 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
|
759 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
|
760 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
|
761 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
|
762 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
763 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
764 " 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
|
765 func Test_cexpr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
766 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
767 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
|
768 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
769 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
|
770 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
|
771 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
|
772 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
773 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
774 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
775 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
|
776 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
|
777 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
778 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
|
779 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
|
780 endfunc |
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 :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
|
783 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
|
784 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
785 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
|
786 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
787 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
|
788 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
|
789 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
790 " 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
|
791 " 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
|
792 " 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
|
793 " |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
794 " +-------------------+ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
795 " | 'nowinfixbuf' | |
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 " | '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
|
798 " +-------------------+ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
799 split |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
800 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
|
801 " 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
|
802 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
|
803 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
|
804 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
|
805 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
806 cfdo echo '' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
807 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
808 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
|
809 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
|
810 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
|
811 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
|
812 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
|
813 endfunc |
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 :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
|
816 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
|
817 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
818 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
|
819 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
820 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
|
821 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
|
822 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
823 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
|
824 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
|
825 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
826 cfdo echo '' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
827 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
|
828 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
|
829 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
|
830 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
|
831 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
|
832 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
833 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
834 " 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
|
835 func Test_cfile() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
836 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
837 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
|
838 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
839 edit first.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
840 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
|
841 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
842 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
|
843 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
844 edit! second.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
845 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
|
846 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
847 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
848 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
|
849 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
|
850 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
851 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
|
852 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
853 set winfixbuf |
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 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
|
856 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
|
857 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
858 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
|
859 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
|
860 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
861 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
|
862 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
|
863 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
|
864 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
865 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
866 " 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
|
867 func Test_cfirst() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
868 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
869 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
|
870 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
871 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
|
872 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
873 " 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
|
874 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
|
875 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
876 " 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
|
877 " "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
|
878 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
|
879 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
|
880 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
881 cfirst |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
882 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
|
883 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
884 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
885 " 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
|
886 func Test_clast() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
887 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
888 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
|
889 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
890 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
|
891 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
892 " 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
|
893 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
|
894 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
895 " 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
|
896 " "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
|
897 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
|
898 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
|
899 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
900 clast |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
901 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
|
902 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
903 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
904 " 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
|
905 " 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
|
906 func Test_cnext() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
907 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
908 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
|
909 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
910 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
|
911 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
|
912 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
913 " 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
|
914 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
|
915 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
916 cnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
917 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
|
918 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
919 " 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
|
920 " "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
|
921 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
|
922 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
|
923 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
924 cnext |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
925 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
|
926 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
|
927 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
928 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
929 " 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
|
930 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
|
931 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
932 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
|
933 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
934 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
|
935 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
|
936 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
937 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
|
938 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
939 " 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
|
940 copen |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
941 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
942 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
|
943 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
944 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
945 " 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
|
946 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
|
947 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
948 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
|
949 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
950 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
|
951 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
|
952 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
953 cfirst! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
954 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
955 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
|
956 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
|
957 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
958 cnext |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
959 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
|
960 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
961 cnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
962 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
|
963 endfunc |
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 " 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
|
966 func Test_cprevious() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
967 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
968 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
|
969 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
970 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
|
971 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
972 " 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
|
973 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
|
974 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
975 " 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
|
976 " "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
|
977 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
|
978 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
|
979 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
980 cprevious |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
981 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
|
982 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
983 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
984 " 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
|
985 func Test_cnfile() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
986 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
987 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
|
988 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
989 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
|
990 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
991 " 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
|
992 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
|
993 cnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
994 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
995 " 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
|
996 " "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
|
997 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
|
998 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
|
999 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1000 cnfile |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1001 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
|
1002 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1003 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1004 " 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
|
1005 func Test_cpfile() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1006 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1007 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
|
1008 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1009 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
|
1010 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1011 " 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
|
1012 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
|
1013 cnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1014 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1015 " 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
|
1016 " "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
|
1017 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
|
1018 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
|
1019 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1020 cpfile |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1021 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
|
1022 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1023 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1024 " 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
|
1025 func Test_crewind() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1026 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1027 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
|
1028 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1029 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
|
1030 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1031 " 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
|
1032 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
|
1033 cnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1034 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1035 " 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
|
1036 " "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
|
1037 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
|
1038 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
|
1039 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1040 crewind |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1041 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
|
1042 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1043 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1044 " 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
|
1045 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
|
1046 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
|
1047 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1048 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1049 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
|
1050 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
|
1051 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
|
1052 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1053 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1054 file other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1055 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
|
1056 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1057 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1058 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1059 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
|
1060 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
|
1061 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
|
1062 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1063 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
|
1064 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1065 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
|
1066 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1067 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1068 " 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
|
1069 func Test_djump() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1070 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
|
1071 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1072 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
|
1073 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
|
1074 \ '#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
|
1075 \ ], |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1076 \ "main.c") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1077 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
|
1078 edit main.c |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1079 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1080 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1081 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1082 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
|
1083 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1084 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
|
1085 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
|
1086 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1087 djump! 1 /min/ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1088 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
|
1089 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1090 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
|
1091 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
|
1092 endfunc |
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 " 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
|
1095 func Test_drop() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1096 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
|
1097 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1098 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
|
1099 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
|
1100 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1101 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
|
1102 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
|
1103 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1104 drop! other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1105 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
|
1106 endfunc |
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 " 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
|
1109 func Test_edit() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1110 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
|
1111 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1112 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
|
1113 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
|
1114 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1115 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
|
1116 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
|
1117 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1118 edit! other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1119 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
|
1120 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1121 |
34647
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1122 " 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
|
1123 " |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1124 " 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
|
1125 " |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1126 " 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
|
1127 " 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
|
1128 " 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
|
1129 " |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1130 " 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
|
1131 " 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
|
1132 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
|
1133 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
|
1134 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1135 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
|
1136 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
|
1137 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
|
1138 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
|
1139 write! |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1140 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1141 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
|
1142 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1143 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
|
1144 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
|
1145 endif |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1146 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1147 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
|
1148 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
|
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 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
|
1151 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1152 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
|
1153 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
|
1154 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
|
1155 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
|
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 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
|
1158 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
|
1159 endfunc |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1160 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1161 " 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
|
1162 " |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1163 " 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
|
1164 " |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1165 " 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
|
1166 " 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
|
1167 " 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
|
1168 " |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1169 " 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
|
1170 " 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
|
1171 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
|
1172 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
|
1173 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1174 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
|
1175 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
|
1176 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
|
1177 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
|
1178 write! |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1179 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1180 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
|
1181 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1182 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
|
1183 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
|
1184 endif |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1185 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1186 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
|
1187 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
|
1188 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
|
1189 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
|
1190 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
|
1191 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1192 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
|
1193 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1194 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
|
1195 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
|
1196 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
|
1197 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
|
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 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
|
1200 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
|
1201 endfunc |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1202 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1203 " 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
|
1204 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
|
1205 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
|
1206 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1207 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
|
1208 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
|
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 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
|
1211 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
|
1212 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1213 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
|
1214 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
|
1215 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
|
1216 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
|
1217 endfunc |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1218 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1219 " 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
|
1220 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
|
1221 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
|
1222 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1223 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
|
1224 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
|
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 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
|
1227 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
|
1228 edit |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1229 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
|
1230 endfunc |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1231 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1232 " 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
|
1233 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
|
1234 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
|
1235 |
34656
3b29a2cdbf74
patch 9.1.0212: CI: MS-Windows fails in test_winfixbuf
Christian Brabandt <cb@256bit.org>
parents:
34647
diff
changeset
|
1236 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
|
1237 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
|
1238 |
34656
3b29a2cdbf74
patch 9.1.0212: CI: MS-Windows fails in test_winfixbuf
Christian Brabandt <cb@256bit.org>
parents:
34647
diff
changeset
|
1239 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
|
1240 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
|
1241 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
|
1242 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
|
1243 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
|
1244 endfunc |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1245 |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1246 " 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
|
1247 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
|
1248 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
|
1249 |
34656
3b29a2cdbf74
patch 9.1.0212: CI: MS-Windows fails in test_winfixbuf
Christian Brabandt <cb@256bit.org>
parents:
34647
diff
changeset
|
1250 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
|
1251 " 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
|
1252 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
|
1253 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
|
1254 let current = bufnr() |
3b29a2cdbf74
patch 9.1.0212: CI: MS-Windows fails in test_winfixbuf
Christian Brabandt <cb@256bit.org>
parents:
34647
diff
changeset
|
1255 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
|
1256 write! |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1257 |
34656
3b29a2cdbf74
patch 9.1.0212: CI: MS-Windows fails in test_winfixbuf
Christian Brabandt <cb@256bit.org>
parents:
34647
diff
changeset
|
1258 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
|
1259 set winfixbuf |
34656
3b29a2cdbf74
patch 9.1.0212: CI: MS-Windows fails in test_winfixbuf
Christian Brabandt <cb@256bit.org>
parents:
34647
diff
changeset
|
1260 execute "edit " file |
3b29a2cdbf74
patch 9.1.0212: CI: MS-Windows fails in test_winfixbuf
Christian Brabandt <cb@256bit.org>
parents:
34647
diff
changeset
|
1261 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
|
1262 |
3b29a2cdbf74
patch 9.1.0212: CI: MS-Windows fails in test_winfixbuf
Christian Brabandt <cb@256bit.org>
parents:
34647
diff
changeset
|
1263 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
|
1264 endfunc |
6b2efa2b2386
patch 9.1.0208: winfixbuf does not allow to re-edit current buffer
Christian Brabandt <cb@256bit.org>
parents:
34554
diff
changeset
|
1265 |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1266 " 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
|
1267 func Test_enew() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1268 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
|
1269 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1270 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
|
1271 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
|
1272 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1273 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
|
1274 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
|
1275 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1276 enew! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1277 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
|
1278 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
|
1279 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1280 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1281 " 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
|
1282 func Test_ex() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1283 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
|
1284 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1285 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
|
1286 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
|
1287 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1288 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
|
1289 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
|
1290 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1291 ex! other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1292 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
|
1293 endfunc |
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 " 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
|
1296 func Test_find() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1297 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
|
1298 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1299 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
|
1300 let l:file = tempname() |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
1301 call writefile([], l:file, 'D') |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
1302 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
|
1303 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
|
1304 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
|
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:original_path = &path |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1307 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
|
1308 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1309 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1310 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1311 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
|
1312 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
|
1313 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1314 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
|
1315 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
|
1316 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1317 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
|
1318 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1319 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1320 " 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
|
1321 func Test_first() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1322 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
|
1323 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1324 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
|
1325 next! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1326 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1327 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
|
1328 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
|
1329 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1330 first! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1331 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
|
1332 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1333 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1334 " 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
|
1335 func Test_grep() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1336 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1337 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
|
1338 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1339 edit first.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1340 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
|
1341 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1342 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
|
1343 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1344 edit current.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1345 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
|
1346 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1347 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
|
1348 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1349 edit! last.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1350 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
|
1351 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1352 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
|
1353 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1354 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1355 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1356 buffer! current.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1357 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1358 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
|
1359 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
|
1360 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
|
1361 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1362 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
|
1363 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
|
1364 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1365 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
|
1366 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
|
1367 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
|
1368 endfunc |
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 " 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
|
1371 func Test_ijump() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1372 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
|
1373 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1374 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
|
1375 call writefile([ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1376 \ '#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
|
1377 \ ], |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
1378 \ "main.c", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
1379 call writefile(["#define min(X, Y) ((X) < (Y) ? (X) : (Y))"], l:include_file, 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1380 edit main.c |
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 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1383 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1384 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
|
1385 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1386 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
|
1387 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
|
1388 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
|
1389 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1390 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
|
1391 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
|
1392 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1393 set nowinfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1394 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1395 ijump! /min/ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1396 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
|
1397 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1398 set define& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1399 set include& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1400 set path& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1401 endfunc |
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 " 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
|
1404 func Test_lNext() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1405 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1406 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
|
1407 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1408 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
|
1409 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
|
1410 |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1411 lnext! |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1412 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
|
1413 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
|
1414 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1415 call assert_fails("lNext", "E1513:") |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1416 " Ensure the entry didn't change. |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1417 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
|
1418 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
|
1419 |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1420 lnext! |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1421 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
|
1422 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
|
1423 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1424 lNext! |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1425 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
|
1426 call assert_equal(l:middle, bufnr()) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1427 |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1428 lNext! |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1429 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
|
1430 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
|
1431 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1432 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1433 " 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
|
1434 func Test_lNfile() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1435 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1436 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
|
1437 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1438 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
|
1439 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
|
1440 |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1441 lnext! |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1442 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
|
1443 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
|
1444 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1445 call assert_fails("lNfile", "E1513:") |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1446 " Ensure the entry didn't change. |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1447 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
|
1448 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
|
1449 |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1450 lnext! |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1451 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
|
1452 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
|
1453 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1454 lNfile! |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1455 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
|
1456 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
|
1457 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1458 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1459 " 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
|
1460 func Test_laddexpr() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1461 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1462 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
|
1463 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1464 let l:file_path = tempname() |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
1465 call writefile(["Error - bad-thing-found"], l:file_path, 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1466 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
|
1467 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
|
1468 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
|
1469 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1470 edit first.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1471 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
|
1472 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1473 edit! other.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1474 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1475 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1476 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1477 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
|
1478 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1479 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
|
1480 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
|
1481 endfunc |
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 " 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
|
1484 func Test_last() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1485 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
|
1486 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1487 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
|
1488 next! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1489 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1490 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
|
1491 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
|
1492 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1493 last! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1494 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
|
1495 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1496 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1497 " 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
|
1498 func Test_lbuffer() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1499 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1500 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
|
1501 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1502 let l:file_path = tempname() |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
1503 call writefile(["first.unittest:1:Error - bad-thing-found"], l:file_path, 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1504 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
|
1505 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
|
1506 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
|
1507 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1508 edit first.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1509 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
|
1510 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1511 edit! other.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1512 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1513 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1514 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1515 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
|
1516 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1517 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
|
1518 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
|
1519 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1520 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
|
1521 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
|
1522 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1523 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1524 " 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
|
1525 func Test_ldo() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1526 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1527 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
|
1528 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1529 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
|
1530 lnext! |
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 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
|
1533 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
|
1534 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
|
1535 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
|
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 :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
|
1539 func Test_lexpr() |
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:file = tempname() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1544 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
|
1545 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
|
1546 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1547 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1548 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1549 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
|
1550 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
|
1551 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1552 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
|
1553 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
|
1554 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1555 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1556 " 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
|
1557 func Test_lfdo() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1558 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1559 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
|
1560 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1561 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
|
1562 lnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1563 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1564 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
|
1565 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
|
1566 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
|
1567 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
|
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 :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
|
1571 func Test_lfile() |
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 edit first.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1576 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
|
1577 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1578 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
|
1579 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1580 edit! second.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1581 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
|
1582 write |
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 let l:file = tempname() |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
1585 call writefile(["first.unittest:1:Error - bad-thing-found was detected"], l:file, 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1586 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1587 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
|
1588 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1589 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1590 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1591 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
|
1592 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
|
1593 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1594 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
|
1595 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
|
1596 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1597 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
|
1598 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
|
1599 endfunc |
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 " 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
|
1602 func Test_ll() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1603 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1604 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
|
1605 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1606 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
|
1607 lopen |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1608 lfirst! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1609 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
|
1610 normal j |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1611 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1612 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
|
1613 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
|
1614 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
|
1615 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
|
1616 .ll! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1617 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
|
1618 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
|
1619 endfunc |
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 " 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
|
1622 func Test_llast() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1623 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1624 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
|
1625 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1626 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
|
1627 lfirst! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1628 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1629 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
|
1630 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
|
1631 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1632 llast! |
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:last, 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 :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
|
1637 func Test_lnext() |
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: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
|
1642 ll! |
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("lnext", "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 lnext! |
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:middle, 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 :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
|
1652 func Test_lnfile() |
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: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
|
1657 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
|
1658 |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1659 lnext! |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1660 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
|
1661 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
|
1662 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1663 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
|
1664 " 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
|
1665 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
|
1666 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
|
1667 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1668 lnfile! |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1669 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
|
1670 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
|
1671 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1672 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1673 " 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
|
1674 func Test_lpfile() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1675 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1676 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
|
1677 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1678 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
|
1679 lnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1680 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1681 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
|
1682 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
|
1683 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1684 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
|
1685 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1686 lpfile! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1687 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
|
1688 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1689 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1690 " 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
|
1691 func Test_lprevious() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1692 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1693 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
|
1694 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1695 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
|
1696 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
|
1697 |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1698 lnext! |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1699 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
|
1700 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
|
1701 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1702 call assert_fails("lprevious", "E1513:") |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1703 " Ensure the entry didn't change. |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1704 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
|
1705 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
|
1706 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1707 lprevious! |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
1708 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
|
1709 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
|
1710 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1711 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1712 " 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
|
1713 func Test_lrewind() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1714 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1715 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
|
1716 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1717 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
|
1718 lnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1719 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1720 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
|
1721 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
|
1722 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1723 lrewind! |
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 :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
|
1728 func Test_ltag() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1729 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
|
1730 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1731 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1732 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
|
1733 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1734 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1735 \ "two\tXfile\t2"], |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
1736 \ "Xtags", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
1737 call writefile(["one", "two", "three"], "Xfile", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
1738 call writefile(["one"], "Xother", 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1739 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1740 execute "normal \<C-]>" |
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 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1743 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1744 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
|
1745 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1746 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
|
1747 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1748 ltag! one |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1749 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1750 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1751 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1752 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1753 " 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
|
1754 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
|
1755 CheckFeature lua |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1756 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
|
1757 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1758 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1759 file first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1760 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
|
1761 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1762 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1763 file second |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1764 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
|
1765 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1766 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1767 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1768 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
|
1769 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
|
1770 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1771 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
|
1772 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
|
1773 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1774 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1775 " 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
|
1776 func Test_lvimgrep() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1777 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1778 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
|
1779 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1780 edit first.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1781 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
|
1782 write |
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 edit winfix.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1785 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
|
1786 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1787 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
|
1788 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1789 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1790 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1791 edit! last.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1792 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
|
1793 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1794 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
|
1795 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1796 buffer! winfix.unittest |
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 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
|
1799 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
|
1800 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1801 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
|
1802 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
|
1803 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1804 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
|
1805 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
|
1806 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
|
1807 endfunc |
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 " 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
|
1810 func Test_lvimgrepadd() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1811 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1812 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
|
1813 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1814 edit first.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1815 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
|
1816 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1817 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1818 edit winfix.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1819 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
|
1820 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1821 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
|
1822 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1823 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1824 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1825 edit! last.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1826 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
|
1827 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1828 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
|
1829 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1830 buffer! winfix.unittest |
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 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
|
1833 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
|
1834 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1835 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
|
1836 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
|
1837 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1838 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
|
1839 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
|
1840 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
|
1841 endfunc |
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 " 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
|
1844 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
|
1845 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
|
1846 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1847 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
|
1848 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
|
1849 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
|
1850 normal mA |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1851 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
|
1852 normal mB |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1853 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1854 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
|
1855 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
|
1856 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1857 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
|
1858 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
|
1859 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1860 set nowinfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1861 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1862 normal `A |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1863 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
|
1864 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1865 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1866 " 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
|
1867 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
|
1868 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
|
1869 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1870 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
|
1871 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
|
1872 normal mA |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1873 normal j |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1874 normal mB |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1875 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1876 set winfixbuf |
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 normal `A |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1879 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
|
1880 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1881 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1882 " 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
|
1883 func Test_next() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1884 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
|
1885 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1886 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
|
1887 first! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1888 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1889 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
|
1890 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
|
1891 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1892 next! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1893 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
|
1894 endfunc |
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 " 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
|
1897 func Test_mksession() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1898 CheckFeature mksession |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1899 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
|
1900 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1901 set sessionoptions+=options |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1902 set winfixbuf |
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 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
|
1905 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1906 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
|
1907 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
|
1908 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
|
1909 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1910 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
|
1911 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1912 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
|
1913 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
|
1914 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1915 set sessionoptions& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1916 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
|
1917 endfunc |
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 " 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
|
1920 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
|
1921 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
|
1922 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1923 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1924 file foo |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1925 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1926 file bar |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1927 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1928 file fizz |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1929 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1930 file buzz |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1931 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
|
1932 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1933 edit foo |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1934 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1935 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
|
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 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
|
1938 next |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1939 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
|
1940 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1941 " 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
|
1942 " 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
|
1943 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
|
1944 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
|
1945 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1946 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1947 " 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
|
1948 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
|
1949 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
|
1950 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1951 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1952 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
|
1953 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1954 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1955 \ "two\tXfile\t2"], |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
1956 \ "Xtags", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
1957 call writefile(["one", "two", "three"], "Xfile", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
1958 call writefile(["one"], "Xother", 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1959 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1960 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1961 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1962 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1963 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
|
1964 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1965 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
|
1966 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
|
1967 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1968 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1969 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1970 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1971 " 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
|
1972 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
|
1973 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
|
1974 set mouse=n |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1975 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1976 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1977 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
|
1978 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1979 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1980 \ "two\tXfile\t2"], |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
1981 \ "Xtags", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
1982 call writefile(["one", "two", "three"], "Xfile", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
1983 call writefile(["one"], "Xother", 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1984 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1985 execute "normal \<C-]>" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1986 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1987 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1988 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1989 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
|
1990 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1991 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
|
1992 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
|
1993 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1994 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1995 set mouse& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1996 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1997 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1998 " 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
|
1999 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
|
2000 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
|
2001 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2002 set tags=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(["!_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
|
2004 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2005 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2006 \ "two\tXfile\t2"], |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2007 \ "Xtags", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2008 call writefile(["one", "two", "three"], "Xfile", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2009 call writefile(["one"], "Xother", 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2010 edit Xother |
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 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2013 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2014 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
|
2015 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2016 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
|
2017 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
|
2018 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2019 set tags& |
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 <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
|
2023 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
|
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 set mouse=n |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2026 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2027 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2028 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
|
2029 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2030 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2031 \ "two\tXfile\t2"], |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2032 \ "Xtags", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2033 call writefile(["one", "two", "three"], "Xfile", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2034 call writefile(["one"], "Xother", 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2035 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2036 execute "normal \<C-]>" |
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 set winfixbuf |
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 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
|
2041 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2042 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
|
2043 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
|
2044 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2045 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2046 set mouse& |
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-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
|
2050 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
|
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 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2053 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2054 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
|
2055 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2056 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2057 \ "two\tXfile\t2"], |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2058 \ "Xtags", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2059 call writefile(["one", "two", "three"], "Xfile", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2060 call writefile(["one"], "Xother", 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2061 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2062 execute "normal \<C-]>" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2063 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2064 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2065 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2066 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
|
2067 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2068 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
|
2069 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
|
2070 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2071 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2072 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2073 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2074 " 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
|
2075 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
|
2076 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
|
2077 clearjumps |
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 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2080 file first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2081 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
|
2082 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2083 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2084 file current |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2085 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
|
2086 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2087 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2088 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2089 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
|
2090 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
|
2091 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2092 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2093 " 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
|
2094 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
|
2095 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
|
2096 clearjumps |
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 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2099 file first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2100 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
|
2101 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2102 enew! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2103 file current |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2104 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
|
2105 " 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
|
2106 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
|
2107 " 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
|
2108 " 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
|
2109 normal m` |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2110 normal k |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2111 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
|
2112 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2113 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2114 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2115 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
|
2116 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
|
2117 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
|
2118 endfunc |
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 " 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
|
2121 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
|
2122 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
|
2123 clearjumps |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2124 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2125 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2126 file first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2127 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
|
2128 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2129 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2130 file current |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2131 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
|
2132 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2133 set winfixbuf |
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 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
|
2136 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
|
2137 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2138 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2139 " 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
|
2140 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
|
2141 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
|
2142 clearjumps |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2143 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2144 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2145 file first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2146 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
|
2147 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2148 enew! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2149 file current |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2150 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
|
2151 " 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
|
2152 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
|
2153 " 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
|
2154 " 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
|
2155 normal m` |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2156 normal k |
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 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2159 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2160 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
|
2161 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
|
2162 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2163 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2164 " 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
|
2165 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
|
2166 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
|
2167 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2168 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2169 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
|
2170 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2171 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2172 \ "two\tXfile\t2"], |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2173 \ "Xtags", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2174 call writefile(["one", "two", "three"], "Xfile", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2175 call writefile(["one"], "Xother", 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2176 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2177 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2178 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2179 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2180 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
|
2181 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2182 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
|
2183 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
|
2184 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2185 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2186 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2187 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2188 " 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
|
2189 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
|
2190 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
|
2191 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2192 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2193 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
|
2194 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2195 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2196 \ "two\tXfile\t2"], |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2197 \ "Xtags", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2198 call writefile(["one", "two", "three"], "Xfile", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2199 call writefile(["one"], "Xother", 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2200 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2201 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2202 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2203 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2204 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
|
2205 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
|
2206 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
|
2207 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2208 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2209 endfunc |
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 " 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
|
2212 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
|
2213 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
|
2214 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2215 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2216 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
|
2217 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2218 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2219 \ "two\tXfile\t2"], |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2220 \ "Xtags", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2221 call writefile(["one", "two", "three"], "Xfile", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2222 call writefile(["one"], "Xother", 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2223 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2224 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2225 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2226 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2227 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
|
2228 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
|
2229 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
|
2230 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2231 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2232 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2233 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2234 " 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
|
2235 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
|
2236 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
|
2237 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2238 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2239 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
|
2240 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2241 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2242 \ "two\tXfile\t2"], |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2243 \ "Xtags", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2244 call writefile(["one", "two", "three"], "Xfile", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2245 call writefile(["one", "two", "three"], "Xother", 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2246 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2247 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2248 set winfixbuf |
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 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
|
2251 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2252 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
|
2253 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
|
2254 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2255 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2256 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2257 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2258 " 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
|
2259 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
|
2260 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
|
2261 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2262 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
|
2263 call append(0, [l:file]) |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2264 call writefile([], l:file, 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2265 " 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
|
2266 normal gg |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2267 " 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
|
2268 " 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
|
2269 set hidden |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2270 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2271 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2272 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2273 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
|
2274 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2275 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
|
2276 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
|
2277 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2278 set nowinfixbuf |
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 normal gF |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2281 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
|
2282 |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2283 set nohidden |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2284 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2285 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2286 " 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
|
2287 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
|
2288 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
|
2289 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2290 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
|
2291 call append(0, [l:file]) |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2292 call writefile([], l:file, 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2293 " 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
|
2294 normal gg |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2295 " 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
|
2296 " 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
|
2297 set hidden |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2298 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2299 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2300 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2301 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
|
2302 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2303 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
|
2304 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
|
2305 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2306 set nowinfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2307 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2308 normal gf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2309 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
|
2310 |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2311 set nohidden |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2312 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2313 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2314 " 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
|
2315 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
|
2316 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
|
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:file = tempname() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2319 call append(0, [l:file]) |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2320 call writefile([], l:file, 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2321 " 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
|
2322 normal gg |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2323 " 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
|
2324 " 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
|
2325 set hidden |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2326 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2327 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2328 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2329 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
|
2330 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2331 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
|
2332 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
|
2333 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2334 set nowinfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2335 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2336 normal [f |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2337 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
|
2338 |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2339 set nohidden |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2340 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2341 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2342 " 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
|
2343 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
|
2344 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
|
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: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
|
2347 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
|
2348 \ '#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
|
2349 \ ], |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2350 \ "main.c", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2351 call writefile(["#define min(X, Y) ((X) < (Y) ? (X) : (Y))"], l:include_file, 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2352 edit main.c |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2353 normal ]\<C-d> |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2354 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2355 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2356 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2357 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
|
2358 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2359 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
|
2360 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
|
2361 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2362 set nowinfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2363 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2364 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
|
2365 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
|
2366 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2367 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2368 " 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
|
2369 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
|
2370 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
|
2371 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2372 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
|
2373 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
|
2374 \ '#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
|
2375 \ ], |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2376 \ "main.c", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2377 call writefile(["#define min(X, Y) ((X) < (Y) ? (X) : (Y))"], l:include_file, 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2378 edit main.c |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2379 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2380 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2381 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2382 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
|
2383 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2384 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
|
2385 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
|
2386 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2387 set nowinfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2388 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2389 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
|
2390 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
|
2391 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2392 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2393 " 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
|
2394 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
|
2395 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
|
2396 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2397 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
|
2398 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
|
2399 \ "min(1, 12);", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2400 \ ], |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2401 \ "main.c", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2402 call writefile(["#define min(X, Y) ((X) < (Y) ? (X) : (Y))"], l:include_file, 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2403 edit main.c |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2404 " 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
|
2405 normal j |
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 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
|
2408 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
|
2409 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
|
2410 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2411 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
|
2412 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2413 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2414 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2415 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
|
2416 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2417 set nowinfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2418 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2419 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
|
2420 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
|
2421 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2422 set define& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2423 set include& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2424 set path& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2425 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2426 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2427 " 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
|
2428 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
|
2429 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
|
2430 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2431 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
|
2432 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
|
2433 \ '#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
|
2434 \ ], |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2435 \ "main.c", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2436 call writefile(["#define min(X, Y) ((X) < (Y) ? (X) : (Y))"], l:include_file, 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2437 edit main.c |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2438 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2439 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2440 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2441 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
|
2442 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
|
2443 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
|
2444 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2445 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
|
2446 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2447 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
|
2448 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
|
2449 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2450 set nowinfixbuf |
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 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
|
2453 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
|
2454 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2455 set define& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2456 set include& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2457 set path& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2458 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2459 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2460 " 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
|
2461 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
|
2462 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
|
2463 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2464 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
|
2465 call append(0, [l:file]) |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2466 call writefile([], l:file, 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2467 " 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
|
2468 normal gg |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2469 " 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
|
2470 " 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
|
2471 set hidden |
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 winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2474 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2475 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
|
2476 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2477 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
|
2478 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
|
2479 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2480 set nowinfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2481 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2482 normal ]f |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2483 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
|
2484 |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2485 set nohidden |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2486 endfunc |
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 " 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
|
2489 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
|
2490 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
|
2491 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2492 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2493 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
|
2494 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2495 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2496 \ "two\tXfile\t2"], |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2497 \ "Xtags", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2498 call writefile(["one", "two", "three"], "Xfile", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2499 call writefile(["one"], "Xother", 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2500 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2501 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2502 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2503 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2504 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
|
2505 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2506 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
|
2507 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
|
2508 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2509 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2510 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2511 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2512 " 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
|
2513 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
|
2514 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
|
2515 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2516 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2517 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
|
2518 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2519 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2520 \ "two\tXfile\t2"], |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2521 \ "Xtags", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2522 call writefile(["one", "two", "three"], "Xfile", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2523 call writefile(["one"], "Xother", 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2524 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2525 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2526 set winfixbuf |
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 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
|
2529 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2530 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
|
2531 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
|
2532 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2533 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2534 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2535 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2536 " 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
|
2537 func Test_pedit() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2538 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
|
2539 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2540 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
|
2541 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2542 pedit other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2543 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2544 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
|
2545 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
|
2546 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2547 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2548 " 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
|
2549 func Test_pop() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2550 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
|
2551 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2552 set tags=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(["!_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
|
2554 \ "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
|
2555 \ "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
|
2556 \ "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
|
2557 \ ], |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2558 \ "Xtags", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2559 call writefile(["thesame one", "thesame two", "thesame three"], "Xfile", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2560 call writefile(["thesame one"], "Xother", 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2561 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2562 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2563 tag thesame |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2564 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2565 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2566 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2567 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
|
2568 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2569 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
|
2570 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
|
2571 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2572 pop! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2573 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
|
2574 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2575 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2576 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2577 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2578 " 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
|
2579 func Test_previous() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2580 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
|
2581 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2582 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
|
2583 next! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2584 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2585 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
|
2586 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
|
2587 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2588 previous! |
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:first, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2590 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2591 |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
2592 " 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
|
2593 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
|
2594 CheckFeature pythonx |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2595 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
|
2596 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2597 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2598 file first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2599 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
|
2600 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2601 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2602 file second |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2603 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2604 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2605 |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
2606 pythonx << EOF |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2607 import vim |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2608 |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
2609 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
|
2610 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
|
2611 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
|
2612 EOF |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2613 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2614 try |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
2615 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
|
2616 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
|
2617 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
|
2618 endtry |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2619 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2620 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
|
2621 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2622 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
|
2623 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2624 |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
2625 " 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
|
2626 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
|
2627 CheckFeature pythonx |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2628 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
|
2629 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2630 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2631 file first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2632 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
|
2633 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2634 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2635 file second |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2636 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2637 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2638 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2639 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
|
2640 \ "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
|
2641 \ "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
|
2642 \ ], |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2643 \ "file.py", 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2644 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2645 try |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
2646 pyxfile file.py |
34554
495218030237
patch 9.1.0178: E1513 might be confusing
Christian Brabandt <cb@256bit.org>
parents:
34500
diff
changeset
|
2647 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
|
2648 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
|
2649 endtry |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2650 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2651 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
|
2652 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2653 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
|
2654 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2655 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2656 " 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
|
2657 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
|
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 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
|
2669 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2670 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2671 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2672 try |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
2673 pythonx << EOF |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2674 import vim |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2675 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2676 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
|
2677 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
|
2678 EOF |
34554
495218030237
patch 9.1.0178: E1513 might be confusing
Christian Brabandt <cb@256bit.org>
parents:
34500
diff
changeset
|
2679 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
|
2680 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
|
2681 endtry |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2682 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2683 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
|
2684 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
|
2685 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2686 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2687 " 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
|
2688 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
|
2689 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
|
2690 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2691 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2692 file first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2693 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
|
2694 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2695 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2696 file current |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2697 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
|
2698 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2699 set winfixbuf |
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 nnoremap g <C-^> |
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 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
|
2704 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
|
2705 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2706 nunmap g |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2707 endfunc |
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 " 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
|
2710 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
|
2711 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
|
2712 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2713 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2714 file first |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2715 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
|
2716 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2717 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2718 file current |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2719 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
|
2720 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2721 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2722 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2723 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
|
2724 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
|
2725 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2726 " 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
|
2727 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
|
2728 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2729 execute "normal \<C-^>" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2730 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
|
2731 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2732 nunmap <C-^> |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2733 endfunc |
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 " 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
|
2736 func Test_rewind() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2737 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
|
2738 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2739 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
|
2740 next! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2741 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2742 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
|
2743 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
|
2744 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2745 rewind! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2746 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
|
2747 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2748 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2749 " 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
|
2750 func Test_sblast() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2751 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
|
2752 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2753 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
|
2754 bfirst! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2755 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
|
2756 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2757 sblast |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2758 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
|
2759 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2760 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2761 " 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
|
2762 func Test_sbprevious() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2763 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
|
2764 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2765 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
|
2766 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
|
2767 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2768 sbprevious |
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:other, bufnr()) |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2770 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2771 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2772 " 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
|
2773 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
|
2774 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
|
2775 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2776 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
|
2777 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2778 set winfixbuf |
35026
96131d0faead
patch 9.1.0364: tests: test_vim9_builtin is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
35022
diff
changeset
|
2779 call assert_fails("edit something_else", "E1513:") |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2780 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2781 set nowinfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2782 set wfb |
35026
96131d0faead
patch 9.1.0364: tests: test_vim9_builtin is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
35022
diff
changeset
|
2783 call assert_fails("edit another_place", "E1513:") |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2784 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2785 set nowfb |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2786 edit last_place |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2787 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2788 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2789 " 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
|
2790 func Test_snext() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2791 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
|
2792 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2793 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
|
2794 first! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2795 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2796 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
|
2797 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2798 snext |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2799 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
|
2800 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
|
2801 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2802 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2803 " 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
|
2804 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
|
2805 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
|
2806 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2807 split |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2808 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
|
2809 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2810 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2811 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2812 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
|
2813 vsplit |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2814 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
|
2815 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2816 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
|
2817 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
|
2818 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2819 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2820 " 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
|
2821 func Test_tNext() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2822 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
|
2823 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2824 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2825 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
|
2826 \ "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
|
2827 \ "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
|
2828 \ "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
|
2829 \ ], |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2830 \ "Xtags", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2831 call writefile(["thesame one", "thesame two", "thesame three"], "Xfile", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2832 call writefile(["thesame one"], "Xother", 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2833 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2834 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2835 tag thesame |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2836 execute "normal \<C-^>" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2837 tnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2838 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2839 set winfixbuf |
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 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
|
2842 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2843 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
|
2844 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
|
2845 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2846 tNext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2847 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2848 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2849 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2850 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2851 " 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
|
2852 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
|
2853 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
|
2854 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2855 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
|
2856 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2857 " 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
|
2858 " 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
|
2859 " 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
|
2860 " |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2861 " +-------------------+ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2862 " | 'nowinfixbuf' | |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2863 " +-------------------+ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2864 " | '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
|
2865 " +-------------------+ |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2866 split |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2867 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
|
2868 " 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
|
2869 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
|
2870 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
|
2871 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2872 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
|
2873 tabdo echo '' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2874 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
|
2875 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
|
2876 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
|
2877 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2878 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2879 " 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
|
2880 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
|
2881 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
|
2882 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2883 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
|
2884 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
|
2885 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2886 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
|
2887 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
|
2888 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2889 tabdo echo '' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2890 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
|
2891 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
|
2892 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
|
2893 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
|
2894 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
|
2895 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2896 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2897 " 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
|
2898 func Test_tag() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2899 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
|
2900 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2901 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2902 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
|
2903 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2904 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2905 \ "two\tXfile\t2"], |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2906 \ "Xtags", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2907 call writefile(["one", "two", "three"], "Xfile", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2908 call writefile(["one"], "Xother", 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2909 edit Xother |
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 set winfixbuf |
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 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
|
2914 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2915 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
|
2916 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
|
2917 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2918 tag! one |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2919 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
|
2920 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2921 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2922 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2923 |
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 " 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
|
2926 func Test_tfirst() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2927 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
|
2928 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2929 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2930 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
|
2931 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2932 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2933 \ "two\tXfile\t2"], |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2934 \ "Xtags", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2935 call writefile(["one", "two", "three"], "Xfile", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2936 call writefile(["one"], "Xother", 'D') |
35622
814fcbca4d8d
patch 9.1.0554: :bw leaves jumplist and tagstack data around
Christian Brabandt <cb@256bit.org>
parents:
35026
diff
changeset
|
2937 tag one |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2938 edit Xother |
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 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2941 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2942 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
|
2943 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2944 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
|
2945 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
|
2946 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2947 tfirst! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2948 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
|
2949 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2950 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2951 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2952 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2953 " 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
|
2954 func Test_tjump() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2955 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
|
2956 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2957 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2958 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
|
2959 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2960 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2961 \ "two\tXfile\t2"], |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2962 \ "Xtags", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2963 call writefile(["one", "two", "three"], "Xfile", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2964 call writefile(["one"], "Xother", 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2965 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2966 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2967 set winfixbuf |
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 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
|
2970 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2971 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
|
2972 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
|
2973 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2974 tjump! one |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2975 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
|
2976 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2977 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2978 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2979 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2980 " 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
|
2981 func Test_tlast() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2982 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
|
2983 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2984 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2985 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
|
2986 \ "one\tXfile\t1", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2987 \ "three\tXfile\t3", |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2988 \ "two\tXfile\t2"], |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2989 \ "Xtags", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
2990 call writefile(["one", "two", "three"], "Xfile", 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2991 edit Xfile |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2992 tjump one |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2993 edit Xfile |
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 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2996 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2997 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
|
2998 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2999 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
|
3000 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
|
3001 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3002 tlast! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3003 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
|
3004 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3005 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3006 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3007 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3008 " 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
|
3009 func Test_tnext() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3010 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
|
3011 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3012 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3013 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
|
3014 \ "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
|
3015 \ "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
|
3016 \ "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
|
3017 \ ], |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
3018 \ "Xtags", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
3019 call writefile(["thesame one", "thesame two", "thesame three"], "Xfile", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
3020 call writefile(["thesame one"], "Xother", 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3021 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3022 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3023 tag thesame |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3024 execute "normal \<C-^>" |
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 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3027 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3028 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
|
3029 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3030 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
|
3031 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
|
3032 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3033 tnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3034 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
|
3035 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3036 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3037 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3038 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3039 " 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
|
3040 func Test_tprevious() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3041 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
|
3042 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3043 set tags=Xtags |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3044 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
|
3045 \ "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
|
3046 \ "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
|
3047 \ "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
|
3048 \ ], |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
3049 \ "Xtags", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
3050 call writefile(["thesame one", "thesame two", "thesame three"], "Xfile", 'D') |
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
3051 call writefile(["thesame one"], "Xother", 'D') |
34470
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3052 edit Xother |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3053 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3054 tag thesame |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3055 execute "normal \<C-^>" |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3056 tnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3057 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3058 set winfixbuf |
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 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
|
3061 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3062 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
|
3063 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
|
3064 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3065 tprevious! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3066 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3067 set tags& |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3068 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3069 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3070 " 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
|
3071 func Test_view() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3072 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
|
3073 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3074 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
|
3075 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
|
3076 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3077 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
|
3078 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
|
3079 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3080 view! other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3081 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
|
3082 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3083 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3084 " 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
|
3085 func Test_visual() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3086 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
|
3087 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3088 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
|
3089 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
|
3090 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3091 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
|
3092 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
|
3093 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3094 visual! other |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3095 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
|
3096 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3097 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3098 " 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
|
3099 func Test_vimgrep() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3100 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3101 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
|
3102 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3103 edit first.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3104 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
|
3105 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3106 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3107 edit winfix.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3108 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
|
3109 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3110 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
|
3111 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3112 set winfixbuf |
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 edit! last.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3115 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
|
3116 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3117 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
|
3118 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3119 buffer! winfix.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3120 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3121 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
|
3122 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
|
3123 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3124 " 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
|
3125 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
|
3126 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
|
3127 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3128 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
|
3129 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
|
3130 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
|
3131 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3132 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3133 " 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
|
3134 func Test_vimgrepadd() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3135 CheckFeature quickfix |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3136 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
|
3137 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3138 edit first.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3139 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
|
3140 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3141 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3142 edit winfix.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3143 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
|
3144 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3145 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
|
3146 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3147 set winfixbuf |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3148 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3149 edit! last.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3150 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
|
3151 write |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3152 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
|
3153 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3154 buffer! winfix.unittest |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3155 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3156 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
|
3157 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
|
3158 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3159 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
|
3160 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
|
3161 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
|
3162 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
|
3163 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
|
3164 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3165 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3166 " 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
|
3167 func Test_wNext() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3168 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
|
3169 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3170 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
|
3171 next! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3172 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3173 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
|
3174 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
|
3175 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3176 wNext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3177 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
|
3178 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3179 call delete("first") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3180 call delete("middle") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3181 call delete("last") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3182 endfunc |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3183 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3184 " 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
|
3185 func Test_windo() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3186 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
|
3187 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3188 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
|
3189 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
|
3190 split |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3191 enew |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3192 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
|
3193 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3194 set winfixbuf |
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 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
|
3197 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3198 windo echo '' |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3199 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
|
3200 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3201 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
|
3202 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
|
3203 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3204 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
|
3205 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
|
3206 endfunc |
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 " 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
|
3209 func Test_wnext() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3210 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
|
3211 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3212 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
|
3213 next! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3214 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3215 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
|
3216 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
|
3217 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3218 wnext! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3219 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
|
3220 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3221 call delete("first") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3222 call delete("middle") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3223 call delete("last") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3224 endfunc |
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 " 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
|
3227 func Test_wprevious() |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3228 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
|
3229 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3230 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
|
3231 next! |
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 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
|
3234 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
|
3235 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3236 wprevious! |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3237 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
|
3238 |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3239 call delete("first") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3240 call delete("middle") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3241 call delete("last") |
dd8f5311cee5
patch 9.1.0147: Cannot keep a buffer focused in a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3242 endfunc |
34479
2cf84e8dc58b
patch 9.1.0149: null pointer member access when accessing 'winfixbuf' property
Christian Brabandt <cb@256bit.org>
parents:
34470
diff
changeset
|
3243 |
2cf84e8dc58b
patch 9.1.0149: null pointer member access when accessing 'winfixbuf' property
Christian Brabandt <cb@256bit.org>
parents:
34470
diff
changeset
|
3244 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
|
3245 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
|
3246 |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3247 call s:make_simple_quickfix() |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3248 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
|
3249 |
2cf84e8dc58b
patch 9.1.0149: null pointer member access when accessing 'winfixbuf' property
Christian Brabandt <cb@256bit.org>
parents:
34470
diff
changeset
|
3250 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
|
3251 split |
2cf84e8dc58b
patch 9.1.0149: null pointer member access when accessing 'winfixbuf' property
Christian Brabandt <cb@256bit.org>
parents:
34470
diff
changeset
|
3252 copen |
2cf84e8dc58b
patch 9.1.0149: null pointer member access when accessing 'winfixbuf' property
Christian Brabandt <cb@256bit.org>
parents:
34470
diff
changeset
|
3253 execute winnr('#') 'quit' |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3254 call assert_equal(2, winnr('$')) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3255 |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3256 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
|
3257 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
|
3258 |
34479
2cf84e8dc58b
patch 9.1.0149: null pointer member access when accessing 'winfixbuf' property
Christian Brabandt <cb@256bit.org>
parents:
34470
diff
changeset
|
3259 set switchbuf& |
2cf84e8dc58b
patch 9.1.0149: null pointer member access when accessing 'winfixbuf' property
Christian Brabandt <cb@256bit.org>
parents:
34470
diff
changeset
|
3260 endfunc |
2cf84e8dc58b
patch 9.1.0149: null pointer member access when accessing 'winfixbuf' property
Christian Brabandt <cb@256bit.org>
parents:
34470
diff
changeset
|
3261 |
34485
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3262 func Test_listdo_goto_prevwin() |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3263 call s:reset_all_buffers() |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3264 call s:make_buffers_list() |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3265 |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3266 new |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3267 call assert_equal(0, &winfixbuf) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3268 wincmd p |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3269 call assert_equal(1, &winfixbuf) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3270 call assert_notequal(bufnr(), bufnr('#')) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3271 |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3272 augroup ListDoGotoPrevwin |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3273 au! |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3274 au BufLeave * let s:triggered = 1 |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3275 \| call assert_equal(bufnr(), winbufnr(winnr())) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3276 augroup END |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3277 " 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
|
3278 " 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
|
3279 bufdo " |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3280 call assert_equal(0, &winfixbuf) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3281 call assert_equal(1, s:triggered) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3282 unlet! s:triggered |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3283 au! ListDoGotoPrevwin |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3284 |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3285 set winfixbuf |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3286 wincmd p |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3287 call assert_equal(2, winnr('$')) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3288 " 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
|
3289 " without it set. |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3290 bufdo " |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3291 call assert_equal(0, &winfixbuf) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3292 call assert_equal(3, winnr('$')) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3293 |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3294 quit |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3295 call assert_equal(2, winnr('$')) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3296 call assert_equal(1, &winfixbuf) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3297 augroup ListDoGotoPrevwin |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3298 au! |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3299 au WinEnter * ++once set winfixbuf |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3300 augroup END |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3301 " 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
|
3302 " :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
|
3303 call assert_fails('bufdo "', 'E1513:') |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3304 |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3305 au! ListDoGotoPrevwin |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3306 augroup! ListDoGotoPrevwin |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3307 endfunc |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3308 |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3309 func Test_quickfix_changed_split_failed() |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3310 call s:reset_all_buffers() |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3311 |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3312 call s:make_simple_quickfix() |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3313 call assert_equal(1, winnr('$')) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3314 |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3315 " 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
|
3316 " 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
|
3317 augroup QfChanged |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3318 au! |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3319 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
|
3320 \| set winfixbuf | call setqflist([], 'f') |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3321 augroup END |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3322 call assert_fails('cnext', ['E1513:', 'E925:']) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3323 " 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
|
3324 call assert_equal(1, winnr('$')) |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3325 |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3326 au! QfChanged |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3327 augroup! QfChanged |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3328 endfunc |
157cf882799f
patch 9.1.0150: Several minor 'winfixbuf' issues
Christian Brabandt <cb@256bit.org>
parents:
34479
diff
changeset
|
3329 |
34500
4da97f213d15
patch 9.1.0156: Make 'wfb' failing to split still report E1513
Christian Brabandt <cb@256bit.org>
parents:
34489
diff
changeset
|
3330 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
|
3331 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
|
3332 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
|
3333 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
|
3334 " 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
|
3335 " split the winfixedbuf window |
4dd6d243e4f7
patch 9.1.0152: Coverity complains about ignoring return value
Christian Brabandt <cb@256bit.org>
parents:
34485
diff
changeset
|
3336 let &winheight=&lines |
4dd6d243e4f7
patch 9.1.0152: Coverity complains about ignoring return value
Christian Brabandt <cb@256bit.org>
parents:
34485
diff
changeset
|
3337 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
|
3338 " 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
|
3339 " 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
|
3340 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
|
3341 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
|
3342 " 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
|
3343 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
|
3344 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
|
3345 endfunc |
4dd6d243e4f7
patch 9.1.0152: Coverity complains about ignoring return value
Christian Brabandt <cb@256bit.org>
parents:
34485
diff
changeset
|
3346 |
34667
968626cf50fa
patch 9.1.0216: Error on exit with EXITFREE and 'winfixbuf'
Christian Brabandt <cb@256bit.org>
parents:
34658
diff
changeset
|
3347 " 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
|
3348 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
|
3349 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
|
3350 set winfixbuf |
968626cf50fa
patch 9.1.0216: Error on exit with EXITFREE and 'winfixbuf'
Christian Brabandt <cb@256bit.org>
parents:
34658
diff
changeset
|
3351 qall! |
968626cf50fa
patch 9.1.0216: Error on exit with EXITFREE and 'winfixbuf'
Christian Brabandt <cb@256bit.org>
parents:
34658
diff
changeset
|
3352 END |
968626cf50fa
patch 9.1.0216: Error on exit with EXITFREE and 'winfixbuf'
Christian Brabandt <cb@256bit.org>
parents:
34658
diff
changeset
|
3353 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
|
3354 call assert_notmatch('E1513:', |
35022
c507111b5c80
patch 9.1.0363: tests: test_winfixbuf is a bit slow
Christian Brabandt <cb@256bit.org>
parents:
34667
diff
changeset
|
3355 \ system(GetVimCommandClean() .. ' --not-a-term -X -S Xwfb_exitfree')) |
34667
968626cf50fa
patch 9.1.0216: Error on exit with EXITFREE and 'winfixbuf'
Christian Brabandt <cb@256bit.org>
parents:
34658
diff
changeset
|
3356 endfunc |
968626cf50fa
patch 9.1.0216: Error on exit with EXITFREE and 'winfixbuf'
Christian Brabandt <cb@256bit.org>
parents:
34658
diff
changeset
|
3357 |
34479
2cf84e8dc58b
patch 9.1.0149: null pointer member access when accessing 'winfixbuf' property
Christian Brabandt <cb@256bit.org>
parents:
34470
diff
changeset
|
3358 " vim: shiftwidth=2 sts=2 expandtab |