patch 9.0.1525: 'smoothscroll' does not always work properly
Problem: 'smoothscroll' does not always work properly.
Solution: Do not reset w_skipcol after it was intentionally set. (Luuk van
Baal, closes #12360, closes #12199, closes #12323)
diff --git a/src/testdir/dumps/Test_smooth_cursormoved_line.dump b/src/testdir/dumps/Test_smooth_cursormoved_line.dump
new file mode 100644
index 0000000..6ae3801
--- /dev/null
+++ b/src/testdir/dumps/Test_smooth_cursormoved_line.dump
@@ -0,0 +1,6 @@
+|<+0#4040ff13#ffffff0@2|_+0#0000000&@71
+@75
+@73>x@1
+@1|_@72|x
+@2| @72
+@57|3|,|7|4| @9|B|o|t|
diff --git a/src/testdir/dumps/Test_smooth_eob_1.dump b/src/testdir/dumps/Test_smooth_eob_1.dump
new file mode 100644
index 0000000..8bd2687
--- /dev/null
+++ b/src/testdir/dumps/Test_smooth_eob_1.dump
@@ -0,0 +1,10 @@
+| +0&#ffffff0@74
+@75
+@75
+@75
+@75
+@75
+@75
+@75
+> @74
+@57|1|0@1|,|0|-|1| @6|B|o|t|
diff --git a/src/testdir/dumps/Test_smooth_eob_2.dump b/src/testdir/dumps/Test_smooth_eob_2.dump
new file mode 100644
index 0000000..55d9e19
--- /dev/null
+++ b/src/testdir/dumps/Test_smooth_eob_2.dump
@@ -0,0 +1,10 @@
+|<+0#4040ff13#ffffff0@2|a+0#0000000&@21| @49
+@75
+@75
+@75
+@75
+@75
+@75
+@75
+> @74
+@57|1|0@1|,|0|-|1| @6|B|o|t|
diff --git a/src/testdir/dumps/Test_smooth_long_10.dump b/src/testdir/dumps/Test_smooth_long_10.dump
index 10634be..0aa7a4b 100644
--- a/src/testdir/dumps/Test_smooth_long_10.dump
+++ b/src/testdir/dumps/Test_smooth_long_10.dump
@@ -1,6 +1,6 @@
-|<+0#4040ff13#ffffff0@2|o+0#0000000&|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o
+|<+0#4040ff13#ffffff0@2|t+0#0000000&|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t
+|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o
+|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o
|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |e|n|d| @11
>f|o|u|r| @35
-|~+0#4040ff13&| @38
-|~| @38
-|:+0#0000000&|s|e|t| |s|c|r|o|l@1|o| @9|4|,|1| @10|B|o|t|
+|:|s|e|t| |s|c|r|o|l@1|o| @9|4|,|1| @10|B|o|t|
diff --git a/src/testdir/test_scroll_opt.vim b/src/testdir/test_scroll_opt.vim
index 95a4aed..5f6fefe 100644
--- a/src/testdir/test_scroll_opt.vim
+++ b/src/testdir/test_scroll_opt.vim
@@ -638,4 +638,47 @@
call StopVimInTerminal(buf)
endfunc
+" this placed the cursor in the command line
+func Test_smoothscroll_cursormoved_line()
+ CheckScreendump
+
+ let lines =<< trim END
+ set smoothscroll
+ call setline(1, [
+ \'',
+ \'_'->repeat(&lines * &columns),
+ \(('_')->repeat(&columns - 2) .. 'xxx')->repeat(2)
+ \])
+ autocmd CursorMoved * eval [line('w0'), line('w$')]
+ call search('xxx')
+ END
+ call writefile(lines, 'XSmoothCursorMovedLine', 'D')
+ let buf = RunVimInTerminal('-S XSmoothCursorMovedLine', #{rows: 6})
+
+ call VerifyScreenDump(buf, 'Test_smooth_cursormoved_line', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
+func Test_smoothscroll_eob()
+ CheckScreendump
+
+ let lines =<< trim END
+ set smoothscroll
+ call setline(1, ['']->repeat(100))
+ norm G
+ END
+ call writefile(lines, 'XSmoothEob', 'D')
+ let buf = RunVimInTerminal('-S XSmoothEob', #{rows: 10})
+
+ " does not scroll halfway when scrolling to end of buffer
+ call VerifyScreenDump(buf, 'Test_smooth_eob_1', {})
+
+ " cursor is not placed below window
+ call term_sendkeys(buf, ":call setline(92, 'a'->repeat(100))\<CR>\<C-B>G")
+ call VerifyScreenDump(buf, 'Test_smooth_eob_2', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab