diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-09-01 06:45:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-01 06:45:27 +0800 |
commit | 592a8f1e90d5abaa695280bf6d41a547b3631d0d (patch) | |
tree | 14fb727e24abd4b9a0dbf66712006fefb4864e12 /src | |
parent | a1bec02c1e105eb9f49d577e04bdbeadd5a05e38 (diff) | |
download | rneovim-592a8f1e90d5abaa695280bf6d41a547b3631d0d.tar.gz rneovim-592a8f1e90d5abaa695280bf6d41a547b3631d0d.tar.bz2 rneovim-592a8f1e90d5abaa695280bf6d41a547b3631d0d.zip |
vim-patch:9.0.1828: cursor wrong with virt text before double-width char (#24967)
Problem: Wrong cursor position with virtual text before double-width
char at window edge.
Solution: Check for double-width char before adding virtual text size.
closes: vim/vim#12977
https://github.com/vim/vim/commit/ac2d8815ae7a93c54b07cba76475cfb3f26a3ac6
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/plines.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/plines.c b/src/nvim/plines.c index f59a1754f5..82554c7785 100644 --- a/src/nvim/plines.c +++ b/src/nvim/plines.c @@ -216,6 +216,7 @@ int win_lbr_chartabsize(chartabsize_T *cts, int *headp) if (*s == NUL && !has_lcs_eol) { size = 0; // NUL is not displayed } + bool is_doublewidth = size == 2 && MB_BYTE2LEN((uint8_t)(*s)) > 1; if (cts->cts_has_virt_text) { int tab_size = size; @@ -247,8 +248,7 @@ int win_lbr_chartabsize(chartabsize_T *cts, int *headp) } } - if (size == 2 && MB_BYTE2LEN((uint8_t)(*s)) > 1 - && wp->w_p_wrap && in_win_border(wp, vcol)) { + if (is_doublewidth && wp->w_p_wrap && in_win_border(wp, vcol + size - 2)) { // Count the ">" in the last column. size++; mb_added = 1; |