Mercurial > vim
annotate src/testdir/test_tabpage.vim @ 10528:3ea703795a4f v8.0.0154
commit https://github.com/vim/vim/commit/31f19ce0a052f7c76d44a9a190e468c79cf5d56d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 8 14:14:43 2017 +0100
patch 8.0.0154: system() test fails on OS/X
Problem: system() test fails on OS/X.
Solution: Deal with leading spaces.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 08 Jan 2017 14:15:04 +0100 |
parents | 262f5bc3d38e |
children | 380e706814da |
rev | line source |
---|---|
9906
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Tests for tabpage |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 function Test_tabpage() |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 bw! |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 " Simple test for opening and closing a tab page |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 tabnew |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 call assert_equal(2, tabpagenr()) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 quit |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 " Open three tab pages and use ":tabdo" |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 0tabnew |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 1tabnew |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 $tabnew |
10270
e5dddd764fef
commit https://github.com/vim/vim/commit/3e8474dd50f64c998bb665ce852f584a58dede6b
Christian Brabandt <cb@256bit.org>
parents:
10136
diff
changeset
|
14 %del |
9906
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 tabdo call append(line('$'), tabpagenr()) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 tabclose! 2 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 tabrewind |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 let line1 = getline('$') |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 undo |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 q |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 tablast |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 let line2 = getline('$') |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 q! |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 call append(line('$'), line1) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 call append(line('$'), line2) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 unlet line1 line2 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 call assert_equal(['', '3', '1', '4'], getline(1, '$')) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 " |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 " Test for settabvar() and gettabvar() functions. Open a new tab page and |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 " set 3 variables to a number, string and a list. Verify that the variables |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 " are correctly set. |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 tabnew |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 tabfirst |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 call settabvar(2, 'val_num', 100) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 call settabvar(2, 'val_str', 'SetTabVar test') |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 call settabvar(2, 'val_list', ['red', 'blue', 'green']) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 " |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 call assert_true(gettabvar(2, 'val_num') == 100 && gettabvar(2, 'val_str') == 'SetTabVar test' && gettabvar(2, 'val_list') == ['red', 'blue', 'green']) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 tabnext 2 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 call assert_true(t:val_num == 100 && t:val_str == 'SetTabVar test' && t:val_list == ['red', 'blue', 'green']) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 tabclose |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 if has('gui') || has('clientserver') |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 " Test for ":tab drop exist-file" to keep current window. |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 sp test1 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 tab drop test1 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 call assert_true(tabpagenr('$') == 1 && winnr('$') == 2 && winnr() == 1) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 close |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 " |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 " |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 " Test for ":tab drop new-file" to keep current window of tabpage 1. |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 split |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 tab drop newfile |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 call assert_true(tabpagenr('$') == 2 && tabpagewinnr(1, '$') == 2 && tabpagewinnr(1) == 1) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 tabclose |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 q |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 " |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 " |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 " Test for ":tab drop multi-opend-file" to keep current tabpage and window. |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 new test1 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 tabnew |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 new test1 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 tab drop test1 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 call assert_true(tabpagenr() == 2 && tabpagewinnr(2, '$') == 2 && tabpagewinnr(2) == 1) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 tabclose |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 q |
10432
262f5bc3d38e
commit https://github.com/vim/vim/commit/5a030a540f4157d5c9905e3564282c92b4dcec9a
Christian Brabandt <cb@256bit.org>
parents:
10270
diff
changeset
|
68 " |
262f5bc3d38e
commit https://github.com/vim/vim/commit/5a030a540f4157d5c9905e3564282c92b4dcec9a
Christian Brabandt <cb@256bit.org>
parents:
10270
diff
changeset
|
69 " |
262f5bc3d38e
commit https://github.com/vim/vim/commit/5a030a540f4157d5c9905e3564282c92b4dcec9a
Christian Brabandt <cb@256bit.org>
parents:
10270
diff
changeset
|
70 " Test for ":tab drop vertical-split-window" to jump test1 buffer |
262f5bc3d38e
commit https://github.com/vim/vim/commit/5a030a540f4157d5c9905e3564282c92b4dcec9a
Christian Brabandt <cb@256bit.org>
parents:
10270
diff
changeset
|
71 tabedit test1 |
262f5bc3d38e
commit https://github.com/vim/vim/commit/5a030a540f4157d5c9905e3564282c92b4dcec9a
Christian Brabandt <cb@256bit.org>
parents:
10270
diff
changeset
|
72 vnew |
262f5bc3d38e
commit https://github.com/vim/vim/commit/5a030a540f4157d5c9905e3564282c92b4dcec9a
Christian Brabandt <cb@256bit.org>
parents:
10270
diff
changeset
|
73 tabfirst |
262f5bc3d38e
commit https://github.com/vim/vim/commit/5a030a540f4157d5c9905e3564282c92b4dcec9a
Christian Brabandt <cb@256bit.org>
parents:
10270
diff
changeset
|
74 tab drop test1 |
262f5bc3d38e
commit https://github.com/vim/vim/commit/5a030a540f4157d5c9905e3564282c92b4dcec9a
Christian Brabandt <cb@256bit.org>
parents:
10270
diff
changeset
|
75 call assert_equal([2, 2, 2, 2], [tabpagenr('$'), tabpagenr(), tabpagewinnr(2, '$'), tabpagewinnr(2)]) |
262f5bc3d38e
commit https://github.com/vim/vim/commit/5a030a540f4157d5c9905e3564282c92b4dcec9a
Christian Brabandt <cb@256bit.org>
parents:
10270
diff
changeset
|
76 1tabonly |
9906
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 endif |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 " |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 " |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 for i in range(9) | tabnew | endfor |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 normal! 1gt |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 call assert_equal(1, tabpagenr()) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
83 tabmove 5 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
84 call assert_equal(5, tabpagenr()) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
85 .tabmove |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
86 call assert_equal(5, tabpagenr()) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 tabmove - |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 call assert_equal(4, tabpagenr()) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
89 tabmove + |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
90 call assert_equal(5, tabpagenr()) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
91 tabmove -2 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
92 call assert_equal(3, tabpagenr()) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
93 tabmove +4 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
94 call assert_equal(7, tabpagenr()) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
95 tabmove |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
96 call assert_equal(10, tabpagenr()) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
97 tabmove -20 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
98 call assert_equal(1, tabpagenr()) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
99 tabmove +20 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
100 call assert_equal(10, tabpagenr()) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
101 0tabmove |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
102 call assert_equal(1, tabpagenr()) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
103 $tabmove |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
104 call assert_equal(10, tabpagenr()) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
105 tabmove 0 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
106 call assert_equal(1, tabpagenr()) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
107 tabmove $ |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
108 call assert_equal(10, tabpagenr()) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
109 3tabmove |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
110 call assert_equal(4, tabpagenr()) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
111 7tabmove 5 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
112 call assert_equal(5, tabpagenr()) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
113 call assert_fails("tabmove foo", 'E474:') |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
114 endfunc |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
115 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
116 " Test autocommands |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
117 function Test_tabpage_with_autocmd() |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
118 if !has('autocmd') |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
119 return |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
120 endif |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
121 tabonly! |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
122 command -nargs=1 -bar C :call add(s:li, '=== ' . <q-args> . ' ===')|<args> |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
123 augroup TestTabpageGroup |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
124 au! |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
125 autocmd TabEnter * call add(s:li, 'TabEnter') |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
126 autocmd WinEnter * call add(s:li, 'WinEnter') |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
127 autocmd BufEnter * call add(s:li, 'BufEnter') |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
128 autocmd TabLeave * call add(s:li, 'TabLeave') |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
129 autocmd WinLeave * call add(s:li, 'WinLeave') |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
130 autocmd BufLeave * call add(s:li, 'BufLeave') |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
131 augroup END |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
132 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
133 let s:li = [] |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
134 let t:a='a' |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
135 C tab split |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
136 call assert_equal(['=== tab split ===', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter'], s:li) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
137 let s:li = [] |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
138 let t:a='b' |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
139 C tabnew |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
140 call assert_equal(['=== tabnew ===', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', 'BufLeave', 'BufEnter'], s:li) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
141 let t:a='c' |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
142 let s:li = split(join(map(range(1, tabpagenr('$')), 'gettabvar(v:val, "a")')) , '\s\+') |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
143 call assert_equal(['a', 'b', 'c'], s:li) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
144 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
145 let s:li = [] |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
146 C call map(range(1, tabpagenr('$')), 'settabvar(v:val, ''a'', v:val*2)') |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
147 call assert_equal(["=== call map(range(1, tabpagenr('$')), 'settabvar(v:val, ''a'', v:val*2)') ==="], s:li) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
148 let s:li = split(join(map(range(1, tabpagenr('$')), 'gettabvar(v:val, "a")')) , '\s\+') |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
149 call assert_equal(['2', '4', '6'], s:li) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
150 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
151 let s:li = [] |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
152 let w:a='a' |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
153 C vsplit |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
154 call assert_equal(['=== vsplit ===', 'WinLeave', 'WinEnter'], s:li) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
155 let s:li = [] |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
156 let w:a='a' |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
157 let tabn=tabpagenr() |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
158 let winr=range(1, winnr('$')) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
159 C tabnext 1 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
160 call assert_equal(['=== tabnext 1 ===', 'BufLeave', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', 'BufEnter'], s:li) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
161 let s:li = split(join(map(copy(winr), 'gettabwinvar('.tabn.', v:val, "a")')), '\s\+') |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
162 call assert_equal(['a', 'a'], s:li) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
163 let s:li = [] |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
164 C call map(copy(winr), 'settabwinvar('.tabn.', v:val, ''a'', v:val*2)') |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
165 let s:li = split(join(map(copy(winr), 'gettabwinvar('.tabn.', v:val, "a")')), '\s\+') |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
166 call assert_equal(['2', '4'], s:li) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
167 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
168 augroup TabDestructive |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
169 autocmd TabEnter * :C tabnext 2 | C tabclose 3 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
170 augroup END |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
171 let s:li = [] |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
172 C tabnext 3 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
173 call assert_equal(['=== tabnext 3 ===', 'BufLeave', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', '=== tabnext 2 ===', '=== tabclose 3 ==='], s:li) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
174 call assert_equal(['2/2'], [tabpagenr().'/'.tabpagenr('$')]) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
175 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
176 autocmd! TabDestructive TabEnter |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
177 let s:li = [] |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
178 C tabnew |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
179 call assert_equal(['=== tabnew ===', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', 'BufLeave', 'BufEnter'], s:li) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
180 let s:li = [] |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
181 C tabnext 1 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
182 call assert_equal(['=== tabnext 1 ===', 'BufLeave', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', 'BufEnter'], s:li) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
183 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
184 autocmd TabDestructive TabEnter * nested :C tabnext 2 | C tabclose 3 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
185 let s:li = [] |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
186 C tabnext 3 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
187 call assert_equal(['=== tabnext 3 ===', 'BufLeave', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', '=== tabnext 2 ===', 'BufLeave', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', '=== tabnext 2 ===', '=== tabclose 3 ===', 'BufEnter', '=== tabclose 3 ==='], s:li) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
188 call assert_equal(['2/2'], [tabpagenr().'/'.tabpagenr('$')]) |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
189 |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
190 delcommand C |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
191 autocmd! TabDestructive |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
192 augroup! TabDestructive |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
193 autocmd! TestTabpageGroup |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
194 augroup! TestTabpageGroup |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
195 tabonly! |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
196 bw! |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
197 endfunction |
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
198 |
9927
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
199 function Test_tabpage_with_tab_modifier() |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
200 for n in range(4) |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
201 tabedit |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
202 endfor |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
203 |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
204 function s:check_tab(pre_nr, cmd, post_nr) |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
205 exec 'tabnext ' . a:pre_nr |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
206 exec a:cmd |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
207 call assert_equal(a:post_nr, tabpagenr()) |
10136
13304dccb96e
commit https://github.com/vim/vim/commit/100f5c90f4d4fb40bc3aeabc35192db371f5988f
Christian Brabandt <cb@256bit.org>
parents:
10082
diff
changeset
|
208 call assert_equal('help', &buftype) |
9927
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
209 helpclose |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
210 endfunc |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
211 |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
212 call s:check_tab(1, 'tab help', 2) |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
213 call s:check_tab(1, '3tab help', 4) |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
214 call s:check_tab(1, '.tab help', 2) |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
215 call s:check_tab(1, '.+1tab help', 3) |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
216 call s:check_tab(1, '0tab help', 1) |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
217 call s:check_tab(2, '+tab help', 4) |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
218 call s:check_tab(2, '+2tab help', 5) |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
219 call s:check_tab(4, '-tab help', 4) |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
220 call s:check_tab(4, '-2tab help', 3) |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
221 call s:check_tab(3, '$tab help', 6) |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
222 call assert_fails('99tab help', 'E16:') |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
223 call assert_fails('+99tab help', 'E16:') |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
224 call assert_fails('-99tab help', 'E16:') |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
225 |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
226 delfunction s:check_tab |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
227 tabonly! |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
228 bw! |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
229 endfunction |
e1a8b2601fe0
commit https://github.com/vim/vim/commit/9b7f8ce9eb3cb704f8cc14ab659bf86b1d6dc13c
Christian Brabandt <cb@256bit.org>
parents:
9906
diff
changeset
|
230 |
10082
7fc6103c6651
commit https://github.com/vim/vim/commit/5a49789a9b1f6447aeafbbbdd5b235dd10c471d5
Christian Brabandt <cb@256bit.org>
parents:
10076
diff
changeset
|
231 func Test_tabnext_on_buf_unload1() |
10076
bc30991c3e98
commit https://github.com/vim/vim/commit/11fbc2866ccc11b4dd1726abdaf582a78ef3f743
Christian Brabandt <cb@256bit.org>
parents:
9927
diff
changeset
|
232 " This once caused a crash |
bc30991c3e98
commit https://github.com/vim/vim/commit/11fbc2866ccc11b4dd1726abdaf582a78ef3f743
Christian Brabandt <cb@256bit.org>
parents:
9927
diff
changeset
|
233 new |
bc30991c3e98
commit https://github.com/vim/vim/commit/11fbc2866ccc11b4dd1726abdaf582a78ef3f743
Christian Brabandt <cb@256bit.org>
parents:
9927
diff
changeset
|
234 tabedit |
bc30991c3e98
commit https://github.com/vim/vim/commit/11fbc2866ccc11b4dd1726abdaf582a78ef3f743
Christian Brabandt <cb@256bit.org>
parents:
9927
diff
changeset
|
235 tabfirst |
bc30991c3e98
commit https://github.com/vim/vim/commit/11fbc2866ccc11b4dd1726abdaf582a78ef3f743
Christian Brabandt <cb@256bit.org>
parents:
9927
diff
changeset
|
236 au BufUnload <buffer> tabnext |
bc30991c3e98
commit https://github.com/vim/vim/commit/11fbc2866ccc11b4dd1726abdaf582a78ef3f743
Christian Brabandt <cb@256bit.org>
parents:
9927
diff
changeset
|
237 q |
bc30991c3e98
commit https://github.com/vim/vim/commit/11fbc2866ccc11b4dd1726abdaf582a78ef3f743
Christian Brabandt <cb@256bit.org>
parents:
9927
diff
changeset
|
238 |
bc30991c3e98
commit https://github.com/vim/vim/commit/11fbc2866ccc11b4dd1726abdaf582a78ef3f743
Christian Brabandt <cb@256bit.org>
parents:
9927
diff
changeset
|
239 while tabpagenr('$') > 1 |
10082
7fc6103c6651
commit https://github.com/vim/vim/commit/5a49789a9b1f6447aeafbbbdd5b235dd10c471d5
Christian Brabandt <cb@256bit.org>
parents:
10076
diff
changeset
|
240 bwipe! |
7fc6103c6651
commit https://github.com/vim/vim/commit/5a49789a9b1f6447aeafbbbdd5b235dd10c471d5
Christian Brabandt <cb@256bit.org>
parents:
10076
diff
changeset
|
241 endwhile |
7fc6103c6651
commit https://github.com/vim/vim/commit/5a49789a9b1f6447aeafbbbdd5b235dd10c471d5
Christian Brabandt <cb@256bit.org>
parents:
10076
diff
changeset
|
242 endfunc |
7fc6103c6651
commit https://github.com/vim/vim/commit/5a49789a9b1f6447aeafbbbdd5b235dd10c471d5
Christian Brabandt <cb@256bit.org>
parents:
10076
diff
changeset
|
243 |
7fc6103c6651
commit https://github.com/vim/vim/commit/5a49789a9b1f6447aeafbbbdd5b235dd10c471d5
Christian Brabandt <cb@256bit.org>
parents:
10076
diff
changeset
|
244 func Test_tabnext_on_buf_unload2() |
7fc6103c6651
commit https://github.com/vim/vim/commit/5a49789a9b1f6447aeafbbbdd5b235dd10c471d5
Christian Brabandt <cb@256bit.org>
parents:
10076
diff
changeset
|
245 " This once caused a crash |
7fc6103c6651
commit https://github.com/vim/vim/commit/5a49789a9b1f6447aeafbbbdd5b235dd10c471d5
Christian Brabandt <cb@256bit.org>
parents:
10076
diff
changeset
|
246 tabedit |
7fc6103c6651
commit https://github.com/vim/vim/commit/5a49789a9b1f6447aeafbbbdd5b235dd10c471d5
Christian Brabandt <cb@256bit.org>
parents:
10076
diff
changeset
|
247 autocmd BufUnload <buffer> tabnext |
7fc6103c6651
commit https://github.com/vim/vim/commit/5a49789a9b1f6447aeafbbbdd5b235dd10c471d5
Christian Brabandt <cb@256bit.org>
parents:
10076
diff
changeset
|
248 file x |
7fc6103c6651
commit https://github.com/vim/vim/commit/5a49789a9b1f6447aeafbbbdd5b235dd10c471d5
Christian Brabandt <cb@256bit.org>
parents:
10076
diff
changeset
|
249 edit y |
7fc6103c6651
commit https://github.com/vim/vim/commit/5a49789a9b1f6447aeafbbbdd5b235dd10c471d5
Christian Brabandt <cb@256bit.org>
parents:
10076
diff
changeset
|
250 |
7fc6103c6651
commit https://github.com/vim/vim/commit/5a49789a9b1f6447aeafbbbdd5b235dd10c471d5
Christian Brabandt <cb@256bit.org>
parents:
10076
diff
changeset
|
251 while tabpagenr('$') > 1 |
7fc6103c6651
commit https://github.com/vim/vim/commit/5a49789a9b1f6447aeafbbbdd5b235dd10c471d5
Christian Brabandt <cb@256bit.org>
parents:
10076
diff
changeset
|
252 bwipe! |
10076
bc30991c3e98
commit https://github.com/vim/vim/commit/11fbc2866ccc11b4dd1726abdaf582a78ef3f743
Christian Brabandt <cb@256bit.org>
parents:
9927
diff
changeset
|
253 endwhile |
bc30991c3e98
commit https://github.com/vim/vim/commit/11fbc2866ccc11b4dd1726abdaf582a78ef3f743
Christian Brabandt <cb@256bit.org>
parents:
9927
diff
changeset
|
254 endfunc |
bc30991c3e98
commit https://github.com/vim/vim/commit/11fbc2866ccc11b4dd1726abdaf582a78ef3f743
Christian Brabandt <cb@256bit.org>
parents:
9927
diff
changeset
|
255 |
bc30991c3e98
commit https://github.com/vim/vim/commit/11fbc2866ccc11b4dd1726abdaf582a78ef3f743
Christian Brabandt <cb@256bit.org>
parents:
9927
diff
changeset
|
256 |
9906
1ed0cab95f9a
commit https://github.com/vim/vim/commit/1381d791478ee77c8368b89a3d4954316bf839b5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
257 " vim: shiftwidth=2 sts=2 expandtab |