summaryrefslogtreecommitdiffstats
path: root/src/getchar.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2023-01-25 17:34:41 +0000
committerBram Moolenaar <Bram@vim.org>2023-01-25 17:34:41 +0000
commit0f843ef091eceb470caece1d90fdfe08926fe076 (patch)
treef501a2405d98bf07a78317fc0002f2c3c59d1767 /src/getchar.c
parent01d4efe2e87632aa085897d3d64e27585908f977 (diff)
patch 9.0.1244: cursor displayed in wrong position when leaving Insert modev9.0.1244
Problem: Cursor briefly displayed in a wrong position when pressing Esc in Insert mode after autoindent was used. Solution: Do not adjust the cursor position for assumed deleted white space if text is following. (closes #11877)
Diffstat (limited to 'src/getchar.c')
-rw-r--r--src/getchar.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/getchar.c b/src/getchar.c
index 2fb9baaf85..f4dce0222a 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -3328,15 +3328,15 @@ vgetorpeek(int advance)
{
if (curwin->w_wcol > 0)
{
- if (did_ai)
+ // After auto-indenting and no text is following,
+ // we are expecting to truncate the trailing
+ // white-space, so find the last non-white
+ // character -- webb
+ if (did_ai && *skipwhite(ml_get_curline()
+ + curwin->w_cursor.col) == NUL)
{
chartabsize_T cts;
- /*
- * We are expecting to truncate the trailing
- * white-space, so find the last non-white
- * character -- webb
- */
curwin->w_wcol = 0;
ptr = ml_get_curline();
init_chartabsize_arg(&cts, curwin,