Skip to content

Commit bf3d580

Browse files
committed
patch 8.0.0523: dv} deletes part of a multi-byte character.
Problem: dv} deletes part of a multi-byte character. (Urtica Dioica) Solution: Include the whole character.
1 parent 3fcfa35 commit bf3d580

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

src/search.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2851,9 +2851,17 @@ findpar(
28512851
curwin->w_cursor.lnum = curr;
28522852
if (curr == curbuf->b_ml.ml_line_count && what != '}')
28532853
{
2854-
if ((curwin->w_cursor.col = (colnr_T)STRLEN(ml_get(curr))) != 0)
2854+
char_u *line = ml_get(curr);
2855+
2856+
/* Put the cursor on the last character in the last line and make the
2857+
* motion inclusive. */
2858+
if ((curwin->w_cursor.col = (colnr_T)STRLEN(line)) != 0)
28552859
{
28562860
--curwin->w_cursor.col;
2861+
#ifdef FEAT_MBYTE
2862+
curwin->w_cursor.col -=
2863+
(*mb_head_off)(line, line + curwin->w_cursor.col);
2864+
#endif
28572865
*pincl = TRUE;
28582866
}
28592867
}

src/testdir/test_normal.vim

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2290,3 +2290,15 @@ func Test_normal_large_count()
22902290
normal 6666666666dL
22912291
bwipe!
22922292
endfunc
2293+
2294+
func Test_delete_until_paragraph()
2295+
if !has('multi_byte')
2296+
return
2297+
endif
2298+
new
2299+
normal grádv}
2300+
call assert_equal('á', getline(1))
2301+
normal grád}
2302+
call assert_equal('', getline(1))
2303+
bwipe!
2304+
endfunc

src/version.c

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

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
523,
767769
/**/
768770
522,
769771
/**/

0 commit comments

Comments
 (0)