summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2015-09-06 23:44:23 +0200
committerMikael Magnusson <mikachu@gmail.com>2015-09-27 02:17:07 +0200
commit8ab150a867ff9ab87d2efdf5cfce919614f2ddbb (patch)
treebcf8af6684128ccd4866ada89fae4837eb9ac7e3
parentMove zle-line-pre-redraw out of zrefresh into zle event handling loop, if it ... (diff)
downloadzsh-8ab150a867ff9ab87d2efdf5cfce919614f2ddbb.tar
zsh-8ab150a867ff9ab87d2efdf5cfce919614f2ddbb.tar.gz
zsh-8ab150a867ff9ab87d2efdf5cfce919614f2ddbb.tar.bz2
zsh-8ab150a867ff9ab87d2efdf5cfce919614f2ddbb.tar.lz
zsh-8ab150a867ff9ab87d2efdf5cfce919614f2ddbb.tar.xz
zsh-8ab150a867ff9ab87d2efdf5cfce919614f2ddbb.tar.zst
zsh-8ab150a867ff9ab87d2efdf5cfce919614f2ddbb.zip
Use a helper function for redraw hook and call from recursiveedit too
-rw-r--r--Src/Zle/zle_main.c49
1 files changed, 27 insertions, 22 deletions
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index e06be664d..516baeb44 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1025,6 +1025,31 @@ getrestchar(int inchar, char *outstr, int *outcount)
/**/
#endif
+static void redrawhook()
+{
+ Thingy initthingy;
+ if ((initthingy = rthingy_nocreate("zle-line-pre-redraw"))) {
+ 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;
+ incompfunc = 0;
+ execzlefunc(initthingy, args, 0);
+ incompfunc = old_incompfunc;
+ 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 */
+ lastcmd = lastcmd_prev;
+ }
+}
/**/
void
@@ -1085,28 +1110,7 @@ zlecore(void)
break;
}
- Thingy initthingy;
- if ((initthingy = rthingy_nocreate("zle-line-pre-redraw"))) {
- 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;
- incompfunc = 0;
- execzlefunc(initthingy, args, 0);
- incompfunc = old_incompfunc;
- 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 */
- lastcmd = lastcmd_prev;
- }
+ redrawhook();
#ifdef HAVE_POLL
if (baud && !(lastcmd & ZLE_MENUCMP)) {
struct pollfd pfd;
@@ -1818,6 +1822,7 @@ recursiveedit(UNUSED(char **args))
{
int locerror;
+ redrawhook();
zrefresh();
zlecore();