diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2020-09-02 22:31:31 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-02 22:31:31 -0700 |
commit | 3acfefb63ee70c8eac13bf6b308a0e73e6fb8007 (patch) | |
tree | 1a891b01dbca622ed8e4cbb5930d1a6425d146ba /src/nvim/fold.c | |
parent | 948e625e1ecbdb1d4771e1481b3d6534b21250c9 (diff) | |
parent | 5fcdb630253b8d71fd30a2259f72aeb27e1676e0 (diff) | |
download | rneovim-3acfefb63ee70c8eac13bf6b308a0e73e6fb8007.tar.gz rneovim-3acfefb63ee70c8eac13bf6b308a0e73e6fb8007.tar.bz2 rneovim-3acfefb63ee70c8eac13bf6b308a0e73e6fb8007.zip |
Merge #12827 'vim-patch:8.2.{1554,1561,1564,1565,1566}'
Diffstat (limited to 'src/nvim/fold.c')
-rw-r--r-- | src/nvim/fold.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/nvim/fold.c b/src/nvim/fold.c index 61a85171e8..697d283cca 100644 --- a/src/nvim/fold.c +++ b/src/nvim/fold.c @@ -1389,6 +1389,10 @@ static void foldMarkAdjustRecurse( linenr_T last; linenr_T top; + if (gap->ga_len == 0) { + return; + } + /* In Insert mode an inserted line at the top of a fold is considered part * of the fold, otherwise it isn't. */ if ((State & INSERT) && amount == (linenr_T)1 && line2 == MAXLNUM) @@ -2738,7 +2742,8 @@ static void truncate_fold(win_T *const wp, fold_T *fp, linenr_T end) } #define FOLD_END(fp) ((fp)->fd_top + (fp)->fd_len - 1) -#define VALID_FOLD(fp, gap) ((fp) < ((fold_T *)(gap)->ga_data + (gap)->ga_len)) +#define VALID_FOLD(fp, gap) \ + ((gap)->ga_len > 0 && (fp) < ((fold_T *)(gap)->ga_data + (gap)->ga_len)) #define FOLD_INDEX(fp, gap) ((size_t)(fp - ((fold_T *)(gap)->ga_data))) void foldMoveRange( win_T *const wp, garray_T *gap, |