about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2015-09-05 15:59:58 +0200
committerMikael Magnusson <mikachu@gmail.com>2015-09-27 02:16:59 +0200
commitf04d219544e77e1bc83670eb1b8d8beb7f4f5c95 (patch)
tree1643c4b7af6cedc7387e827c82ad2270bd1bfa98
parenta36d7ab99b4a5b1c10bc68828942faf69c35c0d0 (diff)
downloadzsh-f04d219544e77e1bc83670eb1b8d8beb7f4f5c95.tar.gz
zsh-f04d219544e77e1bc83670eb1b8d8beb7f4f5c95.tar.xz
zsh-f04d219544e77e1bc83670eb1b8d8beb7f4f5c95.zip
Move zle-line-pre-redraw out of zrefresh into zle event handling loop, if it can be called that
-rw-r--r--Src/Zle/zle_main.c26
-rw-r--r--Src/Zle/zle_refresh.c22
2 files changed, 25 insertions, 23 deletions
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 992f152df..e06be664d 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1084,6 +1084,29 @@ zlecore(void)
 	    errflag |= ERRFLAG_ERROR;
 	    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;
+	}
 #ifdef HAVE_POLL
 	if (baud && !(lastcmd & ZLE_MENUCMP)) {
 	    struct pollfd pfd;
@@ -1113,6 +1136,7 @@ zlecore(void)
 		zrefresh();
 
 	freeheap();
+
     }
 
     region_active = 0;
@@ -1191,7 +1215,7 @@ zleread(char **lp, char **rp, int flags, int context, char *init, char *finish)
     vistartchange = -1;
     zleline = (ZLE_STRING_T)zalloc(((linesz = 256) + 2) * ZLE_CHAR_SIZE);
     *zleline = ZWC('\0');
-    virangeflag = lastcmd = done = zlecs = zlell = mark = 0;
+    virangeflag = lastcmd = done = zlecs = zlell = mark = yankb = yanke = 0;
     vichgflag = 0;
     viinsbegin = 0;
     statusline = NULL;
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index 43b05484b..6facff429 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -994,7 +994,6 @@ zrefresh(void)
     int remetafy;		/* flag that zle line is metafied	     */
     int txtchange;		/* attributes set after prompts              */
     int rprompt_off = 1;	/* Offset of rprompt from right of screen    */
-    int old_incompfunc = incompfunc;
     struct rparams rpms;
 #ifdef MULTIBYTE_SUPPORT
     int width;			/* width of wide character		     */
@@ -1040,27 +1039,6 @@ zrefresh(void)
 	tmpalloced = 0;
     }
 
-    if ((initthingy = rthingy_nocreate("zle-line-pre-redraw"))) {
-	int lastcmd_prev = lastcmd;
-	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;
-    }
-
     /* this will create region_highlights if it's still NULL */
     zle_set_highlight();