aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/fold.c
diff options
context:
space:
mode:
authorMatthieu Coudron <mcoudron@hotmail.com>2020-11-18 22:52:49 +0100
committerMatthieu Coudron <mcoudron@hotmail.com>2020-11-23 21:06:56 +0100
commit4f1fc0f6d514980700152b7c05e5c92ec379f0d7 (patch)
tree56488620cbef1d2d13e7c9866364ea1d7292da17 /src/nvim/fold.c
parent7dfeadb0fcbcedeafc357e60f0b7b2b8916afeaf (diff)
downloadrneovim-4f1fc0f6d514980700152b7c05e5c92ec379f0d7.tar.gz
rneovim-4f1fc0f6d514980700152b7c05e5c92ec379f0d7.tar.bz2
rneovim-4f1fc0f6d514980700152b7c05e5c92ec379f0d7.zip
refactor: pass window to was_set_insecurely
working on get_foldtext and wanted to get rid of the curwin backup/restore. Turns out it's not possible else f_foldtext is run on the same window. Kept the cleanup anyway.
Diffstat (limited to 'src/nvim/fold.c')
-rw-r--r--src/nvim/fold.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/nvim/fold.c b/src/nvim/fold.c
index 5e28ca6538..654aa6d5ba 100644
--- a/src/nvim/fold.c
+++ b/src/nvim/fold.c
@@ -1835,10 +1835,11 @@ char_u *get_foldtext(win_T *wp, linenr_T lnum, linenr_T lnume,
curwin = wp;
curbuf = wp->w_buffer;
- ++emsg_silent; /* handle exceptions, but don't display errors */
- text = eval_to_string_safe(wp->w_p_fdt, NULL,
- was_set_insecurely((char_u *)"foldtext", OPT_LOCAL));
- --emsg_silent;
+ emsg_silent++; // handle exceptions, but don't display errors
+ text = eval_to_string_safe(
+ wp->w_p_fdt, NULL,
+ was_set_insecurely(wp, (char_u *)"foldtext", OPT_LOCAL));
+ emsg_silent--;
if (text == NULL || did_emsg)
got_fdt_error = TRUE;