diff src/fold.c @ 23812:84089558c5df v8.2.2447

patch 8.2.2447: 'foldlevel' not applied to folds restored from session Commit: https://github.com/vim/vim/commit/f9547eb6ef02e305203b859d2dcfdae930b9d544 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Feb 1 19:24:55 2021 +0100 patch 8.2.2447: 'foldlevel' not applied to folds restored from session Problem: 'foldlevel' not applied to folds restored from session. Solution: Set 'foldlevel' after creaiting the folds. (closes https://github.com/vim/vim/issues/7767)
author Bram Moolenaar <Bram@vim.org>
date Mon, 01 Feb 2021 19:30:04 +0100
parents ef4f890f02f6
children 8f2262c72178
line wrap: on
line diff
--- a/src/fold.c
+++ b/src/fold.c
@@ -3309,7 +3309,7 @@ foldlevelExpr(fline_T *flp)
     // KeyTyped may be reset to 0 when calling a function which invokes
     // do_cmdline().  To make 'foldopen' work correctly restore KeyTyped.
     save_keytyped = KeyTyped;
-    n = (int)eval_foldexpr(flp->wp->w_p_fde, &c);
+    n = eval_foldexpr(flp->wp->w_p_fde, &c);
     KeyTyped = save_keytyped;
 
     switch (c)
@@ -3526,7 +3526,8 @@ put_folds(FILE *fd, win_T *wp)
     if (foldmethodIsManual(wp))
     {
 	if (put_line(fd, "silent! normal! zE") == FAIL
-		|| put_folds_recurse(fd, &wp->w_folds, (linenr_T)0) == FAIL)
+		|| put_folds_recurse(fd, &wp->w_folds, (linenr_T)0) == FAIL
+		|| put_line(fd, "let &fdl = &fdl") == FAIL)
 	    return FAIL;
     }