summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_backspace_opt.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-04-17 19:41:21 +0200
committerBram Moolenaar <Bram@vim.org>2020-04-17 19:41:21 +0200
commitaa0489e12d227d24752cf16e4e97058ac32edcc1 (patch)
treec7bffc6ea5b5cf2ec14e15c00c99e779d3f4f15f /src/testdir/test_backspace_opt.vim
parent0fc1288aefce25da0a2fb2a0aab75b0bd314403f (diff)
patch 8.2.0590: no 'backspace' value allows ignoring the insertion pointv8.2.0590
Problem: No 'backspace' value allows ignoring the insertion point. Solution: Add the "nostop" and 3 values. (Christian Brabandt, closes #5940)
Diffstat (limited to 'src/testdir/test_backspace_opt.vim')
-rw-r--r--src/testdir/test_backspace_opt.vim43
1 files changed, 42 insertions, 1 deletions
diff --git a/src/testdir/test_backspace_opt.vim b/src/testdir/test_backspace_opt.vim
index f0e13d1c02..ad051cca45 100644
--- a/src/testdir/test_backspace_opt.vim
+++ b/src/testdir/test_backspace_opt.vim
@@ -19,6 +19,8 @@ func Test_backspace_option()
call assert_equal('eol', &backspace)
set backspace=start
call assert_equal('start', &backspace)
+ set backspace=nostop
+ call assert_equal('nostop', &backspace)
" Add the value
set backspace=
set backspace=indent
@@ -27,7 +29,11 @@ func Test_backspace_option()
call assert_equal('indent,eol', &backspace)
set backspace+=start
call assert_equal('indent,eol,start', &backspace)
+ set backspace+=nostop
+ call assert_equal('indent,eol,start,nostop', &backspace)
" Delete the value
+ set backspace-=nostop
+ call assert_equal('indent,eol,start', &backspace)
set backspace-=indent
call assert_equal('eol,start', &backspace)
set backspace-=start
@@ -47,7 +53,9 @@ func Test_backspace_option()
call assert_equal('1', &backspace)
set backspace=2
call assert_equal('2', &backspace)
- call assert_false(match(Exec('set backspace=3'), '.*E474'))
+ set backspace=3
+ call assert_equal('3', &backspace)
+ call assert_false(match(Exec('set backspace=4'), '.*E474'))
call assert_false(match(Exec('set backspace=10'), '.*E474'))
" Cleared when 'compatible' is set
@@ -101,6 +109,39 @@ func Test_backspace_ctrl_u()
\ "8 this shouldn't be deleted (not touched yet) vim7",
\ ""], getline(1, '$'))
+ " Reset values
+ set compatible&vim
+ set visualbell&vim
+ set backspace&vim
+
+ " Test new nostop option
+ %d_
+ let expected = "foo bar foobar"
+ call setline(1, expected)
+ call cursor(1, 8)
+ exe ":norm! ianotherone\<c-u>"
+ call assert_equal(expected, getline(1))
+ call cursor(1, 8)
+ exe ":norm! ianothertwo\<c-w>"
+ call assert_equal(expected, getline(1))
+
+ let content = getline(1)
+ for value in ['indent,nostop', 'eol,nostop', 'indent,eol,nostop', 'indent,eol,start,nostop']
+ exe ":set bs=".. value
+ %d _
+ call setline(1, content)
+ let expected = " foobar"
+ call cursor(1, 8)
+ exe ":norm! ianotherone\<c-u>"
+ call assert_equal(expected, getline(1), 'CTRL-U backspace value: '.. &bs)
+ let expected = "foo foobar"
+ call setline(1, content)
+ call cursor(1, 8)
+ exe ":norm! ianothertwo\<c-w>"
+ call assert_equal(expected, getline(1), 'CTRL-W backspace value: '.. &bs)
+ endfor
+
+ " Reset options
set compatible&vim
set visualbell&vim
set backspace&vim