Mercurial > vim
annotate src/testdir/test_tab.vim @ 15121:895abc8a5195 v8.1.0571
patch 8.1.0571: non-silent execute() resets display column to zero
commit https://github.com/vim/vim/commit/446e7a3cd36b2de7d559f167eb5795d1e1cd3ddb
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Dec 8 13:57:42 2018 +0100
patch 8.1.0571: non-silent execute() resets display column to zero
Problem: Non-silent execute() resets display column to zero.
Solution: Keep the display column as-is.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 08 Dec 2018 14:00:07 +0100 |
parents | 752ef53d3731 |
children | 08940efa6b4e |
rev | line source |
---|---|
14243
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
1 " Various tests for inserting a Tab. |
12686
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 " Tests for "r<Tab>" with 'smarttab' and 'expandtab' set/not set. |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 " Also test that dv_ works correctly |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 func Test_smarttab() |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 enew! |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 set smarttab expandtab ts=8 sw=4 |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 " make sure that backspace works, no matter what termcap is used |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 exe "set t_kD=\<C-V>x7f t_kb=\<C-V>x08" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 call append(0, ['start text', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 \ "\t\tsome test text", |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 \ 'test text', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 \ "\t\tother test text", |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 \ ' a cde', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 \ ' f ghi', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 \ 'test text', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 \ ' Second line beginning with whitespace' |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 \ ]) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 call cursor(1, 1) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 exe "normal /some\<CR>" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 exe "normal r\t" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 call assert_equal("\t\t ome test text", getline('.')) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 set noexpandtab |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 exe "normal /other\<CR>" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 exe "normal r\t" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 call assert_equal("\t\t ther test text", getline('.')) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 " Test replacing with Tabs and then backspacing to undo it |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 exe "normal j0wR\t\t\t\<BS>\<BS>\<BS>" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 call assert_equal(" a cde", getline('.')) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 " Test replacing with Tabs |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 exe "normal j0wR\t\t\t" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 call assert_equal(" \t\thi", getline('.')) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 " Test that copyindent works with expandtab set |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 set expandtab smartindent copyindent ts=8 sw=8 sts=8 |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 exe "normal jo{\<CR>x" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 call assert_equal('{', getline(line('.') - 1)) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 call assert_equal(' x', getline('.')) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 set nosol |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 exe "normal /Second line/\<CR>" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 exe "normal fwdv_" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 call assert_equal(' with whitespace', getline('.')) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 enew! |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 set expandtab& smartindent& copyindent& ts& sw& sts& |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 endfunc |
14243
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
47 |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
48 func Test_softtabstop() |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
49 new |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
50 set sts=0 sw=0 |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
51 exe "normal ix\<Tab>x\<Esc>" |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
52 call assert_equal("x\tx", getline(1)) |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
53 |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
54 call setline(1, '') |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
55 set sts=4 |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
56 exe "normal ix\<Tab>x\<Esc>" |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
57 call assert_equal("x x", getline(1)) |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
58 |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
59 call setline(1, '') |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
60 set sts=-1 sw=4 |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
61 exe "normal ix\<Tab>x\<Esc>" |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
62 call assert_equal("x x", getline(1)) |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
63 |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
64 call setline(1, 'x ') |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
65 set sts=0 sw=0 backspace=start |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
66 exe "normal A\<BS>x\<Esc>" |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
67 call assert_equal("x x", getline(1)) |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
68 |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
69 call setline(1, 'x ') |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
70 set sts=4 |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
71 exe "normal A\<BS>x\<Esc>" |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
72 call assert_equal("x x", getline(1)) |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
73 |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
74 call setline(1, 'x ') |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
75 set sts=-1 sw=4 |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
76 exe "normal A\<BS>x\<Esc>" |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
77 call assert_equal("x x", getline(1)) |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
78 |
14276
752ef53d3731
patch 8.1.0154: crash with "set smarttab shiftwidth=0 softtabstop=-1"
Christian Brabandt <cb@256bit.org>
parents:
14243
diff
changeset
|
79 call setline(1, 'x') |
752ef53d3731
patch 8.1.0154: crash with "set smarttab shiftwidth=0 softtabstop=-1"
Christian Brabandt <cb@256bit.org>
parents:
14243
diff
changeset
|
80 set sts=-1 sw=0 smarttab |
752ef53d3731
patch 8.1.0154: crash with "set smarttab shiftwidth=0 softtabstop=-1"
Christian Brabandt <cb@256bit.org>
parents:
14243
diff
changeset
|
81 exe "normal I\<Tab>\<Esc>" |
752ef53d3731
patch 8.1.0154: crash with "set smarttab shiftwidth=0 softtabstop=-1"
Christian Brabandt <cb@256bit.org>
parents:
14243
diff
changeset
|
82 call assert_equal("\tx", getline(1)) |
752ef53d3731
patch 8.1.0154: crash with "set smarttab shiftwidth=0 softtabstop=-1"
Christian Brabandt <cb@256bit.org>
parents:
14243
diff
changeset
|
83 |
752ef53d3731
patch 8.1.0154: crash with "set smarttab shiftwidth=0 softtabstop=-1"
Christian Brabandt <cb@256bit.org>
parents:
14243
diff
changeset
|
84 call setline(1, 'x') |
752ef53d3731
patch 8.1.0154: crash with "set smarttab shiftwidth=0 softtabstop=-1"
Christian Brabandt <cb@256bit.org>
parents:
14243
diff
changeset
|
85 exe "normal I\<Tab>\<BS>\<Esc>" |
752ef53d3731
patch 8.1.0154: crash with "set smarttab shiftwidth=0 softtabstop=-1"
Christian Brabandt <cb@256bit.org>
parents:
14243
diff
changeset
|
86 call assert_equal("x", getline(1)) |
752ef53d3731
patch 8.1.0154: crash with "set smarttab shiftwidth=0 softtabstop=-1"
Christian Brabandt <cb@256bit.org>
parents:
14243
diff
changeset
|
87 |
752ef53d3731
patch 8.1.0154: crash with "set smarttab shiftwidth=0 softtabstop=-1"
Christian Brabandt <cb@256bit.org>
parents:
14243
diff
changeset
|
88 set sts=0 sw=0 backspace& nosmarttab |
14243
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
89 bwipe! |
fbf0681606fa
patch 8.1.0138: negative value of 'softtabstop' not used correctly
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
90 endfunc |