aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/getchar.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-01-26 07:31:32 +0800
committerGitHub <noreply@github.com>2023-01-26 07:31:32 +0800
commitc94d8e7f13bbe6aa0d195eeac115695e0d95e7f3 (patch)
tree670be2137596300e4172cd5b616447b32b6776dd /src/nvim/getchar.c
parentb05100a9eaad5980ea7652137bc4a1c2d15d752f (diff)
downloadrneovim-c94d8e7f13bbe6aa0d195eeac115695e0d95e7f3.tar.gz
rneovim-c94d8e7f13bbe6aa0d195eeac115695e0d95e7f3.tar.bz2
rneovim-c94d8e7f13bbe6aa0d195eeac115695e0d95e7f3.zip
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 (limited to 'src/nvim/getchar.c')
-rw-r--r--src/nvim/getchar.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index 9c5364e1b1..51554fea22 100644
--- 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;