comparison src/ex_cmds.c @ 6755:b85fcd9b858d v7.4.700

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)
author Bram Moolenaar <bram@vim.org>
date Wed, 15 Apr 2015 12:43:50 +0200
parents 7347229a646a
children 874c953aca49
comparison
equal deleted inserted replaced
6754:a0651f2537f5 6755:b85fcd9b858d
739 char_u *str; 739 char_u *str;
740 linenr_T l; 740 linenr_T l;
741 linenr_T extra; /* Num lines added before line1 */ 741 linenr_T extra; /* Num lines added before line1 */
742 linenr_T num_lines; /* Num lines moved */ 742 linenr_T num_lines; /* Num lines moved */
743 linenr_T last_line; /* Last line in file after adding new text */ 743 linenr_T last_line; /* Last line in file after adding new text */
744 #ifdef FEAT_FOLDING
745 int isFolded;
746
747 /* Moving lines seems to corrupt the folds, delete folding info now
748 * and recreate it when finished. Don't do this for manual folding, it
749 * would delete all folds. */
750 isFolded = hasAnyFolding(curwin) && !foldmethodIsManual(curwin);
751 if (isFolded)
752 deleteFoldRecurse(&curwin->w_folds);
753 #endif
744 754
745 if (dest >= line1 && dest < line2) 755 if (dest >= line1 && dest < line2)
746 { 756 {
747 EMSG(_("E134: Move lines into themselves")); 757 EMSG(_("E134: Move lines into themselves"));
748 return FAIL; 758 return FAIL;
836 dest = last_line + 1; 846 dest = last_line + 1;
837 changed_lines(line1, 0, dest, 0L); 847 changed_lines(line1, 0, dest, 0L);
838 } 848 }
839 else 849 else
840 changed_lines(dest + 1, 0, line1 + num_lines, 0L); 850 changed_lines(dest + 1, 0, line1 + num_lines, 0L);
851
852 #ifdef FEAT_FOLDING
853 /* recreate folds */
854 if (isFolded)
855 foldUpdateAll(curwin);
856 #endif
841 857
842 return OK; 858 return OK;
843 } 859 }
844 860
845 /* 861 /*