diff options
| author | watiko <service@mail.watiko.net> | 2016-02-05 12:07:46 +0900 |
|---|---|---|
| committer | watiko <service@mail.watiko.net> | 2016-02-05 12:21:14 +0900 |
| commit | 69e448d1d871c648bd1fc0c6067803bdc06c3e5b (patch) | |
| tree | 7afefa391e85fa4f77fdf2d697d2eb4a2dfa2de9 /src/nvim/ex_cmds.c | |
| parent | 863e1c91a6e4daff46cbe976b89e9423ad9bcd04 (diff) | |
| download | rneovim-69e448d1d871c648bd1fc0c6067803bdc06c3e5b.tar.gz rneovim-69e448d1d871c648bd1fc0c6067803bdc06c3e5b.tar.bz2 rneovim-69e448d1d871c648bd1fc0c6067803bdc06c3e5b.zip | |
vim-patch:7.4.700
Problem: Fold can't be opened after ":move". (Ein Brown)
Solution: Delete the folding information and update it afterwards.
(Christian Brabandt)
https://github.com/vim/vim/commit/d5f6933d5c57ea6f79bbdeab6c426cf66a393f33
Diffstat (limited to 'src/nvim/ex_cmds.c')
| -rw-r--r-- | src/nvim/ex_cmds.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index a517037431..4d62dd0ff9 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -690,9 +690,17 @@ int do_move(linenr_T line1, linenr_T line2, linenr_T dest) { char_u *str; linenr_T l; - linenr_T extra; /* Num lines added before line1 */ - linenr_T num_lines; /* Num lines moved */ - linenr_T last_line; /* Last line in file after adding new text */ + linenr_T extra; // Num lines added before line1 + linenr_T num_lines; // Num lines moved + linenr_T last_line; // Last line in file after adding new text + + // Moving lines seems to corrupt the folds, delete folding info now + // and recreate it when finished. Don't do this for manual folding, it + // would delete all folds. + bool isFolded = hasAnyFolding(curwin) && !foldmethodIsManual(curwin); + if (isFolded) { + deleteFoldRecurse(&curwin->w_folds); + } if (dest >= line1 && dest < line2) { EMSG(_("E134: Move lines into themselves")); @@ -777,8 +785,14 @@ int do_move(linenr_T line1, linenr_T line2, linenr_T dest) if (dest > last_line + 1) dest = last_line + 1; changed_lines(line1, 0, dest, 0L); - } else + } else { changed_lines(dest + 1, 0, line1 + num_lines, 0L); + } + + // recreate folds + if (isFolded) { + foldUpdateAll(curwin); + } return OK; } |
