Skip to content

Commit f04d219

Browse files
committed
Move zle-line-pre-redraw out of zrefresh into zle event handling loop, if it can be called that
1 parent a36d7ab commit f04d219

File tree

2 files changed

+25
-23
lines changed

2 files changed

+25
-23
lines changed

Src/Zle/zle_main.c

+25-1
Original file line numberDiff line numberDiff line change
@@ -1084,6 +1084,29 @@ zlecore(void)
10841084
errflag |= ERRFLAG_ERROR;
10851085
break;
10861086
}
1087+
1088+
Thingy initthingy;
1089+
if ((initthingy = rthingy_nocreate("zle-line-pre-redraw"))) {
1090+
int lastcmd_prev = lastcmd;
1091+
int old_incompfunc = incompfunc;
1092+
char *args[2];
1093+
Thingy lbindk_save = lbindk, bindk_save = bindk;
1094+
refthingy(lbindk_save);
1095+
refthingy(bindk_save);
1096+
args[0] = initthingy->nam;
1097+
args[1] = NULL;
1098+
incompfunc = 0;
1099+
execzlefunc(initthingy, args, 0);
1100+
incompfunc = old_incompfunc;
1101+
unrefthingy(initthingy);
1102+
unrefthingy(lbindk);
1103+
unrefthingy(bindk);
1104+
lbindk = lbindk_save;
1105+
bindk = bindk_save;
1106+
/* we can't set ZLE_NOTCOMMAND since it's not a legit widget, so
1107+
* restore lastcmd manually so that we don't mess up the global state */
1108+
lastcmd = lastcmd_prev;
1109+
}
10871110
#ifdef HAVE_POLL
10881111
if (baud && !(lastcmd & ZLE_MENUCMP)) {
10891112
struct pollfd pfd;
@@ -1113,6 +1136,7 @@ zlecore(void)
11131136
zrefresh();
11141137

11151138
freeheap();
1139+
11161140
}
11171141

11181142
region_active = 0;
@@ -1191,7 +1215,7 @@ zleread(char **lp, char **rp, int flags, int context, char *init, char *finish)
11911215
vistartchange = -1;
11921216
zleline = (ZLE_STRING_T)zalloc(((linesz = 256) + 2) * ZLE_CHAR_SIZE);
11931217
*zleline = ZWC('\0');
1194-
virangeflag = lastcmd = done = zlecs = zlell = mark = 0;
1218+
virangeflag = lastcmd = done = zlecs = zlell = mark = yankb = yanke = 0;
11951219
vichgflag = 0;
11961220
viinsbegin = 0;
11971221
statusline = NULL;

Src/Zle/zle_refresh.c

-22
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,6 @@ zrefresh(void)
994994
int remetafy; /* flag that zle line is metafied */
995995
int txtchange; /* attributes set after prompts */
996996
int rprompt_off = 1; /* Offset of rprompt from right of screen */
997-
int old_incompfunc = incompfunc;
998997
struct rparams rpms;
999998
#ifdef MULTIBYTE_SUPPORT
1000999
int width; /* width of wide character */
@@ -1040,27 +1039,6 @@ zrefresh(void)
10401039
tmpalloced = 0;
10411040
}
10421041

1043-
if ((initthingy = rthingy_nocreate("zle-line-pre-redraw"))) {
1044-
int lastcmd_prev = lastcmd;
1045-
char *args[2];
1046-
Thingy lbindk_save = lbindk, bindk_save = bindk;
1047-
refthingy(lbindk_save);
1048-
refthingy(bindk_save);
1049-
args[0] = initthingy->nam;
1050-
args[1] = NULL;
1051-
incompfunc = 0;
1052-
execzlefunc(initthingy, args, 0);
1053-
incompfunc = old_incompfunc;
1054-
unrefthingy(initthingy);
1055-
unrefthingy(lbindk);
1056-
unrefthingy(bindk);
1057-
lbindk = lbindk_save;
1058-
bindk = bindk_save;
1059-
/* we can't set ZLE_NOTCOMMAND since it's not a legit widget, so
1060-
* restore lastcmd manually so that we don't mess up the global state */
1061-
lastcmd = lastcmd_prev;
1062-
}
1063-
10641042
/* this will create region_highlights if it's still NULL */
10651043
zle_set_highlight();
10661044

0 commit comments

Comments
 (0)