diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-04-01 20:37:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-01 20:37:45 +0800 |
commit | fce0d54eb2bcfff6903649ab093603dcd8f21f23 (patch) | |
tree | 2367f938b1e7efea4850f4dea8dbb4ca6ef6192e /src/nvim/edit.c | |
parent | 377e87521157947c384d470a63927719b8c73ad7 (diff) | |
parent | ef595e9b93c3841511d8511e11b001e4162a2998 (diff) | |
download | rneovim-fce0d54eb2bcfff6903649ab093603dcd8f21f23.tar.gz rneovim-fce0d54eb2bcfff6903649ab093603dcd8f21f23.tar.bz2 rneovim-fce0d54eb2bcfff6903649ab093603dcd8f21f23.zip |
Merge pull request #17953 from zeertzjq/vim-8.2.4660
vim-patch:8.2.4660: cursorcolumn is sometimes not correct
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r-- | src/nvim/edit.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index a2687ada73..da0b577056 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -390,9 +390,13 @@ static void insert_enter(InsertState *s) trigger_modechanged(); stop_insert_mode = false; - // Need to recompute the cursor position, it might move when the cursor is - // on a TAB or special character. - curs_columns(curwin, 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(get_cursor_pos_ptr()) > 1) { + curwin->w_valid &= ~VALID_VIRTCOL; + curs_columns(curwin, true); + } // Enable langmap or IME, indicated by 'iminsert'. // Note that IME may enabled/disabled without us noticing here, thus the |