Mercurial > vim
diff src/fold.c @ 11392:dc2800c3572b v8.0.0581
patch 8.0.0581: moving folded text is sometimes not correct
commit https://github.com/vim/vim/commit/94be619e30e82d28cadeea5e0766c6f5c321ff8b
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 22 22:40:11 2017 +0200
patch 8.0.0581: moving folded text is sometimes not correct
Problem: Moving folded text is sometimes not correct.
Solution: Bail out when "move_end" is zero. (Matthew Malcomson)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 22 Apr 2017 22:45:04 +0200 |
parents | 8c153d400bf4 |
children | e9924d19ee37 |
line wrap: on
line diff
--- a/src/fold.c +++ b/src/fold.c @@ -3133,10 +3133,14 @@ foldMoveRange(garray_T *gap, linenr_T li dest_index = fold_index(fp, gap); /* - * All folds are now correct, but they are not necessarily in the correct - * order. We have to swap folds in the range [move_end, dest_index) with - * those in the range [move_start, move_end). + * All folds are now correct, but not necessarily in the correct order. We + * must swap folds in the range [move_end, dest_index) with those in the + * range [move_start, move_end). */ + if (move_end == 0) + /* There are no folds after those moved, hence no folds have been moved + * out of order. */ + return; foldReverseOrder(gap, (linenr_T)move_start, (linenr_T)dest_index - 1); foldReverseOrder(gap, (linenr_T)move_start, (linenr_T)(move_start + dest_index - move_end - 1));