aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/fold.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-04-24 22:21:54 +0800
committerGitHub <noreply@github.com>2022-04-24 22:21:54 +0800
commit2caf5bbbc58fcc9830cd3f8a6110b66040c6e660 (patch)
treea26196c54dbb8825be3d6652db5e8ad94eca217c /src/nvim/fold.c
parent843d9223a14c599fda1b2abf1e7072be738fb831 (diff)
parent2511f3e76d895a725c1a833233e831c856d05422 (diff)
downloadrneovim-2caf5bbbc58fcc9830cd3f8a6110b66040c6e660.tar.gz
rneovim-2caf5bbbc58fcc9830cd3f8a6110b66040c6e660.tar.bz2
rneovim-2caf5bbbc58fcc9830cd3f8a6110b66040c6e660.zip
Merge pull request #18243 from zeertzjq/vim-8.2.4808
vim-patch:8.2.{4808,4810,4813}: pasting text while indent folding may mess up folds
Diffstat (limited to 'src/nvim/fold.c')
-rw-r--r--src/nvim/fold.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nvim/fold.c b/src/nvim/fold.c
index 3643ceb460..e08d6d4a4e 100644
--- a/src/nvim/fold.c
+++ b/src/nvim/fold.c
@@ -1058,7 +1058,7 @@ void 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!).
///
/// @return false when there is no fold that contains "lnum".
@@ -2615,7 +2615,8 @@ static void foldSplit(buf_T *buf, garray_T *const gap, const int i, const linenr
// any between top and bot, they have been removed by the caller.
garray_T *const gap1 = &fp->fd_nested;
garray_T *const 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) {
const int len = (int)((fold_T *)gap1->ga_data + gap1->ga_len - fp2);
if (len > 0) {
ga_grow(gap2, len);