annotate src/testdir/test_backspace_opt.vim @ 35167:6dddafdbe6f9 default tip

Added tag v9.1.0409 for changeset 0b259135fb3a4ce87fc1ff0673ae9b61cb7ed555
author Christian Brabandt <cb@256bit.org>
date Sun, 12 May 2024 00:15:05 +0200
parents e7ab58f57ea3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7464
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for 'backspace' settings
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 func Test_backspace_option()
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 set backspace=
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 call assert_equal('', &backspace)
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 set backspace=indent
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 call assert_equal('indent', &backspace)
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 set backspace=eol
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 call assert_equal('eol', &backspace)
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 set backspace=start
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 call assert_equal('start', &backspace)
20069
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
12 set backspace=nostop
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
13 call assert_equal('nostop', &backspace)
7464
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 " Add the value
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 set backspace=
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 set backspace=indent
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 call assert_equal('indent', &backspace)
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 set backspace+=eol
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 call assert_equal('indent,eol', &backspace)
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 set backspace+=start
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 call assert_equal('indent,eol,start', &backspace)
20069
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
22 set backspace+=nostop
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
23 call assert_equal('indent,eol,start,nostop', &backspace)
7464
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 " Delete the value
20069
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
25 set backspace-=nostop
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
26 call assert_equal('indent,eol,start', &backspace)
7464
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 set backspace-=indent
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 call assert_equal('eol,start', &backspace)
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 set backspace-=start
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 call assert_equal('eol', &backspace)
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 set backspace-=eol
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 call assert_equal('', &backspace)
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 " Check the error
22999
ffb173dbf228 patch 8.2.2046: some test failures don't give a clear error
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
34 call assert_fails('set backspace=ABC', 'E474:')
ffb173dbf228 patch 8.2.2046: some test failures don't give a clear error
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
35 call assert_fails('set backspace+=def', 'E474:')
7464
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 " NOTE: Vim doesn't check following error...
22999
ffb173dbf228 patch 8.2.2046: some test failures don't give a clear error
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
37 "call assert_fails('set backspace-=ghi', 'E474:')
7464
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 " Check backwards compatibility with version 5.4 and earlier
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 set backspace=0
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 call assert_equal('0', &backspace)
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 set backspace=1
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 call assert_equal('1', &backspace)
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 set backspace=2
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 call assert_equal('2', &backspace)
20069
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
46 set backspace=3
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
47 call assert_equal('3', &backspace)
22999
ffb173dbf228 patch 8.2.2046: some test failures don't give a clear error
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
48 call assert_fails('set backspace=4', 'E474:')
ffb173dbf228 patch 8.2.2046: some test failures don't give a clear error
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
49 call assert_fails('set backspace=10', 'E474:')
7464
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 " Cleared when 'compatible' is set
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 set compatible
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 call assert_equal('', &backspace)
8796
fb764adba294 commit https://github.com/vim/vim/commit/e9c07270031e312082604d3505650f185aa65948
Christian Brabandt <cb@256bit.org>
parents: 8564
diff changeset
54 set nocompatible viminfo+=nviminfo
7464
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 endfunc
1e47dd710211 commit https://github.com/vim/vim/commit/27a82e31ee9acedb6922093b2764f7f6860b0f91
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56
16658
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
57 " Test with backspace set to the non-compatible setting
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
58 func Test_backspace_ctrl_u()
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
59 new
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
60 call append(0, [
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
61 \ "1 this shouldn't be deleted",
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
62 \ "2 this shouldn't be deleted",
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
63 \ "3 this shouldn't be deleted",
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
64 \ "4 this should be deleted",
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
65 \ "5 this shouldn't be deleted",
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
66 \ "6 this shouldn't be deleted",
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
67 \ "7 this shouldn't be deleted",
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
68 \ "8 this shouldn't be deleted (not touched yet)"])
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
69 call cursor(2, 1)
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
70
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
71 set compatible
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
72 set backspace=2
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
73
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
74 exe "normal Avim1\<C-U>\<Esc>\<CR>"
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
75 exe "normal Avim2\<C-G>u\<C-U>\<Esc>\<CR>"
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
76
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
77 set cpo-=<
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
78 inoremap <c-u> <left><c-u>
20627
8bce783af0cb patch 8.2.0867: using {xxx} for encoding a modifier is not nice
Bram Moolenaar <Bram@vim.org>
parents: 20603
diff changeset
79 exe "normal Avim3\<*C-U>\<Esc>\<CR>"
16658
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
80 iunmap <c-u>
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
81 exe "normal Avim4\<C-U>\<C-U>\<Esc>\<CR>"
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
82
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
83 " Test with backspace set to the compatible setting
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
84 set backspace= visualbell
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
85 exe "normal A vim5\<Esc>A\<C-U>\<C-U>\<Esc>\<CR>"
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
86 exe "normal A vim6\<Esc>Azwei\<C-G>u\<C-U>\<Esc>\<CR>"
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
87
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
88 inoremap <c-u> <left><c-u>
20627
8bce783af0cb patch 8.2.0867: using {xxx} for encoding a modifier is not nice
Bram Moolenaar <Bram@vim.org>
parents: 20603
diff changeset
89 exe "normal A vim7\<*C-U>\<*C-U>\<Esc>\<CR>"
16658
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
90
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
91 call assert_equal([
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
92 \ "1 this shouldn't be deleted",
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
93 \ "2 this shouldn't be deleted",
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
94 \ "3 this shouldn't be deleted",
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
95 \ "4 this should be deleted3",
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
96 \ "",
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
97 \ "6 this shouldn't be deleted vim5",
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
98 \ "7 this shouldn't be deleted vim6",
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
99 \ "8 this shouldn't be deleted (not touched yet) vim7",
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
100 \ ""], getline(1, '$'))
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
101
20069
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
102 " Reset values
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
103 set compatible&vim
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
104 set visualbell&vim
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
105 set backspace&vim
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
106
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
107 " Test new nostop option
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
108 %d_
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
109 let expected = "foo bar foobar"
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
110 call setline(1, expected)
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
111 call cursor(1, 8)
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
112 exe ":norm! ianotherone\<c-u>"
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
113 call assert_equal(expected, getline(1))
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
114 call cursor(1, 8)
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
115 exe ":norm! ianothertwo\<c-w>"
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
116 call assert_equal(expected, getline(1))
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
117
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
118 let content = getline(1)
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
119 for value in ['indent,nostop', 'eol,nostop', 'indent,eol,nostop', 'indent,eol,start,nostop']
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
120 exe ":set bs=".. value
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
121 %d _
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
122 call setline(1, content)
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
123 let expected = " foobar"
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
124 call cursor(1, 8)
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
125 exe ":norm! ianotherone\<c-u>"
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
126 call assert_equal(expected, getline(1), 'CTRL-U backspace value: '.. &bs)
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
127 let expected = "foo foobar"
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
128 call setline(1, content)
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
129 call cursor(1, 8)
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
130 exe ":norm! ianothertwo\<c-w>"
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
131 call assert_equal(expected, getline(1), 'CTRL-W backspace value: '.. &bs)
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
132 endfor
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
133
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
134 " Reset options
16658
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
135 set compatible&vim
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
136 set visualbell&vim
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
137 set backspace&vim
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
138 close!
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
139 endfunc
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 9909
diff changeset
140
32096
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
141 " Test for setting 'backspace' to a number value (for backward compatibility)
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
142 func Test_backspace_number_value()
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
143 new
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
144
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
145 set backspace=0
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
146 call setline(1, ['one two', 'three four'])
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
147 call cursor(2, 1)
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
148 exe "normal! A\<C-W>\<C-U>"
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
149 call assert_equal('three four', getline(2))
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
150
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
151 set backspace=1
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
152 exe "normal! A\<CR>five\<C-W>\<C-U>\<C-W>\<C-U>"
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
153 call assert_equal(['one two', 'three four'], getline(1, '$'))
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
154
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
155 set backspace=2
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
156 call cursor(2, 7)
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
157 exe "normal! ihalf\<C-U>"
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
158 call assert_equal('three four', getline(2))
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
159
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
160 set backspace=3
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
161 call cursor(2, 7)
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
162 exe "normal! ihalf\<C-U>"
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
163 call assert_equal('four', getline(2))
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
164
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
165 bw!
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
166 set backspace&
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
167 endfunc
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 22999
diff changeset
168
9909
3ee84d270ea7 commit https://github.com/vim/vim/commit/9e4d8215d386100ab660d7d11e6620fd148b605e
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
169 " vim: shiftwidth=2 sts=2 expandtab