Mercurial > vim
annotate src/testdir/test_winbuf_close.vim @ 22636:8e65b58ff15d
Added tag v8.2.1866 for changeset 9e249065aeac135bdd8a3aa6c6a30a73a3408fef
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 19 Oct 2020 20:30:06 +0200 |
parents | 75513701ddd2 |
children | bff3fa5f4c74 |
rev | line source |
---|---|
12616
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Test for commands that close windows and/or buffers: |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 " :quit |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 " :close |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 " :hide |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 " :only |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 " :sall |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 " :all |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 " :ball |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 " :buf |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 " :edit |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 " |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 func Test_winbuf_close() |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 enew | only |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 call writefile(['testtext 1'], 'Xtest1') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 call writefile(['testtext 2'], 'Xtest2') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 call writefile(['testtext 3'], 'Xtest3') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 next! Xtest1 Xtest2 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 call setline(1, 'testtext 1 1') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 " test for working :n when hidden set |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 set hidden |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 next |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 call assert_equal('Xtest2', bufname('%')) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 " test for failing :rew when hidden not set |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 set nohidden |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 call setline(1, 'testtext 2 2') |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
30 call assert_fails('rewind', 'E37:') |
12616
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 call assert_equal('Xtest2', bufname('%')) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 call assert_equal('testtext 2 2', getline(1)) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 " test for working :rew when hidden set |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 set hidden |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 rewind |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 call assert_equal('Xtest1', bufname('%')) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 call assert_equal('testtext 1 1', getline(1)) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 " test for :all keeping a buffer when it's modified |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 set nohidden |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 call setline(1, 'testtext 1 1 1') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 split |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 next Xtest2 Xtest3 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 all |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 1wincmd w |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 call assert_equal('Xtest1', bufname('%')) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 call assert_equal('testtext 1 1 1', getline(1)) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 " test abandoning changed buffer, should be unloaded even when 'hidden' set |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 set hidden |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 call setline(1, 'testtext 1 1 1 1') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 quit! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 call assert_equal('Xtest2', bufname('%')) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 call assert_equal('testtext 2 2', getline(1)) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 unhide |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 call assert_equal('Xtest2', bufname('%')) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 call assert_equal('testtext 2 2', getline(1)) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 " test ":hide" hides anyway when 'hidden' not set |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 set nohidden |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 call setline(1, 'testtext 2 2 2') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 hide |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 call assert_equal('Xtest3', bufname('%')) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 call assert_equal('testtext 3', getline(1)) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 " test ":edit" failing in modified buffer when 'hidden' not set |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 call setline(1, 'testtext 3 3') |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
69 call assert_fails('edit Xtest1', 'E37:') |
12616
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 call assert_equal('Xtest3', bufname('%')) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
71 call assert_equal('testtext 3 3', getline(1)) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 " test ":edit" working in modified buffer when 'hidden' set |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 set hidden |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 edit Xtest1 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
76 call assert_equal('Xtest1', bufname('%')) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 call assert_equal('testtext 1', getline(1)) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 " test ":close" not hiding when 'hidden' not set in modified buffer |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 split Xtest3 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 set nohidden |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 call setline(1, 'testtext 3 3 3') |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
83 call assert_fails('close', 'E37:') |
12616
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
84 call assert_equal('Xtest3', bufname('%')) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
85 call assert_equal('testtext 3 3 3', getline(1)) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
86 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 " test ":close!" does hide when 'hidden' not set in modified buffer; |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 call setline(1, 'testtext 3 3 3 3') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
89 close! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
90 call assert_equal('Xtest1', bufname('%')) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
91 call assert_equal('testtext 1', getline(1)) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
92 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
93 set nohidden |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
94 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
95 " test ":all!" hides changed buffer |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
96 split Xtest4 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
97 call setline(1, 'testtext 4') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
98 all! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
99 1wincmd w |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
100 call assert_equal('Xtest2', bufname('%')) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
101 call assert_equal('testtext 2 2 2', getline(1)) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
102 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
103 " test ":q!" and hidden buffer. |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
104 bwipe! Xtest1 Xtest2 Xtest3 Xtest4 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
105 split Xtest1 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
106 wincmd w |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
107 bwipe! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
108 set modified |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
109 bot split Xtest2 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
110 set modified |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
111 bot split Xtest3 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
112 set modified |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
113 wincmd t |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
114 hide |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
115 call assert_equal('Xtest2', bufname('%')) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
116 quit! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
117 call assert_equal('Xtest3', bufname('%')) |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
118 call assert_fails('silent! quit!', 'E37:') |
12616
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
119 call assert_equal('Xtest1', bufname('%')) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
120 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
121 call delete('Xtest1') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
122 call delete('Xtest2') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
123 call delete('Xtest3') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
124 endfunc |
13837
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
125 |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
126 " Test that ":close" will respect 'winfixheight' when possible. |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
127 func Test_winfixheight_on_close() |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
128 set nosplitbelow nosplitright |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
129 |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
130 split | split | vsplit |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
131 |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
132 $wincmd w |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
133 setlocal winfixheight |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
134 let l:height = winheight(0) |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
135 |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
136 3close |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
137 |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
138 call assert_equal(l:height, winheight(0)) |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
139 |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
140 %bwipeout! |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
141 setlocal nowinfixheight splitbelow& splitright& |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
142 endfunc |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
143 |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
144 " Test that ":close" will respect 'winfixwidth' when possible. |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
145 func Test_winfixwidth_on_close() |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
146 set nosplitbelow nosplitright |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
147 |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
148 vsplit | vsplit | split |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
149 |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
150 $wincmd w |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
151 setlocal winfixwidth |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
152 let l:width = winwidth(0) |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
153 |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
154 3close |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
155 |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
156 call assert_equal(l:width, winwidth(0)) |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
157 |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
158 %bwipeout! |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
159 setlocal nowinfixwidth splitbelow& splitright& |
79419af4b29c
patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
160 endfunction |
16166
a3284dd27de6
patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents:
13837
diff
changeset
|
161 |
a3284dd27de6
patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents:
13837
diff
changeset
|
162 " Test that 'winfixheight' will be respected even there is non-leaf frame |
19155
013f20a3bc6b
patch 8.2.0137: crash when using win_execute() from a new tab
Bram Moolenaar <Bram@vim.org>
parents:
16166
diff
changeset
|
163 func Test_winfixheight_non_leaf_frame() |
16166
a3284dd27de6
patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents:
13837
diff
changeset
|
164 vsplit |
a3284dd27de6
patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents:
13837
diff
changeset
|
165 botright 11new |
a3284dd27de6
patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents:
13837
diff
changeset
|
166 let l:wid = win_getid() |
a3284dd27de6
patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents:
13837
diff
changeset
|
167 setlocal winfixheight |
a3284dd27de6
patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents:
13837
diff
changeset
|
168 call assert_equal(11, winheight(l:wid)) |
a3284dd27de6
patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents:
13837
diff
changeset
|
169 botright new |
a3284dd27de6
patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents:
13837
diff
changeset
|
170 bwipe! |
a3284dd27de6
patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents:
13837
diff
changeset
|
171 call assert_equal(11, winheight(l:wid)) |
a3284dd27de6
patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents:
13837
diff
changeset
|
172 %bwipe! |
a3284dd27de6
patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents:
13837
diff
changeset
|
173 endf |
a3284dd27de6
patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents:
13837
diff
changeset
|
174 |
a3284dd27de6
patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents:
13837
diff
changeset
|
175 " Test that 'winfixwidth' will be respected even there is non-leaf frame |
19155
013f20a3bc6b
patch 8.2.0137: crash when using win_execute() from a new tab
Bram Moolenaar <Bram@vim.org>
parents:
16166
diff
changeset
|
176 func Test_winfixwidth_non_leaf_frame() |
16166
a3284dd27de6
patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents:
13837
diff
changeset
|
177 split |
a3284dd27de6
patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents:
13837
diff
changeset
|
178 topleft 11vnew |
a3284dd27de6
patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents:
13837
diff
changeset
|
179 let l:wid = win_getid() |
a3284dd27de6
patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents:
13837
diff
changeset
|
180 setlocal winfixwidth |
a3284dd27de6
patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents:
13837
diff
changeset
|
181 call assert_equal(11, winwidth(l:wid)) |
a3284dd27de6
patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents:
13837
diff
changeset
|
182 topleft new |
a3284dd27de6
patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents:
13837
diff
changeset
|
183 bwipe! |
a3284dd27de6
patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents:
13837
diff
changeset
|
184 call assert_equal(11, winwidth(l:wid)) |
a3284dd27de6
patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents:
13837
diff
changeset
|
185 %bwipe! |
a3284dd27de6
patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents:
13837
diff
changeset
|
186 endf |
19155
013f20a3bc6b
patch 8.2.0137: crash when using win_execute() from a new tab
Bram Moolenaar <Bram@vim.org>
parents:
16166
diff
changeset
|
187 |
013f20a3bc6b
patch 8.2.0137: crash when using win_execute() from a new tab
Bram Moolenaar <Bram@vim.org>
parents:
16166
diff
changeset
|
188 func Test_tabwin_close() |
013f20a3bc6b
patch 8.2.0137: crash when using win_execute() from a new tab
Bram Moolenaar <Bram@vim.org>
parents:
16166
diff
changeset
|
189 enew |
013f20a3bc6b
patch 8.2.0137: crash when using win_execute() from a new tab
Bram Moolenaar <Bram@vim.org>
parents:
16166
diff
changeset
|
190 let l:wid = win_getid() |
013f20a3bc6b
patch 8.2.0137: crash when using win_execute() from a new tab
Bram Moolenaar <Bram@vim.org>
parents:
16166
diff
changeset
|
191 tabedit |
013f20a3bc6b
patch 8.2.0137: crash when using win_execute() from a new tab
Bram Moolenaar <Bram@vim.org>
parents:
16166
diff
changeset
|
192 call win_execute(l:wid, 'close') |
013f20a3bc6b
patch 8.2.0137: crash when using win_execute() from a new tab
Bram Moolenaar <Bram@vim.org>
parents:
16166
diff
changeset
|
193 " Should not crash. |
013f20a3bc6b
patch 8.2.0137: crash when using win_execute() from a new tab
Bram Moolenaar <Bram@vim.org>
parents:
16166
diff
changeset
|
194 call assert_true(v:true) |
22399
75513701ddd2
patch 8.2.1748: closing split window in other tab may cause a crash
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
195 |
75513701ddd2
patch 8.2.1748: closing split window in other tab may cause a crash
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
196 " This tests closing a window in another tab, while leaving the tab open |
75513701ddd2
patch 8.2.1748: closing split window in other tab may cause a crash
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
197 " i.e. two windows in another tab. |
75513701ddd2
patch 8.2.1748: closing split window in other tab may cause a crash
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
198 tabedit |
75513701ddd2
patch 8.2.1748: closing split window in other tab may cause a crash
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
199 let w:this_win = 42 |
75513701ddd2
patch 8.2.1748: closing split window in other tab may cause a crash
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
200 new |
75513701ddd2
patch 8.2.1748: closing split window in other tab may cause a crash
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
201 let othertab_wid = win_getid() |
75513701ddd2
patch 8.2.1748: closing split window in other tab may cause a crash
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
202 tabprevious |
75513701ddd2
patch 8.2.1748: closing split window in other tab may cause a crash
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
203 call win_execute(othertab_wid, 'q') |
75513701ddd2
patch 8.2.1748: closing split window in other tab may cause a crash
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
204 " drawing the tabline helps check that the other tab's windows and buffers |
75513701ddd2
patch 8.2.1748: closing split window in other tab may cause a crash
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
205 " are still valid |
75513701ddd2
patch 8.2.1748: closing split window in other tab may cause a crash
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
206 redrawtabline |
75513701ddd2
patch 8.2.1748: closing split window in other tab may cause a crash
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
207 " but to be certain, ensure we can focus the other tab too |
75513701ddd2
patch 8.2.1748: closing split window in other tab may cause a crash
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
208 tabnext |
75513701ddd2
patch 8.2.1748: closing split window in other tab may cause a crash
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
209 call assert_equal(42, w:this_win) |
75513701ddd2
patch 8.2.1748: closing split window in other tab may cause a crash
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
210 |
75513701ddd2
patch 8.2.1748: closing split window in other tab may cause a crash
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
211 bwipe! |
19155
013f20a3bc6b
patch 8.2.0137: crash when using win_execute() from a new tab
Bram Moolenaar <Bram@vim.org>
parents:
16166
diff
changeset
|
212 endfunc |
20049
8c401bc7f32b
patch 8.2.0580: window size wrong if 'ea' is off and 'splitright' is on
Bram Moolenaar <Bram@vim.org>
parents:
19155
diff
changeset
|
213 |
8c401bc7f32b
patch 8.2.0580: window size wrong if 'ea' is off and 'splitright' is on
Bram Moolenaar <Bram@vim.org>
parents:
19155
diff
changeset
|
214 " Test when closing a split window (above/below) restores space to the window |
8c401bc7f32b
patch 8.2.0580: window size wrong if 'ea' is off and 'splitright' is on
Bram Moolenaar <Bram@vim.org>
parents:
19155
diff
changeset
|
215 " below when 'noequalalways' and 'splitright' are set. |
8c401bc7f32b
patch 8.2.0580: window size wrong if 'ea' is off and 'splitright' is on
Bram Moolenaar <Bram@vim.org>
parents:
19155
diff
changeset
|
216 func Test_window_close_splitright_noequalalways() |
8c401bc7f32b
patch 8.2.0580: window size wrong if 'ea' is off and 'splitright' is on
Bram Moolenaar <Bram@vim.org>
parents:
19155
diff
changeset
|
217 set noequalalways |
8c401bc7f32b
patch 8.2.0580: window size wrong if 'ea' is off and 'splitright' is on
Bram Moolenaar <Bram@vim.org>
parents:
19155
diff
changeset
|
218 set splitright |
8c401bc7f32b
patch 8.2.0580: window size wrong if 'ea' is off and 'splitright' is on
Bram Moolenaar <Bram@vim.org>
parents:
19155
diff
changeset
|
219 new |
8c401bc7f32b
patch 8.2.0580: window size wrong if 'ea' is off and 'splitright' is on
Bram Moolenaar <Bram@vim.org>
parents:
19155
diff
changeset
|
220 let w1 = win_getid() |
8c401bc7f32b
patch 8.2.0580: window size wrong if 'ea' is off and 'splitright' is on
Bram Moolenaar <Bram@vim.org>
parents:
19155
diff
changeset
|
221 new |
8c401bc7f32b
patch 8.2.0580: window size wrong if 'ea' is off and 'splitright' is on
Bram Moolenaar <Bram@vim.org>
parents:
19155
diff
changeset
|
222 let w2 = win_getid() |
8c401bc7f32b
patch 8.2.0580: window size wrong if 'ea' is off and 'splitright' is on
Bram Moolenaar <Bram@vim.org>
parents:
19155
diff
changeset
|
223 execute "normal \<c-w>b" |
8c401bc7f32b
patch 8.2.0580: window size wrong if 'ea' is off and 'splitright' is on
Bram Moolenaar <Bram@vim.org>
parents:
19155
diff
changeset
|
224 let h = winheight(0) |
8c401bc7f32b
patch 8.2.0580: window size wrong if 'ea' is off and 'splitright' is on
Bram Moolenaar <Bram@vim.org>
parents:
19155
diff
changeset
|
225 let w = win_getid() |
8c401bc7f32b
patch 8.2.0580: window size wrong if 'ea' is off and 'splitright' is on
Bram Moolenaar <Bram@vim.org>
parents:
19155
diff
changeset
|
226 new |
8c401bc7f32b
patch 8.2.0580: window size wrong if 'ea' is off and 'splitright' is on
Bram Moolenaar <Bram@vim.org>
parents:
19155
diff
changeset
|
227 q |
8c401bc7f32b
patch 8.2.0580: window size wrong if 'ea' is off and 'splitright' is on
Bram Moolenaar <Bram@vim.org>
parents:
19155
diff
changeset
|
228 call assert_equal(h, winheight(0), "Window height does not match eight before opening and closing another window") |
8c401bc7f32b
patch 8.2.0580: window size wrong if 'ea' is off and 'splitright' is on
Bram Moolenaar <Bram@vim.org>
parents:
19155
diff
changeset
|
229 call assert_equal(w, win_getid(), "Did not return to original window after opening and closing a window") |
8c401bc7f32b
patch 8.2.0580: window size wrong if 'ea' is off and 'splitright' is on
Bram Moolenaar <Bram@vim.org>
parents:
19155
diff
changeset
|
230 endfunc |
8c401bc7f32b
patch 8.2.0580: window size wrong if 'ea' is off and 'splitright' is on
Bram Moolenaar <Bram@vim.org>
parents:
19155
diff
changeset
|
231 |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
232 " vim: shiftwidth=2 sts=2 expandtab |