comparison 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
comparison
equal deleted inserted replaced
24340:b835b68b64a4 24341:0e1b8b98f9f4
888 888
889 func Test_fold_relative_move() 889 func Test_fold_relative_move()
890 new 890 new
891 set fdm=indent sw=2 wrap tw=80 891 set fdm=indent sw=2 wrap tw=80
892 892
893 let content = [ ' foo', ' bar', ' baz', 893 let longtext = repeat('x', &columns + 1)
894 \ repeat('x', &columns + 1), 894 let content = [ ' foo', ' ' .. longtext, ' baz',
895 \ ' foo', ' bar', ' baz' 895 \ longtext,
896 \ ' foo', ' ' .. longtext, ' baz'
896 \ ] 897 \ ]
897 call append(0, content) 898 call append(0, content)
898 899
899 normal zM 900 normal zM
900 901
901 call cursor(3, 1) 902 for lnum in range(1, 3)
902 call assert_true(foldclosed(line('.'))) 903 call cursor(lnum, 1)
903 normal gj 904 call assert_true(foldclosed(line('.')))
904 call assert_equal(2, winline()) 905 normal gj
906 call assert_equal(2, winline())
907 endfor
905 908
906 call cursor(2, 1) 909 call cursor(2, 1)
907 call assert_true(foldclosed(line('.'))) 910 call assert_true(foldclosed(line('.')))
908 normal 2gj 911 normal 2gj
909 call assert_equal(3, winline()) 912 call assert_equal(3, winline())
910 913
911 call cursor(5, 1) 914 for lnum in range(5, 7)
912 call assert_true(foldclosed(line('.'))) 915 call cursor(lnum, 1)
913 normal gk 916 call assert_true(foldclosed(line('.')))
914 call assert_equal(3, winline()) 917 normal gk
918 call assert_equal(3, winline())
919 endfor
915 920
916 call cursor(6, 1) 921 call cursor(6, 1)
917 call assert_true(foldclosed(line('.'))) 922 call assert_true(foldclosed(line('.')))
918 normal 2gk 923 normal 2gk
919 call assert_equal(2, winline()) 924 call assert_equal(2, winline())