diff options
author | Ibby <33922797+SleepySwords@users.noreply.github.com> | 2023-03-19 20:31:52 +1100 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2023-05-22 13:49:42 +0200 |
commit | 0c7fa3bdcc3761cc851ea0ac37bf692b990044cc (patch) | |
tree | 8876f39c6edd4c72bfa369abcc53f8b0279df3da /src/nvim/charset.c | |
parent | 389f5ca39d278173dc0446dc339f7ac1ff573329 (diff) | |
download | rneovim-0c7fa3bdcc3761cc851ea0ac37bf692b990044cc.tar.gz rneovim-0c7fa3bdcc3761cc851ea0ac37bf692b990044cc.tar.bz2 rneovim-0c7fa3bdcc3761cc851ea0ac37bf692b990044cc.zip |
fix(ui): fix multi-byte characters highlight in virtual text
This also fixes insert cursor position around virtual text
vim-patch:9.0.0132: multi-byte characters in virtual text not handled correctly
Problem: Multi-byte characters in virtual text not handled correctly.
Solution: Count screen cells instead of bytes.
https://github.com/vim/vim/commit/09ff4b54fb86a64390ba9c609853c6410ea6197c
Diffstat (limited to 'src/nvim/charset.c')
-rw-r--r-- | src/nvim/charset.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nvim/charset.c b/src/nvim/charset.c index 8cae831881..48a38dd3d3 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -1079,8 +1079,10 @@ void getvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *en } if (cursor != NULL) { - // 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; + } if ((*ptr == TAB) && (State & MODE_NORMAL) && !wp->w_p_list |