Mercurial > vim
diff src/normal.c @ 5682:a1c07956171a v7.4.187
updated for version 7.4.187
Problem: Delete that crosses line break splits multi-byte character.
Solution: Advance a character instead of a byte. (Cade Foster)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Sat, 22 Feb 2014 23:49:35 +0100 |
parents | beb037a6c270 |
children | 40f18a1c1592 |
line wrap: on
line diff
--- 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(®name); # endif - if (regname == 0 || regname == '"' + if (regname == 0 || regname == '"' || VIM_ISDIGIT(regname) || regname == '-' # ifdef FEAT_CLIPBOARD || (clip_unnamed && (regname == '*' || regname == '+'))