]> granicus.if.org Git - vim/commitdiff
patch 9.0.1244: cursor displayed in wrong position when leaving Insert mode v9.0.1244
authorBram Moolenaar <Bram@vim.org>
Wed, 25 Jan 2023 17:34:41 +0000 (17:34 +0000)
committerBram Moolenaar <Bram@vim.org>
Wed, 25 Jan 2023 17:34:41 +0000 (17:34 +0000)
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)

src/getchar.c
src/version.c

index 2fb9baaf85c14fad247929c32cd332c84f7c5656..f4dce0222ac79795defee1bad772151450e38676 100644 (file)
@@ -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,
index 47052dda688ec3bee8eee61b2360ff4bd9c47ac9..1bb82e2492f5df4474722133635c6bf54006ca36 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1244,
 /**/
     1243,
 /**/