annotate src/testdir/test_increment.vim @ 17867:180fb9981255 v8.1.1930

patch 8.1.1930: cannot recognize .jsx and .tsx files Commit: https://github.com/vim/vim/commit/92852cee3fcff1dc6ce12387b234634e73267b22 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Aug 26 21:28:15 2019 +0200 patch 8.1.1930: cannot recognize .jsx and .tsx files Problem: Cannot recognize .jsx and .tsx files. Solution: Recognize them as javascriptreact and typescriptreact. (closes #4830)
author Bram Moolenaar <Bram@vim.org>
date Mon, 26 Aug 2019 21:30:04 +0200
parents 973a0037f4c3
children f70a3c1000bb
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...
7574
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
136 call assert_equal([0, 1, 1, 0], getpos('.'))
7544
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
137 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
138
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
139 " 5) g<Ctrl-A> on letter
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
140 " Test:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
141 " a
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
142 " a
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143 " a
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
144 " a
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
145 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
146 " 1) g Ctrl-A on visually selected lines
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
147 " b
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
148 " c
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
149 " d
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
150 " e
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
151 func Test_visual_increment_05()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
152 set nrformats+=alpha
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
153 call setline(1, repeat(["a"], 4))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
154 exec "norm! GV3kg\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
155 call assert_equal(["b", "c", "d", "e"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
156 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
157 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
158
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
159 " 6) g<Ctrl-A> on letter
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
160 " Test:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
161 " z
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
162 " z
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
163 " z
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
164 " z
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
165 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
166 " 1) g Ctrl-X on visually selected lines
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
167 " y
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
168 " x
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
169 " w
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
170 " v
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
171 func Test_visual_increment_06()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
172 set nrformats+=alpha
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
173 call setline(1, repeat(["z"], 4))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
174 exec "norm! GV3kg\<C-X>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
175 call assert_equal(["y", "x", "w", "v"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
177 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
178
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
179 " 7) <Ctrl-A> on letter
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
180 " Test:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
181 " 2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
182 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
183 " 0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
184 " -1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
185 " -2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
186 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
187 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
188 " 1) Ctrl-A on visually selected lines
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
189 " 3
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
190 " 2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
191 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
192 " 0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
193 " -1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
194 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
195 " 2) Ctrl-X on visually selected lines
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
196 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
197 " 0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
198 " -1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
199 " -2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
200 " -3
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
201 func Test_visual_increment_07()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
202 call setline(1, ["2", "1", "0", "-1", "-2"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
203 exec "norm! GV4k\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
204 call assert_equal(["3", "2", "1", "0", "-1"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
205 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
206
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
207 call setline(1, ["2", "1", "0", "-1", "-2"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
208 exec "norm! GV4k\<C-X>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
209 call assert_equal(["1", "0", "-1", "-2", "-3"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
210 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
211 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
212
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
213 " 8) Block increment on 0x9
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
214 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
215 " 0x9
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
216 " 0x9
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
217 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
218 " 1) Ctrl-A on visually block selected region (cursor at beginning):
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
219 " 0xa
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
220 " 0xa
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
221 " 2) Ctrl-A on visually block selected region (cursor at end)
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
222 " 0xa
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
223 " 0xa
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
224 func Test_visual_increment_08()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
225 call setline(1, repeat(["0x9"], 2))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
226 exec "norm! \<C-V>j$\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
227 call assert_equal(["0xa", "0xa"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
228 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
229
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
230 call setline(1, repeat(["0x9"], 2))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
231 exec "norm! gg$\<C-V>+\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
232 call assert_equal(["0xa", "0xa"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
233 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
234 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
235
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
236 " 9) Increment and redo
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
237 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
238 " 2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
239 " 2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
240 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
241 " 3
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
242 " 3
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
243 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
244 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
245 " 1) 2 Ctrl-A on first 2 visually selected lines
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
246 " 4
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
247 " 4
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
248 " 2) redo (.) on 3
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
249 " 5
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
250 " 5
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
251 func Test_visual_increment_09()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
252 call setline(1, ["2", "2", "", "3", "3", ""])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
253 exec "norm! ggVj2\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
254 call assert_equal(["4", "4", "", "3", "3", ""], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
255 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
256
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
257 exec "norm! 3j."
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
258 call assert_equal(["4", "4", "", "5", "5", ""], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
259 call assert_equal([0, 4, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
260 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
261
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
262 " 10) sequentially decrement 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
263 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
264 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
265 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
266 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
267 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
268 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
269 " 1) g Ctrl-X on visually selected lines
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
270 " 0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
271 " -1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
272 " -2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
273 " -3
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
274 func Test_visual_increment_10()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
275 call setline(1, repeat(["1"], 4))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
276 exec "norm! GV3kg\<C-X>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
277 call assert_equal(["0", "-1", "-2", "-3"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
278 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
279 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
280
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
281 " 11) visually block selected indented lines
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
282 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
283 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
284 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
285 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
286 " 1
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
12996
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
367 "
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
368 " Also: 019 with "01" selected increments to "029".
7544
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
369 func Test_visual_increment_15()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
370 call setline(1, ["101"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
371 exec "norm! lv\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
372 call assert_equal(["111"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
373 call assert_equal([0, 1, 2, 0], getpos('.'))
12996
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
374
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
375 call setline(1, ["019"])
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
376 exec "norm! 0vl\<C-A>"
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
377 call assert_equal("029", getline(1))
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
378
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
379 call setline(1, ["01239"])
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
380 exec "norm! 0vlll\<C-A>"
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
381 call assert_equal("01249", getline(1))
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
382
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
383 call setline(1, ["01299"])
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
384 exec "norm! 0vlll\<C-A>"
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
385 call assert_equal("1309", getline(1))
7544
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
386 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
387
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
388 " 16) increment right aligned numbers
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
389 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
390 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
391 " 19
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
392 " 119
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
393 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
394 " 1) Ctrl-a on line selected region
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
395 " 2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
396 " 20
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
397 " 120
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
398 func Test_visual_increment_16()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
399 call setline(1, [" 1", " 19", " 119"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
400 exec "norm! VG\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
401 call assert_equal([" 2", " 20", " 120"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
402 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
403 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
404
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
405 " 17) block-wise increment and redo
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
406 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
407 " 100
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
408 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
409 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
410 " 100
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
411 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
412 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
413 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
414 " 1) Ctrl-V j $ on first block, afterwards '.' on second
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
415 " 101
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
416 " 2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
417 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
418 " 101
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
419 " 2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
420 func Test_visual_increment_17()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
421 call setline(1, [" 100", " 1", "", " 100", " 1"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
422 exec "norm! \<C-V>j$\<C-A>2j."
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
423 call assert_equal([" 101", " 2", "", " 101", " 1"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
424 call assert_equal([0, 3, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
425 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
426
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
427 " 18) repeat of g<Ctrl-a>
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
428 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
429 " 0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
430 " 0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
431 " 0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
432 " 0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
433 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
434 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
435 " 1) V 4j g<ctrl-a>, repeat twice afterwards with .
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
436 " 3
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
437 " 6
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
438 " 9
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
439 " 12
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
440 func Test_visual_increment_18()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
441 call setline(1, repeat(["0"], 4))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
442 exec "norm! GV3kg\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
443 exec "norm! .."
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
444 call assert_equal(["3", "6", "9", "12"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
445 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
446 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
447
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
448 " 19) increment on number with nrformat including alpha
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
449 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
450 " 1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
451 " 1a
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
452 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
453 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
454 " 1) <Ctrl-V>j$ <ctrl-a>
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
455 " 2
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
456 " 2a
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
457 func Test_visual_increment_19()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
458 set nrformats+=alpha
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
459 call setline(1, ["1", "1a"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
460 exec "norm! \<C-V>G$\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
461 call assert_equal(["2", "2a"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
462 call assert_equal([0, 1, 1, 0], getpos('.'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
463 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
464
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
465 " 20) increment a single letter
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
466 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
467 " a
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
468 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
469 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
470 " 1) <Ctrl-a> and cursor is on a
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
471 " b
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
472 func Test_visual_increment_20()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
473 set nrformats+=alpha
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
474 call setline(1, ["a"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
475 exec "norm! \<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
476 call assert_equal(["b"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
477 call assert_equal([0, 1, 1, 0], getpos('.'))
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 " 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
481 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
482 " 0x123456
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
483 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
484 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
485 " 1) Ctrl-V f3 <ctrl-a>
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
486 " 0x124456
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
487 func Test_visual_increment_21()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
488 call setline(1, ["0x123456"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
489 exec "norm! \<C-V>f3\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
490 call assert_equal(["0x124456"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
491 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
492 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
493
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
494 " 22) Block increment on 0b0
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
495 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
496 " 0b1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
497 " 0b1
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
498 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
499 " 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
500 " 0b10
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
501 " 0b10
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
502 " 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
503 " 0b10
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
504 " 0b10
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
505 func Test_visual_increment_22()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
506 call setline(1, repeat(["0b1"], 2))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
507 exec "norm! \<C-V>j$\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
508 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
509 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
510
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
511 call setline(1, repeat(["0b1"], 2))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
512 exec "norm! $\<C-V>+\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
513 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
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 " 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
518 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
519 " 0b1001
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-V 5l <ctrl-a>
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
523 " 0b1011
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
524 func Test_visual_increment_23()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
525 call setline(1, ["0b1001"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
526 exec "norm! \<C-V>4l\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
527 call assert_equal(["0b1011"], 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 " 24) increment hexadecimal
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 " 0x0b1001
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 " 0x0b1002
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
538 func Test_visual_increment_24()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
539 call setline(1, ["0x0b1001"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
540 exec "norm! \<C-V>$\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
541 call assert_equal(["0x0b1002"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
542 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
543 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
544
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
545 " 25) increment binary with nrformats including alpha
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
546 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
547 " 0b1001a
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
548 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
549 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
550 " 1) <ctrl-a>
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
551 " 0b1010a
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
552 func Test_visual_increment_25()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
553 set nrformats+=alpha
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
554 call setline(1, ["0b1001a"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
555 exec "norm! \<C-V>$\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
556 call assert_equal(["0b1010a"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
557 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
558 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
559
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
560 " 26) increment binary with 32 bits
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
561 " Text:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
562 " 0b11111111111111111111111111111110
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
563 "
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
564 " Expected:
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
565 " 1) <ctrl-a>
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
566 " 0b11111111111111111111111111111111
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
567 func Test_visual_increment_26()
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
568 set nrformats+=alpha
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
569 call setline(1, ["0b11111111111111111111111111111110"])
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
570 exec "norm! \<C-V>$\<C-A>"
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
571 call assert_equal(["0b11111111111111111111111111111111"], getline(1, '$'))
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
572 call assert_equal([0, 1, 1, 0], getpos('.'))
7568
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
573 set nrformats-=alpha
7544
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
574 endfunc
25e3b1a99768 commit https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
575
7551
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
576 " 27) increment with 'rightreft', if supported
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
577 func Test_visual_increment_27()
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
578 if exists('+rightleft')
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
579 set rightleft
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
580 call setline(1, ["1234 56"])
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
581
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
582 exec "norm! $\<C-A>"
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
583 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
584 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
585
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
586 exec "norm! \<C-A>"
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
587 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
588 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
589 set norightleft
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
590 endif
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
591 endfunc
f624d7671e0c commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c
Christian Brabandt <cb@256bit.org>
parents: 7544
diff changeset
592
7574
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
593 " Tab code and linewise-visual inc/dec
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
594 func Test_visual_increment_28()
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
595 call setline(1, ["x\<TAB>10", "\<TAB>-1"])
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
596 exec "norm! Vj\<C-A>"
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
597 call assert_equal(["x\<TAB>11", "\<TAB>0"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
598 call assert_equal([0, 1, 1, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
599
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
600 call setline(1, ["x\<TAB>10", "\<TAB>-1"])
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
601 exec "norm! ggVj\<C-X>"
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
602 call assert_equal(["x\<TAB>9", "\<TAB>-2"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
603 call assert_equal([0, 1, 1, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
604 endfunc
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
605
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
606 " Tab code and linewise-visual inc/dec with 'nrformats'+=alpha
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
607 func Test_visual_increment_29()
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
608 set nrformats+=alpha
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
609 call setline(1, ["x\<TAB>10", "\<TAB>-1"])
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
610 exec "norm! Vj\<C-A>"
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
611 call assert_equal(["y\<TAB>10", "\<TAB>0"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
612 call assert_equal([0, 1, 1, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
613
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
614 call setline(1, ["x\<TAB>10", "\<TAB>-1"])
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
615 exec "norm! ggVj\<C-X>"
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
616 call assert_equal(["w\<TAB>10", "\<TAB>-2"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
617 call assert_equal([0, 1, 1, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
618 endfunc
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
619
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
620 " Tab code and character-visual inc/dec
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
621 func Test_visual_increment_30()
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
622 call setline(1, ["x\<TAB>10", "\<TAB>-1"])
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
623 exec "norm! f1vjf1\<C-A>"
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
624 call assert_equal(["x\<TAB>11", "\<TAB>0"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
625 call assert_equal([0, 1, 3, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
626
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
627 call setline(1, ["x\<TAB>10", "\<TAB>-1"])
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
628 exec "norm! ggf1vjf1\<C-X>"
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
629 call assert_equal(["x\<TAB>9", "\<TAB>-2"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
630 call assert_equal([0, 1, 3, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
631 endfunc
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
632
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
633 " Tab code and blockwise-visual inc/dec
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
634 func Test_visual_increment_31()
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
635 call setline(1, ["x\<TAB>10", "\<TAB>-1"])
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
636 exec "norm! f1\<C-V>jl\<C-A>"
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
637 call assert_equal(["x\<TAB>11", "\<TAB>0"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
638 call assert_equal([0, 1, 3, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
639
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
640 call setline(1, ["x\<TAB>10", "\<TAB>-1"])
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
641 exec "norm! ggf1\<C-V>jl\<C-X>"
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
642 call assert_equal(["x\<TAB>9", "\<TAB>-2"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
643 call assert_equal([0, 1, 3, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
644 endfunc
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
645
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
646 " Tab code and blockwise-visual decrement with 'linebreak' and 'showbreak'
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
647 func Test_visual_increment_32()
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
648 28vnew dummy_31
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
649 set linebreak showbreak=+
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
650 call setline(1, ["x\<TAB>\<TAB>\<TAB>10", "\<TAB>\<TAB>\<TAB>\<TAB>-1"])
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
651 exec "norm! ggf0\<C-V>jg_\<C-X>"
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
652 call assert_equal(["x\<TAB>\<TAB>\<TAB>1-1", "\<TAB>\<TAB>\<TAB>\<TAB>-2"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
653 call assert_equal([0, 1, 6, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
654 bwipe!
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
655 endfunc
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
656
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
657 " Tab code and blockwise-visual increment with $
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
658 func Test_visual_increment_33()
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
659 call setline(1, ["\<TAB>123", "456"])
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
660 exec "norm! gg0\<C-V>j$\<C-A>"
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
661 call assert_equal(["\<TAB>124", "457"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
662 call assert_equal([0, 1, 1, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
663 endfunc
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
664
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
665 " Tab code and blockwise-visual increment and redo
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
666 func Test_visual_increment_34()
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
667 call setline(1, ["\<TAB>123", " 456789"])
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
668 exec "norm! gg0\<C-V>j\<C-A>"
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
669 call assert_equal(["\<TAB>123", " 457789"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
670 call assert_equal([0, 1, 1, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
671
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
672 exec "norm! .."
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
673 call assert_equal(["\<TAB>123", " 459789"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
674 call assert_equal([0, 1, 1, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
675 endfunc
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
676
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
677 " Tab code, spaces and character-visual increment and redo
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
678 func Test_visual_increment_35()
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
679 call setline(1, ["\<TAB>123", " 123", "\<TAB>123", "\<TAB>123"])
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
680 exec "norm! ggvjf3\<C-A>..."
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
681 call assert_equal(["\<TAB>127", " 127", "\<TAB>123", "\<TAB>123"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
682 call assert_equal([0, 1, 2, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
683 endfunc
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
684
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
685 " Tab code, spaces and blockwise-visual increment and redo
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
686 func Test_visual_increment_36()
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
687 call setline(1, [" 123", "\<TAB>456789"])
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
688 exec "norm! G0\<C-V>kl\<C-A>"
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
689 call assert_equal([" 123", "\<TAB>556789"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
690 call assert_equal([0, 1, 1, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
691
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
692 exec "norm! ..."
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
693 call assert_equal([" 123", "\<TAB>856789"], getline(1, '$'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
694 call assert_equal([0, 1, 1, 0], getpos('.'))
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
695 endfunc
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
696
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
697 " block-wise increment and dot-repeat
7568
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
698 " Text:
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
699 " 1 23
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
700 " 4 56
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
701 "
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
702 " Expected:
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
703 " 1) f2 Ctrl-V jl <ctrl-a>, repeat twice afterwards with .
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
704 " 1 26
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
705 " 4 59
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
706 "
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
707 " Try with and without indent.
7574
b872724c37db commit https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
Christian Brabandt <cb@256bit.org>
parents: 7568
diff changeset
708 func Test_visual_increment_37()
7568
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
709 call setline(1, [" 1 23", " 4 56"])
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
710 exec "norm! ggf2\<C-V>jl\<C-A>.."
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
711 call assert_equal([" 1 26", " 4 59"], getline(1, 2))
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
712
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
713 call setline(1, ["1 23", "4 56"])
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
714 exec "norm! ggf2\<C-V>jl\<C-A>.."
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
715 call assert_equal(["1 26", "4 59"], getline(1, 2))
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
716 endfunc
5274513d3f54 commit https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
Christian Brabandt <cb@256bit.org>
parents: 7551
diff changeset
717
7578
fdae4c496775 commit https://github.com/vim/vim/commit/ef2b5036b3005f1ce15d146dce72379a9834c56d
Christian Brabandt <cb@256bit.org>
parents: 7574
diff changeset
718 " Check redo after the normal mode increment
fdae4c496775 commit https://github.com/vim/vim/commit/ef2b5036b3005f1ce15d146dce72379a9834c56d
Christian Brabandt <cb@256bit.org>
parents: 7574
diff changeset
719 func Test_visual_increment_38()
fdae4c496775 commit https://github.com/vim/vim/commit/ef2b5036b3005f1ce15d146dce72379a9834c56d
Christian Brabandt <cb@256bit.org>
parents: 7574
diff changeset
720 exec "norm! i10\<ESC>5\<C-A>."
fdae4c496775 commit https://github.com/vim/vim/commit/ef2b5036b3005f1ce15d146dce72379a9834c56d
Christian Brabandt <cb@256bit.org>
parents: 7574
diff changeset
721 call assert_equal(["20"], getline(1, '$'))
fdae4c496775 commit https://github.com/vim/vim/commit/ef2b5036b3005f1ce15d146dce72379a9834c56d
Christian Brabandt <cb@256bit.org>
parents: 7574
diff changeset
722 call assert_equal([0, 1, 2, 0], getpos('.'))
fdae4c496775 commit https://github.com/vim/vim/commit/ef2b5036b3005f1ce15d146dce72379a9834c56d
Christian Brabandt <cb@256bit.org>
parents: 7574
diff changeset
723 endfunc
fdae4c496775 commit https://github.com/vim/vim/commit/ef2b5036b3005f1ce15d146dce72379a9834c56d
Christian Brabandt <cb@256bit.org>
parents: 7574
diff changeset
724
7927
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
725 " Test what patch 7.3.414 fixed. Ctrl-A on "000" drops the leading zeros.
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
726 func Test_normal_increment_01()
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
727 call setline(1, "000")
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
728 exec "norm! gg0\<C-A>"
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
729 call assert_equal("001", getline(1))
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
730
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
731 call setline(1, "000")
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
732 exec "norm! gg$\<C-A>"
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
733 call assert_equal("001", getline(1))
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
734
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
735 call setline(1, "001")
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
736 exec "norm! gg0\<C-A>"
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
737 call assert_equal("002", getline(1))
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
738
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
739 call setline(1, "001")
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
740 exec "norm! gg$\<C-A>"
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
741 call assert_equal("002", getline(1))
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
742 endfunc
2a34dd90beba commit https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5
Christian Brabandt <cb@256bit.org>
parents: 7578
diff changeset
743
8690
6a1becf4f282 commit https://github.com/vim/vim/commit/8e08125d3a9afd0b16cd84454ae9ddad0abaaab0
Christian Brabandt <cb@256bit.org>
parents: 7927
diff changeset
744 " Test a regression of patch 7.4.1087 fixed.
6a1becf4f282 commit https://github.com/vim/vim/commit/8e08125d3a9afd0b16cd84454ae9ddad0abaaab0
Christian Brabandt <cb@256bit.org>
parents: 7927
diff changeset
745 func Test_normal_increment_02()
6a1becf4f282 commit https://github.com/vim/vim/commit/8e08125d3a9afd0b16cd84454ae9ddad0abaaab0
Christian Brabandt <cb@256bit.org>
parents: 7927
diff changeset
746 call setline(1, ["hello 10", "world"])
6a1becf4f282 commit https://github.com/vim/vim/commit/8e08125d3a9afd0b16cd84454ae9ddad0abaaab0
Christian Brabandt <cb@256bit.org>
parents: 7927
diff changeset
747 exec "norm! ggl\<C-A>jx"
6a1becf4f282 commit https://github.com/vim/vim/commit/8e08125d3a9afd0b16cd84454ae9ddad0abaaab0
Christian Brabandt <cb@256bit.org>
parents: 7927
diff changeset
748 call assert_equal(["hello 11", "worl"], getline(1, '$'))
6a1becf4f282 commit https://github.com/vim/vim/commit/8e08125d3a9afd0b16cd84454ae9ddad0abaaab0
Christian Brabandt <cb@256bit.org>
parents: 7927
diff changeset
749 call assert_equal([0, 2, 4, 0], getpos('.'))
6a1becf4f282 commit https://github.com/vim/vim/commit/8e08125d3a9afd0b16cd84454ae9ddad0abaaab0
Christian Brabandt <cb@256bit.org>
parents: 7927
diff changeset
750 endfunc
6a1becf4f282 commit https://github.com/vim/vim/commit/8e08125d3a9afd0b16cd84454ae9ddad0abaaab0
Christian Brabandt <cb@256bit.org>
parents: 7927
diff changeset
751
9361
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
752 " The test35 unified to this file.
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
753 func Test_normal_increment_03()
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
754 call setline(1, ["100 0x100 077 0",
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
755 \ "100 0x100 077 ",
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
756 \ "100 0x100 077 0xfF 0xFf",
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
757 \ "100 0x100 077 "])
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
758 set nrformats=octal,hex
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
759 exec "norm! gg\<C-A>102\<C-X>\<C-A>l\<C-X>l\<C-A>64\<C-A>128\<C-X>$\<C-X>"
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
760 set nrformats=octal
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
761 exec "norm! j0\<C-A>102\<C-X>\<C-A>l\<C-X>2\<C-A>w65\<C-A>129\<C-X>blx6lD"
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
762 set nrformats=hex
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
763 exec "norm! j0101\<C-X>l257\<C-X>\<C-A>Txldt \<C-A> \<C-X> \<C-X>"
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
764 set nrformats=
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
765 exec "norm! j0200\<C-X>l100\<C-X>w78\<C-X>\<C-A>k"
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
766 call assert_equal(["0 0x0ff 0000 -1",
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
767 \ "0 1x100 0777777",
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
768 \ "-1 0x0 078 0xFE 0xfe",
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
769 \ "-100 -100x100 000 "], getline(1, '$'))
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
770 call assert_equal([0, 3, 25, 0], getpos('.'))
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
771 endfunc
f089eb0a5fa4 commit https://github.com/vim/vim/commit/52df117df724a7ad20affdf15214d2df2e507dcc
Christian Brabandt <cb@256bit.org>
parents: 8690
diff changeset
772
12996
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
773 func Test_increment_empty_line()
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
774 new
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
775 call setline(1, ['0', '0', '0', '0', '0', '0', ''])
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
776 exe "normal Gvgg\<C-A>"
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
777 call assert_equal(['1', '1', '1', '1', '1', '1', ''], getline(1, 7))
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
778 bwipe!
973a0037f4c3 patch 8.0.1374: CTRL-A does not work with an empty line
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
779 endfunc
8690
6a1becf4f282 commit https://github.com/vim/vim/commit/8e08125d3a9afd0b16cd84454ae9ddad0abaaab0
Christian Brabandt <cb@256bit.org>
parents: 7927
diff changeset
780
9909
3ee84d270ea7 commit https://github.com/vim/vim/commit/9e4d8215d386100ab660d7d11e6620fd148b605e
Christian Brabandt <cb@256bit.org>
parents: 9361
diff changeset
781 " vim: shiftwidth=2 sts=2 expandtab