summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2014-02-22 23:49:35 +0100
committerBram Moolenaar <Bram@vim.org>2014-02-22 23:49:35 +0100
commit7d311c52ce2859f67532e0a4b604eb8147473c01 (patch)
tree7da6bf9c5a94243ea5bd3d42516edc61c3ded0ac
parentb1d90a3d770c5e513e6cad8284a5168ac5535883 (diff)
updated for version 7.4.187v7.4.187
Problem: Delete that crosses line break splits multi-byte character. Solution: Advance a character instead of a byte. (Cade Foster)
-rw-r--r--src/normal.c17
-rw-r--r--src/testdir/test69.in10
-rw-r--r--src/testdir/test69.ok3
-rw-r--r--src/version.c2
4 files changed, 28 insertions, 4 deletions
diff --git a/src/normal.c b/src/normal.c
index 6bef56dcf6..73505a6c5d 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -21,7 +21,7 @@
static int resel_VIsual_mode = NUL; /* 'v', 'V', or Ctrl-V */
static linenr_T resel_VIsual_line_count; /* number of lines */
static colnr_T resel_VIsual_vcol; /* nr of cols or end col */
-static int VIsual_mode_orig = NUL; /* type of Visual mode, that user entered */
+static int VIsual_mode_orig = NUL; /* saved Visual mode */
static int restart_VIsual_select = 0;
#endif
@@ -6202,8 +6202,17 @@ nv_left(cap)
|| cap->oap->op_type == OP_CHANGE)
&& !lineempty(curwin->w_cursor.lnum))
{
- if (*ml_get_cursor() != NUL)
- ++curwin->w_cursor.col;
+ char_u *cp = ml_get_cursor();
+
+ if (*cp != NUL)
+ {
+#ifdef FEAT_MBYTE
+ if (has_mbyte)
+ curwin->w_cursor.col += (*mb_ptr2len)(cp);
+ else
+#endif
+ ++curwin->w_cursor.col;
+ }
cap->retval |= CA_NO_ADJ_OP_END;
}
continue;
@@ -9482,7 +9491,7 @@ nv_put(cap)
# ifdef FEAT_CLIPBOARD
adjust_clip_reg(&regname);
# endif
- if (regname == 0 || regname == '"'
+ if (regname == 0 || regname == '"'
|| VIM_ISDIGIT(regname) || regname == '-'
# ifdef FEAT_CLIPBOARD
|| (clip_unnamed && (regname == '*' || regname == '+'))
diff --git a/src/testdir/test69.in b/src/testdir/test69.in
index f18ee37905..75317b4954 100644
--- a/src/testdir/test69.in
+++ b/src/testdir/test69.in
@@ -155,6 +155,16 @@ ra test
aab
STARTTEST
+:set whichwrap+=h
+/^x
+dh
+:set whichwrap-=h
+ENDTEST
+
+x
+
+STARTTEST
:let a = '.é.' " one char of two bytes
:let b = '.é.' " normal e with composing char
/^byteidx
diff --git a/src/testdir/test69.ok b/src/testdir/test69.ok
index 1ff82f26bc..41cd9d02c3 100644
--- a/src/testdir/test69.ok
+++ b/src/testdir/test69.ok
@@ -150,6 +150,9 @@ aaaa
aaa
+áx
+
+
byteidx
[0, 1, 3, 4, -1]
[0, 1, 4, 5, -1]
diff --git a/src/version.c b/src/version.c
index 8dcd656cac..dccd84bc89 100644
--- a/src/version.c
+++ b/src/version.c
@@ -739,6 +739,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 187,
+/**/
186,
/**/
185,