diff options
author | luukvbaal <luukvbaal@gmail.com> | 2023-05-13 02:15:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-13 08:15:01 +0800 |
commit | a6d63591f1fc61d570b646306d7c259b5ec2cace (patch) | |
tree | 4deb092a0a48c7f3556402c4aab7e45f7cdd41e2 | |
parent | 2835b0daad434fe85bd26b9226edfa45d6545f55 (diff) | |
download | rneovim-a6d63591f1fc61d570b646306d7c259b5ec2cace.tar.gz rneovim-a6d63591f1fc61d570b646306d7c259b5ec2cace.tar.bz2 rneovim-a6d63591f1fc61d570b646306d7c259b5ec2cace.zip |
vim-patch:9.0.1545: text not scrolled when cursor moved with "g0" and "h" (#23599)
Problem: Text not scrolled when cursor moved with "g0" and "h".
Solution: Adjust w_skipcol when needed. (Luuk van Baal, closes vim/vim#12387)
https://github.com/vim/vim/commit/8667a5678f983ba899825b810ab849952d49bcb8
-rw-r--r-- | src/nvim/edit.c | 1 | ||||
-rw-r--r-- | src/nvim/normal.c | 1 | ||||
-rw-r--r-- | test/old/testdir/test_scroll_opt.vim | 12 |
3 files changed, 14 insertions, 0 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 8fbc5fb2ab..7670d6754f 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -2527,6 +2527,7 @@ int oneleft(void) } curwin->w_set_curswant = true; + adjust_skipcol(); return OK; } diff --git a/src/nvim/normal.c b/src/nvim/normal.c index fa6cdb0ad8..7e44e55a8e 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -5272,6 +5272,7 @@ static void nv_g_home_m_cmd(cmdarg_T *cap) curwin->w_valid &= ~VALID_WCOL; } curwin->w_set_curswant = true; + adjust_skipcol(); } /// "g_": to the last non-blank character in the line or <count> lines downward. diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index 6f3d12679e..cf37195e1d 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -419,6 +419,18 @@ func Test_smoothscroll_cursor_position() exe "normal \<C-Y>" call s:check_col_calc(1, 3, 41) + " Test "g0/g<Home>" + exe "normal gg\<C-E>" + norm $gkg0 + call s:check_col_calc(1, 2, 21) + + " Test moving the cursor behind the <<< display with 'virtualedit' + set virtualedit=all + exe "normal \<C-E>" + norm 3lgkh + call s:check_col_calc(3, 2, 23) + set virtualedit& + normal gg3l exe "normal \<C-E>" |