diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-02-15 20:36:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-15 20:36:01 +0800 |
commit | 0072a97b2e577ee9363651f332baaf5898a52167 (patch) | |
tree | bb767733b65a43f2b1397d5be1f9f5afcc667679 /src/nvim/ops.c | |
parent | 8cc881e4f4c2edc185067f6ec9ff78f6a79a4fd0 (diff) | |
parent | 8f3e56ed3a3b05e19a9c5b9c812596cc87281bf9 (diff) | |
download | rneovim-0072a97b2e577ee9363651f332baaf5898a52167.tar.gz rneovim-0072a97b2e577ee9363651f332baaf5898a52167.tar.bz2 rneovim-0072a97b2e577ee9363651f332baaf5898a52167.zip |
Merge pull request #17411 from zeertzjq/vim-8.2.3820
vim-patch:8.2.{3820,3823}: "vrc" does not replace composing characters
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r-- | src/nvim/ops.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c index c9a99fef84..e012ab0c57 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -1961,11 +1961,14 @@ static int op_replace(oparg_T *oap, int c) while (ltoreq(curwin->w_cursor, oap->end)) { n = gchar_cursor(); if (n != NUL) { - if (utf_char2len(c) > 1 || utf_char2len(n) > 1) { + int new_byte_len = utf_char2len(c); + int old_byte_len = utfc_ptr2len(get_cursor_pos_ptr()); + + if (new_byte_len > 1 || old_byte_len > 1) { // This is slow, but it handles replacing a single-byte // with a multi-byte and the other way around. if (curwin->w_cursor.lnum == oap->end.lnum) { - oap->end.col += utf_char2len(c) - utf_char2len(n); + oap->end.col += new_byte_len - old_byte_len; } replace_character(c); } else { |