Mercurial > vim
comparison src/testdir/test_backspace_opt.vim @ 20069:9a67d41708d2 v8.2.0590
patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Commit: https://github.com/vim/vim/commit/aa0489e12d227d24752cf16e4e97058ac32edcc1
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Apr 17 19:41:21 2020 +0200
patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Problem: No 'backspace' value allows ignoring the insertion point.
Solution: Add the "nostop" and 3 values. (Christian Brabandt, closes https://github.com/vim/vim/issues/5940)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 17 Apr 2020 19:45:05 +0200 |
parents | b07672d13ff9 |
children | c2570baa2e4c |
comparison
equal
deleted
inserted
replaced
20068:b644ea832304 | 20069:9a67d41708d2 |
---|---|
17 call assert_equal('indent', &backspace) | 17 call assert_equal('indent', &backspace) |
18 set backspace=eol | 18 set backspace=eol |
19 call assert_equal('eol', &backspace) | 19 call assert_equal('eol', &backspace) |
20 set backspace=start | 20 set backspace=start |
21 call assert_equal('start', &backspace) | 21 call assert_equal('start', &backspace) |
22 set backspace=nostop | |
23 call assert_equal('nostop', &backspace) | |
22 " Add the value | 24 " Add the value |
23 set backspace= | 25 set backspace= |
24 set backspace=indent | 26 set backspace=indent |
25 call assert_equal('indent', &backspace) | 27 call assert_equal('indent', &backspace) |
26 set backspace+=eol | 28 set backspace+=eol |
27 call assert_equal('indent,eol', &backspace) | 29 call assert_equal('indent,eol', &backspace) |
28 set backspace+=start | 30 set backspace+=start |
29 call assert_equal('indent,eol,start', &backspace) | 31 call assert_equal('indent,eol,start', &backspace) |
32 set backspace+=nostop | |
33 call assert_equal('indent,eol,start,nostop', &backspace) | |
30 " Delete the value | 34 " Delete the value |
35 set backspace-=nostop | |
36 call assert_equal('indent,eol,start', &backspace) | |
31 set backspace-=indent | 37 set backspace-=indent |
32 call assert_equal('eol,start', &backspace) | 38 call assert_equal('eol,start', &backspace) |
33 set backspace-=start | 39 set backspace-=start |
34 call assert_equal('eol', &backspace) | 40 call assert_equal('eol', &backspace) |
35 set backspace-=eol | 41 set backspace-=eol |
45 call assert_equal('0', &backspace) | 51 call assert_equal('0', &backspace) |
46 set backspace=1 | 52 set backspace=1 |
47 call assert_equal('1', &backspace) | 53 call assert_equal('1', &backspace) |
48 set backspace=2 | 54 set backspace=2 |
49 call assert_equal('2', &backspace) | 55 call assert_equal('2', &backspace) |
50 call assert_false(match(Exec('set backspace=3'), '.*E474')) | 56 set backspace=3 |
57 call assert_equal('3', &backspace) | |
58 call assert_false(match(Exec('set backspace=4'), '.*E474')) | |
51 call assert_false(match(Exec('set backspace=10'), '.*E474')) | 59 call assert_false(match(Exec('set backspace=10'), '.*E474')) |
52 | 60 |
53 " Cleared when 'compatible' is set | 61 " Cleared when 'compatible' is set |
54 set compatible | 62 set compatible |
55 call assert_equal('', &backspace) | 63 call assert_equal('', &backspace) |
99 \ "6 this shouldn't be deleted vim5", | 107 \ "6 this shouldn't be deleted vim5", |
100 \ "7 this shouldn't be deleted vim6", | 108 \ "7 this shouldn't be deleted vim6", |
101 \ "8 this shouldn't be deleted (not touched yet) vim7", | 109 \ "8 this shouldn't be deleted (not touched yet) vim7", |
102 \ ""], getline(1, '$')) | 110 \ ""], getline(1, '$')) |
103 | 111 |
112 " Reset values | |
113 set compatible&vim | |
114 set visualbell&vim | |
115 set backspace&vim | |
116 | |
117 " Test new nostop option | |
118 %d_ | |
119 let expected = "foo bar foobar" | |
120 call setline(1, expected) | |
121 call cursor(1, 8) | |
122 exe ":norm! ianotherone\<c-u>" | |
123 call assert_equal(expected, getline(1)) | |
124 call cursor(1, 8) | |
125 exe ":norm! ianothertwo\<c-w>" | |
126 call assert_equal(expected, getline(1)) | |
127 | |
128 let content = getline(1) | |
129 for value in ['indent,nostop', 'eol,nostop', 'indent,eol,nostop', 'indent,eol,start,nostop'] | |
130 exe ":set bs=".. value | |
131 %d _ | |
132 call setline(1, content) | |
133 let expected = " foobar" | |
134 call cursor(1, 8) | |
135 exe ":norm! ianotherone\<c-u>" | |
136 call assert_equal(expected, getline(1), 'CTRL-U backspace value: '.. &bs) | |
137 let expected = "foo foobar" | |
138 call setline(1, content) | |
139 call cursor(1, 8) | |
140 exe ":norm! ianothertwo\<c-w>" | |
141 call assert_equal(expected, getline(1), 'CTRL-W backspace value: '.. &bs) | |
142 endfor | |
143 | |
144 " Reset options | |
104 set compatible&vim | 145 set compatible&vim |
105 set visualbell&vim | 146 set visualbell&vim |
106 set backspace&vim | 147 set backspace&vim |
107 close! | 148 close! |
108 endfunc | 149 endfunc |