annotate src/testdir/test_winbuf_close.vim @ 19270:6eca0794f137

Added tag v8.2.0193 for changeset a8a915898b35fa8d1c3d8354c45751eee720ad4a
author Bram Moolenaar <Bram@vim.org>
date Sat, 01 Feb 2020 22:45:04 +0100
parents 013f20a3bc6b
children 8c401bc7f32b
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
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')
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 call assert_fails('rewind', 'E37')
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')
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 call assert_fails('edit Xtest1', 'E37')
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')
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 call assert_fails('close', 'E37')
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('%'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
118 call assert_fails('silent! quit!', 'E162')
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)
013f20a3bc6b patch 8.2.0137: crash when using win_execute() from a new tab
Bram Moolenaar <Bram@vim.org>
parents: 16166
diff changeset
195 %bwipe!
013f20a3bc6b patch 8.2.0137: crash when using win_execute() from a new tab
Bram Moolenaar <Bram@vim.org>
parents: 16166
diff changeset
196 endfunc