annotate src/testdir/test_increment.vim @ 7551:f624d7671e0c v7.4.1076

commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 10 14:13:40 2016 +0100 patch 7.4.1076 Problem: CTRL-A does not work well in right-left mode. Solution: Remove reversing the line, add a test. (Hirohito Higashi)
author Christian Brabandt <cb@256bit.org>
date Sun, 10 Jan 2016 14:15:03 +0100
parents 25e3b1a99768
children 5274513d3f54
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7544
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for using Ctrl-A/Ctrl-X on visual selections
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...
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
136 "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
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
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
287 " Expexted:
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
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
367 func Test_visual_increment_15()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
368 call setline(1, ["101"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
369 exec "norm! lv\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
370 call assert_equal(["111"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
371 call assert_equal([0, 1, 2, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
372 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
373
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
374 " 16) increment right aligned numbers
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
375 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
376 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
377 " 19
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
378 " 119
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
379 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
380 " 1) Ctrl-a on line selected region
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
381 " 2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
382 " 20
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
383 " 120
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
384 func Test_visual_increment_16()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
385 call setline(1, [" 1", " 19", " 119"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
386 exec "norm! VG\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
387 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
388 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
389 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
390
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
391 " 17) block-wise increment and redo
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
392 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
393 " 100
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
394 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
395 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
396 " 100
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
397 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
398 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
399 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
400 " 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
401 " 101
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
402 " 2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
403 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
404 " 101
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
405 " 2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
406 func Test_visual_increment_17()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
407 call setline(1, [" 100", " 1", "", " 100", " 1"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
408 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
409 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
410 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
411 endfunc
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 " 18) repeat of g<Ctrl-a>
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
414 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
415 " 0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
416 " 0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
417 " 0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
418 " 0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
419 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
420 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
421 " 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
422 " 3
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
423 " 6
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
424 " 9
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
425 " 12
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
426 func Test_visual_increment_18()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
427 call setline(1, repeat(["0"], 4))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
428 exec "norm! GV3kg\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
429 exec "norm! .."
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
430 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
431 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
432 endfunc
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 " 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
435 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
436 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
437 " 1a
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
438 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
439 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
440 " 1) <Ctrl-V>j$ <ctrl-a>
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
441 " 2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
442 " 2a
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
443 func Test_visual_increment_19()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
444 set nrformats+=alpha
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
445 call setline(1, ["1", "1a"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
446 exec "norm! \<C-V>G$\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
447 call assert_equal(["2", "2a"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
448 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
449 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
450
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
451 " 20) increment a single letter
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
452 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
453 " a
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
454 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
455 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
456 " 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
457 " b
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
458 func Test_visual_increment_20()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
459 set nrformats+=alpha
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
460 call setline(1, ["a"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
461 exec "norm! \<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
462 call assert_equal(["b"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
463 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
464 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
465
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
466 " 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
467 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
468 " 0x123456
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
469 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
470 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
471 " 1) Ctrl-V f3 <ctrl-a>
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
472 " 0x124456
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
473 func Test_visual_increment_21()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
474 call setline(1, ["0x123456"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
475 exec "norm! \<C-V>f3\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
476 call assert_equal(["0x124456"], 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('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
478 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
479
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
480 " 22) Block increment on 0b0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
481 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
482 " 0b1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
483 " 0b1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
484 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
485 " 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
486 " 0b10
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
487 " 0b10
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
488 " 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
489 " 0b10
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
490 " 0b10
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
491 func Test_visual_increment_22()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
492 call setline(1, repeat(["0b1"], 2))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
493 exec "norm! \<C-V>j$\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
494 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
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
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
497 call setline(1, repeat(["0b1"], 2))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
498 exec "norm! $\<C-V>+\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
499 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
500 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
501 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
502
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
503 " 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
504 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
505 " 0b1001
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
506 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
507 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
508 " 1) Ctrl-V 5l <ctrl-a>
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
509 " 0b1011
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
510 func Test_visual_increment_23()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
511 call setline(1, ["0b1001"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
512 exec "norm! \<C-V>4l\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
513 call assert_equal(["0b1011"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
514 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
515 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
516
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
517 " 24) increment hexadecimal
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
518 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
519 " 0x0b1001
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 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
522 " 1) <ctrl-a>
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
523 " 0x0b1002
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
524 func Test_visual_increment_24()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
525 call setline(1, ["0x0b1001"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
526 exec "norm! \<C-V>$\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
527 call assert_equal(["0x0b1002"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
528 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
529 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
530
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
531 " 25) increment binary with nrformats including alpha
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
532 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
533 " 0b1001a
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 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
536 " 1) <ctrl-a>
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
537 " 0b1010a
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
538 func Test_visual_increment_25()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
539 set nrformats+=alpha
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
540 call setline(1, ["0b1001a"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
541 exec "norm! \<C-V>$\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
542 call assert_equal(["0b1010a"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
543 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
544 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
545
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
546 " 26) increment binary with 32 bits
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
547 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
548 " 0b11111111111111111111111111111110
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
549 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
550 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
551 " 1) <ctrl-a>
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
552 " 0b11111111111111111111111111111111
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
553 func Test_visual_increment_26()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
554 set nrformats+=alpha
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
555 call setline(1, ["0b11111111111111111111111111111110"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
556 exec "norm! \<C-V>$\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
557 call assert_equal(["0b11111111111111111111111111111111"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
558 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
559 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
560
7551
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
561 " 27) increment with 'rightreft', if supported
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
562 func Test_visual_increment_27()
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
563 if exists('+rightleft')
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
564 set rightleft
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
565 call setline(1, ["1234 56"])
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
566
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
567 exec "norm! $\<C-A>"
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
568 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
569 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
570
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
571 exec "norm! \<C-A>"
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
572 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
573 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
574 set norightleft
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
575 endif
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
576 endfunc
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
577
7544
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
578 " vim: tabstop=2 shiftwidth=2 expandtab