summaryrefslogtreecommitdiff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/zle_keymap.c15
-rw-r--r--Src/Zle/zle_main.c13
-rw-r--r--Src/Zle/zle_misc.c22
3 files changed, 43 insertions, 7 deletions
diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index 30c747900..7f59d9d9b 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -1176,8 +1176,6 @@ default_bindings(void)
char buf[3], *ed;
int i;
- isearch_keymap = newkeymap(NULL, "isearch");
-
/* vi insert mode and emacs mode: *
* 0-31 taken from the tables *
* 32-126 self-insert *
@@ -1276,10 +1274,19 @@ default_bindings(void)
else
linkkeymap(emap, "main", 0);
- linkkeymap(isearch_keymap, "isearch", 0);
-
/* the .safe map cannot be modified or deleted */
smap->flags |= KM_IMMUTABLE;
+
+ /* isearch keymap: initially empty */
+ isearch_keymap = newkeymap(NULL, "isearch");
+ linkkeymap(isearch_keymap, "isearch", 0);
+
+ /* command keymap: make sure accept-line and send-break are bound */
+ command_keymap = newkeymap(NULL, "command");
+ command_keymap->first['\n'] = refthingy(t_acceptline);
+ command_keymap->first['\r'] = refthingy(t_acceptline);
+ command_keymap->first['G'&0x1F] = refthingy(t_sendbreak);
+ linkkeymap(command_keymap, "command", 0);
}
/*************************/
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 9106083ed..ef14342bc 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1212,6 +1212,19 @@ zleread(char **lp, char **rp, int flags, int context)
zlecore();
+ if (done && !exit_pending && !errflag &&
+ (initthingy = rthingy_nocreate("zle-line-finish"))) {
+ int saverrflag = errflag;
+ int savretflag = retflag;
+ char *args[2];
+ args[0] = initthingy->nam;
+ args[1] = NULL;
+ execzlefunc(initthingy, args, 1);
+ unrefthingy(initthingy);
+ errflag = saverrflag;
+ retflag = savretflag;
+ }
+
statusline = NULL;
invalidatelist();
trashzle();
diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c
index 738e7b8c4..961776f43 100644
--- a/Src/Zle/zle_misc.c
+++ b/Src/Zle/zle_misc.c
@@ -966,11 +966,19 @@ scancompcmd(HashNode hn, UNUSED(int flags))
#define NAMLEN 60
+/*
+ * Local keymap used when reading a command name for the
+ * execute-named-command and where-is widgets.
+ */
+
+/**/
+Keymap command_keymap;
+
/**/
Thingy
executenamedcommand(char *prmt)
{
- Thingy cmd;
+ Thingy cmd, retval = NULL;
int l, len, feep = 0, listed = 0, curlist = 0;
int ols = (listshown && validlist), olll = lastlistlen;
char *cmdbuf, *ptr;
@@ -988,6 +996,7 @@ executenamedcommand(char *prmt)
strcpy(cmdbuf, prmt);
zsfree(prmt);
statusline = cmdbuf;
+ selectlocalmap(command_keymap);
selectkeymap("main", 1);
ptr = cmdbuf += l;
len = 0;
@@ -1005,7 +1014,8 @@ executenamedcommand(char *prmt)
} else if (listed)
clearlist = listshown = 1;
- return NULL;
+ retval = NULL;
+ goto done;
}
if(cmd == Th(z_clearscreen)) {
clearscreen(zlenoargs);
@@ -1090,7 +1100,9 @@ executenamedcommand(char *prmt)
lastlistlen = olll;
} else if (listed)
clearlist = listshown = 1;
- return r;
+
+ retval = r;
+ goto done;
}
unrefthingy(r);
}
@@ -1180,6 +1192,10 @@ executenamedcommand(char *prmt)
handlefeep(zlenoargs);
feep = 0;
}
+
+ done:
+ selectlocalmap(NULL);
+ return retval;
}
/*****************/