blob: ecbc6f99a13ac3a0b458d729c1e2dae96429a418 [file] [log] [blame]
Bram Moolenaar3a304b22015-06-25 13:57:36 +02001Tests for using Ctrl-A/Ctrl-X on visual selections
2
3Test cases
4==========
5
61) Ctrl-A on visually selected number
7Text:
8foobar-10
Bram Moolenaar9bb19302015-07-03 12:44:07 +02009 Expected:
Bram Moolenaar3a304b22015-06-25 13:57:36 +020010 1) Ctrl-A on start of line:
11 foobar-9
12 2) Ctrl-A on visually selected "-10":
13 foobar-9
14 3) Ctrl-A on visually selected "10":
15 foobar-11
16 4) Ctrl-X on visually selected "-10"
17 foobar-11
18 5) Ctrl-X on visually selected "10"
19 foobar-9
20
212) Ctrl-A on visually selected lines
22Text:
2310
2420
2530
2640
27
Bram Moolenaar9bb19302015-07-03 12:44:07 +020028 Expected:
Bram Moolenaar3a304b22015-06-25 13:57:36 +020029 1) Ctrl-A on visually selected lines:
3011
3121
3231
3341
34
35 2) Ctrl-X on visually selected lines:
369
3719
3829
3939
40
413) g Ctrl-A on visually selected lines, with non-numbers in between
42Text:
4310
44
4520
46
4730
48
4940
50
Bram Moolenaar9bb19302015-07-03 12:44:07 +020051 Expected:
Bram Moolenaar3a304b22015-06-25 13:57:36 +020052 1) 2 g Ctrl-A on visually selected lines:
5312
54
5524
56
5736
58
5948
60 2) 2 g Ctrl-X on visually selected lines
618
62
6316
64
6524
66
6732
68
694) Ctrl-A on non-number
70Text:
71foobar-10
Bram Moolenaar9bb19302015-07-03 12:44:07 +020072 Expected:
Bram Moolenaar3a304b22015-06-25 13:57:36 +020073 1) visually select foobar:
74 foobar-10
75
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200765) g<Ctrl-A> on letter
77Test:
78a
79a
80a
81a
82 Expected:
83 1) g Ctrl-A on visually selected lines
84 b
85 c
86 d
87 e
88
896) g<Ctrl-A> on letter
90Test:
91z
92z
93z
94z
95 Expected:
96 1) g Ctrl-X on visually selected lines
97 y
98 x
99 w
100 v
101
1027) <Ctrl-A> on letter
103Test:
1042
1051
1060
107-1
108-2
109
110 Expected:
111 1) Ctrl-A on visually selected lines
112 3
113 2
114 1
115 0
116 -1
117
118 2) Ctrl-X on visually selected lines
119 1
120 0
121 -1
122 -2
123 -3
1248) Block increment on 0x9
125Text:
1260x9
1270x9
128 Expected:
129 1) Ctrl-A on visually block selected region (cursor at beginning):
130 0xa
131 0xa
132 2) Ctrl-A on visually block selected region (cursor at end)
133 0xa
134 0xa
135
1369) Increment and redo
137Text:
1382
1392
140
1413
1423
143
144 Expected:
145 1) 2 Ctrl-A on first 2 visually selected lines
146 4
147 4
148 2) redo (.) on 3
149 5
150 5
15110) sequentially decrement 1
152Text:
1531
1541
1551
1561
157 Expected:
158 1) g Ctrl-X on visually selected lines
159 0
160 -1
161 -2
162 -3
163
16411) visually block selected indented lines
165Text:
166 1
1671
168 1
169 1
170 Expexted:
171 1) g Ctrl-A on block selected indented lines
172 2
1731
174 3
175 4
176
17712) visually selected several columns
178Text:
1790 0
1800 0
1810 0
182 Expected:
183 1) 'v' select last zero and first zeroes
184 0 1
185 1 0
186 1 0
187
Bram Moolenaar5d1bc782015-07-17 13:03:48 +020018813) visually selected part of columns
189Text:
190max: 100px
191max: 200px
192max: 300px
193max: 400px
194 Expected:
195 1) 'v' on first two numbers Ctrl-A
196 max: 110px
197 max: 220px
198 max: 330px
199 max: 400px
200 2) 'v' on first two numbers Ctrl-X
201 max: 90px
202 max: 190px
203 max: 290px
204 max: 400px
205
20614) redo in block mode
207Text:
2081 1
2091 1
210 Expected:
211 1) Ctrl-a on first column, redo on second column
212 2 2
213 2 2
214
21515) block select single numbers
216Text:
217101
218 Expected:
219 1) Ctrl-a on visually selected zero
220 111
221
22216) increment right aligned numbers
223Text:
224 1
225 19
226 119
227 Expected:
228 1) Ctrl-a on line selected region
229 2
230 20
231 120
232
23317) block-wise increment and redo
234Text:
235 100
236 1
237
238 100
239 1
240
241 Expected:
242 1) Ctrl-V j $ on first block, afterwards '.' on second
243 101
244 2
245
246 101
247 2
248
24918) repeat of g<Ctrl-a>
250Text:
251 0
252 0
253 0
254 0
255
256 Expected:
257 1) V 4j g<ctrl-a>, repeat twice afterwards with .
258 3
259 6
260 9
261 12
262
Bram Moolenaarcc218ab2015-08-04 18:23:22 +020026319) increment on number with nrformat including alpha
264Text:
265 1
266 1a
267
268 Expected:
269 1) <Ctrl-V>j$ <ctrl-a>
270 2
Bram Moolenaar25c2f672015-08-11 19:36:42 +0200271 2a
272
27320) increment a single letter
274Text:
275 a
276
277 Expected:
278 1) <Ctrl-a> and cursor is on a
279 b
Bram Moolenaarcc218ab2015-08-04 18:23:22 +0200280
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200281
282
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200283STARTTEST
284:so small.vim
Bram Moolenaar6a57cce2015-06-28 19:24:39 +0200285:"
286:" Avoid CTRL-X being mapped in Visual mode for MS-Windows
287:vmapclear
288:"
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200289:" Test 1
290:/^S1=/+,/^E1=/-y a
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200291:/^E1=/+put a
292:/^E1=/+2put a
293f-v$:/^E1=/+3put a
294f1v$:/^E1=/+4put a
295f-v$:/^E1=/+5put a
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200296f1v$
297
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200298:" Test 2
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200299:/^S2=/+,/^E2=/-y a
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200300:/^E2=/+put a
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200301V3k$3j:.+put a
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200302V3k$
303
304:" Test 3
305:/^S3=/+,/^E3=/-y a
306:/^E3=/+put a
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200307V6k2g6j:.+put a
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200308V6k2g
309
310:" Test 4
311:/^S4=/+,/^E4=/-y a
312:/^E4=/+put a
313vf-
314
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200315:" Test 5
316:set nrformats+=alpha
317:/^S5=/+,/^E5=/-y a
318:/^E5=/+put a
319v3kg
320
321:" Test 6
322:/^S6=/+,/^E6=/-y a
323:/^E6=/+put a
324v3kg
325
326:" Test 7
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200327:set nrformats&vim
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200328:/^S7=/+,/^E7=/-y a
329:/^E7=/+put a
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200330V4k4j:.+put a
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200331V4k
332
333:" Test 8
334:/^S8=/+,/^E8=/-y a
335:/^E8=/+put a
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200336kj$j:.+put a
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200337k$+
338
339:" Test 9
340:/^S9=/+,/^E9=/-y a
341:/^E9=/+put a
Bram Moolenaar5d1bc782015-07-17 13:03:48 +02003425kVj23j.
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200343
344:" Test 10
345:/^S10=/+,/^E10=/-y a
346:/^E10=/+put a
347V3kg
348
349: Test 11
350:/^S11=/+,/^E11=/-y a
351:/^E11=/+put a
3523kf13jg
353
354:" Test 12
355:/^S12=/+,/^E12=/-y a
356:/^E12=/+put a
3572k$v++
358
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200359:" Test 13
360:/^S13=/+,/^E13=/-y a
361:/^E13=/+put a
3623kf1l2j3j:.+put a
3633kf1l2j
364
365:" Test 14
366:/^S14=/+,/^E14=/-y a
367:/^E14=/+put a
368kw.
369
370:" Test 15
371:/^S15=/+,/^E15=/-y a
372:/^E15=/+put a
373lv
374
375:" Test 16
376:/^S16=/+,/^E16=/-y a
377:/^E16=/+put a
378V3k
379
380:" Test 17
381:/^S17=/+,/^E17=/-y a
382:/^E17=/+put a
3834kj$2j.
384
385:" Test 18
386:/^S18=/+,/^E18=/-y a
387:/^E18=/+put a
388V3kg..
389
Bram Moolenaarcc218ab2015-08-04 18:23:22 +0200390:" Test 19
391:set nrformats+=alpha
392:/^S19=/+,/^E19=/-y a
393:/^E19=/+put a
394k$
395:set nrformats&vim
396
Bram Moolenaar25c2f672015-08-11 19:36:42 +0200397:" Test 20
398:set nrformats+=alpha
399:/^S20=/+,/^E20=/-y a
400:/^E20=/+put a
401:.put =col('.')
402:set nrformats&vim
403
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200404:" Save the report
405:/^# Test 1/,$w! test.out
406:qa!
407
408
409# Test 1
410S1======
411foobar-10
412E1======
413
414
415
416# Test 2
417S2=====
41810
41920
42030
42140
422E2=====
423
424
425
426# Test 3
427S3=====
42810
429
43020
431
43230
433
43440
435E3=====
436
437
438
439# Test 4
440S4=====
441foobar-10
442E4=====
443
444
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200445
446# Test 5
447S5====
448a
449a
450a
451a
452E5====
453
454
455# Test 6
456S6====
457z
458z
459z
460z
461E6====
462
463
464
465# Test 7
466S7====
4672
4681
4690
470-1
471-2
472E7====
473
474
475
476# Test 8
477S8====
4780x9
4790x9
480E8====
481
482
483
484
485# Test 9
486S9====
4872
4882
489
4903
4913
492
493E9====
494
495
496
497
498# Test 10
499S10====
5001
5011
5021
5031
504E10====
505
506
507
508
509# Test 11
510S11====
511 1
5121
513 1
514 1
515E11====
516
517
518
519# Test 12
520S12====
5210 0
5220 0
5230 0
524E12====
525
526
527
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200528# Test 13
529S13====
530max: 100px
531max: 200px
532max: 300px
533max: 400px
534E13====
535
536
537
538# Test 14
539S14====
5401 1
5411 1
542E14====
543
544
545
546# Test 15
547S15====
548101
549E15====
550
551
552
553# Test 16
554S16====
555 1
556 19
557 119
558E16====
559
560
561
562# Test 17
563S17====
564 100
565 1
566
567 100
568 1
569E17====
570
571
572# Test 18
573S18====
5740
5750
5760
5770
578E18====
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200579
580
581
Bram Moolenaarcc218ab2015-08-04 18:23:22 +0200582# Test 19
583S19====
5841
5851a
586E19====
587
588
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200589
Bram Moolenaar25c2f672015-08-11 19:36:42 +0200590# Test 20
591S20====
592a
593E20====
594
595
596
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200597
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200598ENDTEST
599