commit c94d8e7f13bbe6aa0d195eeac115695e0d95e7f3
parent b05100a9eaad5980ea7652137bc4a1c2d15d752f
Author: zeertzjq <zeertzjq@outlook.com>
Date: Thu, 26 Jan 2023 07:31:32 +0800
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)
https://github.com/vim/vim/commit/0f843ef091eceb470caece1d90fdfe08926fe076
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat:
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
@@ -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;