patch 9.1.1385: inefficient loop for 'nosmoothscroll' scrolling
Problem: Loop that ensures "w_skipcol" is zero with 'nosmoothscroll'
for (half)-page scrolling is inefficient.
Solution: Calculate the required "count" instead of looping until
"w_skipcol" is zero (Luuk van Baal).
fixes: #17301
closes: #17306
Signed-off-by: Luuk van Baal <luukvbaal@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim
index aa24bce..7f4f909 100644
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -4345,4 +4345,13 @@
bwipe!
endfunc
+" Benchmark test for Ctrl-F with 'nosmoothscroll'
+func Test_scroll_longline_benchmark()
+ call setline(1, ['foo'->repeat(20000)] + [''])
+ let start = reltime()
+ exe "normal! \<C-F>"
+ call assert_inrange(0, 0.1, reltimefloat(reltime(start)))
+ bwipe!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab nofoldenable