* Re: Vimode problem (key press dropping) [not found] ` <9361.1438161965@thecus.kiddle.eu> @ 2015-07-29 10:51 ` Jun T. 2015-07-29 14:14 ` Oliver Kiddle 2015-07-29 15:22 ` Bart Schaefer 1 sibling, 1 reply; 5+ messages in thread From: Jun T. @ 2015-07-29 10:51 UTC (permalink / raw) To: zsh-workers reply to zsh-users, X-Seq: 20356 On 2015/07/29, at 18:26, Oliver Kiddle <okiddle@yahoo.co.uk> wrote: > > Question to -workers subscribers: how should we address this in the > defaults? In zle_keymap.c, near line 1493, timeout is set only if (f != t_undefinedkey). But ESC is an undefinedkey in vicmd keymap, and the timeout remains to be zero even if ispfx is true. I guess the timeout should always be set if ispfx is true. Maybe something like the following? diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c index d355f41..f1fa912 100644 --- a/Src/Zle/zle_keymap.c +++ b/Src/Zle/zle_keymap.c @@ -1495,14 +1495,14 @@ getkeymapcmd(Keymap km, Thingy *funcp, char **strp) func = f; str = s; lastc = lastchar; - - /* can be patient with vi commands that need a motion operator: * - * they wait till a key is pressed for the movement anyway */ - timeout = !(!virangeflag && !region_active && f && f->widget && - f->widget->flags & ZLE_VIOPER); } if (!ispfx) break; + + /* can be patient with vi commands that need a motion operator: * + * they wait till a key is pressed for the movement anyway */ + timeout = !(!virangeflag && !region_active && f && f->widget && + f->widget->flags & ZLE_VIOPER); } if(!lastlen && keybuflen) lastlen = keybuflen; ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Vimode problem (key press dropping) 2015-07-29 10:51 ` Vimode problem (key press dropping) Jun T. @ 2015-07-29 14:14 ` Oliver Kiddle 2015-07-29 15:31 ` Jun T. 0 siblings, 1 reply; 5+ messages in thread From: Oliver Kiddle @ 2015-07-29 14:14 UTC (permalink / raw) To: zsh-workers "Jun T." wrote: > > On 2015/07/29, at 18:26, Oliver Kiddle <okiddle@yahoo.co.uk> wrote: > > > > Question to -workers subscribers: how should we address this in the > > defaults? > > In zle_keymap.c, near line 1493, timeout is set only if > (f != t_undefinedkey). But ESC is an undefinedkey in vicmd keymap, > and the timeout remains to be zero even if ispfx is true. I don't think this helps because where the prefix is an individual key typed by the user, they are then forced to type the following character in the sequence faster than KEYTIMEOUT. And if something like <Escape>a is typed too fast from vi-mode, it would still be thrown out as a whole. Taking the default emacs bindings, Ctrl-X is a prefix but we don't want a timeout after Ctrl-X because it is the user typing followup characters. Mikael wrote: > I always felt like how it should work if we get the string "abc", is > first abc is looked up and we find it isn't bound to anything, the a > gets treated as a separate input string, then we look up bc instead, > etc. What we do now is just discard the whole string as > "undefined-key". The current behaviour where the whole sequence is thrown out is consistent with emacs. I think it makes sense for the typical emacs case if you make a mistake with a manual sequence. We can't really special-case escape because manual sequences with escape are also common in emacs mode. Binding escape in vi command mode does, however, solve it. Oliver ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Vimode problem (key press dropping) 2015-07-29 14:14 ` Oliver Kiddle @ 2015-07-29 15:31 ` Jun T. 0 siblings, 0 replies; 5+ messages in thread From: Jun T. @ 2015-07-29 15:31 UTC (permalink / raw) To: zsh-workers 2015/07/29 23:14, Oliver Kiddle <okiddle@yahoo.co.uk> wrote: > And if something like <Escape>a > is typed too fast from vi-mode, it would still be thrown out as a whole. I knew this but was thinking this was not a serious problem, but > Taking the default emacs bindings, Ctrl-X is a prefix but we don't > want a timeout after Ctrl-X because it is the user typing followup > characters. yes, I didn't test for emacs mode but was just imagining that prefixes in emacs mode are taken care of somewhere else. Then maybe just to modify the default? Or create a widget like z_nop (no operation)? diff --git a/Src/Zle/zle_bindings.c b/Src/Zle/zle_bindings.c index 2ae8c87..55863db 100644 --- a/Src/Zle/zle_bindings.c +++ b/Src/Zle/zle_bindings.c @@ -317,7 +317,7 @@ int vicmdbind[128] = { /* ^X */ z_undefinedkey, /* ^Y */ z_undefinedkey, /* ^Z */ z_undefinedkey, - /* ^[ */ z_undefinedkey, + /* ^[ */ z_beep, /* ^\ */ z_undefinedkey, /* ^] */ z_undefinedkey, /* ^^ */ z_undefinedkey, ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Vimode problem (key press dropping) [not found] ` <9361.1438161965@thecus.kiddle.eu> 2015-07-29 10:51 ` Vimode problem (key press dropping) Jun T. @ 2015-07-29 15:22 ` Bart Schaefer 2015-08-10 12:34 ` Oliver Kiddle 1 sibling, 1 reply; 5+ messages in thread From: Bart Schaefer @ 2015-07-29 15:22 UTC (permalink / raw) To: zsh-workers On Jul 29, 11:26am, Oliver Kiddle wrote: } } Question to -workers subscribers: how should we address this in the } defaults? I also have escape bound to set REGION_ACTIVE=0 from the } visual keymap which should perhaps also be default behaviour (vim does } that). This seems reasonable to me. -- Barton E. Schaefer ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Vimode problem (key press dropping) 2015-07-29 15:22 ` Bart Schaefer @ 2015-08-10 12:34 ` Oliver Kiddle 0 siblings, 0 replies; 5+ messages in thread From: Oliver Kiddle @ 2015-08-10 12:34 UTC (permalink / raw) To: zsh-workers On 29 Jul, Bart wrote: > } > } I also have escape bound to set REGION_ACTIVE=0 from the > } visual keymap which should perhaps also be default behaviour (vim does > } that). > > This seems reasonable to me. This patch does that then, using deactivate-region as the name for the new widget. I searched emacs documentation to see if it has something similar, mainly to ensure consistent naming. It seems in emacs you have to use Ctrl-G which is a more general command for aborting things. Also note that set-mark-command with a negative argument will deactivate the region but I don't think it is possible to bind to that directly. Oliver diff --git a/Src/Zle/iwidgets.list b/Src/Zle/iwidgets.list index 657e4ef..2b2654c 100644 --- a/Src/Zle/iwidgets.list +++ b/Src/Zle/iwidgets.list @@ -35,6 +35,7 @@ "copy-prev-word", copyprevword, ZLE_KEEPSUFFIX "copy-prev-shell-word", copyprevshellword, ZLE_KEEPSUFFIX "copy-region-as-kill", copyregionaskill, ZLE_KEEPSUFFIX +"deactivate-region", deactivateregion, 0 "delete-char", deletechar, ZLE_KEEPSUFFIX "delete-char-or-list", deletecharorlist, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_ISCOMP "delete-word", deleteword, ZLE_KEEPSUFFIX diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c index d355f41..c16e32e 100644 --- a/Src/Zle/zle_keymap.c +++ b/Src/Zle/zle_keymap.c @@ -1363,6 +1363,7 @@ default_bindings(void) } /* escape in operator pending cancels the operation */ bindkey(oppmap, "\33", refthingy(t_vicmdmode), NULL); + bindkey(vismap, "\33", refthingy(t_deactivateregion), NULL); bindkey(vismap, "o", refthingy(t_exchangepointandmark), NULL); bindkey(vismap, "p", refthingy(t_putreplaceselection), NULL); bindkey(vismap, "x", refthingy(t_videlete), NULL); diff --git a/Src/Zle/zle_move.c b/Src/Zle/zle_move.c index d751c43..cf8f345 100644 --- a/Src/Zle/zle_move.c +++ b/Src/Zle/zle_move.c @@ -555,6 +555,13 @@ visuallinemode(UNUSED(char **args)) return 0; } +/**/ +int +deactivateregion(UNUSED(char **args)) +{ + region_active = 0; + return 0; +} /**/ int ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-08-10 12:41 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <5d9984411ba10dee4321a408e2763317@riseup.net> [not found] ` <9361.1438161965@thecus.kiddle.eu> 2015-07-29 10:51 ` Vimode problem (key press dropping) Jun T. 2015-07-29 14:14 ` Oliver Kiddle 2015-07-29 15:31 ` Jun T. 2015-07-29 15:22 ` Bart Schaefer 2015-08-10 12:34 ` Oliver Kiddle
Code repositories for project(s) associated with this public inbox https://git.vuxu.org/mirror/zsh/ This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).