annotate src/testdir/test_window_cmd.vim @ 19783:546bdeef35f1 v8.2.0448

patch 8.2.0448: various functions not properly tested Commit: https://github.com/vim/vim/commit/0e05de46226eb4e5ea580beefa71831f92d613d3 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Mar 25 22:23:46 2020 +0100 patch 8.2.0448: various functions not properly tested Problem: Various functions not properly tested. Solution: Add more tests, especially for failures. (Yegappan Lakshmanan, closes #5843)
author Bram Moolenaar <Bram@vim.org>
date Wed, 25 Mar 2020 22:30:04 +0100
parents 0927df746554
children 2c4d9ca33769
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
18253
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
3 so check.vim
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
4
9102
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 func Test_window_cmd_ls0_with_split()
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 set ls=0
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 set splitbelow
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 split
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 quit
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 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
11 new | only!
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 "
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 set splitbelow&vim
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 botright split
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 quit
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 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
17 new | only!
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 set ls&vim
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 endfunc
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 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
22 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
23 for v in range(0, 2)
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 exec "set ls=" . v
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 vsplit
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 call feedkeys("q:\<CR>")
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 let ac = &lines - (&cmdheight + winheight(0) + !!v)
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 let emsg = printf(efmt, ac, v, 'left')
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 call assert_equal(0, ac, emsg)
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 wincmd w
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 let ac = &lines - (&cmdheight + winheight(0) + !!v)
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 let emsg = printf(efmt, ac, v, 'right')
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 call assert_equal(0, ac, emsg)
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 new | only!
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 endfor
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 set ls&vim
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 endfunc
0e90f3e13d88 commit https://github.com/vim/vim/commit/991dea3ab185fb35e577ab0bdfd443cd4b43ccc6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38
9349
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
39 function Test_window_cmd_wincmd_gf()
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
40 let fname = 'test_gf.txt'
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
41 let swp_fname = '.' . fname . '.swp'
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
42 call writefile([], fname)
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
43 call writefile([], swp_fname)
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
44 function s:swap_exists()
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
45 let v:swapchoice = s:swap_choice
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
46 endfunc
17360
cb71b5e9e5d9 patch 8.1.1679: test using SwapExists autocommand file may fail
Bram Moolenaar <Bram@vim.org>
parents: 16690
diff changeset
47 " Remove the catch-all that runtest.vim adds
cb71b5e9e5d9 patch 8.1.1679: test using SwapExists autocommand file may fail
Bram Moolenaar <Bram@vim.org>
parents: 16690
diff changeset
48 au! SwapExists
9349
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
49 augroup test_window_cmd_wincmd_gf
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
50 autocmd!
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
51 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
52 augroup END
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
53
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
54 call setline(1, fname)
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
55 " (E)dit anyway
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
56 let s:swap_choice = 'e'
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
57 wincmd gf
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
58 call assert_equal(2, tabpagenr())
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
59 call assert_equal(fname, bufname("%"))
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
60 quit!
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
61
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
62 " (Q)uit
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
63 let s:swap_choice = 'q'
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
64 wincmd gf
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
65 call assert_equal(1, tabpagenr())
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
66 call assert_notequal(fname, bufname("%"))
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
67 new | only!
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
68
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
69 call delete(fname)
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
70 call delete(swp_fname)
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
71 augroup! test_window_cmd_wincmd_gf
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
72 endfunc
b24900b73f90 commit https://github.com/vim/vim/commit/5d2ca0402954ff79b73d9c86cc16c8a6454b75a7
Christian Brabandt <cb@256bit.org>
parents: 9102
diff changeset
73
11197
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
74 func Test_window_quit()
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
75 e Xa
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
76 split Xb
18035
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
77 call assert_equal(2, '$'->winnr())
11197
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
78 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
79 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
80
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
81 wincmd q
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
82 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
83 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
84
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
85 bw Xa Xb
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
86 endfunc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
87
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
88 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
89 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
90 3wincmd s
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
91 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
92 call assert_equal(3, winheight(0))
18035
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
93 call assert_equal(winwidth(1), 2->winwidth())
11197
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 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
96 bw
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
97 endfunc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
98
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
99 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
100 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
101 3wincmd v
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
102 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
103 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
104 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
105
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
106 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
107 bw
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
108 endfunc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
109
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
110 " 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
111 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
112
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 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
114 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
115 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
116
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
117 " 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
118 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
119 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
120 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
121 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
122 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
123
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 " 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
125 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
126 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
127 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
128 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
129 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
130 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
131
15012
55663ef68467 patch 8.1.0517: Test_window_split_edit_alternate() fails on AppVeyor
Bram Moolenaar <Bram@vim.org>
parents: 15006
diff changeset
132 " FIXME: this currently fails on AppVeyor, but passes locally
55663ef68467 patch 8.1.0517: Test_window_split_edit_alternate() fails on AppVeyor
Bram Moolenaar <Bram@vim.org>
parents: 15006
diff changeset
133 if !has('win32')
55663ef68467 patch 8.1.0517: Test_window_split_edit_alternate() fails on AppVeyor
Bram Moolenaar <Bram@vim.org>
parents: 15006
diff changeset
134 " Test the Normal mode command.
55663ef68467 patch 8.1.0517: Test_window_split_edit_alternate() fails on AppVeyor
Bram Moolenaar <Bram@vim.org>
parents: 15006
diff changeset
135 call feedkeys("\<C-W>\<C-^>", 'tx')
55663ef68467 patch 8.1.0517: Test_window_split_edit_alternate() fails on AppVeyor
Bram Moolenaar <Bram@vim.org>
parents: 15006
diff changeset
136 call assert_equal(l:nr2, winbufnr(1))
55663ef68467 patch 8.1.0517: Test_window_split_edit_alternate() fails on AppVeyor
Bram Moolenaar <Bram@vim.org>
parents: 15006
diff changeset
137 call assert_equal(l:nr1, winbufnr(2))
55663ef68467 patch 8.1.0517: Test_window_split_edit_alternate() fails on AppVeyor
Bram Moolenaar <Bram@vim.org>
parents: 15006
diff changeset
138 endif
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
139
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 %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
141 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
142
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 " 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
144 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
145
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 %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
147 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
148 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
149 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
150 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
151
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
152 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
153 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
154 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
155 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
156
15014
cc4c41448d77 patch 8.1.0518: Test_window_split_edit_bufnr() fails on AppVeyor
Bram Moolenaar <Bram@vim.org>
parents: 15012
diff changeset
157 " FIXME: this currently fails on AppVeyor, but passes locally
cc4c41448d77 patch 8.1.0518: Test_window_split_edit_bufnr() fails on AppVeyor
Bram Moolenaar <Bram@vim.org>
parents: 15012
diff changeset
158 if !has('win32')
cc4c41448d77 patch 8.1.0518: Test_window_split_edit_bufnr() fails on AppVeyor
Bram Moolenaar <Bram@vim.org>
parents: 15012
diff changeset
159 call feedkeys(l:foo_nr . "\<C-W>\<C-^>", 'tx')
cc4c41448d77 patch 8.1.0518: Test_window_split_edit_bufnr() fails on AppVeyor
Bram Moolenaar <Bram@vim.org>
parents: 15012
diff changeset
160 call assert_equal('Xfoo', bufname(winbufnr(1)))
cc4c41448d77 patch 8.1.0518: Test_window_split_edit_bufnr() fails on AppVeyor
Bram Moolenaar <Bram@vim.org>
parents: 15012
diff changeset
161 call assert_equal('Xbaz', bufname(winbufnr(2)))
cc4c41448d77 patch 8.1.0518: Test_window_split_edit_bufnr() fails on AppVeyor
Bram Moolenaar <Bram@vim.org>
parents: 15012
diff changeset
162 only
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
163
15014
cc4c41448d77 patch 8.1.0518: Test_window_split_edit_bufnr() fails on AppVeyor
Bram Moolenaar <Bram@vim.org>
parents: 15012
diff changeset
164 call feedkeys(l:bar_nr . "\<C-W>\<C-^>", 'tx')
cc4c41448d77 patch 8.1.0518: Test_window_split_edit_bufnr() fails on AppVeyor
Bram Moolenaar <Bram@vim.org>
parents: 15012
diff changeset
165 call assert_equal('Xbar', bufname(winbufnr(1)))
cc4c41448d77 patch 8.1.0518: Test_window_split_edit_bufnr() fails on AppVeyor
Bram Moolenaar <Bram@vim.org>
parents: 15012
diff changeset
166 call assert_equal('Xfoo', bufname(winbufnr(2)))
cc4c41448d77 patch 8.1.0518: Test_window_split_edit_bufnr() fails on AppVeyor
Bram Moolenaar <Bram@vim.org>
parents: 15012
diff changeset
167 only
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
168
15014
cc4c41448d77 patch 8.1.0518: Test_window_split_edit_bufnr() fails on AppVeyor
Bram Moolenaar <Bram@vim.org>
parents: 15012
diff changeset
169 execute l:baz_nr . 'wincmd ^'
cc4c41448d77 patch 8.1.0518: Test_window_split_edit_bufnr() fails on AppVeyor
Bram Moolenaar <Bram@vim.org>
parents: 15012
diff changeset
170 call assert_equal('Xbaz', bufname(winbufnr(1)))
cc4c41448d77 patch 8.1.0518: Test_window_split_edit_bufnr() fails on AppVeyor
Bram Moolenaar <Bram@vim.org>
parents: 15012
diff changeset
171 call assert_equal('Xbar', bufname(winbufnr(2)))
cc4c41448d77 patch 8.1.0518: Test_window_split_edit_bufnr() fails on AppVeyor
Bram Moolenaar <Bram@vim.org>
parents: 15012
diff changeset
172 endif
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
173
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
174 %bw!
11197
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
175 endfunc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
176
19740
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
177 func Test_window_split_no_room()
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
178 " N horizontal windows need >= 2*N + 1 lines:
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
179 " - 1 line + 1 status line in each window
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
180 " - 1 Ex command line
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
181 "
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
182 " 2*N + 1 <= &lines
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
183 " N <= (lines - 1)/2
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
184 "
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
185 " Beyond that number of windows, E36: Not enough room is expected.
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
186 let hor_win_count = (&lines - 1)/2
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
187 let hor_split_count = hor_win_count - 1
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
188 for s in range(1, hor_split_count) | split | endfor
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
189 call assert_fails('split', 'E36:')
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
190
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
191 " N vertical windows need >= 2*(N - 1) + 1 columns:
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
192 " - 1 column + 1 separator for each window (except last window)
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
193 " - 1 column for the last window which does not have separator
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
194 "
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
195 " 2*(N - 1) + 1 <= &columns
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
196 " 2*N - 1 <= &columns
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
197 " N <= (&columns + 1)/2
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
198 let ver_win_count = (&columns + 1)/2
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
199 let ver_split_count = ver_win_count - 1
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
200 for s in range(1, ver_split_count) | vsplit | endfor
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
201 call assert_fails('vsplit', 'E36:')
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
202
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
203 %bw!
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
204 endfunc
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
205
11197
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
206 func Test_window_preview()
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18253
diff changeset
207 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18253
diff changeset
208
11197
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
209 " Open a preview window
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
210 pedit Xa
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
211 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
212 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
213
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
214 " 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
215 wincmd P
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
216 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
217
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
218 " Close preview window
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
219 wincmd z
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
220 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
221 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
222
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
223 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
224 endfunc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
225
17746
a4e488a6655c patch 8.1.1870: using :pedit from a help file sets help filetype
Bram Moolenaar <Bram@vim.org>
parents: 17516
diff changeset
226 func Test_window_preview_from_help()
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18253
diff changeset
227 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18253
diff changeset
228
17746
a4e488a6655c patch 8.1.1870: using :pedit from a help file sets help filetype
Bram Moolenaar <Bram@vim.org>
parents: 17516
diff changeset
229 filetype on
a4e488a6655c patch 8.1.1870: using :pedit from a help file sets help filetype
Bram Moolenaar <Bram@vim.org>
parents: 17516
diff changeset
230 call writefile(['/* some C code */'], 'Xpreview.c')
a4e488a6655c patch 8.1.1870: using :pedit from a help file sets help filetype
Bram Moolenaar <Bram@vim.org>
parents: 17516
diff changeset
231 help
a4e488a6655c patch 8.1.1870: using :pedit from a help file sets help filetype
Bram Moolenaar <Bram@vim.org>
parents: 17516
diff changeset
232 pedit Xpreview.c
a4e488a6655c patch 8.1.1870: using :pedit from a help file sets help filetype
Bram Moolenaar <Bram@vim.org>
parents: 17516
diff changeset
233 wincmd P
a4e488a6655c patch 8.1.1870: using :pedit from a help file sets help filetype
Bram Moolenaar <Bram@vim.org>
parents: 17516
diff changeset
234 call assert_equal(1, &previewwindow)
a4e488a6655c patch 8.1.1870: using :pedit from a help file sets help filetype
Bram Moolenaar <Bram@vim.org>
parents: 17516
diff changeset
235 call assert_equal('c', &filetype)
a4e488a6655c patch 8.1.1870: using :pedit from a help file sets help filetype
Bram Moolenaar <Bram@vim.org>
parents: 17516
diff changeset
236 wincmd z
a4e488a6655c patch 8.1.1870: using :pedit from a help file sets help filetype
Bram Moolenaar <Bram@vim.org>
parents: 17516
diff changeset
237
a4e488a6655c patch 8.1.1870: using :pedit from a help file sets help filetype
Bram Moolenaar <Bram@vim.org>
parents: 17516
diff changeset
238 filetype off
a4e488a6655c patch 8.1.1870: using :pedit from a help file sets help filetype
Bram Moolenaar <Bram@vim.org>
parents: 17516
diff changeset
239 close
a4e488a6655c patch 8.1.1870: using :pedit from a help file sets help filetype
Bram Moolenaar <Bram@vim.org>
parents: 17516
diff changeset
240 call delete('Xpreview.c')
a4e488a6655c patch 8.1.1870: using :pedit from a help file sets help filetype
Bram Moolenaar <Bram@vim.org>
parents: 17516
diff changeset
241 endfunc
a4e488a6655c patch 8.1.1870: using :pedit from a help file sets help filetype
Bram Moolenaar <Bram@vim.org>
parents: 17516
diff changeset
242
11197
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
243 func Test_window_exchange()
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
244 e Xa
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
245
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
246 " 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
247 wincmd x
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
248 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
249
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
250 split Xb
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
251 split Xc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
252
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
253 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
254 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
255 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
256
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
257 " 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
258 3wincmd x
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
259 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
260 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
261 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
262
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
263 " 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
264 wincmd x
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
265 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
266 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
267 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
268
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
269 " 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
270 wincmd j
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
271 wincmd x
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
272 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
273 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
274 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
275
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
276 " 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
277 " 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
278 wincmd j
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
279 wincmd x
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
280 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
281 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
282 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
283
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
284 bw Xa Xb Xc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
285 endfunc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
286
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
287 func Test_window_rotate()
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
288 e Xa
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
289 split Xb
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
290 split Xc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
291 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
292 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
293 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
294
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
295 " Rotate downwards
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
296 wincmd r
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
297 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
298 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
299 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
300
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
301 2wincmd r
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
302 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
303 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
304 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
305
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
306 " Rotate upwards
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
307 wincmd R
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
308 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
309 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
310 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
311
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
312 2wincmd R
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
313 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
314 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
315 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
316
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
317 bot vsplit
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
318 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
319
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
320 bw Xa Xb Xc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
321 endfunc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
322
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
323 func Test_window_height()
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
324 e Xa
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
325 split Xb
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 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
328 " 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
329 " than the other window.
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
330 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
331
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
332 wincmd -
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
333 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
334 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
335
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
336 wincmd +
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
337 call assert_equal(wh1, winheight(1))
18035
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
338 call assert_equal(wh2, 2->winheight())
11197
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
339
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
340 2wincmd _
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
341 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
342 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
343
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
344 wincmd =
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
345 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
346 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
347
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
348 2wincmd _
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
349 set winfixheight
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
350 split Xc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
351 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
352 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
353 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
354 3wincmd +
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
355 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
356 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
357 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
358 wincmd =
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
359 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
360 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
361 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
362
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
363 wincmd j
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
364 set winfixheight&
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
365
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
366 wincmd =
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
367 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
368 " 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
369 " than the other windows.
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
370 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
371 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
372
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
373 bw Xa Xb Xc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
374 endfunc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
375
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
376 func Test_window_width()
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
377 e Xa
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
378 vsplit Xb
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
379
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
380 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
381 " 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
382 " than the other window.
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
383 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
384
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
385 wincmd <
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
386 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
387 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
388
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
389 wincmd >
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
390 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
391 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
392
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
393 2wincmd |
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
394 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
395 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
396
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
397 wincmd =
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
398 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
399 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
400
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
401 2wincmd |
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
402 set winfixwidth
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
403 vsplit Xc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
404 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
405 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
406 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
407 3wincmd >
11207
e6140f3d2be7 patch 8.0.0490: vertical split makes 'winfixwidth' window smaller
Christian Brabandt <cb@256bit.org>
parents: 11197
diff changeset
408 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
409 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
410 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
411 wincmd =
11207
e6140f3d2be7 patch 8.0.0490: vertical split makes 'winfixwidth' window smaller
Christian Brabandt <cb@256bit.org>
parents: 11197
diff changeset
412 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
413 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
414 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
415
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
416 wincmd l
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
417 set winfixwidth&
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
418
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
419 wincmd =
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
420 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
421 " 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
422 " than the other windows.
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
423 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
424 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
425
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
426 bw Xa Xb Xc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
427 endfunc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
428
11591
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
429 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
430 set equalalways
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
431 vsplit
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
432 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
433 split
11591
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
434 wincmd J
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
435 " 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
436 " 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
437 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
438 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
439 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
440 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
441 " 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
442 close
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
443 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
444 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
445 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
446 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
447 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
448 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
449
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
450 1wincmd w
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
451 split
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
452 4wincmd w
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
453 resize + 5
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
454 " 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
455 " 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
456 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
457 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
458 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
459 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
460 3wincmd w
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
461 " 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
462 " the right column
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
463 close
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
464 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
465 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
466 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
467 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
468
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
469 only
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
470 set equalalways&
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
471 endfunc
d06a3db9b651 patch 8.0.0678: closing a window does not trigger resizing
Christian Brabandt <cb@256bit.org>
parents: 11207
diff changeset
472
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
473 func Test_win_screenpos()
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18253
diff changeset
474 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18253
diff changeset
475
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
476 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
477 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
478 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
479 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
480 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
481 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
482 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
483 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
484 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
485 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
486 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
487
11197
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
488 func Test_window_jump_tag()
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18253
diff changeset
489 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18253
diff changeset
490
11197
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
491 help
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
492 /iccf
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
493 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
494 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
495 2wincmd }
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
496 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
497 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
498 wincmd k
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
499 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
500 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
501
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
502 wincmd z
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
503 set previewheight=4
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
504 help
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
505 /bugs
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
506 wincmd }
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
507 wincmd k
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
508 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
509 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
510 set previewheight&
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
511
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
512 %bw!
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
513 endfunc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
514
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
515 func Test_window_newtab()
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
516 e Xa
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
517
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
518 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
519 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
520
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
521 split Xb
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
522 split Xc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
523
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
524 wincmd T
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
525 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
526 call assert_equal(['Xb', 'Xa'], map(tabpagebuflist(1), 'bufname(v:val)'))
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17746
diff changeset
527 call assert_equal(['Xc' ], map(2->tabpagebuflist(), 'bufname(v:val)'))
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19752
diff changeset
528 call assert_equal(['Xc' ], map(tabpagebuflist(), 'bufname(v:val)'))
11197
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
529
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
530 %bw!
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
531 endfunc
7f355d8cd634 patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents: 11193
diff changeset
532
11193
75ccc8a15a51 patch 8.0.0483: illegal memory access when using :all
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
533 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
534 " 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
535 n x
75ccc8a15a51 patch 8.0.0483: illegal memory access when using :all
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
536 norm axxx
75ccc8a15a51 patch 8.0.0483: illegal memory access when using :all
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
537 split
75ccc8a15a51 patch 8.0.0483: illegal memory access when using :all
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
538 split
75ccc8a15a51 patch 8.0.0483: illegal memory access when using :all
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
539 s/x
75ccc8a15a51 patch 8.0.0483: illegal memory access when using :all
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
540 s/x
75ccc8a15a51 patch 8.0.0483: illegal memory access when using :all
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
541 all
75ccc8a15a51 patch 8.0.0483: illegal memory access when using :all
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
542 bwipe!
75ccc8a15a51 patch 8.0.0483: illegal memory access when using :all
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
543 endfunc
75ccc8a15a51 patch 8.0.0483: illegal memory access when using :all
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
544
12019
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
545 " 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
546 func GetScreenStr(row)
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
547 let str = ""
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
548 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
549 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
550 endfor
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
551 return str
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
552 endfunc
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
553
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
554 func Test_window_contents()
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
555 enew! | only | new
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
556 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
557
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
558 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
559 redraw
13880
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
560 let s3 = GetScreenStr(1)
12019
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
561 wincmd p
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
562 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
563 call assert_equal('1 ', s3)
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
564
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
565 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
566 redraw
13880
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
567 let s3 = GetScreenStr(1)
12019
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
568 wincmd p
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
569 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
570 call assert_equal('50 ', s3)
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
571
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
572 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
573 redraw
13880
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
574 let s3 = GetScreenStr(1)
12019
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
575 wincmd p
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
576 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
577 call assert_equal('59 ', s3)
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
578
19724
b3e93a05c3ca patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19435
diff changeset
579 %d
b3e93a05c3ca patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19435
diff changeset
580 call setline(1, ['one', 'two', 'three'])
b3e93a05c3ca patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19435
diff changeset
581 call assert_equal(1, line('w0'))
b3e93a05c3ca patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19435
diff changeset
582 call assert_equal(3, line('w$'))
b3e93a05c3ca patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19435
diff changeset
583
12019
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
584 bwipeout!
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
585 call test_garbagecollect_now()
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
586 endfunc
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11591
diff changeset
587
13072
50aa6da392ce patch 8.0.1411: reading invalid memory with CTRL-W :
Christian Brabandt <cb@256bit.org>
parents: 12977
diff changeset
588 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
589 " 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
590 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
591 endfunc
50aa6da392ce patch 8.0.1411: reading invalid memory with CTRL-W :
Christian Brabandt <cb@256bit.org>
parents: 12977
diff changeset
592
13144
20fb8c711050 patch 8.0.1446: acessing freed memory after window command in auto command
Christian Brabandt <cb@256bit.org>
parents: 13072
diff changeset
593 func Test_access_freed_mem()
17516
711db62c8aca patch 8.1.1756: autocommand that splits window messes up window layout
Bram Moolenaar <Bram@vim.org>
parents: 17360
diff changeset
594 call assert_equal(&columns, winwidth(0))
13144
20fb8c711050 patch 8.0.1446: acessing freed memory after window command in auto command
Christian Brabandt <cb@256bit.org>
parents: 13072
diff changeset
595 " 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
596 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
597 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
598 argadd
17516
711db62c8aca patch 8.1.1756: autocommand that splits window messes up window layout
Bram Moolenaar <Bram@vim.org>
parents: 17360
diff changeset
599 call assert_fails("all", "E249:")
13144
20fb8c711050 patch 8.0.1446: acessing freed memory after window command in auto command
Christian Brabandt <cb@256bit.org>
parents: 13072
diff changeset
600 au!
20fb8c711050 patch 8.0.1446: acessing freed memory after window command in auto command
Christian Brabandt <cb@256bit.org>
parents: 13072
diff changeset
601 bwipe xxx
17516
711db62c8aca patch 8.1.1756: autocommand that splits window messes up window layout
Bram Moolenaar <Bram@vim.org>
parents: 17360
diff changeset
602 call assert_equal(&columns, winwidth(0))
13144
20fb8c711050 patch 8.0.1446: acessing freed memory after window command in auto command
Christian Brabandt <cb@256bit.org>
parents: 13072
diff changeset
603 endfunc
20fb8c711050 patch 8.0.1446: acessing freed memory after window command in auto command
Christian Brabandt <cb@256bit.org>
parents: 13072
diff changeset
604
18253
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
605 func Test_insert_cleared_on_switch_to_term()
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
606 CheckFeature terminal
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
607
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
608 set showmode
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
609 terminal
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
610 wincmd p
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
611
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
612 call feedkeys("i\<C-O>", 'ntx')
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
613 redraw
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
614
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
615 " The "-- (insert) --" indicator should be visible.
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
616 let chars = map(range(1, &columns), 'nr2char(screenchar(&lines, v:val))')
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
617 let str = trim(join(chars, ''))
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
618 call assert_equal('-- (insert) --', str)
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
619
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
620 call feedkeys("\<C-W>p", 'ntx')
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
621 redraw
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
622
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
623 " The "-- (insert) --" indicator should have been cleared.
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
624 let chars = map(range(1, &columns), 'nr2char(screenchar(&lines, v:val))')
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
625 let str = trim(join(chars, ''))
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
626 call assert_equal('', str)
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
627
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
628 set showmode&
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
629 %bw!
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
630 endfunc
783f796a1426 patch 8.1.2121: mode is not updated when switching to terminal
Bram Moolenaar <Bram@vim.org>
parents: 18049
diff changeset
631
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
632 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
633 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
634 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
635 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
636 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
637 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
638 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
639 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
640 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
641 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
642 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
643 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
644 " 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
645 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
646 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
647 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
648 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
649 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
650 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
651 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
652 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
653 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
654 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
655
13880
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
656 func Test_winrestcmd()
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
657 2split
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
658 3vsplit
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
659 let a = winrestcmd()
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
660 call assert_equal(2, winheight(0))
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
661 call assert_equal(3, winwidth(0))
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
662 wincmd =
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
663 call assert_notequal(2, winheight(0))
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
664 call assert_notequal(3, winwidth(0))
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
665 exe a
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
666 call assert_equal(2, winheight(0))
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
667 call assert_equal(3, winwidth(0))
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
668 only
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
669 endfunc
60e80884994d patch 8.0.1811: no test for winrestcmd()
Christian Brabandt <cb@256bit.org>
parents: 13666
diff changeset
670
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 15241
diff changeset
671 func Fun_RenewFile()
17746
a4e488a6655c patch 8.1.1870: using :pedit from a help file sets help filetype
Bram Moolenaar <Bram@vim.org>
parents: 17516
diff changeset
672 " Need to wait a bit for the timestamp to be older.
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17746
diff changeset
673 let old_ftime = getftime("tmp.txt")
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17746
diff changeset
674 while getftime("tmp.txt") == old_ftime
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17746
diff changeset
675 sleep 100m
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17746
diff changeset
676 silent execute '!echo "1" > tmp.txt'
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17746
diff changeset
677 endwhile
15241
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
678 sp
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
679 wincmd p
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
680 edit! tmp.txt
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 15241
diff changeset
681 endfunc
15241
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
682
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
683 func Test_window_prevwin()
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
684 " Can we make this work on MS-Windows?
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
685 if !has('unix')
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
686 return
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
687 endif
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
688
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
689 set hidden autoread
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
690 call writefile(['2'], 'tmp.txt')
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
691 new tmp.txt
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
692 q
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
693 call Fun_RenewFile()
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
694 call assert_equal(2, winnr())
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
695 wincmd p
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
696 call assert_equal(1, winnr())
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
697 wincmd p
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
698 q
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
699 call Fun_RenewFile()
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
700 call assert_equal(2, winnr())
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
701 wincmd p
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
702 call assert_equal(1, winnr())
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
703 wincmd p
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
704 " reset
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
705 q
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
706 call delete('tmp.txt')
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
707 set hidden&vim autoread&vim
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
708 delfunc Fun_RenewFile
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
709 endfunc
83ff85896a14 patch 8.1.0630: "wincmd p" does not work after using an autocmd window
Bram Moolenaar <Bram@vim.org>
parents: 15014
diff changeset
710
15977
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
711 func Test_relative_cursor_position_in_one_line_window()
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
712 new
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
713 only
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
714 call setline(1, range(1, 10000))
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
715 normal 50%
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
716 let lnum = getcurpos()[1]
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
717 split
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
718 split
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
719 " make third window take as many lines as possible, other windows will
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
720 " become one line
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
721 3wincmd w
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
722 for i in range(1, &lines - 6)
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
723 wincmd +
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
724 redraw!
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
725 endfor
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
726
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
727 " first and second window should show cursor line
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
728 let wininfo = getwininfo()
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
729 call assert_equal(lnum, wininfo[0].topline)
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
730 call assert_equal(lnum, wininfo[1].topline)
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
731
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
732 only!
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
733 bwipe!
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
734 endfunc
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
735
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
736 func Test_relative_cursor_position_after_move_and_resize()
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
737 let so_save = &so
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
738 set so=0
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
739 enew
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
740 call setline(1, range(1, 10000))
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
741 normal 50%
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
742 split
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
743 1wincmd w
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
744 " Move cursor to first line in window
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
745 normal H
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
746 redraw!
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
747 " Reduce window height to two lines
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
748 let height = winheight(0)
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
749 while winheight(0) > 2
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
750 wincmd -
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
751 redraw!
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
752 endwhile
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
753 " move cursor to second/last line in window
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
754 normal j
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
755 " restore previous height
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
756 while winheight(0) < height
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
757 wincmd +
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
758 redraw!
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
759 endwhile
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
760 " make window two lines again
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
761 while winheight(0) > 2
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
762 wincmd -
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
763 redraw!
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
764 endwhile
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
765
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
766 " cursor should be at bottom line
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
767 let info = getwininfo(win_getid())[0]
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
768 call assert_equal(info.topline + 1, getcurpos()[1])
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
769
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
770 only!
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
771 bwipe!
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
772 let &so = so_save
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
773 endfunc
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
774
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
775 func Test_relative_cursor_position_after_resize()
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
776 let so_save = &so
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
777 set so=0
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
778 enew
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
779 call setline(1, range(1, 10000))
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
780 normal 50%
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
781 split
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
782 1wincmd w
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
783 let winid1 = win_getid()
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
784 let info = getwininfo(winid1)[0]
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
785 " Move cursor to second line in window
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
786 exe "normal " . (info.topline + 1) . "G"
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
787 redraw!
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
788 let lnum = getcurpos()[1]
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
789
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
790 " Make the window only two lines high, cursor should end up in top line
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
791 2wincmd w
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
792 exe (info.height - 2) . "wincmd +"
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
793 redraw!
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
794 let info = getwininfo(winid1)[0]
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
795 call assert_equal(lnum, info.topline)
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
796
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
797 only!
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
798 bwipe!
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
799 let &so = so_save
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
800 endfunc
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
801
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
802 func Test_relative_cursor_second_line_after_resize()
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
803 let so_save = &so
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
804 set so=0
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
805 enew
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
806 call setline(1, range(1, 10000))
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
807 normal 50%
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
808 split
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
809 1wincmd w
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
810 let winid1 = win_getid()
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
811 let info = getwininfo(winid1)[0]
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
812
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
813 " Make the window only two lines high
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
814 2wincmd _
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
815
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
816 " Move cursor to second line in window
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
817 normal H
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
818 normal j
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
819
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
820 " Make window size bigger, then back to 2 lines
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
821 for i in range(1, 10)
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
822 wincmd +
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
823 redraw!
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
824 endfor
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
825 for i in range(1, 10)
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
826 wincmd -
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
827 redraw!
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
828 endfor
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
829
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
830 " cursor should end up in bottom line
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
831 let info = getwininfo(winid1)[0]
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
832 call assert_equal(info.topline + 1, getcurpos()[1])
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
833
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
834 only!
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
835 bwipe!
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
836 let &so = so_save
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
837 endfunc
7fbdceabad64 patch 8.1.0994: relative cursor position is not calculated correctly
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
838
16650
06fd0eaada01 patch 8.1.1327: unnecessary scroll after horizontal split
Bram Moolenaar <Bram@vim.org>
parents: 16271
diff changeset
839 func Test_split_noscroll()
06fd0eaada01 patch 8.1.1327: unnecessary scroll after horizontal split
Bram Moolenaar <Bram@vim.org>
parents: 16271
diff changeset
840 let so_save = &so
16690
4e3c4e8e465c patch 8.1.1347: fractional scroll position not restored after closing window
Bram Moolenaar <Bram@vim.org>
parents: 16650
diff changeset
841 enew
4e3c4e8e465c patch 8.1.1347: fractional scroll position not restored after closing window
Bram Moolenaar <Bram@vim.org>
parents: 16650
diff changeset
842 call setline(1, range(1, 8))
16650
06fd0eaada01 patch 8.1.1327: unnecessary scroll after horizontal split
Bram Moolenaar <Bram@vim.org>
parents: 16271
diff changeset
843 normal 100%
06fd0eaada01 patch 8.1.1327: unnecessary scroll after horizontal split
Bram Moolenaar <Bram@vim.org>
parents: 16271
diff changeset
844 split
06fd0eaada01 patch 8.1.1327: unnecessary scroll after horizontal split
Bram Moolenaar <Bram@vim.org>
parents: 16271
diff changeset
845
06fd0eaada01 patch 8.1.1327: unnecessary scroll after horizontal split
Bram Moolenaar <Bram@vim.org>
parents: 16271
diff changeset
846 1wincmd w
06fd0eaada01 patch 8.1.1327: unnecessary scroll after horizontal split
Bram Moolenaar <Bram@vim.org>
parents: 16271
diff changeset
847 let winid1 = win_getid()
06fd0eaada01 patch 8.1.1327: unnecessary scroll after horizontal split
Bram Moolenaar <Bram@vim.org>
parents: 16271
diff changeset
848 let info1 = getwininfo(winid1)[0]
06fd0eaada01 patch 8.1.1327: unnecessary scroll after horizontal split
Bram Moolenaar <Bram@vim.org>
parents: 16271
diff changeset
849
06fd0eaada01 patch 8.1.1327: unnecessary scroll after horizontal split
Bram Moolenaar <Bram@vim.org>
parents: 16271
diff changeset
850 2wincmd w
06fd0eaada01 patch 8.1.1327: unnecessary scroll after horizontal split
Bram Moolenaar <Bram@vim.org>
parents: 16271
diff changeset
851 let winid2 = win_getid()
06fd0eaada01 patch 8.1.1327: unnecessary scroll after horizontal split
Bram Moolenaar <Bram@vim.org>
parents: 16271
diff changeset
852 let info2 = getwininfo(winid2)[0]
06fd0eaada01 patch 8.1.1327: unnecessary scroll after horizontal split
Bram Moolenaar <Bram@vim.org>
parents: 16271
diff changeset
853
06fd0eaada01 patch 8.1.1327: unnecessary scroll after horizontal split
Bram Moolenaar <Bram@vim.org>
parents: 16271
diff changeset
854 call assert_equal(1, info1.topline)
06fd0eaada01 patch 8.1.1327: unnecessary scroll after horizontal split
Bram Moolenaar <Bram@vim.org>
parents: 16271
diff changeset
855 call assert_equal(1, info2.topline)
06fd0eaada01 patch 8.1.1327: unnecessary scroll after horizontal split
Bram Moolenaar <Bram@vim.org>
parents: 16271
diff changeset
856
16690
4e3c4e8e465c patch 8.1.1347: fractional scroll position not restored after closing window
Bram Moolenaar <Bram@vim.org>
parents: 16650
diff changeset
857 " window that fits all lines by itself, but not when split: closing other
4e3c4e8e465c patch 8.1.1347: fractional scroll position not restored after closing window
Bram Moolenaar <Bram@vim.org>
parents: 16650
diff changeset
858 " window should restore fraction.
16650
06fd0eaada01 patch 8.1.1327: unnecessary scroll after horizontal split
Bram Moolenaar <Bram@vim.org>
parents: 16271
diff changeset
859 only!
16690
4e3c4e8e465c patch 8.1.1347: fractional scroll position not restored after closing window
Bram Moolenaar <Bram@vim.org>
parents: 16650
diff changeset
860 call setline(1, range(1, &lines - 10))
4e3c4e8e465c patch 8.1.1347: fractional scroll position not restored after closing window
Bram Moolenaar <Bram@vim.org>
parents: 16650
diff changeset
861 exe &lines / 4
4e3c4e8e465c patch 8.1.1347: fractional scroll position not restored after closing window
Bram Moolenaar <Bram@vim.org>
parents: 16650
diff changeset
862 let winid1 = win_getid()
4e3c4e8e465c patch 8.1.1347: fractional scroll position not restored after closing window
Bram Moolenaar <Bram@vim.org>
parents: 16650
diff changeset
863 let info1 = getwininfo(winid1)[0]
4e3c4e8e465c patch 8.1.1347: fractional scroll position not restored after closing window
Bram Moolenaar <Bram@vim.org>
parents: 16650
diff changeset
864 call assert_equal(1, info1.topline)
4e3c4e8e465c patch 8.1.1347: fractional scroll position not restored after closing window
Bram Moolenaar <Bram@vim.org>
parents: 16650
diff changeset
865 new
4e3c4e8e465c patch 8.1.1347: fractional scroll position not restored after closing window
Bram Moolenaar <Bram@vim.org>
parents: 16650
diff changeset
866 redraw
4e3c4e8e465c patch 8.1.1347: fractional scroll position not restored after closing window
Bram Moolenaar <Bram@vim.org>
parents: 16650
diff changeset
867 close
4e3c4e8e465c patch 8.1.1347: fractional scroll position not restored after closing window
Bram Moolenaar <Bram@vim.org>
parents: 16650
diff changeset
868 let info1 = getwininfo(winid1)[0]
4e3c4e8e465c patch 8.1.1347: fractional scroll position not restored after closing window
Bram Moolenaar <Bram@vim.org>
parents: 16650
diff changeset
869 call assert_equal(1, info1.topline)
4e3c4e8e465c patch 8.1.1347: fractional scroll position not restored after closing window
Bram Moolenaar <Bram@vim.org>
parents: 16650
diff changeset
870
16650
06fd0eaada01 patch 8.1.1327: unnecessary scroll after horizontal split
Bram Moolenaar <Bram@vim.org>
parents: 16271
diff changeset
871 bwipe!
06fd0eaada01 patch 8.1.1327: unnecessary scroll after horizontal split
Bram Moolenaar <Bram@vim.org>
parents: 16271
diff changeset
872 let &so = so_save
06fd0eaada01 patch 8.1.1327: unnecessary scroll after horizontal split
Bram Moolenaar <Bram@vim.org>
parents: 16271
diff changeset
873 endfunc
06fd0eaada01 patch 8.1.1327: unnecessary scroll after horizontal split
Bram Moolenaar <Bram@vim.org>
parents: 16271
diff changeset
874
16271
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
875 " Tests for the winnr() function
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
876 func Test_winnr()
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
877 only | tabonly
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
878 call assert_equal(1, winnr('j'))
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
879 call assert_equal(1, winnr('k'))
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
880 call assert_equal(1, winnr('h'))
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
881 call assert_equal(1, winnr('l'))
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
882
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
883 " create a set of horizontally and vertically split windows
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
884 leftabove new | wincmd p
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
885 leftabove new | wincmd p
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
886 rightbelow new | wincmd p
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
887 rightbelow new | wincmd p
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
888 leftabove vnew | wincmd p
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
889 leftabove vnew | wincmd p
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
890 rightbelow vnew | wincmd p
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
891 rightbelow vnew | wincmd p
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
892
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
893 call assert_equal(8, winnr('j'))
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
894 call assert_equal(2, winnr('k'))
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
895 call assert_equal(4, winnr('h'))
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
896 call assert_equal(6, winnr('l'))
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
897 call assert_equal(9, winnr('2j'))
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
898 call assert_equal(1, winnr('2k'))
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
899 call assert_equal(3, winnr('2h'))
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
900 call assert_equal(7, winnr('2l'))
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
901
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
902 " Error cases
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
903 call assert_fails("echo winnr('0.2k')", 'E15:')
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
904 call assert_equal(2, winnr('-2k'))
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
905 call assert_fails("echo winnr('-2xj')", 'E15:')
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
906 call assert_fails("echo winnr('j2j')", 'E15:')
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
907 call assert_fails("echo winnr('ll')", 'E15:')
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
908 call assert_fails("echo winnr('5')", 'E15:')
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
909 call assert_equal(4, winnr('0h'))
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
910
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
911 tabnew
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
912 call assert_equal(8, tabpagewinnr(1, 'j'))
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17746
diff changeset
913 call assert_equal(2, 1->tabpagewinnr('k'))
16271
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
914 call assert_equal(4, tabpagewinnr(1, 'h'))
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
915 call assert_equal(6, tabpagewinnr(1, 'l'))
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
916
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
917 only | tabonly
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
918 endfunc
243cdc183ec9 patch 8.1.1140: not easy to find out what neighbors a window has
Bram Moolenaar <Bram@vim.org>
parents: 15977
diff changeset
919
18035
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
920 func Test_winrestview()
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
921 split runtest.vim
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
922 normal 50%
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
923 let view = winsaveview()
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
924 close
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
925 split runtest.vim
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
926 eval view->winrestview()
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
927 call assert_equal(view, winsaveview())
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
928
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
929 bwipe!
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
930 endfunc
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
931
18049
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
932 func Test_win_splitmove()
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18253
diff changeset
933 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18253
diff changeset
934
18049
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
935 edit a
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
936 leftabove split b
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
937 leftabove vsplit c
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
938 leftabove split d
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
939 call assert_equal(0, win_splitmove(winnr(), winnr('l')))
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
940 call assert_equal(bufname(winbufnr(1)), 'c')
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
941 call assert_equal(bufname(winbufnr(2)), 'd')
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
942 call assert_equal(bufname(winbufnr(3)), 'b')
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
943 call assert_equal(bufname(winbufnr(4)), 'a')
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
944 call assert_equal(0, win_splitmove(winnr(), winnr('j'), {'vertical': 1}))
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
945 call assert_equal(0, win_splitmove(winnr(), winnr('j'), {'vertical': 1}))
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
946 call assert_equal(bufname(winbufnr(1)), 'c')
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
947 call assert_equal(bufname(winbufnr(2)), 'b')
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
948 call assert_equal(bufname(winbufnr(3)), 'd')
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
949 call assert_equal(bufname(winbufnr(4)), 'a')
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
950 call assert_equal(0, win_splitmove(winnr(), winnr('k'), {'vertical': 1}))
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
951 call assert_equal(bufname(winbufnr(1)), 'd')
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
952 call assert_equal(bufname(winbufnr(2)), 'c')
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
953 call assert_equal(bufname(winbufnr(3)), 'b')
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
954 call assert_equal(bufname(winbufnr(4)), 'a')
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
955 call assert_equal(0, win_splitmove(winnr(), winnr('j'), {'rightbelow': v:true}))
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
956 call assert_equal(bufname(winbufnr(1)), 'c')
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
957 call assert_equal(bufname(winbufnr(2)), 'b')
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
958 call assert_equal(bufname(winbufnr(3)), 'a')
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
959 call assert_equal(bufname(winbufnr(4)), 'd')
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
960 only | bd
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
961
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
962 call assert_fails('call win_splitmove(winnr(), 123)', 'E957:')
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
963 call assert_fails('call win_splitmove(123, winnr())', 'E957:')
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
964 call assert_fails('call win_splitmove(winnr(), winnr())', 'E957:')
19065
ef3633932b0c patch 8.2.0093: win_splitmove() can make Vim hang
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
965
ef3633932b0c patch 8.2.0093: win_splitmove() can make Vim hang
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
966 tabnew
ef3633932b0c patch 8.2.0093: win_splitmove() can make Vim hang
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
967 call assert_fails('call win_splitmove(1, win_getid(1, 1))', 'E957:')
ef3633932b0c patch 8.2.0093: win_splitmove() can make Vim hang
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
968 tabclose
18049
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
969 endfunc
a9f1656f13c9 patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
970
19289
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19065
diff changeset
971 " Test for the :only command
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19065
diff changeset
972 func Test_window_only()
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19065
diff changeset
973 new
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19065
diff changeset
974 set modified
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19065
diff changeset
975 new
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19065
diff changeset
976 call assert_fails('only', 'E445:')
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19065
diff changeset
977 only!
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
978 " Test for :only with a count
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
979 let wid = win_getid()
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
980 new
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
981 new
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
982 3only
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
983 call assert_equal(1, winnr('$'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
984 call assert_equal(wid, win_getid())
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
985 call assert_fails('close', 'E444:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
986 call assert_fails('%close', 'E16:')
19289
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19065
diff changeset
987 endfunc
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19065
diff changeset
988
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
989 " Test for errors with :wincmd
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
990 func Test_wincmd_errors()
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
991 call assert_fails('wincmd g', 'E474:')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
992 call assert_fails('wincmd ab', 'E474:')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
993 endfunc
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
994
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
995 " Test for errors with :winpos
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
996 func Test_winpos_errors()
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
997 if !has("gui_running") && !has('win32')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
998 call assert_fails('winpos', 'E188:')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
999 endif
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
1000 call assert_fails('winpos 10', 'E466:')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
1001 endfunc
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
1002
19435
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1003 " Test for +cmd in a :split command
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1004 func Test_split_cmd()
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1005 split +set\ readonly
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1006 call assert_equal(1, &readonly)
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1007 call assert_equal(2, winnr('$'))
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1008 close
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1009 endfunc
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1010
19748
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1011 " Create maximum number of horizontally or vertically split windows and then
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1012 " run commands that create a new horizontally/vertically split window
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1013 func Run_noroom_for_newwindow_test(dir_arg)
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1014 let dir = (a:dir_arg == 'v') ? 'vert ' : ''
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1015
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1016 " Open as many windows as possible
19752
0927df746554 patch 8.2.0432: a few tests fail in a huge terminal
Bram Moolenaar <Bram@vim.org>
parents: 19748
diff changeset
1017 while v:true
19748
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1018 try
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1019 exe dir . 'new'
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1020 catch /E36:/
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1021 break
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1022 endtry
19752
0927df746554 patch 8.2.0432: a few tests fail in a huge terminal
Bram Moolenaar <Bram@vim.org>
parents: 19748
diff changeset
1023 endwhile
19748
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1024
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1025 call writefile(['first', 'second', 'third'], 'Xfile1')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1026 call writefile([], 'Xfile2')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1027 call writefile([], 'Xfile3')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1028
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1029 " Argument list related commands
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1030 args Xfile1 Xfile2 Xfile3
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1031 next
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1032 for cmd in ['sargument 2', 'snext', 'sprevious', 'sNext', 'srewind',
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1033 \ 'sfirst', 'slast']
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1034 call assert_fails(dir .. cmd, 'E36:')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1035 endfor
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1036 %argdelete
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1037
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1038 " Buffer related commands
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1039 set modified
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1040 hide enew
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1041 for cmd in ['sbuffer Xfile1', 'sbnext', 'sbprevious', 'sbNext', 'sbrewind',
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1042 \ 'sbfirst', 'sblast', 'sball', 'sbmodified', 'sunhide']
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1043 call assert_fails(dir .. cmd, 'E36:')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1044 endfor
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1045
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1046 " Window related commands
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1047 for cmd in ['split', 'split Xfile2', 'new', 'new Xfile3', 'sview Xfile1',
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1048 \ 'sfind runtest.vim']
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1049 call assert_fails(dir .. cmd, 'E36:')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1050 endfor
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1051
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1052 " Help
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1053 call assert_fails(dir .. 'help', 'E36:')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1054 call assert_fails(dir .. 'helpgrep window', 'E36:')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1055
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1056 " Command-line window
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1057 if a:dir_arg == 'h'
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1058 " Cmd-line window is always a horizontally split window
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1059 call assert_beeps('call feedkeys("q:\<CR>", "xt")')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1060 endif
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1061
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1062 " Quickfix and location list window
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1063 if has('quickfix')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1064 cexpr ''
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1065 call assert_fails(dir .. 'copen', 'E36:')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1066 lexpr ''
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1067 call assert_fails(dir .. 'lopen', 'E36:')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1068
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1069 " Preview window
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1070 call assert_fails(dir .. 'pedit Xfile2', 'E36:')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1071 call setline(1, 'abc')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1072 call assert_fails(dir .. 'psearch abc', 'E36:')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1073 endif
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1074
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1075 " Window commands (CTRL-W ^ and CTRL-W f)
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1076 if a:dir_arg == 'h'
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1077 call assert_fails('call feedkeys("\<C-W>^", "xt")', 'E36:')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1078 call setline(1, 'Xfile1')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1079 call assert_fails('call feedkeys("gg\<C-W>f", "xt")', 'E36:')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1080 endif
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1081 enew!
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1082
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1083 " Tag commands (:stag, :stselect and :stjump)
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1084 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1085 \ "second\tXfile1\t2",
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1086 \ "third\tXfile1\t3",],
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1087 \ 'Xtags')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1088 set tags=Xtags
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1089 call assert_fails(dir .. 'stag second', 'E36:')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1090 call assert_fails('call feedkeys(":" .. dir .. "stselect second\n1\n", "xt")', 'E36:')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1091 call assert_fails(dir .. 'stjump second', 'E36:')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1092 call assert_fails(dir .. 'ptag second', 'E36:')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1093 set tags&
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1094 call delete('Xtags')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1095
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1096 " :isplit and :dsplit
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1097 call setline(1, ['#define FOO 1', 'FOO'])
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1098 normal 2G
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1099 call assert_fails(dir .. 'isplit FOO', 'E36:')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1100 call assert_fails(dir .. 'dsplit FOO', 'E36:')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1101
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1102 " terminal
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1103 if has('terminal')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1104 call assert_fails(dir .. 'terminal', 'E36:')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1105 endif
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1106
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1107 %bwipe!
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1108 call delete('Xfile1')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1109 call delete('Xfile2')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1110 call delete('Xfile3')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1111 only
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1112 endfunc
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1113
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1114 func Test_split_cmds_with_no_room()
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1115 call Run_noroom_for_newwindow_test('h')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1116 call Run_noroom_for_newwindow_test('v')
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1117 endfunc
d089bd9511c0 patch 8.2.0430: window creation failure not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
1118
9909
3ee84d270ea7 commit https://github.com/vim/vim/commit/9e4d8215d386100ab660d7d11e6620fd148b605e
Christian Brabandt <cb@256bit.org>
parents: 9349
diff changeset
1119 " vim: shiftwidth=2 sts=2 expandtab