Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
11391:553eb2299827 | 11392:dc2800c3572b |
---|---|
3131 } | 3131 } |
3132 | 3132 |
3133 dest_index = fold_index(fp, gap); | 3133 dest_index = fold_index(fp, gap); |
3134 | 3134 |
3135 /* | 3135 /* |
3136 * All folds are now correct, but they are not necessarily in the correct | 3136 * All folds are now correct, but not necessarily in the correct order. We |
3137 * order. We have to swap folds in the range [move_end, dest_index) with | 3137 * must swap folds in the range [move_end, dest_index) with those in the |
3138 * those in the range [move_start, move_end). | 3138 * range [move_start, move_end). |
3139 */ | 3139 */ |
3140 if (move_end == 0) | |
3141 /* There are no folds after those moved, hence no folds have been moved | |
3142 * out of order. */ | |
3143 return; | |
3140 foldReverseOrder(gap, (linenr_T)move_start, (linenr_T)dest_index - 1); | 3144 foldReverseOrder(gap, (linenr_T)move_start, (linenr_T)dest_index - 1); |
3141 foldReverseOrder(gap, (linenr_T)move_start, | 3145 foldReverseOrder(gap, (linenr_T)move_start, |
3142 (linenr_T)(move_start + dest_index - move_end - 1)); | 3146 (linenr_T)(move_start + dest_index - move_end - 1)); |
3143 foldReverseOrder(gap, (linenr_T)(move_start + dest_index - move_end), | 3147 foldReverseOrder(gap, (linenr_T)(move_start + dest_index - move_end), |
3144 (linenr_T)(dest_index - 1)); | 3148 (linenr_T)(dest_index - 1)); |