annotate src/testdir/test_increment.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 39f4126d2a0d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20613
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
1 " Tests for using Ctrl-A/Ctrl-X
7544
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 func SetUp()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 new dummy
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 set nrformats&vim
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 func TearDown()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 bwipe!
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 " 1) Ctrl-A on visually selected number
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 " foobar-10
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 " 1) Ctrl-A on start of line:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 " foobar-9
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 " 2) Ctrl-A on visually selected "-10":
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 " foobar-9
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 " 3) Ctrl-A on visually selected "10":
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 " foobar-11
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 " 4) Ctrl-X on visually selected "-10"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 " foobar-11
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 " 5) Ctrl-X on visually selected "10"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 " foobar-9
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 func Test_visual_increment_01()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 call setline(1, repeat(["foobaar-10"], 5))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 call cursor(1, 1)
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 exec "norm! \<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 call assert_equal("foobaar-9", getline('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 call assert_equal([0, 1, 9, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 call cursor(2, 1)
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 exec "norm! f-v$\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 call assert_equal("foobaar-9", getline('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 call assert_equal([0, 2, 8, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 call cursor(3, 1)
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 exec "norm! f1v$\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 call assert_equal("foobaar-11", getline('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 call assert_equal([0, 3, 9, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 call cursor(4, 1)
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 exec "norm! f-v$\<C-X>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 call assert_equal("foobaar-11", getline('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 call assert_equal([0, 4, 8, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 call cursor(5, 1)
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 exec "norm! f1v$\<C-X>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 call assert_equal("foobaar-9", getline('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 call assert_equal([0, 5, 9, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 " 2) Ctrl-A on visually selected lines
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 " 10
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 " 20
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 " 30
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 " 40
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 " 1) Ctrl-A on visually selected lines:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 " 11
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 " 21
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 " 31
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 " 41
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 " 2) Ctrl-X on visually selected lines:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 " 9
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 " 19
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 " 29
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 " 39
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 func Test_visual_increment_02()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 call setline(1, ["10", "20", "30", "40"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 exec "norm! GV3k$\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 call assert_equal(["11", "21", "31", "41"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 call setline(1, ["10", "20", "30", "40"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 exec "norm! GV3k$\<C-X>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 call assert_equal(["9", "19", "29", "39"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 " 3) g Ctrl-A on visually selected lines, with non-numbers in between
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 " 10
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 " 20
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 " 30
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 " 40
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 " 1) 2 g Ctrl-A on visually selected lines:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98 " 12
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 " 24
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102 " 36
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104 " 48
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
105 " 2) 2 g Ctrl-X on visually selected lines
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
106 " 8
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
108 " 16
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
110 " 24
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112 " 32
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113 func Test_visual_increment_03()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
114 call setline(1, ["10", "", "20", "", "30", "", "40"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115 exec "norm! GV6k2g\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
116 call assert_equal(["12", "", "24", "", "36", "", "48"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
118
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
119 call setline(1, ["10", "", "20", "", "30", "", "40"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
120 exec "norm! GV6k2g\<C-X>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 call assert_equal(["8", "", "16", "", "24", "", "32"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
122 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 " 4) Ctrl-A on non-number
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127 " foobar-10
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
129 " 1) visually select foobar:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
130 " foobar-10
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
131 func Test_visual_increment_04()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 call setline(1, ["foobar-10"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133 exec "norm! vf-\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
134 call assert_equal(["foobar-10"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
135 " NOTE: I think this is correct behavior...
7574
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
136 call assert_equal([0, 1, 1, 0], getpos('.'))
7544
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
137 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
138
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
139 " 5) g<Ctrl-A> on letter
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
140 " Test:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
141 " a
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
142 " a
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143 " a
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
144 " a
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
145 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
146 " 1) g Ctrl-A on visually selected lines
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
147 " b
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
148 " c
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
149 " d
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
150 " e
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
151 func Test_visual_increment_05()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
152 set nrformats+=alpha
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
153 call setline(1, repeat(["a"], 4))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
154 exec "norm! GV3kg\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
155 call assert_equal(["b", "c", "d", "e"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
156 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
157 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
158
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
159 " 6) g<Ctrl-A> on letter
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
160 " Test:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
161 " z
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
162 " z
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
163 " z
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
164 " z
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
165 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
166 " 1) g Ctrl-X on visually selected lines
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
167 " y
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
168 " x
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
169 " w
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
170 " v
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
171 func Test_visual_increment_06()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
172 set nrformats+=alpha
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
173 call setline(1, repeat(["z"], 4))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
174 exec "norm! GV3kg\<C-X>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
175 call assert_equal(["y", "x", "w", "v"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
177 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
178
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
179 " 7) <Ctrl-A> on letter
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
180 " Test:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
181 " 2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
182 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
183 " 0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
184 " -1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
185 " -2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
186 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
187 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
188 " 1) Ctrl-A on visually selected lines
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
189 " 3
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
190 " 2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
191 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
192 " 0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
193 " -1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
194 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
195 " 2) Ctrl-X on visually selected lines
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
196 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
197 " 0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
198 " -1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
199 " -2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
200 " -3
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
201 func Test_visual_increment_07()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
202 call setline(1, ["2", "1", "0", "-1", "-2"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
203 exec "norm! GV4k\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
204 call assert_equal(["3", "2", "1", "0", "-1"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
205 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
206
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
207 call setline(1, ["2", "1", "0", "-1", "-2"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
208 exec "norm! GV4k\<C-X>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
209 call assert_equal(["1", "0", "-1", "-2", "-3"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
210 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
211 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
212
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
213 " 8) Block increment on 0x9
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
214 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
215 " 0x9
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
216 " 0x9
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
217 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
218 " 1) Ctrl-A on visually block selected region (cursor at beginning):
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
219 " 0xa
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
220 " 0xa
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
221 " 2) Ctrl-A on visually block selected region (cursor at end)
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
222 " 0xa
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
223 " 0xa
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
224 func Test_visual_increment_08()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
225 call setline(1, repeat(["0x9"], 2))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
226 exec "norm! \<C-V>j$\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
227 call assert_equal(["0xa", "0xa"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
228 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
229
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
230 call setline(1, repeat(["0x9"], 2))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
231 exec "norm! gg$\<C-V>+\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
232 call assert_equal(["0xa", "0xa"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
233 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
234 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
235
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
236 " 9) Increment and redo
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
237 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
238 " 2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
239 " 2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
240 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
241 " 3
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
242 " 3
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
243 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
244 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
245 " 1) 2 Ctrl-A on first 2 visually selected lines
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
246 " 4
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
247 " 4
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
248 " 2) redo (.) on 3
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
249 " 5
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
250 " 5
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
251 func Test_visual_increment_09()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
252 call setline(1, ["2", "2", "", "3", "3", ""])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
253 exec "norm! ggVj2\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
254 call assert_equal(["4", "4", "", "3", "3", ""], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
255 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
256
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
257 exec "norm! 3j."
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
258 call assert_equal(["4", "4", "", "5", "5", ""], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
259 call assert_equal([0, 4, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
260 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
261
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
262 " 10) sequentially decrement 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
263 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
264 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
265 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
266 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
267 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
268 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
269 " 1) g Ctrl-X on visually selected lines
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
270 " 0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
271 " -1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
272 " -2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
273 " -3
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
274 func Test_visual_increment_10()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
275 call setline(1, repeat(["1"], 4))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
276 exec "norm! GV3kg\<C-X>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
277 call assert_equal(["0", "-1", "-2", "-3"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
278 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
279 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
280
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
281 " 11) visually block selected indented lines
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
282 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
283 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
284 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
285 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
286 " 1
23229
b545334ae654 patch 8.2.2160: various typos
Bram Moolenaar <Bram@vim.org>
parents: 20822
diff changeset
287 " Expected:
7544
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
288 " 1) g Ctrl-A on block selected indented lines
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
289 " 2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
290 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
291 " 3
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
292 " 4
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
293 func Test_visual_increment_11()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
294 call setline(1, [" 1", "1", " 1", " 1"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
295 exec "norm! f1\<C-V>3jg\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
296 call assert_equal([" 2", "1", " 3", " 4"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
297 call assert_equal([0, 1, 5, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
298 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
299
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
300 " 12) visually selected several columns
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
301 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
302 " 0 0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
303 " 0 0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
304 " 0 0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
305 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
306 " 1) 'v' select last zero and first zeroes
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
307 " 0 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
308 " 1 0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
309 " 1 0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
310 func Test_visual_increment_12()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
311 call setline(1, repeat(["0 0"], 3))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
312 exec "norm! $v++\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
313 call assert_equal(["0 1", "1 0", "1 0"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
314 call assert_equal([0, 1, 3, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
315 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
316
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
317 " 13) visually selected part of columns
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
318 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
319 " max: 100px
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
320 " max: 200px
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
321 " max: 300px
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
322 " max: 400px
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
323 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
324 " 1) 'v' on first two numbers Ctrl-A
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
325 " max: 110px
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
326 " max: 220px
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
327 " max: 330px
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
328 " max: 400px
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
329 " 2) 'v' on first two numbers Ctrl-X
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
330 " max: 90px
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
331 " max: 190px
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
332 " max: 290px
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
333 " max: 400px
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
334 func Test_visual_increment_13()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
335 call setline(1, ["max: 100px", "max: 200px", "max: 300px", "max: 400px"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
336 exec "norm! f1\<C-V>l2j\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
337 call assert_equal(["max: 110px", "max: 210px", "max: 310px", "max: 400px"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
338 call assert_equal([0, 1, 6, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
339
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
340 call setline(1, ["max: 100px", "max: 200px", "max: 300px", "max: 400px"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
341 exec "norm! ggf1\<C-V>l2j\<C-X>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
342 call assert_equal(["max: 90px", "max: 190px", "max: 290px", "max: 400px"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
343 call assert_equal([0, 1, 6, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
344 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
345
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
346 " 14) redo in block mode
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
347 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
348 " 1 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
349 " 1 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
350 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
351 " 1) Ctrl-a on first column, redo on second column
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
352 " 2 2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
353 " 2 2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
354 func Test_visual_increment_14()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
355 call setline(1, repeat(["1 1"], 2))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
356 exec "norm! G\<C-V>k\<C-A>w."
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
357 call assert_equal(["2 2", "2 2"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
358 call assert_equal([0, 1, 3, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
359 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
360
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
361 " 15) block select single numbers
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
362 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
363 " 101
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
364 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
365 " 1) Ctrl-a on visually selected zero
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
366 " 111
12996
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
367 "
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
368 " Also: 019 with "01" selected increments to "029".
7544
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
369 func Test_visual_increment_15()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
370 call setline(1, ["101"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
371 exec "norm! lv\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
372 call assert_equal(["111"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
373 call assert_equal([0, 1, 2, 0], getpos('.'))
12996
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
374
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
375 call setline(1, ["019"])
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
376 exec "norm! 0vl\<C-A>"
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
377 call assert_equal("029", getline(1))
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
378
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
379 call setline(1, ["01239"])
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
380 exec "norm! 0vlll\<C-A>"
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
381 call assert_equal("01249", getline(1))
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
382
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
383 call setline(1, ["01299"])
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
384 exec "norm! 0vlll\<C-A>"
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
385 call assert_equal("1309", getline(1))
7544
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
386 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
387
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
388 " 16) increment right aligned numbers
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
389 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
390 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
391 " 19
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
392 " 119
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
393 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
394 " 1) Ctrl-a on line selected region
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
395 " 2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
396 " 20
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
397 " 120
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
398 func Test_visual_increment_16()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
399 call setline(1, [" 1", " 19", " 119"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
400 exec "norm! VG\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
401 call assert_equal([" 2", " 20", " 120"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
402 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
403 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
404
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
405 " 17) block-wise increment and redo
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
406 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
407 " 100
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
408 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
409 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
410 " 100
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
411 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
412 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
413 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
414 " 1) Ctrl-V j $ on first block, afterwards '.' on second
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
415 " 101
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
416 " 2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
417 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
418 " 101
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
419 " 2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
420 func Test_visual_increment_17()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
421 call setline(1, [" 100", " 1", "", " 100", " 1"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
422 exec "norm! \<C-V>j$\<C-A>2j."
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
423 call assert_equal([" 101", " 2", "", " 101", " 1"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
424 call assert_equal([0, 3, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
425 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
426
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
427 " 18) repeat of g<Ctrl-a>
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
428 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
429 " 0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
430 " 0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
431 " 0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
432 " 0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
433 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
434 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
435 " 1) V 4j g<ctrl-a>, repeat twice afterwards with .
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
436 " 3
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
437 " 6
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
438 " 9
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
439 " 12
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
440 func Test_visual_increment_18()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
441 call setline(1, repeat(["0"], 4))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
442 exec "norm! GV3kg\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
443 exec "norm! .."
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
444 call assert_equal(["3", "6", "9", "12"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
445 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
446 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
447
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
448 " 19) increment on number with nrformat including alpha
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
449 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
450 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
451 " 1a
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
452 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
453 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
454 " 1) <Ctrl-V>j$ <ctrl-a>
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
455 " 2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
456 " 2a
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
457 func Test_visual_increment_19()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
458 set nrformats+=alpha
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
459 call setline(1, ["1", "1a"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
460 exec "norm! \<C-V>G$\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
461 call assert_equal(["2", "2a"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
462 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
463 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
464
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
465 " 20) increment a single letter
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
466 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
467 " a
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
468 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
469 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
470 " 1) <Ctrl-a> and cursor is on a
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
471 " b
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
472 func Test_visual_increment_20()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
473 set nrformats+=alpha
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
474 call setline(1, ["a"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
475 exec "norm! \<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
476 call assert_equal(["b"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
477 call assert_equal([0, 1, 1, 0], getpos('.'))
19969
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
478 " decrement a and A and increment z and Z
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
479 call setline(1, ['a', 'A', 'z', 'Z'])
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
480 exe "normal 1G\<C-X>2G\<C-X>3G\<C-A>4G\<C-A>"
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
481 call assert_equal(['a', 'A', 'z', 'Z'], getline(1, '$'))
7544
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
482 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
483
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
484 " 21) block-wise increment on part of hexadecimal
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
485 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
486 " 0x123456
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
487 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
488 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
489 " 1) Ctrl-V f3 <ctrl-a>
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
490 " 0x124456
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
491 func Test_visual_increment_21()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
492 call setline(1, ["0x123456"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
493 exec "norm! \<C-V>f3\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
494 call assert_equal(["0x124456"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
495 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
496 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
497
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
498 " 22) Block increment on 0b0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
499 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
500 " 0b1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
501 " 0b1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
502 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
503 " 1) Ctrl-A on visually block selected region (cursor at beginning):
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
504 " 0b10
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
505 " 0b10
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
506 " 2) Ctrl-A on visually block selected region (cursor at end)
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
507 " 0b10
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
508 " 0b10
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
509 func Test_visual_increment_22()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
510 call setline(1, repeat(["0b1"], 2))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
511 exec "norm! \<C-V>j$\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
512 call assert_equal(repeat(["0b10"], 2), getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
513 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
514
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
515 call setline(1, repeat(["0b1"], 2))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
516 exec "norm! $\<C-V>+\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
517 call assert_equal(repeat(["0b10"], 2), getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
518 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
519 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
520
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
521 " 23) block-wise increment on part of binary
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
522 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
523 " 0b1001
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
524 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
525 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
526 " 1) Ctrl-V 5l <ctrl-a>
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
527 " 0b1011
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
528 func Test_visual_increment_23()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
529 call setline(1, ["0b1001"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
530 exec "norm! \<C-V>4l\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
531 call assert_equal(["0b1011"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
532 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
533 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
534
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
535 " 24) increment hexadecimal
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
536 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
537 " 0x0b1001
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
538 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
539 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
540 " 1) <ctrl-a>
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
541 " 0x0b1002
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
542 func Test_visual_increment_24()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
543 call setline(1, ["0x0b1001"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
544 exec "norm! \<C-V>$\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
545 call assert_equal(["0x0b1002"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
546 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
547 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
548
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
549 " 25) increment binary with nrformats including alpha
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
550 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
551 " 0b1001a
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
552 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
553 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
554 " 1) <ctrl-a>
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
555 " 0b1010a
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
556 func Test_visual_increment_25()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
557 set nrformats+=alpha
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
558 call setline(1, ["0b1001a"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
559 exec "norm! \<C-V>$\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
560 call assert_equal(["0b1010a"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
561 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
562 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
563
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
564 " 26) increment binary with 32 bits
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
565 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
566 " 0b11111111111111111111111111111110
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
567 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
568 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
569 " 1) <ctrl-a>
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
570 " 0b11111111111111111111111111111111
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
571 func Test_visual_increment_26()
19969
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
572 set nrformats+=bin
7544
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
573 call setline(1, ["0b11111111111111111111111111111110"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
574 exec "norm! \<C-V>$\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
575 call assert_equal(["0b11111111111111111111111111111111"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
576 call assert_equal([0, 1, 1, 0], getpos('.'))
19969
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
577 exec "norm! \<C-V>$\<C-X>"
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
578 call assert_equal(["0b11111111111111111111111111111110"], getline(1, '$'))
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
579 set nrformats-=bin
7544
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
580 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
581
7551
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
582 " 27) increment with 'rightreft', if supported
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
583 func Test_visual_increment_27()
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
584 if exists('+rightleft')
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
585 set rightleft
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
586 call setline(1, ["1234 56"])
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
587
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
588 exec "norm! $\<C-A>"
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
589 call assert_equal(["1234 57"], getline(1, '$'))
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
590 call assert_equal([0, 1, 7, 0], getpos('.'))
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
591
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
592 exec "norm! \<C-A>"
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
593 call assert_equal(["1234 58"], getline(1, '$'))
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
594 call assert_equal([0, 1, 7, 0], getpos('.'))
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
595 set norightleft
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
596 endif
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
597 endfunc
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
598
7574
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
599 " Tab code and linewise-visual inc/dec
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
600 func Test_visual_increment_28()
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
601 call setline(1, ["x\<TAB>10", "\<TAB>-1"])
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
602 exec "norm! Vj\<C-A>"
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
603 call assert_equal(["x\<TAB>11", "\<TAB>0"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
604 call assert_equal([0, 1, 1, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
605
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
606 call setline(1, ["x\<TAB>10", "\<TAB>-1"])
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
607 exec "norm! ggVj\<C-X>"
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
608 call assert_equal(["x\<TAB>9", "\<TAB>-2"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
609 call assert_equal([0, 1, 1, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
610 endfunc
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
611
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
612 " Tab code and linewise-visual inc/dec with 'nrformats'+=alpha
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
613 func Test_visual_increment_29()
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
614 set nrformats+=alpha
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
615 call setline(1, ["x\<TAB>10", "\<TAB>-1"])
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
616 exec "norm! Vj\<C-A>"
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
617 call assert_equal(["y\<TAB>10", "\<TAB>0"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
618 call assert_equal([0, 1, 1, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
619
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
620 call setline(1, ["x\<TAB>10", "\<TAB>-1"])
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
621 exec "norm! ggVj\<C-X>"
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
622 call assert_equal(["w\<TAB>10", "\<TAB>-2"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
623 call assert_equal([0, 1, 1, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
624 endfunc
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
625
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
626 " Tab code and character-visual inc/dec
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
627 func Test_visual_increment_30()
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
628 call setline(1, ["x\<TAB>10", "\<TAB>-1"])
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
629 exec "norm! f1vjf1\<C-A>"
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
630 call assert_equal(["x\<TAB>11", "\<TAB>0"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
631 call assert_equal([0, 1, 3, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
632
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
633 call setline(1, ["x\<TAB>10", "\<TAB>-1"])
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
634 exec "norm! ggf1vjf1\<C-X>"
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
635 call assert_equal(["x\<TAB>9", "\<TAB>-2"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
636 call assert_equal([0, 1, 3, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
637 endfunc
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
638
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
639 " Tab code and blockwise-visual inc/dec
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
640 func Test_visual_increment_31()
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
641 call setline(1, ["x\<TAB>10", "\<TAB>-1"])
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
642 exec "norm! f1\<C-V>jl\<C-A>"
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
643 call assert_equal(["x\<TAB>11", "\<TAB>0"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
644 call assert_equal([0, 1, 3, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
645
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
646 call setline(1, ["x\<TAB>10", "\<TAB>-1"])
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
647 exec "norm! ggf1\<C-V>jl\<C-X>"
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
648 call assert_equal(["x\<TAB>9", "\<TAB>-2"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
649 call assert_equal([0, 1, 3, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
650 endfunc
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
651
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
652 " Tab code and blockwise-visual decrement with 'linebreak' and 'showbreak'
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
653 func Test_visual_increment_32()
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
654 28vnew dummy_31
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
655 set linebreak showbreak=+
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
656 call setline(1, ["x\<TAB>\<TAB>\<TAB>10", "\<TAB>\<TAB>\<TAB>\<TAB>-1"])
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
657 exec "norm! ggf0\<C-V>jg_\<C-X>"
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
658 call assert_equal(["x\<TAB>\<TAB>\<TAB>1-1", "\<TAB>\<TAB>\<TAB>\<TAB>-2"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
659 call assert_equal([0, 1, 6, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
660 bwipe!
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
661 endfunc
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
662
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
663 " Tab code and blockwise-visual increment with $
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
664 func Test_visual_increment_33()
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
665 call setline(1, ["\<TAB>123", "456"])
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
666 exec "norm! gg0\<C-V>j$\<C-A>"
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
667 call assert_equal(["\<TAB>124", "457"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
668 call assert_equal([0, 1, 1, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
669 endfunc
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
670
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
671 " Tab code and blockwise-visual increment and redo
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
672 func Test_visual_increment_34()
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
673 call setline(1, ["\<TAB>123", " 456789"])
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
674 exec "norm! gg0\<C-V>j\<C-A>"
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
675 call assert_equal(["\<TAB>123", " 457789"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
676 call assert_equal([0, 1, 1, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
677
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
678 exec "norm! .."
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
679 call assert_equal(["\<TAB>123", " 459789"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
680 call assert_equal([0, 1, 1, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
681 endfunc
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
682
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
683 " Tab code, spaces and character-visual increment and redo
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
684 func Test_visual_increment_35()
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
685 call setline(1, ["\<TAB>123", " 123", "\<TAB>123", "\<TAB>123"])
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
686 exec "norm! ggvjf3\<C-A>..."
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
687 call assert_equal(["\<TAB>127", " 127", "\<TAB>123", "\<TAB>123"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
688 call assert_equal([0, 1, 2, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
689 endfunc
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
690
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
691 " Tab code, spaces and blockwise-visual increment and redo
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
692 func Test_visual_increment_36()
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
693 call setline(1, [" 123", "\<TAB>456789"])
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
694 exec "norm! G0\<C-V>kl\<C-A>"
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
695 call assert_equal([" 123", "\<TAB>556789"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
696 call assert_equal([0, 1, 1, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
697
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
698 exec "norm! ..."
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
699 call assert_equal([" 123", "\<TAB>856789"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
700 call assert_equal([0, 1, 1, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
701 endfunc
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
702
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
703 " block-wise increment and dot-repeat
7568
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
704 " Text:
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
705 " 1 23
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
706 " 4 56
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
707 "
7568
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
708 " Expected:
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
709 " 1) f2 Ctrl-V jl <ctrl-a>, repeat twice afterwards with .
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
710 " 1 26
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
711 " 4 59
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
712 "
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
713 " Try with and without indent.
7574
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
714 func Test_visual_increment_37()
7568
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
715 call setline(1, [" 1 23", " 4 56"])
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
716 exec "norm! ggf2\<C-V>jl\<C-A>.."
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
717 call assert_equal([" 1 26", " 4 59"], getline(1, 2))
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
718
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
719 call setline(1, ["1 23", "4 56"])
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
720 exec "norm! ggf2\<C-V>jl\<C-A>.."
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
721 call assert_equal(["1 26", "4 59"], getline(1, 2))
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
722 endfunc
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
723
7578
fdae4c496775 commit https://github.com/vim/vim/commit/ef2b5036b3005f1ce15d146dce72379a9834c56d
Christian Brabandt <cb@256bit.org>
parents: 7574
diff changeset
724 " Check redo after the normal mode increment
fdae4c496775 commit https://github.com/vim/vim/commit/ef2b5036b3005f1ce15d146dce72379a9834c56d
Christian Brabandt <cb@256bit.org>
parents: 7574
diff changeset
725 func Test_visual_increment_38()
fdae4c496775 commit https://github.com/vim/vim/commit/ef2b5036b3005f1ce15d146dce72379a9834c56d
Christian Brabandt <cb@256bit.org>
parents: 7574
diff changeset
726 exec "norm! i10\<ESC>5\<C-A>."
fdae4c496775 commit https://github.com/vim/vim/commit/ef2b5036b3005f1ce15d146dce72379a9834c56d
Christian Brabandt <cb@256bit.org>
parents: 7574
diff changeset
727 call assert_equal(["20"], getline(1, '$'))
fdae4c496775 commit https://github.com/vim/vim/commit/ef2b5036b3005f1ce15d146dce72379a9834c56d
Christian Brabandt <cb@256bit.org>
parents: 7574
diff changeset
728 call assert_equal([0, 1, 2, 0], getpos('.'))
fdae4c496775 commit https://github.com/vim/vim/commit/ef2b5036b3005f1ce15d146dce72379a9834c56d
Christian Brabandt <cb@256bit.org>
parents: 7574
diff changeset
729 endfunc
fdae4c496775 commit https://github.com/vim/vim/commit/ef2b5036b3005f1ce15d146dce72379a9834c56d
Christian Brabandt <cb@256bit.org>
parents: 7574
diff changeset
730
7927
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
731 " Test what patch 7.3.414 fixed. Ctrl-A on "000" drops the leading zeros.
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
732 func Test_normal_increment_01()
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
733 call setline(1, "000")
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
734 exec "norm! gg0\<C-A>"
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
735 call assert_equal("001", getline(1))
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
736
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
737 call setline(1, "000")
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
738 exec "norm! gg$\<C-A>"
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
739 call assert_equal("001", getline(1))
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
740
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
741 call setline(1, "001")
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
742 exec "norm! gg0\<C-A>"
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
743 call assert_equal("002", getline(1))
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
744
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
745 call setline(1, "001")
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
746 exec "norm! gg$\<C-A>"
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
747 call assert_equal("002", getline(1))
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
748 endfunc
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
749
8690
6a1becf4f282 commit https://github.com/vim/vim/commit/8e08125d3a9afd0b16cd84454ae9ddad0abaaab0
Christian Brabandt <cb@256bit.org>
parents: 7927
diff changeset
750 " Test a regression of patch 7.4.1087 fixed.
6a1becf4f282 commit https://github.com/vim/vim/commit/8e08125d3a9afd0b16cd84454ae9ddad0abaaab0
Christian Brabandt <cb@256bit.org>
parents: 7927
diff changeset
751 func Test_normal_increment_02()
6a1becf4f282 commit https://github.com/vim/vim/commit/8e08125d3a9afd0b16cd84454ae9ddad0abaaab0
Christian Brabandt <cb@256bit.org>
parents: 7927
diff changeset
752 call setline(1, ["hello 10", "world"])
6a1becf4f282 commit https://github.com/vim/vim/commit/8e08125d3a9afd0b16cd84454ae9ddad0abaaab0
Christian Brabandt <cb@256bit.org>
parents: 7927
diff changeset
753 exec "norm! ggl\<C-A>jx"
6a1becf4f282 commit https://github.com/vim/vim/commit/8e08125d3a9afd0b16cd84454ae9ddad0abaaab0
Christian Brabandt <cb@256bit.org>
parents: 7927
diff changeset
754 call assert_equal(["hello 11", "worl"], getline(1, '$'))
6a1becf4f282 commit https://github.com/vim/vim/commit/8e08125d3a9afd0b16cd84454ae9ddad0abaaab0
Christian Brabandt <cb@256bit.org>
parents: 7927
diff changeset
755 call assert_equal([0, 2, 4, 0], getpos('.'))
6a1becf4f282 commit https://github.com/vim/vim/commit/8e08125d3a9afd0b16cd84454ae9ddad0abaaab0
Christian Brabandt <cb@256bit.org>
parents: 7927
diff changeset
756 endfunc
6a1becf4f282 commit https://github.com/vim/vim/commit/8e08125d3a9afd0b16cd84454ae9ddad0abaaab0
Christian Brabandt <cb@256bit.org>
parents: 7927
diff changeset
757
9361
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
758 " The test35 unified to this file.
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
759 func Test_normal_increment_03()
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
760 call setline(1, ["100 0x100 077 0",
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
761 \ "100 0x100 077 ",
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
762 \ "100 0x100 077 0xfF 0xFf",
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
763 \ "100 0x100 077 "])
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
764 set nrformats=octal,hex
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
765 exec "norm! gg\<C-A>102\<C-X>\<C-A>l\<C-X>l\<C-A>64\<C-A>128\<C-X>$\<C-X>"
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
766 set nrformats=octal
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
767 exec "norm! j0\<C-A>102\<C-X>\<C-A>l\<C-X>2\<C-A>w65\<C-A>129\<C-X>blx6lD"
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
768 set nrformats=hex
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
769 exec "norm! j0101\<C-X>l257\<C-X>\<C-A>Txldt \<C-A> \<C-X> \<C-X>"
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
770 set nrformats=
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
771 exec "norm! j0200\<C-X>l100\<C-X>w78\<C-X>\<C-A>k"
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
772 call assert_equal(["0 0x0ff 0000 -1",
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
773 \ "0 1x100 0777777",
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
774 \ "-1 0x0 078 0xFE 0xfe",
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
775 \ "-100 -100x100 000 "], getline(1, '$'))
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
776 call assert_equal([0, 3, 25, 0], getpos('.'))
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
777 endfunc
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
778
12996
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
779 func Test_increment_empty_line()
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
780 call setline(1, ['0', '0', '0', '0', '0', '0', ''])
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
781 exe "normal Gvgg\<C-A>"
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
782 call assert_equal(['1', '1', '1', '1', '1', '1', ''], getline(1, 7))
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 12996
diff changeset
783
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 12996
diff changeset
784 " Ctrl-A/Ctrl-X should do nothing in operator pending mode
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 12996
diff changeset
785 %d
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 12996
diff changeset
786 call setline(1, 'one two')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 12996
diff changeset
787 exe "normal! c\<C-A>l"
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 12996
diff changeset
788 exe "normal! c\<C-X>l"
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 12996
diff changeset
789 call assert_equal('one two', getline(1))
19969
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
790 endfunc
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 12996
diff changeset
791
19969
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
792 " Try incrementing/decrementing a non-digit/alpha character
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
793 func Test_increment_special_char()
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
794 call setline(1, '!')
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
795 call assert_beeps("normal \<C-A>")
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
796 call assert_beeps("normal \<C-X>")
12996
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
797 endfunc
8690
6a1becf4f282 commit https://github.com/vim/vim/commit/8e08125d3a9afd0b16cd84454ae9ddad0abaaab0
Christian Brabandt <cb@256bit.org>
parents: 7927
diff changeset
798
20613
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
799 " Try incrementing/decrementing a number when nrformats contains unsigned
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
800 func Test_increment_unsigned()
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
801 set nrformats+=unsigned
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
802
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
803 call setline(1, '0')
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
804 exec "norm! gg0\<C-X>"
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
805 call assert_equal('0', getline(1))
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
806
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
807 call setline(1, '3')
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
808 exec "norm! gg010\<C-X>"
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
809 call assert_equal('0', getline(1))
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
810
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
811 call setline(1, '-0')
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
812 exec "norm! gg0\<C-X>"
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
813 call assert_equal("-0", getline(1))
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
814
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
815 call setline(1, '-11')
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
816 exec "norm! gg08\<C-X>"
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
817 call assert_equal('-3', getline(1))
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
818
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
819 " NOTE: 18446744073709551615 == 2^64 - 1
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
820 call setline(1, '18446744073709551615')
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
821 exec "norm! gg0\<C-A>"
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
822 call assert_equal('18446744073709551615', getline(1))
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
823
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
824 call setline(1, '-18446744073709551615')
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
825 exec "norm! gg0\<C-A>"
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
826 call assert_equal('-18446744073709551615', getline(1))
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
827
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
828 call setline(1, '-18446744073709551614')
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
829 exec "norm! gg08\<C-A>"
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
830 call assert_equal('-18446744073709551615', getline(1))
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
831
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
832 call setline(1, '-1')
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
833 exec "norm! gg0\<C-A>"
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
834 call assert_equal('-2', getline(1))
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
835
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
836 call setline(1, '-3')
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
837 exec "norm! gg08\<C-A>"
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
838 call assert_equal('-11', getline(1))
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
839
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
840 set nrformats-=unsigned
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
841 endfunc
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
842
32098
39f4126d2a0d patch 9.0.1380: CTRL-X on 2**64 subtracts two
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
843 func Test_in_decrement_large_number()
39f4126d2a0d patch 9.0.1380: CTRL-X on 2**64 subtracts two
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
844 " NOTE: 18446744073709551616 == 2^64
39f4126d2a0d patch 9.0.1380: CTRL-X on 2**64 subtracts two
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
845 call setline(1, '18446744073709551616')
39f4126d2a0d patch 9.0.1380: CTRL-X on 2**64 subtracts two
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
846 exec "norm! gg0\<C-X>"
39f4126d2a0d patch 9.0.1380: CTRL-X on 2**64 subtracts two
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
847 call assert_equal('18446744073709551615', getline(1))
39f4126d2a0d patch 9.0.1380: CTRL-X on 2**64 subtracts two
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
848
39f4126d2a0d patch 9.0.1380: CTRL-X on 2**64 subtracts two
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
849 exec "norm! gg0\<C-X>"
39f4126d2a0d patch 9.0.1380: CTRL-X on 2**64 subtracts two
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
850 call assert_equal('18446744073709551614', getline(1))
39f4126d2a0d patch 9.0.1380: CTRL-X on 2**64 subtracts two
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
851
39f4126d2a0d patch 9.0.1380: CTRL-X on 2**64 subtracts two
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
852 exec "norm! gg0\<C-A>"
39f4126d2a0d patch 9.0.1380: CTRL-X on 2**64 subtracts two
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
853 call assert_equal('18446744073709551615', getline(1))
39f4126d2a0d patch 9.0.1380: CTRL-X on 2**64 subtracts two
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
854
39f4126d2a0d patch 9.0.1380: CTRL-X on 2**64 subtracts two
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
855 exec "norm! gg0\<C-A>"
39f4126d2a0d patch 9.0.1380: CTRL-X on 2**64 subtracts two
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
856 call assert_equal('-18446744073709551615', getline(1))
39f4126d2a0d patch 9.0.1380: CTRL-X on 2**64 subtracts two
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
857 endfunc
39f4126d2a0d patch 9.0.1380: CTRL-X on 2**64 subtracts two
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
858
20822
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
859 func Test_normal_increment_with_virtualedit()
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
860 set virtualedit=all
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
861
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
862 call setline(1, ["\<TAB>1"])
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
863 exec "norm! 0\<C-A>"
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
864 call assert_equal("\<TAB>2", getline(1))
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
865 call assert_equal([0, 1, 2, 0], getpos('.'))
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
866
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
867 call setline(1, ["\<TAB>1"])
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
868 exec "norm! 0l\<C-A>"
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
869 call assert_equal("\<TAB>2", getline(1))
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
870 call assert_equal([0, 1, 2, 0], getpos('.'))
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
871
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
872 call setline(1, ["\<TAB>1"])
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
873 exec "norm! 07l\<C-A>"
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
874 call assert_equal("\<TAB>2", getline(1))
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
875 call assert_equal([0, 1, 2, 0], getpos('.'))
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
876
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
877 call setline(1, ["\<TAB>1"])
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
878 exec "norm! 0w\<C-A>"
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
879 call assert_equal("\<TAB>2", getline(1))
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
880 call assert_equal([0, 1, 2, 0], getpos('.'))
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
881
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
882 call setline(1, ["\<TAB>1"])
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
883 exec "norm! 0wl\<C-A>"
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
884 call assert_equal("\<TAB>1", getline(1))
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
885 call assert_equal([0, 1, 3, 0], getpos('.'))
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
886
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
887 call setline(1, ["\<TAB>1"])
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
888 exec "norm! 0w30l\<C-A>"
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
889 call assert_equal("\<TAB>1", getline(1))
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
890 call assert_equal([0, 1, 3, 29], getpos('.'))
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
891
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
892 set virtualedit&
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
893 endfunc
8e5f991db3b4 patch 8.2.0963: number increment/decrement does not work with 'virtualedit'
Bram Moolenaar <Bram@vim.org>
parents: 20613
diff changeset
894
24725
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
895 " Test for incrementing a signed hexadecimal and octal number
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
896 func Test_normal_increment_signed_hexoct_nr()
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
897 new
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
898 " negative sign before a hex number should be ignored
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
899 call setline(1, ["-0x9"])
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
900 exe "norm \<C-A>"
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
901 call assert_equal(["-0xa"], getline(1, '$'))
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
902 exe "norm \<C-X>"
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
903 call assert_equal(["-0x9"], getline(1, '$'))
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
904 call setline(1, ["-007"])
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
905 exe "norm \<C-A>"
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
906 call assert_equal(["-010"], getline(1, '$'))
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
907 exe "norm \<C-X>"
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
908 call assert_equal(["-007"], getline(1, '$'))
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
909 bw!
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
910 endfunc
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
911
9909
3ee84d270ea7 commit https://github.com/vim/vim/commit/9e4d8215d386100ab660d7d11e6620fd148b605e
Christian Brabandt <cb@256bit.org>
parents: 9361
diff changeset
912 " vim: shiftwidth=2 sts=2 expandtab