From aa0489e12d227d24752cf16e4e97058ac32edcc1 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 17 Apr 2020 19:41:21 +0200 Subject: 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 #5940) --- src/testdir/test_backspace_opt.vim | 43 +++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'src/testdir/test_backspace_opt.vim') 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\" + call assert_equal(expected, getline(1)) + call cursor(1, 8) + exe ":norm! ianothertwo\" + 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\" + 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\" + call assert_equal(expected, getline(1), 'CTRL-W backspace value: '.. &bs) + endfor + + " Reset options set compatible&vim set visualbell&vim set backspace&vim -- cgit v1.2.3