about summary refs log tree commit diff
path: root/Src/Zle
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2006-03-21 19:19:05 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2006-03-21 19:19:05 +0000
commit7b7905fedbd7d8b4b0791928c96682bb97057956 (patch)
treef2aa7a0546bb190c9d6d6ef774db08cfc6e53442 /Src/Zle
parent7b92878c24cb3ae68abb8facbbb3088a6fed7bdd (diff)
downloadzsh-7b7905fedbd7d8b4b0791928c96682bb97057956.tar.gz
zsh-7b7905fedbd7d8b4b0791928c96682bb97057956.tar.xz
zsh-7b7905fedbd7d8b4b0791928c96682bb97057956.zip
22638: MACHINES: IRIX
users/10047: zle widget -K keymap
Diffstat (limited to 'Src/Zle')
-rw-r--r--Src/Zle/zle_thingy.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/Src/Zle/zle_thingy.c b/Src/Zle/zle_thingy.c
index 96c9e935e..b0f295e10 100644
--- a/Src/Zle/zle_thingy.c
+++ b/Src/Zle/zle_thingy.c
@@ -642,7 +642,7 @@ bin_zle_call(char *name, char **args, UNUSED(Options ops), UNUSED(char func))
     Thingy t;
     struct modifier modsave = zmod;
     int ret, saveflag = 0;
-    char *wname = *args++;
+    char *wname = *args++, *keymap_restore = NULL, *keymap_tmp;
 
     if (!wname)
 	return !zle_usable();
@@ -680,6 +680,18 @@ bin_zle_call(char *name, char **args, UNUSED(Options ops), UNUSED(char func))
 		zmod.mult = 1;
 		zmod.flags &= ~MOD_MULT;
 		break;
+	    case 'K':
+		keymap_tmp = args[0][1] ? args[0]+1 : args[1];
+		if (!keymap_tmp) {
+		    zwarnname(name, "keymap expected after -%c", NULL, **args);
+		    return 1;
+		}
+		if (!args[0][1])
+		    *++args = "" - 1;
+		keymap_restore = dupstring(curkeymapname);
+		if (selectkeymap(keymap_tmp, 0))
+		    return 1;
+		break;
 	    default:
 		zwarnnam(name, "unknown option: %s", *args, 0);
 		return 1;
@@ -693,6 +705,8 @@ bin_zle_call(char *name, char **args, UNUSED(Options ops), UNUSED(char func))
     unrefthingy(t);
     if (saveflag)
 	zmod = modsave;
+    if (keymap_restore)
+	selectkeymap(keymap_restore, 0);
     return ret;
 }