patch 9.0.1530: cursor moves to wrong line when 'foldmethod' is "diff"
Problem: Cursor moves to wrong line when 'foldmethod' is "diff". (Rick
Howe)
Solution: Adjust logic for scrolling. (Luuk van Baal, closes #12364,
closes #12218)
diff --git a/src/testdir/dumps/Test_normal_j_below_botline.dump b/src/testdir/dumps/Test_normal_j_below_botline.dump
new file mode 100644
index 0000000..e736b64
--- /dev/null
+++ b/src/testdir/dumps/Test_normal_j_below_botline.dump
@@ -0,0 +1,19 @@
+| +0#af5f00255#ffffff0@1|2| |2+0#0000000&@35
+| +0#af5f00255&@3|2+0#0000000&@35
+| +0#af5f00255&@3|2+0#0000000&@35
+| +0#af5f00255&@3|2+0#0000000&@35
+| +0#af5f00255&@3|2+0#0000000&@35
+| +0#af5f00255&@3|2+0#0000000&@19| @15
+| +0#af5f00255&@1|3| |3+0#0000000&@35
+| +0#af5f00255&@3|3+0#0000000&@35
+| +0#af5f00255&@3|3+0#0000000&@35
+| +0#af5f00255&@3|3+0#0000000&@35
+| +0#af5f00255&@3|3+0#0000000&@35
+| +0#af5f00255&@3|3+0#0000000&@19| @15
+| +0#af5f00255&@1|4| >4+0#0000000&@35
+| +0#af5f00255&@3|4+0#0000000&@35
+| +0#af5f00255&@3|4+0#0000000&@35
+| +0#af5f00255&@3|4+0#0000000&@35
+| +0#af5f00255&@3|4+0#0000000&@35
+| +0#af5f00255&@3|4+0#0000000&@19| @15
+@22|4|,|1| @10|1|6|%|
diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim
index 470b41c..a3d9454 100644
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -3980,4 +3980,22 @@
call delete('Xmouseshapes')
endfunc
+" Test that "j" does not skip lines when scrolling below botline and
+" 'foldmethod' is not "manual".
+func Test_normal_j_below_botline()
+ CheckScreendump
+
+ let lines =<< trim END
+ set number foldmethod=diff scrolloff=0
+ call setline(1, map(range(1, 9), 'repeat(v:val, 200)'))
+ norm Lj
+ END
+ call writefile(lines, 'XNormalJBelowBotline', 'D')
+ let buf = RunVimInTerminal('-S XNormalJBelowBotline', #{rows: 19, cols: 40})
+
+ call VerifyScreenDump(buf, 'Test_normal_j_below_botline', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab