diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-02-24 22:04:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-24 22:04:52 +0800 |
commit | febf4810026a1f54f63cedbfef2e30e72cf535bf (patch) | |
tree | 3130082752d2236119a0127a680bc92fac65ebe4 /src | |
parent | 63c9e0c4ae42fd05c03e4dd3893a3f2eede771a7 (diff) | |
download | rneovim-febf4810026a1f54f63cedbfef2e30e72cf535bf.tar.gz rneovim-febf4810026a1f54f63cedbfef2e30e72cf535bf.tar.bz2 rneovim-febf4810026a1f54f63cedbfef2e30e72cf535bf.zip |
vim-patch:9.1.0132: "C" doesn't include composing chars with 'virtualedit' (#27605)
Problem: using "C" and 've=all' set, doesn't include composing chars
when changing a line, keeps the composing chars for whatever
is typed afterwards.
Solution: Use mb_head_off() and mb_ptr2len() instead of mb_tail_off().
(zeertzjq)
closes: vim/vim#14083
https://github.com/vim/vim/commit/048761bcd40ec630fd3e039f0066cf4e484ceabd
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ops.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c index a4af2a54be..5a0ef66e91 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -1770,8 +1770,13 @@ static void mb_adjust_opend(oparg_T *oap) return; } - char *p = ml_get(oap->end.lnum); - oap->end.col += utf_cp_tail_off(p, p + oap->end.col); + const char *line = ml_get(oap->end.lnum); + const char *ptr = line + oap->end.col; + if (*ptr != NUL) { + ptr -= utf_head_off(line, ptr); + ptr += utfc_ptr2len(ptr) - 1; + oap->end.col = (colnr_T)(ptr - line); + } } /// Put character 'c' at position 'lp' |