summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Src/Zle/zle_main.c19
2 files changed, 20 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index e8740b8c4..8345fb23f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2016-11-13 Barton E. Schaefer <schaefer@zsh.org>
+ * 39933: Src/Zle/zle_main.c: more of zlecallhook() in redrawhook(),
+ add commentary on some of the differences
+
* 39929: Doc/Zsh/zle.yo: clarify execute{,-last}-named-cmd
2016-11-12 Barton E. Schaefer <schaefer@zsh.org>
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 04b93575f..96b631eeb 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1041,28 +1041,43 @@ getrestchar(int inchar, char *outstr, int *outcount)
#endif
/**/
-void redrawhook(void)
+void
+redrawhook(void)
{
Thingy initthingy;
if ((initthingy = rthingy_nocreate("zle-line-pre-redraw"))) {
+ /* Duplicating most of zlecallhook() to save additional state */
+ int saverrflag = errflag, savretflag = retflag;
int lastcmd_prev = lastcmd;
int old_incompfunc = incompfunc;
char *args[2];
Thingy lbindk_save = lbindk, bindk_save = bindk;
+
refthingy(lbindk_save);
refthingy(bindk_save);
args[0] = initthingy->nam;
args[1] = NULL;
+
+ /* The generic redraw hook cannot be a completion function, so
+ * temporarily reset state for special variable handling etc.
+ */
incompfunc = 0;
execzlefunc(initthingy, args, 1);
incompfunc = old_incompfunc;
+
+ /* Restore errflag and retflag as zlecallhook() does */
+ errflag = saverrflag | (errflag & ERRFLAG_INT);
+ retflag = savretflag;
+
unrefthingy(initthingy);
unrefthingy(lbindk);
unrefthingy(bindk);
lbindk = lbindk_save;
bindk = bindk_save;
+
/* we can't set ZLE_NOTCOMMAND since it's not a legit widget, so
- * restore lastcmd manually so that we don't mess up the global state */
+ * restore lastcmd manually so that we don't mess up the global state
+ */
lastcmd = lastcmd_prev;
}
}