patch 9.1.0407: Stuck with long line and half-page scrolling

Problem:  No scrolling happens with half-page scrolling with line
          filling entire window when 'smoothscroll' is disabled.
          (Mathias Rav, after v9.1.0285)
Solution: Adjust amount to move cursor by so that it is moved the same
          number of lines as was scrolled, even when scrolling different
          number of lines than requested with 'nosmoothscroll'.

fixes: #14743
closes: #14746

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 4b7e5e6..5cbf681 100644
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -4260,4 +4260,12 @@
   bwipe!
 endfunc
 
+" Test for Ctrl-D with long line
+func Test_halfpage_longline()
+  10new
+  call setline(1, ['long'->repeat(1000), 'short'])
+  exe "norm! \<C-D>"
+  call assert_equal(2, line('.'))
+  bwipe!
+endfunc
 " vim: shiftwidth=2 sts=2 expandtab nofoldenable