aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/edit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r--src/nvim/edit.c10
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