Mercurial > vim
diff src/window.c @ 31960:9460e6b656ca v9.0.1312
patch 9.0.1312: Cursor position wrong when splitting window in insert mode
Commit: https://github.com/vim/vim/commit/bc3dc298b37820a8212e7d839e882e07d6cc98c8
Author: Luuk van Baal <luukvbaal@gmail.com>
Date: Wed Feb 15 16:45:27 2023 +0000
patch 9.0.1312: Cursor position wrong when splitting window in insert mode
Problem: Cursor position wrong when splitting window in insert mode.
Solution: Pass the actual mode to win_fix_cursor(). (Luuk van Baal,
closes #11999,
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 15 Feb 2023 18:00:06 +0100 |
parents | 1009c33499e7 |
children | 4545f58c8490 |
line wrap: on
line diff
--- a/src/window.c +++ b/src/window.c @@ -5328,7 +5328,10 @@ win_enter_ext(win_T *wp, int flags) if (*p_spk == 'c') // assume cursor position needs updating changed_line_abv_curs(); else - win_fix_cursor(TRUE); + // Make sure the cursor position is valid, either by moving the cursor + // or by scrolling the text. + win_fix_cursor( + get_real_state() & (MODE_NORMAL|MODE_CMDLINE|MODE_TERMINAL)); // Now it is OK to parse messages again, which may be needed in // autocommands. @@ -6782,7 +6785,8 @@ win_fix_scroll(int resize) /* * Make sure the cursor position is valid for 'splitkeep'. * If it is not, put the cursor position in the jumplist and move it. - * If we are not in normal mode, scroll to make valid instead. + * If we are not in normal mode ("normal" is zero), make it valid by scrolling + * instead. */ static void win_fix_cursor(int normal)