aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/mark.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-03-25 00:16:33 +0100
committerJustin M. Keyes <justinkz@gmail.com>2017-03-25 00:16:33 +0100
commit0cd829161a3f6aa7ed9737cc1c8462067812c9c5 (patch)
tree1c13c4e6287ee97ed23b2508a86a8c31816e9a8c /src/nvim/mark.c
parentd094a36e7c7ac8fe96915d9fbf348ae88caa07d9 (diff)
parent90ac8b09f56bf5a53ca9e1ddba0a5f92e4df7fa9 (diff)
downloadrneovim-0cd829161a3f6aa7ed9737cc1c8462067812c9c5.tar.gz
rneovim-0cd829161a3f6aa7ed9737cc1c8462067812c9c5.tar.bz2
rneovim-0cd829161a3f6aa7ed9737cc1c8462067812c9c5.zip
Merge #6221
Diffstat (limited to 'src/nvim/mark.c')
-rw-r--r--src/nvim/mark.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/nvim/mark.c b/src/nvim/mark.c
index 4e05845eb5..de2fdd7f13 100644
--- a/src/nvim/mark.c
+++ b/src/nvim/mark.c
@@ -887,6 +887,23 @@ void ex_changes(exarg_T *eap)
*/
void mark_adjust(linenr_T line1, linenr_T line2, long amount, long amount_after)
{
+ mark_adjust_internal(line1, line2, amount, amount_after, true);
+}
+
+// mark_adjust_nofold() does the same as mark_adjust() but without adjusting
+// folds in any way. Folds must be adjusted manually by the caller.
+// This is only useful when folds need to be moved in a way different to
+// calling foldMarkAdjust() with arguments line1, line2, amount, amount_after,
+// for an example of why this may be necessary, see do_move().
+void mark_adjust_nofold(linenr_T line1, linenr_T line2, long amount,
+ long amount_after)
+{
+ mark_adjust_internal(line1, line2, amount, amount_after, false);
+}
+
+static void mark_adjust_internal(linenr_T line1, linenr_T line2, long amount,
+ long amount_after, bool adjust_folds)
+{
int i;
int fnum = curbuf->b_fnum;
linenr_T *lp;
@@ -1011,8 +1028,9 @@ void mark_adjust(linenr_T line1, linenr_T line2, long amount, long amount_after)
}
}
- /* adjust folds */
- foldMarkAdjust(win, line1, line2, amount, amount_after);
+ if (adjust_folds) {
+ foldMarkAdjust(win, line1, line2, amount, amount_after);
+ }
}
}