patch 9.1.0601: Wrong cursor position with 'breakindent' when wide char doesn't fit
Problem: Wrong cursor position with 'breakindent' when a double-width
character doesn't fit in a screen line (mikoto2000)
Solution: Include the width of the 'breakindent' properly.
(zeertzjq)
fixes: #15289
closes: #15290
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/charset.c b/src/charset.c
index 45b16aa..19b0895 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1397,17 +1397,17 @@
else if (max_head_vcol > vcol + head_prev + prev_rem)
head += (max_head_vcol - (vcol + head_prev + prev_rem)
+ width2 - 1) / width2 * head_mid;
-# ifdef FEAT_PROP_POPUP
else if (max_head_vcol < 0)
{
- int off = 0;
+ int off = mb_added;
+# ifdef FEAT_PROP_POPUP
if (*s != NUL
&& ((State & MODE_NORMAL) || cts->cts_start_incl))
off += cts->cts_cur_text_width;
+# endif
if (off >= prev_rem)
head += (1 + (off - prev_rem) / width) * head_mid;
}
-# endif
}
}