Skip to content

Commit ba12de0

Browse files
committed
updated for version 7.4.085
Problem: When inserting text in Visual block mode and moving the cursor the wrong text gets repeated in other lines. Solution: Use the '[ mark to find the start of the actually inserted text. (Christian Brabandt)
1 parent f0e731d commit ba12de0

File tree

4 files changed

+36
-0
lines changed

4 files changed

+36
-0
lines changed

src/ops.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff 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.

src/testdir/test39.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ Gllllkkklllrq
1919
:" Test block-change
2020
G$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
2327
Gothe youtu�euu endYpk0wgUe
2428
:" gUfx must uppercase until x, inclusive.
@@ -40,6 +44,11 @@ G3o987652k02l2jr
4044
:qa!
4145
ENDTEST
4246

47+
aaaaaa
48+
bbbbbb
49+
cccccc
50+
dddddd
51+
4352
abcdefghijklm
4453
abcdefghijklm
4554
abcdefghijklm

src/testdir/test39.ok

37 Bytes
Binary file not shown.

src/version.c

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

739739
static int included_patches[] =
740740
{ /* Add new patch number below this line */
741+
/**/
742+
85,
741743
/**/
742744
84,
743745
/**/

0 commit comments

Comments
 (0)