diff src/testdir/test_fold.vim @ 24341:0e1b8b98f9f4 v8.2.2711

patch 8.2.2711: "gj" in a closed fold does not move out of the fold Commit: https://github.com/vim/vim/commit/3c49e74e18993915a779cafe4af3749b39fd3e2a Author: Bram Moolenaar <Bram@vim.org> Date: Sun Apr 4 21:26:04 2021 +0200 patch 8.2.2711: "gj" in a closed fold does not move out of the fold Problem: "gj" in a closed fold does not move out of the fold. (Marco Hinz) Solution: Add a check for being in a closed fold. (closes https://github.com/vim/vim/issues/8062)
author Bram Moolenaar <Bram@vim.org>
date Sun, 04 Apr 2021 21:30:03 +0200
parents c2a234e8c896
children eab30779c97c
line wrap: on
line diff
--- a/src/testdir/test_fold.vim
+++ b/src/testdir/test_fold.vim
@@ -890,28 +890,33 @@ func Test_fold_relative_move()
   new
   set fdm=indent sw=2 wrap tw=80
 
-  let content = [ '  foo', '  bar', '  baz',
-              \   repeat('x', &columns + 1),
-              \   '  foo', '  bar', '  baz'
+  let longtext = repeat('x', &columns + 1)
+  let content = [ '  foo', '  ' .. longtext, '  baz',
+              \   longtext,
+              \   '  foo', '  ' .. longtext, '  baz'
               \ ]
   call append(0, content)
 
   normal zM
 
-  call cursor(3, 1)
-  call assert_true(foldclosed(line('.')))
-  normal gj
-  call assert_equal(2, winline())
+  for lnum in range(1, 3)
+    call cursor(lnum, 1)
+    call assert_true(foldclosed(line('.')))
+    normal gj
+    call assert_equal(2, winline())
+  endfor
 
   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())
+  for lnum in range(5, 7)
+    call cursor(lnum, 1)
+    call assert_true(foldclosed(line('.')))
+    normal gk
+    call assert_equal(3, winline())
+  endfor
 
   call cursor(6, 1)
   call assert_true(foldclosed(line('.')))