diff options
author | Luuk van Baal <luukvbaal@gmail.com> | 2023-04-28 12:32:39 +0200 |
---|---|---|
committer | Luuk van Baal <luukvbaal@gmail.com> | 2023-05-02 13:11:47 +0200 |
commit | c25fd85c2e618535b7780b965a883cb20ab1aa1a (patch) | |
tree | f637e6978676ea094d9a469b5dc396ea5bd57c3d /src | |
parent | 5ba11087b60eb7cbcaa1ea4ccbb0b1a6bcf3c1be (diff) | |
download | rneovim-c25fd85c2e618535b7780b965a883cb20ab1aa1a.tar.gz rneovim-c25fd85c2e618535b7780b965a883cb20ab1aa1a.tar.bz2 rneovim-c25fd85c2e618535b7780b965a883cb20ab1aa1a.zip |
vim-patch:9.0.0998: "gk" may reset skipcol when not needed
Problem: "gk" may reset skipcol when not needed.
Solution: Only reset skipcol if the cursor column is less.
https://github.com/vim/vim/commit/1b73edd9ee40aec400f3611f59823cec5fd1c489
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/move.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nvim/move.c b/src/nvim/move.c index abe908cfa0..2bae811e6d 100644 --- a/src/nvim/move.c +++ b/src/nvim/move.c @@ -1776,7 +1776,7 @@ void scroll_cursor_top(int min_scroll, int always) scroll_cursor_halfway(false, false); } else { // If "always" is false, only adjust topline to a lower value, higher - // value may happen with wrapping lines + // value may happen with wrapping lines. if (new_topline < curwin->w_topline || always) { curwin->w_topline = new_topline; } @@ -1792,7 +1792,8 @@ void scroll_cursor_top(int min_scroll, int always) } check_topfill(curwin, false); // TODO(vim): if the line doesn't fit may optimize w_skipcol - if (curwin->w_topline == curwin->w_cursor.lnum) { + if (curwin->w_topline == curwin->w_cursor.lnum + && curwin->w_skipcol >= curwin->w_cursor.col) { reset_skipcol(curwin); } if (curwin->w_topline != old_topline |