diff src/testdir/test_normal.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 fa2084ba5138
line wrap: on
line diff
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -4210,4 +4210,19 @@ func Test_single_line_scroll()
   call prop_type_delete(vt)
 endfunc
 
+" Test for zb in buffer with a single line and filler lines
+func Test_single_line_filler_zb()
+  call setline(1, ['', 'foobar one two three'])
+  diffthis
+  new
+  call setline(1, ['foobar one two three'])
+  diffthis
+
+  " zb scrolls to reveal filler lines at the start of the buffer.
+  exe "normal \<C-E>zb"
+  call assert_equal(1, winsaveview().topfill)
+
+  bw!
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab nofoldenable