Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: give precedence to local keymaps (was Re: More on getkeycmd())
- X-seq: zsh-workers 33596
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: PATCH: give precedence to local keymaps (was Re: More on getkeycmd())
- Date: Mon, 03 Nov 2014 17:30:36 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1415032237; bh=IpXbrqxNV29s8YbgZ7RYHQjOXpZqI3jdzs5psyoMv/0=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=HnMjOF3J8AKwvyDpZldxW05Pa73Op/G0qoZCXwR1I1kappj+U/TA6DxTONXCYwlD0rIGJZmGWWQT7snetHAW0gWoZsBdVoSNUdKptpwYIpyAkaqYdiZ//CBWSyJupToCZxK9Hhf3rL/D8gI0ZYFzK/oBDR8B7wT7JUcq/l1dAhnrJSFZcSRDh9VsYCw0tcYEHiElLC9JEFEZDTNl4zNlx5xo64RaO7+QsH6iK6gubc/gSrNKmtCvFAo+AIrjk2GG5J8l3tcPkYs0wYx7oK+zjpBggGIoEOeN/Z4ADIrOr9erz1G2fOJePMscS3DmzNOhyyiE0lsadci2+3ofE2Gmhg==
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s2048; d=yahoo.co.uk; b=kIToKCNZnekQuRmVb0msJJY6sqdFE1axVYFzuwkQsYKCAUUqAvf+Zfvnq+5HQDUIbow26ewHFTXIa4D58tYNJgFmZyEdi1yhR7zlBLJl7sWFYmQSJBvWtLaG0C74OadbWZHWewURgRusfY0uAYs+oVh/UItN66Q6WtY/9BKJz66k5+RhQURuxzFv6FoqZHC1jqsrnTMfd1H+17gSGssjinFdtB5RxmTlqXZdv7G57fl2rkrNOHjjM9pU2yZ36jbeYn24iVPn3taL+dz93vWt0321V4uEuzqY/ulgaVmwyJPoMCsUM9YdDXLnsX3VBXc+vqdtxy56M+ZQqcluvGWNPg==;
- In-reply-to: <CAH+w=7a8UZ0CEkK=OhnYAn-vZraP7S+_84QOZeD34BrVXwL_cg@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <1050927145304.ZM23258@candle.brasslantern.com> <18653.1415004330@thecus.kiddle.eu> <CAH+w=7a8UZ0CEkK=OhnYAn-vZraP7S+_84QOZeD34BrVXwL_cg@mail.gmail.com>
Bart wrote:
>
> I don't particularly object, though of course the ideal behavior would be
> that the prefix would be treated as such whenever the two maps overlap.
Well, no: I don't want to treat the key as a prefix when the global
binding is a prefix of the local binding because then I'm forced to
type the local binding faster than $KEYTIMEOUT. I use a fairly short
$KEYTIMEOUT having had problems with escape followed by vi commands
being interpreted as a key sequence.
How about the following patch? This does hiding in the case I mention
above but not for the converse: a local binding that is a prefix of a
global binding won't hide the longer global binding: you might not want
the small $KEYTIMEOUT delay but that's harmless compared to having to
type your keys faster than it.
Oliver
diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index e21e769..6a71076 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -1435,7 +1435,7 @@ getkeymapcmd(Keymap km, Thingy *funcp, char **strp)
loc = ((f = keybind(localkeymap, keybuf, &s)) != t_undefinedkey);
ispfx = keyisprefix(localkeymap, keybuf);
}
- if (!loc)
+ if (!loc && !ispfx)
f = keybind(km, keybuf, &s);
ispfx |= keyisprefix(km, keybuf);
Messages sorted by:
Reverse Date,
Date,
Thread,
Author