mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 01:16:31 +00:00
vim-patch:9.0.0178: cursor position wrong with virtual text before Tab
Problem: Cursor position wrong with virtual text before Tab.
Solution: Use the byte length, not the cell with, to compare the column.
Correct tab size after text prop. (closes vim/vim#10866)
e428fa04a7
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -411,6 +411,7 @@ int win_lbr_chartabsize(chartabsize_T *cts, int *headp)
|
||||
// First get normal size, without 'linebreak' or virtual text
|
||||
int size = win_chartabsize(wp, s, vcol);
|
||||
if (cts->cts_has_virt_text) {
|
||||
int tab_size = size;
|
||||
int charlen = *s == NUL ? 1 : utf_ptr2len(s);
|
||||
int col = (int)(s - line);
|
||||
while (true) {
|
||||
@@ -425,6 +426,12 @@ int win_lbr_chartabsize(chartabsize_T *cts, int *headp)
|
||||
if (decor.virt_text_pos == kVTInline) {
|
||||
cts->cts_cur_text_width += decor.virt_text_width;
|
||||
size += decor.virt_text_width;
|
||||
if (*s == TAB) {
|
||||
// tab size changes because of the inserted text
|
||||
size -= tab_size;
|
||||
tab_size = win_chartabsize(wp, s, vcol + size);
|
||||
size += tab_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user