blob: fb7e6e3ee28b397dcd980f9ac8c10e8999746885 [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
271 1b
272
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200273
274
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200275STARTTEST
276:so small.vim
Bram Moolenaar6a57cce2015-06-28 19:24:39 +0200277:"
278:" Avoid CTRL-X being mapped in Visual mode for MS-Windows
279:vmapclear
280:"
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200281:" Test 1
282:/^S1=/+,/^E1=/-y a
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200283:/^E1=/+put a
284:/^E1=/+2put a
285f-v$:/^E1=/+3put a
286f1v$:/^E1=/+4put a
287f-v$:/^E1=/+5put a
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200288f1v$
289
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200290:" Test 2
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200291:/^S2=/+,/^E2=/-y a
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200292:/^E2=/+put a
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200293V3k$3j:.+put a
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200294V3k$
295
296:" Test 3
297:/^S3=/+,/^E3=/-y a
298:/^E3=/+put a
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200299V6k2g6j:.+put a
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200300V6k2g
301
302:" Test 4
303:/^S4=/+,/^E4=/-y a
304:/^E4=/+put a
305vf-
306
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200307:" Test 5
308:set nrformats+=alpha
309:/^S5=/+,/^E5=/-y a
310:/^E5=/+put a
311v3kg
312
313:" Test 6
314:/^S6=/+,/^E6=/-y a
315:/^E6=/+put a
316v3kg
317
318:" Test 7
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200319:set nrformats&vim
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200320:/^S7=/+,/^E7=/-y a
321:/^E7=/+put a
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200322V4k4j:.+put a
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200323V4k
324
325:" Test 8
326:/^S8=/+,/^E8=/-y a
327:/^E8=/+put a
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200328kj$j:.+put a
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200329k$+
330
331:" Test 9
332:/^S9=/+,/^E9=/-y a
333:/^E9=/+put a
Bram Moolenaar5d1bc782015-07-17 13:03:48 +02003345kVj23j.
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200335
336:" Test 10
337:/^S10=/+,/^E10=/-y a
338:/^E10=/+put a
339V3kg
340
341: Test 11
342:/^S11=/+,/^E11=/-y a
343:/^E11=/+put a
3443kf13jg
345
346:" Test 12
347:/^S12=/+,/^E12=/-y a
348:/^E12=/+put a
3492k$v++
350
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200351:" Test 13
352:/^S13=/+,/^E13=/-y a
353:/^E13=/+put a
3543kf1l2j3j:.+put a
3553kf1l2j
356
357:" Test 14
358:/^S14=/+,/^E14=/-y a
359:/^E14=/+put a
360kw.
361
362:" Test 15
363:/^S15=/+,/^E15=/-y a
364:/^E15=/+put a
365lv
366
367:" Test 16
368:/^S16=/+,/^E16=/-y a
369:/^E16=/+put a
370V3k
371
372:" Test 17
373:/^S17=/+,/^E17=/-y a
374:/^E17=/+put a
3754kj$2j.
376
377:" Test 18
378:/^S18=/+,/^E18=/-y a
379:/^E18=/+put a
380V3kg..
381
Bram Moolenaarcc218ab2015-08-04 18:23:22 +0200382:" Test 19
383:set nrformats+=alpha
384:/^S19=/+,/^E19=/-y a
385:/^E19=/+put a
386k$
387:set nrformats&vim
388
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200389:" Save the report
390:/^# Test 1/,$w! test.out
391:qa!
392
393
394# Test 1
395S1======
396foobar-10
397E1======
398
399
400
401# Test 2
402S2=====
40310
40420
40530
40640
407E2=====
408
409
410
411# Test 3
412S3=====
41310
414
41520
416
41730
418
41940
420E3=====
421
422
423
424# Test 4
425S4=====
426foobar-10
427E4=====
428
429
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200430
431# Test 5
432S5====
433a
434a
435a
436a
437E5====
438
439
440# Test 6
441S6====
442z
443z
444z
445z
446E6====
447
448
449
450# Test 7
451S7====
4522
4531
4540
455-1
456-2
457E7====
458
459
460
461# Test 8
462S8====
4630x9
4640x9
465E8====
466
467
468
469
470# Test 9
471S9====
4722
4732
474
4753
4763
477
478E9====
479
480
481
482
483# Test 10
484S10====
4851
4861
4871
4881
489E10====
490
491
492
493
494# Test 11
495S11====
496 1
4971
498 1
499 1
500E11====
501
502
503
504# Test 12
505S12====
5060 0
5070 0
5080 0
509E12====
510
511
512
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200513# Test 13
514S13====
515max: 100px
516max: 200px
517max: 300px
518max: 400px
519E13====
520
521
522
523# Test 14
524S14====
5251 1
5261 1
527E14====
528
529
530
531# Test 15
532S15====
533101
534E15====
535
536
537
538# Test 16
539S16====
540 1
541 19
542 119
543E16====
544
545
546
547# Test 17
548S17====
549 100
550 1
551
552 100
553 1
554E17====
555
556
557# Test 18
558S18====
5590
5600
5610
5620
563E18====
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200564
565
566
Bram Moolenaarcc218ab2015-08-04 18:23:22 +0200567# Test 19
568S19====
5691
5701a
571E19====
572
573
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200574
575
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200576ENDTEST
577