Mercurial > vim
comparison src/testdir/test_scroll_opt.vim @ 34767:be09936c20c7 v9.1.0260
patch 9.1.0260: Problems with "zb" and scrolling to new topline with 'smoothscroll'
Commit: https://github.com/vim/vim/commit/bd28cae1f1c21c0e3743e3427c98bbd848fad237
Author: Luuk van Baal <luukvbaal@gmail.com>
Date: Wed Apr 3 22:50:40 2024 +0200
patch 9.1.0260: Problems with "zb" and scrolling to new topline with 'smoothscroll'
Problem: "zb" does not reveal filler lines at the start of a buffer.
Scrolled cursor position with 'smoothscroll' is unpredictable,
and may reset skipcol later if it is not visible (after v9.1.258)
Solution: Replace confusing for loop that reaches final control value too
early with while loop. Set "w_curswant" accordingly so cursor
will be placed in visible part of topline.
(Luuk van Baal)
closes: #14394
Signed-off-by: Luuk van Baal <luukvbaal@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 03 Apr 2024 23:00:04 +0200 |
parents | b20609f4ab37 |
children | 8e38ceda0822 |
comparison
equal
deleted
inserted
replaced
34766:3b404223f7e8 | 34767:be09936c20c7 |
---|---|
1016 call assert_equal(80, winsaveview().skipcol) | 1016 call assert_equal(80, winsaveview().skipcol) |
1017 exe "norm! \<C-B>" | 1017 exe "norm! \<C-B>" |
1018 call assert_equal(0, winsaveview().skipcol) | 1018 call assert_equal(0, winsaveview().skipcol) |
1019 | 1019 |
1020 " Half-page scrolling does not go beyond end of buffer and moves the cursor. | 1020 " Half-page scrolling does not go beyond end of buffer and moves the cursor. |
1021 " Even with 'nostartofline', the correct amount of lines is scrolled. | |
1022 setl nostartofline | |
1021 exe "norm! 0\<C-D>" | 1023 exe "norm! 0\<C-D>" |
1022 call assert_equal(200, winsaveview().skipcol) | 1024 call assert_equal(200, winsaveview().skipcol) |
1023 call assert_equal(204, col('.')) | 1025 call assert_equal(204, col('.')) |
1024 exe "norm! \<C-D>" | 1026 exe "norm! \<C-D>" |
1025 call assert_equal(400, winsaveview().skipcol) | 1027 call assert_equal(400, winsaveview().skipcol) |
1039 exe "norm! \<C-U>" | 1041 exe "norm! \<C-U>" |
1040 call assert_equal(200, winsaveview().skipcol) | 1042 call assert_equal(200, winsaveview().skipcol) |
1041 call assert_equal(204, col('.')) | 1043 call assert_equal(204, col('.')) |
1042 exe "norm! \<C-U>" | 1044 exe "norm! \<C-U>" |
1043 call assert_equal(0, winsaveview().skipcol) | 1045 call assert_equal(0, winsaveview().skipcol) |
1044 call assert_equal(1, col('.')) | 1046 call assert_equal(40, col('.')) |
1045 | 1047 |
1046 bwipe! | 1048 bwipe! |
1047 endfunc | 1049 endfunc |
1048 | 1050 |
1049 func Test_smoothscroll_next_topline() | 1051 func Test_smoothscroll_next_topline() |
1057 call assert_equal(880, winsaveview().skipcol) | 1059 call assert_equal(880, winsaveview().skipcol) |
1058 exe "norm! \<C-E>" | 1060 exe "norm! \<C-E>" |
1059 redraw | 1061 redraw |
1060 call assert_equal(0, winsaveview().skipcol) | 1062 call assert_equal(0, winsaveview().skipcol) |
1061 | 1063 |
1064 " Also when scrolling back. | |
1065 exe "norm! G\<C-Y>" | |
1066 redraw | |
1067 call assert_equal(880, winsaveview().skipcol) | |
1068 | |
1062 " Cursor in correct place when not in the first screenline of a buffer line. | 1069 " Cursor in correct place when not in the first screenline of a buffer line. |
1063 exe "norm! gg4gj20\<C-D>\<C-D>" | 1070 exe "norm! gg4gj20\<C-D>\<C-D>" |
1064 redraw | 1071 redraw |
1065 call assert_equal(2, line('w0')) | 1072 call assert_equal(2, line('w0')) |
1066 | 1073 |