annotate src/testdir/test_winfixbuf.vim @ 34641:b41af4b613da v9.1.0206

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