aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/lua/stdlib.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nvim/lua/stdlib.c b/src/nvim/lua/stdlib.c
index d7a7abe3c8..fc2fedeaa1 100644
--- a/src/nvim/lua/stdlib.c
+++ b/src/nvim/lua/stdlib.c
@@ -536,11 +536,14 @@ static int nlua_iconv(lua_State *lstate)
return 1;
}
-// Like 'zx' but don't call newFoldLevel()
+// Update foldlevels (e.g., by evaluating 'foldexpr') for all lines in the current window without
+// invoking other side effects. Unlike `zx`, it does not close manually opened folds and does not
+// open folds under the cursor.
static int nlua_foldupdate(lua_State *lstate)
{
curwin->w_foldinvalid = true; // recompute folds
- foldOpenCursor();
+ foldUpdate(curwin, 1, (linenr_T)MAXLNUM);
+ curwin->w_foldinvalid = false;
return 0;
}