patch 9.0.1568: with 'smoothscroll' cursor may move below botline

Problem:    With 'smoothscroll' cursor may move below botline.
Solution:   Call redraw_later() if needed,  Compute cursor row with adjusted
            condition. (Luuk van Baal, closes #12415)
diff --git a/src/testdir/test_scroll_opt.vim b/src/testdir/test_scroll_opt.vim
index 469cf12..648060b 100644
--- a/src/testdir/test_scroll_opt.vim
+++ b/src/testdir/test_scroll_opt.vim
@@ -257,11 +257,14 @@
   call term_sendkeys(buf, "G")
   call VerifyScreenDump(buf, 'Test_smooth_wrap_4', {})
 
-  " moving cursor up right after the >>> marker - no need to show whole line
+  call term_sendkeys(buf, "4\<C-Y>G")
+  call VerifyScreenDump(buf, 'Test_smooth_wrap_4', {})
+
+  " moving cursor up right after the <<< marker - no need to show whole line
   call term_sendkeys(buf, "2gj3l2k")
   call VerifyScreenDump(buf, 'Test_smooth_wrap_5', {})
 
-  " moving cursor up where the >>> marker is - whole top line shows
+  " moving cursor up where the <<< marker is - whole top line shows
   call term_sendkeys(buf, "2j02k")
   call VerifyScreenDump(buf, 'Test_smooth_wrap_6', {})
 
@@ -705,4 +708,30 @@
   call StopVimInTerminal(buf)
 endfunc
 
+" skipcol should not reset when doing incremental search on the same word
+func Test_smoothscroll_incsearch()
+  CheckScreendump
+
+  let lines =<< trim END
+      set smoothscroll number scrolloff=0 incsearch
+      call setline(1, repeat([''], 20))
+      call setline(11, repeat('a', 100))
+      call setline(14, 'bbbb')
+  END
+  call writefile(lines, 'XSmoothIncsearch', 'D')
+  let buf = RunVimInTerminal('-S XSmoothIncsearch', #{rows: 8, cols:40})
+
+  call term_sendkeys(buf, "/b")
+  call VerifyScreenDump(buf, 'Test_smooth_incsearch_1', {})
+  call term_sendkeys(buf, "b")
+  call VerifyScreenDump(buf, 'Test_smooth_incsearch_2', {})
+  call term_sendkeys(buf, "b")
+  call VerifyScreenDump(buf, 'Test_smooth_incsearch_3', {})
+  call term_sendkeys(buf, "b")
+  call VerifyScreenDump(buf, 'Test_smooth_incsearch_4', {})
+  call term_sendkeys(buf, "\<CR>")
+
+  call StopVimInTerminal(buf)
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab