Skip to content

Commit e1edc1c

Browse files
committed
patch 7.4.1084
Problem: Using "." to repeat CTRL-A in Visual mode increments the wrong numbers. Solution: Append right size to the redo buffer. (Ozaki Kiichi)
1 parent 4514d27 commit e1edc1c

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

src/normal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3632,7 +3632,7 @@ prep_redo_visual(cap)
36323632
else if (curbuf->b_visual.vi_end.col > curbuf->b_visual.vi_start.col)
36333633
{
36343634
AppendNumberToRedobuff(curbuf->b_visual.vi_end.col
3635-
- curbuf->b_visual.vi_start.col - 1);
3635+
- curbuf->b_visual.vi_start.col);
36363636
AppendCharToRedobuff(' ');
36373637
}
36383638
}

src/testdir/test_increment.vim

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,7 @@ func Test_visual_increment_26()
556556
exec "norm! \<C-V>$\<C-A>"
557557
call assert_equal(["0b11111111111111111111111111111111"], getline(1, '$'))
558558
call assert_equal([0, 1, 1, 0], getpos('.'))
559+
set nrformats-=alpha
559560
endfunc
560561

561562
" 27) increment with 'rightreft', if supported
@@ -575,4 +576,25 @@ func Test_visual_increment_27()
575576
endif
576577
endfunc
577578

579+
" 28) block-wise increment and dot-repeat
580+
" Text:
581+
" 1 23
582+
" 4 56
583+
"
584+
" Expected:
585+
" 1) f2 Ctrl-V jl <ctrl-a>, repeat twice afterwards with .
586+
" 1 26
587+
" 4 59
588+
"
589+
" Try with and without indent.
590+
func Test_visual_increment_28()
591+
call setline(1, [" 1 23", " 4 56"])
592+
exec "norm! ggf2\<C-V>jl\<C-A>.."
593+
call assert_equal([" 1 26", " 4 59"], getline(1, 2))
594+
595+
call setline(1, ["1 23", "4 56"])
596+
exec "norm! ggf2\<C-V>jl\<C-A>.."
597+
call assert_equal(["1 26", "4 59"], getline(1, 2))
598+
endfunc
599+
578600
" vim: tabstop=2 shiftwidth=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,8 @@ static char *(features[]) =
741741

742742
static int included_patches[] =
743743
{ /* Add new patch number below this line */
744+
/**/
745+
1084,
744746
/**/
745747
1083,
746748
/**/

0 commit comments

Comments
 (0)