Mercurial > vim
comparison src/getchar.c @ 31823:a5c68c2e5ae8 v9.0.1244
patch 9.0.1244: cursor displayed in wrong position when leaving Insert mode
Commit: https://github.com/vim/vim/commit/0f843ef091eceb470caece1d90fdfe08926fe076
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jan 25 17:34:41 2023 +0000
patch 9.0.1244: cursor displayed in wrong position when leaving Insert mode
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 25 Jan 2023 18:45:04 +0100 |
parents | e5ee2ffd826a |
children | e16361210675 |
comparison
equal
deleted
inserted
replaced
31822:2f25be7e01fd | 31823:a5c68c2e5ae8 |
---|---|
3326 // move cursor left, if possible | 3326 // move cursor left, if possible |
3327 if (curwin->w_cursor.col != 0) | 3327 if (curwin->w_cursor.col != 0) |
3328 { | 3328 { |
3329 if (curwin->w_wcol > 0) | 3329 if (curwin->w_wcol > 0) |
3330 { | 3330 { |
3331 if (did_ai) | 3331 // After auto-indenting and no text is following, |
3332 // we are expecting to truncate the trailing | |
3333 // white-space, so find the last non-white | |
3334 // character -- webb | |
3335 if (did_ai && *skipwhite(ml_get_curline() | |
3336 + curwin->w_cursor.col) == NUL) | |
3332 { | 3337 { |
3333 chartabsize_T cts; | 3338 chartabsize_T cts; |
3334 | 3339 |
3335 /* | |
3336 * We are expecting to truncate the trailing | |
3337 * white-space, so find the last non-white | |
3338 * character -- webb | |
3339 */ | |
3340 curwin->w_wcol = 0; | 3340 curwin->w_wcol = 0; |
3341 ptr = ml_get_curline(); | 3341 ptr = ml_get_curline(); |
3342 init_chartabsize_arg(&cts, curwin, | 3342 init_chartabsize_arg(&cts, curwin, |
3343 curwin->w_cursor.lnum, 0, ptr, ptr); | 3343 curwin->w_cursor.lnum, 0, ptr, ptr); |
3344 while (cts.cts_ptr < ptr + curwin->w_cursor.col) | 3344 while (cts.cts_ptr < ptr + curwin->w_cursor.col) |