summaryrefslogtreecommitdiffstats
path: root/src/fold.c
diff options
context:
space:
mode:
authorBrandon Simmons <simmsbra@gmail.com>2022-04-23 13:50:17 +0100
committerBram Moolenaar <Bram@vim.org>2022-04-23 13:50:17 +0100
commit2c40707baa13a53cac4137ffb8b2ac67f50cea63 (patch)
tree260b40a241950eb8fbe5cad245dfe9f6c8beb768 /src/fold.c
parent8279cfe49961b3711c84c66a9954c9f70e9b78c8 (diff)
patch 8.2.4813: pasting text while indent folding may mess up foldsv8.2.4813
Problem: Pasting text while indent folding may mess up folds. Solution: Adjust the way folds are split. (Brandon Simmons, closes #10254)
Diffstat (limited to 'src/fold.c')
-rw-r--r--src/fold.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/fold.c b/src/fold.c
index 8078e3af88..229cb2ad2d 100644
--- a/src/fold.c
+++ b/src/fold.c
@@ -1128,7 +1128,7 @@ cloneFoldGrowArray(garray_T *from, garray_T *to)
// foldFind() {{{2
/*
* Search for line "lnum" in folds of growarray "gap".
- * Set *fpp to the fold struct for the fold that contains "lnum" or
+ * Set "*fpp" to the fold struct for the fold that contains "lnum" or
* the first fold below it (careful: it can be beyond the end of the array!).
* Returns FALSE when there is no fold that contains "lnum".
*/
@@ -2911,7 +2911,8 @@ foldSplit(
// any between top and bot, they have been removed by the caller.
gap1 = &fp->fd_nested;
gap2 = &fp[1].fd_nested;
- if (foldFind(gap1, bot + 1 - fp->fd_top, &fp2))
+ (void)foldFind(gap1, bot + 1 - fp->fd_top, &fp2);
+ if (fp2 != NULL)
{
len = (int)((fold_T *)gap1->ga_data + gap1->ga_len - fp2);
if (len > 0 && ga_grow(gap2, len) == OK)