patch 9.1.0132: "C" doesn't include composing chars with 'virtualedit'
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: #14083
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/ops.c b/src/ops.c
index e66b4b5..57e6991 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -990,13 +990,20 @@
static void
mb_adjust_opend(oparg_T *oap)
{
- char_u *p;
+ char_u *line;
+ char_u *ptr;
if (!oap->inclusive)
return;
- p = ml_get(oap->end.lnum);
- oap->end.col += mb_tail_off(p, p + oap->end.col);
+ line = ml_get(oap->end.lnum);
+ ptr = line + oap->end.col;
+ if (*ptr != NUL)
+ {
+ ptr -= (*mb_head_off)(line, ptr);
+ ptr += (*mb_ptr2len)(ptr) - 1;
+ oap->end.col = ptr - line;
+ }
}
/*