aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-01-21 23:43:49 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-01-22 09:03:44 -0500
commit30ef922f3908edae9511c029da294b92f342a1cc (patch)
treec05ec57189d0780cea9029aa2ae3c141f882b808 /src/nvim/testdir
parentb8ea076ad116ff2639bebbde3283ac025fb9acb3 (diff)
downloadrneovim-30ef922f3908edae9511c029da294b92f342a1cc.tar.gz
rneovim-30ef922f3908edae9511c029da294b92f342a1cc.tar.bz2
rneovim-30ef922f3908edae9511c029da294b92f342a1cc.zip
vim-patch:8.2.2385: "gj" and "gk" do not work correctly when inside a fold
Problem: "gj" and "gk" do not work correctly when inside a fold. Solution: Move check for folding. (closes vim/vim#7724, closes vim/vim#4095) https://github.com/vim/vim/commit/e71996bd0865659bde5450f466bc3e53e83431b2
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_fold.vim35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_fold.vim b/src/nvim/testdir/test_fold.vim
index 88ce64b9eb..18f328acf4 100644
--- a/src/nvim/testdir/test_fold.vim
+++ b/src/nvim/testdir/test_fold.vim
@@ -822,4 +822,39 @@ func Test_fold_create_delete()
bwipe!
endfunc
+func Test_fold_relative_move()
+ enew!
+ set fdm=indent sw=2 wrap tw=80
+
+ let content = [ ' foo', ' bar', ' baz',
+ \ repeat('x', 100),
+ \ ' foo', ' bar', ' baz'
+ \ ]
+ call append(0, content)
+
+ normal zM
+
+ call cursor(3, 1)
+ call assert_true(foldclosed(line('.')))
+ normal gj
+ call assert_equal(2, winline())
+
+ call cursor(2, 1)
+ call assert_true(foldclosed(line('.')))
+ normal 2gj
+ call assert_equal(3, winline())
+
+ call cursor(5, 1)
+ call assert_true(foldclosed(line('.')))
+ normal gk
+ call assert_equal(3, winline())
+
+ call cursor(6, 1)
+ call assert_true(foldclosed(line('.')))
+ normal 2gk
+ call assert_equal(2, winline())
+
+ set fdm& sw& wrap& tw&
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab