diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-08-01 16:51:02 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-08-01 16:51:02 +0100 |
commit | 09ff4b54fb86a64390ba9c609853c6410ea6197c (patch) | |
tree | 4316af527f21093d41123c2421863159b27c95e7 /src/charset.c | |
parent | 783ef7214b6a33300bd83f616c1ead587370ce49 (diff) |
patch 9.0.0132: multi-byte characters in virtual text not handled correctlyv9.0.0132
Problem: Multi-byte characters in virtual text not handled correctly.
Solution: Count screen cells instead of bytes.
Diffstat (limited to 'src/charset.c')
-rw-r--r-- | src/charset.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/charset.c b/src/charset.c index 2b657476df..c2137049b7 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1097,9 +1097,8 @@ win_lbr_chartabsize( { char_u *p = ((char_u **)wp->w_buffer->b_textprop_text.ga_data)[ -tp->tp_id - 1]; - int len = (int)STRLEN(p); + int len = vim_strsize(p); - // TODO: count screen cells if (tp->tp_col == MAXCOL) { // TODO: truncating @@ -1454,8 +1453,9 @@ getvcol( if (cursor != NULL) { #ifdef FEAT_PROP_POPUP - // cursor is after inserted text - vcol += cts.cts_cur_text_width; + if ((State & MODE_INSERT) == 0) + // cursor is after inserted text + vcol += cts.cts_cur_text_width; #endif if (*ptr == TAB && (State & MODE_NORMAL) |