aboutsummaryrefslogtreecommitdiff
path: root/src/normal.c
diff options
context:
space:
mode:
authorHinidu <hinidu@gmail.com>2014-04-08 22:21:07 +0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-04-10 16:56:42 -0300
commit321c67d610f0e0a8e818cfbb10d966033eb7db58 (patch)
tree5f49d3ee0b4f5418de81e382244358093c20ce1a /src/normal.c
parent2a0c6ff3efdc46ffb6e94adc918740b26e11547d (diff)
downloadrneovim-321c67d610f0e0a8e818cfbb10d966033eb7db58.tar.gz
rneovim-321c67d610f0e0a8e818cfbb10d966033eb7db58.tar.bz2
rneovim-321c67d610f0e0a8e818cfbb10d966033eb7db58.zip
vim-patch:7.4.187
Problem: Delete that crosses line break splits multi-byte character. Solution: Advance a character instead of a byte. (Cade Foster) https://code.google.com/p/vim/source/detail?r=a1c07956171a133583df42627d3498f935e59988
Diffstat (limited to 'src/normal.c')
-rw-r--r--src/normal.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/normal.c b/src/normal.c
index cafb73cac6..ca5a0d912a 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -62,7 +62,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;
@@ -4804,8 +4804,15 @@ static void nv_left(cmdarg_T *cap)
if ( (cap->oap->op_type == OP_DELETE
|| 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) {
+ if (has_mbyte) {
+ curwin->w_cursor.col += (*mb_ptr2len)(cp);
+ } else {
+ curwin->w_cursor.col++;
+ }
+ }
cap->retval |= CA_NO_ADJ_OP_END;
}
continue;