0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 8.2.4660: cursorcolumn is sometimes not correct

Problem:    Cursorcolumn is sometimes not correct.
Solution:   Recompute the cursor column when entering Insert mode and the
            cursor is on a character wider than a screen cell.
This commit is contained in:
Bram Moolenaar
2022-04-01 12:06:31 +01:00
parent 96e08e028c
commit 782c6744b4
5 changed files with 48 additions and 5 deletions

View File

@@ -293,11 +293,14 @@ edit(
conceal_check_cursor_line(cursor_line_was_concealed);
#endif
/*
* Need to recompute the cursor position, it might move when the cursor is
* on a TAB or special character.
*/
curs_columns(TRUE);
// Need to recompute the cursor position, it might move when the cursor
// is on a TAB or special character.
// ptr2cells() treats a TAB character as double-width.
if (ptr2cells(ml_get_cursor()) > 1)
{
curwin->w_valid &= ~VALID_VIRTCOL;
curs_columns(TRUE);
}
/*
* Enable langmap or IME, indicated by 'iminsert'.