blob: 2ae6b8a56395be276bd2eb8d84742aa30a9060f1 [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 Moolenaar5adfea12015-09-01 18:51:39 +0200280
28121) block-wise increment on part of hexadecimal
282Text:
2830x123456
284
285 Expected:
286 1) Ctrl-V f3 <ctrl-a>
2870x124456
288
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200289
290
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200291STARTTEST
292:so small.vim
Bram Moolenaar6a57cce2015-06-28 19:24:39 +0200293:"
294:" Avoid CTRL-X being mapped in Visual mode for MS-Windows
295:vmapclear
296:"
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200297:" Test 1
298:/^S1=/+,/^E1=/-y a
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200299:/^E1=/+put a
300:/^E1=/+2put a
301f-v$:/^E1=/+3put a
302f1v$:/^E1=/+4put a
303f-v$:/^E1=/+5put a
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200304f1v$
305
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200306:" Test 2
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200307:/^S2=/+,/^E2=/-y a
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200308:/^E2=/+put a
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200309V3k$3j:.+put a
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200310V3k$
311
312:" Test 3
313:/^S3=/+,/^E3=/-y a
314:/^E3=/+put a
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200315V6k2g6j:.+put a
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200316V6k2g
317
318:" Test 4
319:/^S4=/+,/^E4=/-y a
320:/^E4=/+put a
321vf-
322
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200323:" Test 5
324:set nrformats+=alpha
325:/^S5=/+,/^E5=/-y a
326:/^E5=/+put a
327v3kg
328
329:" Test 6
330:/^S6=/+,/^E6=/-y a
331:/^E6=/+put a
332v3kg
333
334:" Test 7
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200335:set nrformats&vim
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200336:/^S7=/+,/^E7=/-y a
337:/^E7=/+put a
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200338V4k4j:.+put a
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200339V4k
340
341:" Test 8
342:/^S8=/+,/^E8=/-y a
343:/^E8=/+put a
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200344kj$j:.+put a
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200345k$+
346
347:" Test 9
348:/^S9=/+,/^E9=/-y a
349:/^E9=/+put a
Bram Moolenaar5d1bc782015-07-17 13:03:48 +02003505kVj23j.
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200351
352:" Test 10
353:/^S10=/+,/^E10=/-y a
354:/^E10=/+put a
355V3kg
356
357: Test 11
358:/^S11=/+,/^E11=/-y a
359:/^E11=/+put a
3603kf13jg
361
362:" Test 12
363:/^S12=/+,/^E12=/-y a
364:/^E12=/+put a
3652k$v++
366
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200367:" Test 13
368:/^S13=/+,/^E13=/-y a
369:/^E13=/+put a
3703kf1l2j3j:.+put a
3713kf1l2j
372
373:" Test 14
374:/^S14=/+,/^E14=/-y a
375:/^E14=/+put a
376kw.
377
378:" Test 15
379:/^S15=/+,/^E15=/-y a
380:/^E15=/+put a
381lv
382
383:" Test 16
384:/^S16=/+,/^E16=/-y a
385:/^E16=/+put a
386V3k
387
388:" Test 17
389:/^S17=/+,/^E17=/-y a
390:/^E17=/+put a
3914kj$2j.
392
393:" Test 18
394:/^S18=/+,/^E18=/-y a
395:/^E18=/+put a
396V3kg..
397
Bram Moolenaarcc218ab2015-08-04 18:23:22 +0200398:" Test 19
399:set nrformats+=alpha
400:/^S19=/+,/^E19=/-y a
401:/^E19=/+put a
402k$
403:set nrformats&vim
404
Bram Moolenaar25c2f672015-08-11 19:36:42 +0200405:" Test 20
406:set nrformats+=alpha
407:/^S20=/+,/^E20=/-y a
408:/^E20=/+put a
409:.put =col('.')
410:set nrformats&vim
411
Bram Moolenaar5adfea12015-09-01 18:51:39 +0200412:" Test 21
413:/^S21=/+,/^E21=/-y a
414:/^E21=/+put a
415:set nrformats&vim
416f3
417
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200418:" Save the report
419:/^# Test 1/,$w! test.out
420:qa!
421
422
423# Test 1
424S1======
425foobar-10
426E1======
427
428
429
430# Test 2
431S2=====
43210
43320
43430
43540
436E2=====
437
438
439
440# Test 3
441S3=====
44210
443
44420
445
44630
447
44840
449E3=====
450
451
452
453# Test 4
454S4=====
455foobar-10
456E4=====
457
458
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200459
460# Test 5
461S5====
462a
463a
464a
465a
466E5====
467
468
469# Test 6
470S6====
471z
472z
473z
474z
475E6====
476
477
478
479# Test 7
480S7====
4812
4821
4830
484-1
485-2
486E7====
487
488
489
490# Test 8
491S8====
4920x9
4930x9
494E8====
495
496
497
498
499# Test 9
500S9====
5012
5022
503
5043
5053
506
507E9====
508
509
510
511
512# Test 10
513S10====
5141
5151
5161
5171
518E10====
519
520
521
522
523# Test 11
524S11====
525 1
5261
527 1
528 1
529E11====
530
531
532
533# Test 12
534S12====
5350 0
5360 0
5370 0
538E12====
539
540
541
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200542# Test 13
543S13====
544max: 100px
545max: 200px
546max: 300px
547max: 400px
548E13====
549
550
551
552# Test 14
553S14====
5541 1
5551 1
556E14====
557
558
559
560# Test 15
561S15====
562101
563E15====
564
565
566
567# Test 16
568S16====
569 1
570 19
571 119
572E16====
573
574
575
576# Test 17
577S17====
578 100
579 1
580
581 100
582 1
583E17====
584
585
586# Test 18
587S18====
5880
5890
5900
5910
592E18====
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200593
594
595
Bram Moolenaarcc218ab2015-08-04 18:23:22 +0200596# Test 19
597S19====
5981
5991a
600E19====
601
602
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200603
Bram Moolenaar25c2f672015-08-11 19:36:42 +0200604# Test 20
605S20====
606a
607E20====
608
609
610
Bram Moolenaar5adfea12015-09-01 18:51:39 +0200611# Test 21
612S21====
6130x123456
614E21====
615
616
617
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200618
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200619ENDTEST
620