annotate src/testdir/test_winbuf_close.vim @ 31598:f7fbe6aa92cd v9.0.1131

patch 9.0.1131: build failure without the +eval feature Commit: https://github.com/vim/vim/commit/a2942c74683be3f67c6044c2886dc6c237358b3d Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jan 2 13:41:49 2023 +0000 patch 9.0.1131: build failure without the +eval feature Problem: Build failure without the +eval feature. Solution: Move code inside #ifdef.
author Bram Moolenaar <Bram@vim.org>
date Mon, 02 Jan 2023 14:45:03 +0100
parents bff3fa5f4c74
children dbec60b8c253
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
30869
bff3fa5f4c74 patch 9.0.0769: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 22399
diff changeset
15 call writefile(['testtext 1'], 'Xtest1', 'D')
bff3fa5f4c74 patch 9.0.0769: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 22399
diff changeset
16 call writefile(['testtext 2'], 'Xtest2', 'D')
bff3fa5f4c74 patch 9.0.0769: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 22399
diff changeset
17 call writefile(['testtext 3'], 'Xtest3', 'D')
12616
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 endfunc
13837
79419af4b29c patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
121
79419af4b29c patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
122 " 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
123 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
124 set nosplitbelow nosplitright
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 split | split | vsplit
79419af4b29c patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
127
79419af4b29c patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
128 $wincmd w
79419af4b29c patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
129 setlocal winfixheight
79419af4b29c patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
130 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
131
79419af4b29c patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
132 3close
79419af4b29c patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
133
79419af4b29c patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
134 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
135
79419af4b29c patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
136 %bwipeout!
79419af4b29c patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
137 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
138 endfunc
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 " 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
141 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
142 set nosplitbelow nosplitright
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 vsplit | vsplit | split
79419af4b29c patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
145
79419af4b29c patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
146 $wincmd w
79419af4b29c patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
147 setlocal winfixwidth
79419af4b29c patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
148 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
149
79419af4b29c patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
150 3close
79419af4b29c patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
151
79419af4b29c patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
152 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
153
79419af4b29c patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
154 %bwipeout!
79419af4b29c patch 8.0.1790: 'winfixwidth' is not always respected by :close
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
155 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
156 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
157
a3284dd27de6 patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents: 13837
diff changeset
158 " 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
159 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
160 vsplit
a3284dd27de6 patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents: 13837
diff changeset
161 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
162 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
163 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
164 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
165 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
166 bwipe!
a3284dd27de6 patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents: 13837
diff changeset
167 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
168 %bwipe!
a3284dd27de6 patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents: 13837
diff changeset
169 endf
a3284dd27de6 patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents: 13837
diff changeset
170
a3284dd27de6 patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents: 13837
diff changeset
171 " 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
172 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
173 split
a3284dd27de6 patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents: 13837
diff changeset
174 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
175 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
176 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
177 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
178 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
179 bwipe!
a3284dd27de6 patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents: 13837
diff changeset
180 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
181 %bwipe!
a3284dd27de6 patch 8.1.1088: height of quickfix window not retained with vertical split
Bram Moolenaar <Bram@vim.org>
parents: 13837
diff changeset
182 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
183
013f20a3bc6b patch 8.2.0137: crash when using win_execute() from a new tab
Bram Moolenaar <Bram@vim.org>
parents: 16166
diff changeset
184 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
185 enew
013f20a3bc6b patch 8.2.0137: crash when using win_execute() from a new tab
Bram Moolenaar <Bram@vim.org>
parents: 16166
diff changeset
186 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
187 tabedit
013f20a3bc6b patch 8.2.0137: crash when using win_execute() from a new tab
Bram Moolenaar <Bram@vim.org>
parents: 16166
diff changeset
188 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
189 " 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
190 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
191
75513701ddd2 patch 8.2.1748: closing split window in other tab may cause a crash
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
192 " 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
193 " 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
194 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
195 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
196 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
197 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
198 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
199 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
200 " 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
201 " 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
202 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
203 " 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
204 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
205 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
206
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 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
208 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
209
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
210 " 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
211 " 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
212 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
213 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
214 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
215 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
216 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
217 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
218 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
219 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
220 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
221 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
222 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
223 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
224 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
225 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
226 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
227
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
228 " vim: shiftwidth=2 sts=2 expandtab