annotate src/testdir/test_window_cmd.vim @ 15006:1fd8e32532f7 v8.1.0514

patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name commit https://github.com/vim/vim/commit/1bbb61948342b5cf6e363629f145c65eb455c388 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Nov 10 16:02:01 2018 +0100 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name Problem: CTRL-W ^ does not work when alternate buffer has no name. Solution: Use another method to split and edit the alternate buffer. (Jason Franklin)
author Bram Moolenaar <Bram@vim.org>
date Sat, 10 Nov 2018 16:15:05 +0100
parents 60e80884994d
children 55663ef68467
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9102
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for window cmd (:wincmd, :split, :vsplit, :resize and etc...)
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 func Test_window_cmd_ls0_with_split()
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 set ls=0
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 set splitbelow
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 split
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 quit
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 call assert_equal(0, &lines - &cmdheight - winheight(0))
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 new | only!
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 "
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 set splitbelow&vim
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 botright split
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 quit
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 call assert_equal(0, &lines - &cmdheight - winheight(0))
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 new | only!
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 set ls&vim
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 endfunc
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 func Test_window_cmd_cmdwin_with_vsp()
13880
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
20 let efmt = 'Expected 0 but got %d (in ls=%d, %s window)'
9102
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 for v in range(0, 2)
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 exec "set ls=" . v
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 vsplit
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 call feedkeys("q:\<CR>")
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 let ac = &lines - (&cmdheight + winheight(0) + !!v)
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 let emsg = printf(efmt, ac, v, 'left')
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 call assert_equal(0, ac, emsg)
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 wincmd w
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 let ac = &lines - (&cmdheight + winheight(0) + !!v)
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 let emsg = printf(efmt, ac, v, 'right')
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 call assert_equal(0, ac, emsg)
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 new | only!
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 endfor
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 set ls&vim
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 endfunc
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36
9349
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
37 function Test_window_cmd_wincmd_gf()
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
38 let fname = 'test_gf.txt'
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
39 let swp_fname = '.' . fname . '.swp'
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
40 call writefile([], fname)
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
41 call writefile([], swp_fname)
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
42 function s:swap_exists()
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
43 let v:swapchoice = s:swap_choice
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
44 endfunc
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
45 augroup test_window_cmd_wincmd_gf
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
46 autocmd!
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
47 exec "autocmd SwapExists " . fname . " call s:swap_exists()"
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
48 augroup END
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
49
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
50 call setline(1, fname)
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
51 " (E)dit anyway
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
52 let s:swap_choice = 'e'
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
53 wincmd gf
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
54 call assert_equal(2, tabpagenr())
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
55 call assert_equal(fname, bufname("%"))
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
56 quit!
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
57
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
58 " (Q)uit
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
59 let s:swap_choice = 'q'
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
60 wincmd gf
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
61 call assert_equal(1, tabpagenr())
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
62 call assert_notequal(fname, bufname("%"))
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
63 new | only!
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
64
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
65 call delete(fname)
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
66 call delete(swp_fname)
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
67 augroup! test_window_cmd_wincmd_gf
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
68 endfunc
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
69
11197
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
70 func Test_window_quit()
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
71 e Xa
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
72 split Xb
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
73 call assert_equal(2, winnr('$'))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
74 call assert_equal('Xb', bufname(winbufnr(1)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
75 call assert_equal('Xa', bufname(winbufnr(2)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
76
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
77 wincmd q
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
78 call assert_equal(1, winnr('$'))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
79 call assert_equal('Xa', bufname(winbufnr(1)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
80
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
81 bw Xa Xb
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
82 endfunc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
83
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
84 func Test_window_horizontal_split()
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
85 call assert_equal(1, winnr('$'))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
86 3wincmd s
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
87 call assert_equal(2, winnr('$'))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
88 call assert_equal(3, winheight(0))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
89 call assert_equal(winwidth(1), winwidth(2))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
90
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
91 call assert_fails('botright topleft wincmd s', 'E442:')
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
92 bw
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
93 endfunc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
94
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
95 func Test_window_vertical_split()
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
96 call assert_equal(1, winnr('$'))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
97 3wincmd v
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
98 call assert_equal(2, winnr('$'))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
99 call assert_equal(3, winwidth(0))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
100 call assert_equal(winheight(1), winheight(2))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
101
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
102 call assert_fails('botright topleft wincmd v', 'E442:')
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
103 bw
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
104 endfunc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
105
15006
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
106 " Test the ":wincmd ^" and "<C-W>^" commands.
11197
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
107 func Test_window_split_edit_alternate()
15006
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
108
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
109 " Test for failure when the alternate buffer/file no longer exists.
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
110 edit Xfoo | %bw
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
111 call assert_fails(':wincmd ^', 'E23')
11197
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
112
15006
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
113 " Test for the expected behavior when we have two named buffers.
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
114 edit Xfoo | edit Xbar
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
115 wincmd ^
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
116 call assert_equal('Xfoo', bufname(winbufnr(1)))
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
117 call assert_equal('Xbar', bufname(winbufnr(2)))
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
118 only
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
119
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
120 " Test for the expected behavior when the alternate buffer is not named.
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
121 enew | let l:nr1 = bufnr('%')
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
122 edit Xfoo | let l:nr2 = bufnr('%')
11197
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
123 wincmd ^
15006
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
124 call assert_equal(l:nr1, winbufnr(1))
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
125 call assert_equal(l:nr2, winbufnr(2))
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
126 only
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
127
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
128 " Test the Normal mode command.
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
129 call feedkeys("\<C-W>\<C-^>", 'tx')
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
130 call assert_equal(l:nr2, winbufnr(1))
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
131 call assert_equal(l:nr1, winbufnr(2))
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
132
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
133 %bw!
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
134 endfunc
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
135
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
136 " Test the ":[count]wincmd ^" and "[count]<C-W>^" commands.
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
137 func Test_window_split_edit_bufnr()
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
138
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
139 %bwipeout
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
140 let l:nr = bufnr('%') + 1
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
141 call assert_fails(':execute "normal! ' . l:nr . '\<C-W>\<C-^>"', 'E92')
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
142 call assert_fails(':' . l:nr . 'wincmd ^', 'E16')
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
143 call assert_fails(':0wincmd ^', 'E16')
11197
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
144
15006
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
145 edit Xfoo | edit Xbar | edit Xbaz
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
146 let l:foo_nr = bufnr('Xfoo')
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
147 let l:bar_nr = bufnr('Xbar')
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
148 let l:baz_nr = bufnr('Xbaz')
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
149
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
150 call feedkeys(l:foo_nr . "\<C-W>\<C-^>", 'tx')
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
151 call assert_equal('Xfoo', bufname(winbufnr(1)))
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
152 call assert_equal('Xbaz', bufname(winbufnr(2)))
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
153 only
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
154
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
155 call feedkeys(l:bar_nr . "\<C-W>\<C-^>", 'tx')
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
156 call assert_equal('Xbar', bufname(winbufnr(1)))
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
157 call assert_equal('Xfoo', bufname(winbufnr(2)))
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
158 only
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
159
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
160 execute l:baz_nr . 'wincmd ^'
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
161 call assert_equal('Xbaz', bufname(winbufnr(1)))
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
162 call assert_equal('Xbar', bufname(winbufnr(2)))
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
163
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
164 %bw!
11197
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
165 endfunc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
166
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
167 func Test_window_preview()
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
168 " Open a preview window
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
169 pedit Xa
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
170 call assert_equal(2, winnr('$'))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
171 call assert_equal(0, &previewwindow)
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
172
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
173 " Go to the preview window
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
174 wincmd P
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
175 call assert_equal(1, &previewwindow)
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
176
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
177 " Close preview window
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
178 wincmd z
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
179 call assert_equal(1, winnr('$'))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
180 call assert_equal(0, &previewwindow)
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
181
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
182 call assert_fails('wincmd P', 'E441:')
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
183 endfunc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
184
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
185 func Test_window_exchange()
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
186 e Xa
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
187
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
188 " Nothing happens with window exchange when there is 1 window
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
189 wincmd x
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
190 call assert_equal(1, winnr('$'))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
191
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
192 split Xb
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
193 split Xc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
194
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
195 call assert_equal('Xc', bufname(winbufnr(1)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
196 call assert_equal('Xb', bufname(winbufnr(2)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
197 call assert_equal('Xa', bufname(winbufnr(3)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
198
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
199 " Exchange current window 1 with window 3
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
200 3wincmd x
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
201 call assert_equal('Xa', bufname(winbufnr(1)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
202 call assert_equal('Xb', bufname(winbufnr(2)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
203 call assert_equal('Xc', bufname(winbufnr(3)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
204
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
205 " Exchange window with next when at the top window
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
206 wincmd x
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
207 call assert_equal('Xb', bufname(winbufnr(1)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
208 call assert_equal('Xa', bufname(winbufnr(2)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
209 call assert_equal('Xc', bufname(winbufnr(3)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
210
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
211 " Exchange window with next when at the middle window
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
212 wincmd j
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
213 wincmd x
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
214 call assert_equal('Xb', bufname(winbufnr(1)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
215 call assert_equal('Xc', bufname(winbufnr(2)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
216 call assert_equal('Xa', bufname(winbufnr(3)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
217
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
218 " Exchange window with next when at the bottom window.
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
219 " When there is no next window, it exchanges with the previous window.
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
220 wincmd j
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
221 wincmd x
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
222 call assert_equal('Xb', bufname(winbufnr(1)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
223 call assert_equal('Xa', bufname(winbufnr(2)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
224 call assert_equal('Xc', bufname(winbufnr(3)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
225
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
226 bw Xa Xb Xc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
227 endfunc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
228
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
229 func Test_window_rotate()
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
230 e Xa
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
231 split Xb
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
232 split Xc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
233 call assert_equal('Xc', bufname(winbufnr(1)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
234 call assert_equal('Xb', bufname(winbufnr(2)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
235 call assert_equal('Xa', bufname(winbufnr(3)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
236
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
237 " Rotate downwards
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
238 wincmd r
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
239 call assert_equal('Xa', bufname(winbufnr(1)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
240 call assert_equal('Xc', bufname(winbufnr(2)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
241 call assert_equal('Xb', bufname(winbufnr(3)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
242
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
243 2wincmd r
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
244 call assert_equal('Xc', bufname(winbufnr(1)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
245 call assert_equal('Xb', bufname(winbufnr(2)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
246 call assert_equal('Xa', bufname(winbufnr(3)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
247
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
248 " Rotate upwards
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
249 wincmd R
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
250 call assert_equal('Xb', bufname(winbufnr(1)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
251 call assert_equal('Xa', bufname(winbufnr(2)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
252 call assert_equal('Xc', bufname(winbufnr(3)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
253
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
254 2wincmd R
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
255 call assert_equal('Xc', bufname(winbufnr(1)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
256 call assert_equal('Xb', bufname(winbufnr(2)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
257 call assert_equal('Xa', bufname(winbufnr(3)))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
258
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
259 bot vsplit
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
260 call assert_fails('wincmd R', 'E443:')
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
261
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
262 bw Xa Xb Xc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
263 endfunc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
264
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
265 func Test_window_height()
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
266 e Xa
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
267 split Xb
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
268
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
269 let [wh1, wh2] = [winheight(1), winheight(2)]
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
270 " Active window (1) should have the same height or 1 more
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
271 " than the other window.
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
272 call assert_inrange(wh2, wh2 + 1, wh1)
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
273
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
274 wincmd -
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
275 call assert_equal(wh1 - 1, winheight(1))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
276 call assert_equal(wh2 + 1, winheight(2))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
277
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
278 wincmd +
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
279 call assert_equal(wh1, winheight(1))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
280 call assert_equal(wh2, winheight(2))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
281
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
282 2wincmd _
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
283 call assert_equal(2, winheight(1))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
284 call assert_equal(wh1 + wh2 - 2, winheight(2))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
285
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
286 wincmd =
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
287 call assert_equal(wh1, winheight(1))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
288 call assert_equal(wh2, winheight(2))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
289
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
290 2wincmd _
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
291 set winfixheight
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
292 split Xc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
293 let [wh1, wh2, wh3] = [winheight(1), winheight(2), winheight(3)]
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
294 call assert_equal(2, winheight(2))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
295 call assert_inrange(wh3, wh3 + 1, wh1)
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
296 3wincmd +
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
297 call assert_equal(2, winheight(2))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
298 call assert_equal(wh1 + 3, winheight(1))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
299 call assert_equal(wh3 - 3, winheight(3))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
300 wincmd =
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
301 call assert_equal(2, winheight(2))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
302 call assert_equal(wh1, winheight(1))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
303 call assert_equal(wh3, winheight(3))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
304
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
305 wincmd j
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
306 set winfixheight&
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
307
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
308 wincmd =
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
309 let [wh1, wh2, wh3] = [winheight(1), winheight(2), winheight(3)]
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
310 " Current window (2) should have the same height or 1 more
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
311 " than the other windows.
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
312 call assert_inrange(wh1, wh1 + 1, wh2)
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
313 call assert_inrange(wh3, wh3 + 1, wh2)
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
314
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
315 bw Xa Xb Xc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
316 endfunc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
317
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
318 func Test_window_width()
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
319 e Xa
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
320 vsplit Xb
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
321
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
322 let [ww1, ww2] = [winwidth(1), winwidth(2)]
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
323 " Active window (1) should have the same width or 1 more
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
324 " than the other window.
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
325 call assert_inrange(ww2, ww2 + 1, ww1)
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
326
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
327 wincmd <
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
328 call assert_equal(ww1 - 1, winwidth(1))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
329 call assert_equal(ww2 + 1, winwidth(2))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
330
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
331 wincmd >
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
332 call assert_equal(ww1, winwidth(1))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
333 call assert_equal(ww2, winwidth(2))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
334
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
335 2wincmd |
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
336 call assert_equal(2, winwidth(1))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
337 call assert_equal(ww1 + ww2 - 2, winwidth(2))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
338
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
339 wincmd =
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
340 call assert_equal(ww1, winwidth(1))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
341 call assert_equal(ww2, winwidth(2))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
342
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
343 2wincmd |
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
344 set winfixwidth
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
345 vsplit Xc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
346 let [ww1, ww2, ww3] = [winwidth(1), winwidth(2), winwidth(3)]
11207
e6140f3d2be7 patch 8.0.0490: vertical split makes 'winfixwidth' window smaller
Christian Brabandt <cb@256bit.org>
parents: 11197
diff changeset
347 call assert_equal(2, winwidth(2))
11197
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
348 call assert_inrange(ww3, ww3 + 1, ww1)
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
349 3wincmd >
11207
e6140f3d2be7 patch 8.0.0490: vertical split makes 'winfixwidth' window smaller
Christian Brabandt <cb@256bit.org>
parents: 11197
diff changeset
350 call assert_equal(2, winwidth(2))
11197
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
351 call assert_equal(ww1 + 3, winwidth(1))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
352 call assert_equal(ww3 - 3, winwidth(3))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
353 wincmd =
11207
e6140f3d2be7 patch 8.0.0490: vertical split makes 'winfixwidth' window smaller
Christian Brabandt <cb@256bit.org>
parents: 11197
diff changeset
354 call assert_equal(2, winwidth(2))
11197
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
355 call assert_equal(ww1, winwidth(1))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
356 call assert_equal(ww3, winwidth(3))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
357
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
358 wincmd l
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
359 set winfixwidth&
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
360
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
361 wincmd =
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
362 let [ww1, ww2, ww3] = [winwidth(1), winwidth(2), winwidth(3)]
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
363 " Current window (2) should have the same width or 1 more
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
364 " than the other windows.
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
365 call assert_inrange(ww1, ww1 + 1, ww2)
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
366 call assert_inrange(ww3, ww3 + 1, ww2)
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
367
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
368 bw Xa Xb Xc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
369 endfunc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
370
11591
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
371 func Test_equalalways_on_close()
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
372 set equalalways
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
373 vsplit
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
374 windo split
15006
1fd8e32532f7 patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Bram Moolenaar <Bram@vim.org>
parents: 13880
diff changeset
375 split
11591
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
376 wincmd J
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
377 " now we have a frame top-left with two windows, a frame top-right with two
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
378 " windows and a frame at the bottom, full-width.
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
379 let height_1 = winheight(1)
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
380 let height_2 = winheight(2)
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
381 let height_3 = winheight(3)
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
382 let height_4 = winheight(4)
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
383 " closing the bottom window causes all windows to be resized.
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
384 close
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
385 call assert_notequal(height_1, winheight(1))
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
386 call assert_notequal(height_2, winheight(2))
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
387 call assert_notequal(height_3, winheight(3))
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
388 call assert_notequal(height_4, winheight(4))
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
389 call assert_equal(winheight(1), winheight(3))
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
390 call assert_equal(winheight(2), winheight(4))
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
391
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
392 1wincmd w
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
393 split
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
394 4wincmd w
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
395 resize + 5
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
396 " left column has three windows, equalized heights.
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
397 " right column has two windows, top one a bit higher
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
398 let height_1 = winheight(1)
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
399 let height_2 = winheight(2)
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
400 let height_4 = winheight(4)
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
401 let height_5 = winheight(5)
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
402 3wincmd w
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
403 " closing window in left column equalizes heights in left column but not in
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
404 " the right column
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
405 close
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
406 call assert_notequal(height_1, winheight(1))
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
407 call assert_notequal(height_2, winheight(2))
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
408 call assert_equal(height_4, winheight(3))
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
409 call assert_equal(height_5, winheight(4))
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
410
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
411 only
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
412 set equalalways&
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
413 endfunc
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
414
12977
2d817fd289ba patch 8.0.1364: there is no easy way to get the window position
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
415 func Test_win_screenpos()
2d817fd289ba patch 8.0.1364: there is no easy way to get the window position
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
416 call assert_equal(1, winnr('$'))
2d817fd289ba patch 8.0.1364: there is no easy way to get the window position
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
417 split
2d817fd289ba patch 8.0.1364: there is no easy way to get the window position
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
418 vsplit
2d817fd289ba patch 8.0.1364: there is no easy way to get the window position
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
419 10wincmd _
2d817fd289ba patch 8.0.1364: there is no easy way to get the window position
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
420 30wincmd |
2d817fd289ba patch 8.0.1364: there is no easy way to get the window position
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
421 call assert_equal([1, 1], win_screenpos(1))
2d817fd289ba patch 8.0.1364: there is no easy way to get the window position
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
422 call assert_equal([1, 32], win_screenpos(2))
2d817fd289ba patch 8.0.1364: there is no easy way to get the window position
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
423 call assert_equal([12, 1], win_screenpos(3))
2d817fd289ba patch 8.0.1364: there is no easy way to get the window position
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
424 call assert_equal([0, 0], win_screenpos(4))
2d817fd289ba patch 8.0.1364: there is no easy way to get the window position
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
425 only
2d817fd289ba patch 8.0.1364: there is no easy way to get the window position
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
426 endfunc
2d817fd289ba patch 8.0.1364: there is no easy way to get the window position
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
427
11197
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
428 func Test_window_jump_tag()
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
429 help
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
430 /iccf
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
431 call assert_match('^|iccf|', getline('.'))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
432 call assert_equal(2, winnr('$'))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
433 2wincmd }
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
434 call assert_equal(3, winnr('$'))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
435 call assert_match('^|iccf|', getline('.'))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
436 wincmd k
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
437 call assert_match('\*iccf\*', getline('.'))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
438 call assert_equal(2, winheight(0))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
439
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
440 wincmd z
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
441 set previewheight=4
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
442 help
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
443 /bugs
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
444 wincmd }
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
445 wincmd k
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
446 call assert_match('\*bugs\*', getline('.'))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
447 call assert_equal(4, winheight(0))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
448 set previewheight&
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
449
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
450 %bw!
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
451 endfunc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
452
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
453 func Test_window_newtab()
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
454 e Xa
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
455
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
456 call assert_equal(1, tabpagenr('$'))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
457 call assert_equal("\nAlready only one window", execute('wincmd T'))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
458
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
459 split Xb
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
460 split Xc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
461
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
462 wincmd T
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
463 call assert_equal(2, tabpagenr('$'))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
464 call assert_equal(['Xb', 'Xa'], map(tabpagebuflist(1), 'bufname(v:val)'))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
465 call assert_equal(['Xc' ], map(tabpagebuflist(2), 'bufname(v:val)'))
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
466
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
467 %bw!
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
468 endfunc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
469
11193
75ccc8a15a51 patch 8.0.0483: illegal memory access when using :all
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
470 func Test_next_split_all()
75ccc8a15a51 patch 8.0.0483: illegal memory access when using :all
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
471 " This was causing an illegal memory access.
75ccc8a15a51 patch 8.0.0483: illegal memory access when using :all
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
472 n x
75ccc8a15a51 patch 8.0.0483: illegal memory access when using :all
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
473 norm axxx
75ccc8a15a51 patch 8.0.0483: illegal memory access when using :all
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
474 split
75ccc8a15a51 patch 8.0.0483: illegal memory access when using :all
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
475 split
75ccc8a15a51 patch 8.0.0483: illegal memory access when using :all
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
476 s/x
75ccc8a15a51 patch 8.0.0483: illegal memory access when using :all
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
477 s/x
75ccc8a15a51 patch 8.0.0483: illegal memory access when using :all
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
478 all
75ccc8a15a51 patch 8.0.0483: illegal memory access when using :all
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
479 bwipe!
75ccc8a15a51 patch 8.0.0483: illegal memory access when using :all
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
480 endfunc
75ccc8a15a51 patch 8.0.0483: illegal memory access when using :all
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
481
12019
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
482 " Tests for adjusting window and contents
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
483 func GetScreenStr(row)
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
484 let str = ""
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
485 for c in range(1,3)
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
486 let str .= nr2char(screenchar(a:row, c))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
487 endfor
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
488 return str
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
489 endfunc
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
490
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
491 func Test_window_contents()
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
492 enew! | only | new
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
493 call setline(1, range(1,256))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
494
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
495 exe "norm! \<C-W>t\<C-W>=1Gzt\<C-W>w\<C-W>+"
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
496 redraw
13880
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
497 let s3 = GetScreenStr(1)
12019
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
498 wincmd p
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
499 call assert_equal(1, line("w0"))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
500 call assert_equal('1 ', s3)
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
501
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
502 exe "norm! \<C-W>t\<C-W>=50Gzt\<C-W>w\<C-W>+"
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
503 redraw
13880
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
504 let s3 = GetScreenStr(1)
12019
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
505 wincmd p
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
506 call assert_equal(50, line("w0"))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
507 call assert_equal('50 ', s3)
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
508
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
509 exe "norm! \<C-W>t\<C-W>=59Gzt\<C-W>w\<C-W>+"
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
510 redraw
13880
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
511 let s3 = GetScreenStr(1)
12019
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
512 wincmd p
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
513 call assert_equal(59, line("w0"))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
514 call assert_equal('59 ', s3)
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
515
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
516 bwipeout!
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
517 call test_garbagecollect_now()
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
518 endfunc
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
519
13072
50aa6da392ce patch 8.0.1411: reading invalid memory with CTRL-W :
Christian Brabandt <cb@256bit.org>
parents: 12977
diff changeset
520 func Test_window_colon_command()
50aa6da392ce patch 8.0.1411: reading invalid memory with CTRL-W :
Christian Brabandt <cb@256bit.org>
parents: 12977
diff changeset
521 " This was reading invalid memory.
50aa6da392ce patch 8.0.1411: reading invalid memory with CTRL-W :
Christian Brabandt <cb@256bit.org>
parents: 12977
diff changeset
522 exe "norm! v\<C-W>:\<C-U>echo v:version"
50aa6da392ce patch 8.0.1411: reading invalid memory with CTRL-W :
Christian Brabandt <cb@256bit.org>
parents: 12977
diff changeset
523 endfunc
50aa6da392ce patch 8.0.1411: reading invalid memory with CTRL-W :
Christian Brabandt <cb@256bit.org>
parents: 12977
diff changeset
524
13144
20fb8c711050 patch 8.0.1446: acessing freed memory after window command in auto command
Christian Brabandt <cb@256bit.org>
parents: 13072
diff changeset
525 func Test_access_freed_mem()
20fb8c711050 patch 8.0.1446: acessing freed memory after window command in auto command
Christian Brabandt <cb@256bit.org>
parents: 13072
diff changeset
526 " This was accessing freed memory
20fb8c711050 patch 8.0.1446: acessing freed memory after window command in auto command
Christian Brabandt <cb@256bit.org>
parents: 13072
diff changeset
527 au * 0 vs xxx
20fb8c711050 patch 8.0.1446: acessing freed memory after window command in auto command
Christian Brabandt <cb@256bit.org>
parents: 13072
diff changeset
528 arg 0
20fb8c711050 patch 8.0.1446: acessing freed memory after window command in auto command
Christian Brabandt <cb@256bit.org>
parents: 13072
diff changeset
529 argadd
20fb8c711050 patch 8.0.1446: acessing freed memory after window command in auto command
Christian Brabandt <cb@256bit.org>
parents: 13072
diff changeset
530 all
20fb8c711050 patch 8.0.1446: acessing freed memory after window command in auto command
Christian Brabandt <cb@256bit.org>
parents: 13072
diff changeset
531 all
20fb8c711050 patch 8.0.1446: acessing freed memory after window command in auto command
Christian Brabandt <cb@256bit.org>
parents: 13072
diff changeset
532 au!
20fb8c711050 patch 8.0.1446: acessing freed memory after window command in auto command
Christian Brabandt <cb@256bit.org>
parents: 13072
diff changeset
533 bwipe xxx
20fb8c711050 patch 8.0.1446: acessing freed memory after window command in auto command
Christian Brabandt <cb@256bit.org>
parents: 13072
diff changeset
534 endfunc
20fb8c711050 patch 8.0.1446: acessing freed memory after window command in auto command
Christian Brabandt <cb@256bit.org>
parents: 13072
diff changeset
535
13666
57da3d873f20 patch 8.0.1705: when making a vertical split the mode message isn't updated
Christian Brabandt <cb@256bit.org>
parents: 13144
diff changeset
536 func Test_visual_cleared_after_window_split()
57da3d873f20 patch 8.0.1705: when making a vertical split the mode message isn't updated
Christian Brabandt <cb@256bit.org>
parents: 13144
diff changeset
537 new | only!
57da3d873f20 patch 8.0.1705: when making a vertical split the mode message isn't updated
Christian Brabandt <cb@256bit.org>
parents: 13144
diff changeset
538 let smd_save = &showmode
57da3d873f20 patch 8.0.1705: when making a vertical split the mode message isn't updated
Christian Brabandt <cb@256bit.org>
parents: 13144
diff changeset
539 set showmode
57da3d873f20 patch 8.0.1705: when making a vertical split the mode message isn't updated
Christian Brabandt <cb@256bit.org>
parents: 13144
diff changeset
540 let ls_save = &laststatus
57da3d873f20 patch 8.0.1705: when making a vertical split the mode message isn't updated
Christian Brabandt <cb@256bit.org>
parents: 13144
diff changeset
541 set laststatus=1
57da3d873f20 patch 8.0.1705: when making a vertical split the mode message isn't updated
Christian Brabandt <cb@256bit.org>
parents: 13144
diff changeset
542 call setline(1, ['a', 'b', 'c', 'd', ''])
57da3d873f20 patch 8.0.1705: when making a vertical split the mode message isn't updated
Christian Brabandt <cb@256bit.org>
parents: 13144
diff changeset
543 norm! G
57da3d873f20 patch 8.0.1705: when making a vertical split the mode message isn't updated
Christian Brabandt <cb@256bit.org>
parents: 13144
diff changeset
544 exe "norm! kkvk"
57da3d873f20 patch 8.0.1705: when making a vertical split the mode message isn't updated
Christian Brabandt <cb@256bit.org>
parents: 13144
diff changeset
545 redraw
57da3d873f20 patch 8.0.1705: when making a vertical split the mode message isn't updated
Christian Brabandt <cb@256bit.org>
parents: 13144
diff changeset
546 exe "norm! \<C-W>v"
57da3d873f20 patch 8.0.1705: when making a vertical split the mode message isn't updated
Christian Brabandt <cb@256bit.org>
parents: 13144
diff changeset
547 redraw
57da3d873f20 patch 8.0.1705: when making a vertical split the mode message isn't updated
Christian Brabandt <cb@256bit.org>
parents: 13144
diff changeset
548 " check if '-- VISUAL --' disappeared from command line
57da3d873f20 patch 8.0.1705: when making a vertical split the mode message isn't updated
Christian Brabandt <cb@256bit.org>
parents: 13144
diff changeset
549 let columns = range(1, &columns)
57da3d873f20 patch 8.0.1705: when making a vertical split the mode message isn't updated
Christian Brabandt <cb@256bit.org>
parents: 13144
diff changeset
550 let cmdlinechars = map(columns, 'nr2char(screenchar(&lines, v:val))')
57da3d873f20 patch 8.0.1705: when making a vertical split the mode message isn't updated
Christian Brabandt <cb@256bit.org>
parents: 13144
diff changeset
551 let cmdline = join(cmdlinechars, '')
57da3d873f20 patch 8.0.1705: when making a vertical split the mode message isn't updated
Christian Brabandt <cb@256bit.org>
parents: 13144
diff changeset
552 let cmdline_ltrim = substitute(cmdline, '^\s*', "", "")
57da3d873f20 patch 8.0.1705: when making a vertical split the mode message isn't updated
Christian Brabandt <cb@256bit.org>
parents: 13144
diff changeset
553 let mode_shown = substitute(cmdline_ltrim, '\s*$', "", "")
57da3d873f20 patch 8.0.1705: when making a vertical split the mode message isn't updated
Christian Brabandt <cb@256bit.org>
parents: 13144
diff changeset
554 call assert_equal('', mode_shown)
57da3d873f20 patch 8.0.1705: when making a vertical split the mode message isn't updated
Christian Brabandt <cb@256bit.org>
parents: 13144
diff changeset
555 let &showmode = smd_save
57da3d873f20 patch 8.0.1705: when making a vertical split the mode message isn't updated
Christian Brabandt <cb@256bit.org>
parents: 13144
diff changeset
556 let &laststatus = ls_save
57da3d873f20 patch 8.0.1705: when making a vertical split the mode message isn't updated
Christian Brabandt <cb@256bit.org>
parents: 13144
diff changeset
557 bwipe!
57da3d873f20 patch 8.0.1705: when making a vertical split the mode message isn't updated
Christian Brabandt <cb@256bit.org>
parents: 13144
diff changeset
558 endfunc
57da3d873f20 patch 8.0.1705: when making a vertical split the mode message isn't updated
Christian Brabandt <cb@256bit.org>
parents: 13144
diff changeset
559
13880
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
560 func Test_winrestcmd()
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
561 2split
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
562 3vsplit
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
563 let a = winrestcmd()
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
564 call assert_equal(2, winheight(0))
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
565 call assert_equal(3, winwidth(0))
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
566 wincmd =
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
567 call assert_notequal(2, winheight(0))
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
568 call assert_notequal(3, winwidth(0))
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
569 exe a
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
570 call assert_equal(2, winheight(0))
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
571 call assert_equal(3, winwidth(0))
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
572 only
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
573 endfunc
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
574
9909
3ee84d270ea7 commit https://github.com/vim/vim/commit/9e4d8215d386100ab660d7d11e6620fd148b605e
Christian Brabandt <cb@256bit.org>
parents: 9349
diff changeset
575 " vim: shiftwidth=2 sts=2 expandtab