From e1079c2a289de18923950338ea08ee80c01cc6cf Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Sat, 17 Sep 2016 07:40:00 +0900 Subject: insert_enter: Update folds on insert-leave. #5351 Fixes failing test: 045_folding_spec.lua References #5299 --- src/nvim/edit.c | 2 ++ src/nvim/fold.c | 6 +----- src/nvim/normal.c | 3 +++ 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/nvim/edit.c b/src/nvim/edit.c index ff1107db6c..18d5ea533d 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -462,6 +462,8 @@ static void insert_enter(InsertState *s) o_lnum = curwin->w_cursor.lnum; } + foldUpdateAll(curwin); + foldOpenCursor(); if (s->cmdchar != 'r' && s->cmdchar != 'v') { apply_autocmds(EVENT_INSERTLEAVE, NULL, NULL, false, curbuf); } diff --git a/src/nvim/fold.c b/src/nvim/fold.c index a92ee86248..70030b8525 100644 --- a/src/nvim/fold.c +++ b/src/nvim/fold.c @@ -765,12 +765,8 @@ void foldUpdate(win_T *wp, linenr_T top, linenr_T bot) return; } - fold_T *fp; - if (wp->w_buffer->terminal) { - return; - } - // Mark all folds from top to bot as maybe-small. + fold_T *fp; (void)foldFind(&wp->w_folds, top, &fp); while (fp < (fold_T *)wp->w_folds.ga_data + wp->w_folds.ga_len && fp->fd_top < bot) { diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 68ba9e399f..d0a9d3aca7 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -5924,6 +5924,9 @@ static void nv_replace(cmdarg_T *cap) curwin->w_set_curswant = true; set_last_insert(cap->nchar); } + + foldUpdateAll(curwin); + foldOpenCursor(); } /* -- cgit