File tree Expand file tree Collapse file tree 4 files changed +36
-0
lines changed
Expand file tree Collapse file tree 4 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -2640,6 +2640,31 @@ op_insert(oap, count1)
26402640 {
26412641 struct block_def bd2 ;
26422642
2643+ /* The user may have moved the cursor before inserting something, try
2644+ * to adjust the block for that. */
2645+ if (oap -> start .lnum == curbuf -> b_op_start .lnum )
2646+ {
2647+ if (oap -> op_type == OP_INSERT
2648+ && oap -> start .col != curbuf -> b_op_start .col )
2649+ {
2650+ oap -> start .col = curbuf -> b_op_start .col ;
2651+ pre_textlen -= getviscol2 (oap -> start .col , oap -> start .coladd )
2652+ - oap -> start_vcol ;
2653+ oap -> start_vcol = getviscol2 (oap -> start .col , oap -> start .coladd );
2654+ }
2655+ else if (oap -> op_type == OP_APPEND
2656+ && oap -> end .col >= curbuf -> b_op_start .col )
2657+ {
2658+ oap -> start .col = curbuf -> b_op_start .col ;
2659+ /* reset pre_textlen to the value of OP_INSERT */
2660+ pre_textlen += bd .textlen ;
2661+ pre_textlen -= getviscol2 (oap -> start .col , oap -> start .coladd )
2662+ - oap -> start_vcol ;
2663+ oap -> start_vcol = getviscol2 (oap -> start .col , oap -> start .coladd );
2664+ oap -> op_type = OP_INSERT ;
2665+ }
2666+ }
2667+
26432668 /*
26442669 * Spaces and tabs in the indent may have changed to other spaces and
26452670 * tabs. Get the starting column again and correct the length.
Original file line number Diff line number Diff line change @@ -19,6 +19,10 @@ Gllllkkklllrq
1919:" Test block-change
2020G$khhhhhkkcmno
2121:$-4,$w! test.out
22+ :" Test block-insert using cursor keys for movement
23+ /^aaaa/
24+ :exe ":norm! l\<C-V>jjjlllI\<Right>\<Right> \<Esc>"
25+ :/^aa/,/^$/w >> test.out
2226:" gUe must uppercase a whole word, also when � changes to SS
2327Gothe youtu�euu endYpk0wgUe
2428:" gUfx must uppercase until x, inclusive.
@@ -40,6 +44,11 @@ G3o987652k02l2jr
4044:qa!
4145ENDTEST
4246
47+ aaaaaa
48+ bbbbbb
49+ cccccc
50+ dddddd
51+
4352abcdefghijklm
4453abcdefghijklm
4554abcdefghijklm
Original file line number Diff line number Diff line change @@ -738,6 +738,8 @@ static char *(features[]) =
738738
739739static int included_patches [] =
740740{ /* Add new patch number below this line */
741+ /**/
742+ 85 ,
741743/**/
742744 84 ,
743745/**/
You can’t perform that action at this time.
0 commit comments