vim-patch:9.0.1244: cursor displayed in wrong position when leaving Insert mode (#21996)

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 vim/vim#11877)

0f843ef091

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq 2023-01-26 07:31:32 +08:00 committed by GitHub
parent b05100a9ea
commit c94d8e7f13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2526,10 +2526,12 @@ static int vgetorpeek(bool advance)
// move cursor left, if possible
if (curwin->w_cursor.col != 0) {
if (curwin->w_wcol > 0) {
if (did_ai) {
// We are expecting to truncate the trailing
// white-space, so find the last non-white
// character -- webb
// 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(get_cursor_line_ptr() + curwin->w_cursor.col) == NUL) {
curwin->w_wcol = 0;
ptr = (char_u *)get_cursor_line_ptr();
chartabsize_T cts;