aboutsummaryrefslogtreecommitdiff
path: root/test/functional/normal/fold_spec.lua
diff options
context:
space:
mode:
authorMatthew Malcomson <hardenedapple@gmail.com>2017-04-16 20:15:50 +0100
committerJustin M. Keyes <justinkz@gmail.com>2017-04-17 04:45:55 +0200
commit263849b2dd4dc98bbe0870f5654c77809caeb965 (patch)
tree669057bc90c5712ad23be51bb2dd889c2792473e /test/functional/normal/fold_spec.lua
parent77a4f8f235901778d889aed7c708e1608eac25f6 (diff)
downloadrneovim-263849b2dd4dc98bbe0870f5654c77809caeb965.tar.gz
rneovim-263849b2dd4dc98bbe0870f5654c77809caeb965.tar.bz2
rneovim-263849b2dd4dc98bbe0870f5654c77809caeb965.zip
fold: foldMoveRange(): fix :move bug #6534
Closes #6540 In #6221 there was a mistake in calculating which folds need to be re-ordered. When there are no folds after those that have been adjusted, then `move_end` remains 0. This results in reverse_fold_order() swapping folds that have been adjusted with uninitialised folds in the remainder of the grow array. Add a check in foldMoveRange() to account for this case.
Diffstat (limited to 'test/functional/normal/fold_spec.lua')
-rw-r--r--test/functional/normal/fold_spec.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/functional/normal/fold_spec.lua b/test/functional/normal/fold_spec.lua
index 85e4631b61..00e83bedc8 100644
--- a/test/functional/normal/fold_spec.lua
+++ b/test/functional/normal/fold_spec.lua
@@ -232,6 +232,25 @@ a
a]], '2,3m0')
eq({1, 2, 0, 0, 0}, get_folds())
end)
+ it('handles shifting all remaining folds', function()
+ test_move_indent([[
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+a]], '13m7')
+ eq({1, 2, 2, 2, 1, 2, 2, 1, 1, 1, 2, 2, 2, 1, 0}, get_folds())
+ end)
end)
it('updates correctly on :read', function()
-- luacheck: ignore 621