From 3183cbd98c6f980a1d0d15227b12cf1caeb54e33 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Tue, 11 Aug 2015 13:28:14 +0200 Subject: 36044: deactivate-region widget for escape in visual mode --- ChangeLog | 8 ++++++++ Doc/Zsh/zle.yo | 5 +++++ Src/Zle/iwidgets.list | 1 + Src/Zle/zle_keymap.c | 1 + Src/Zle/zle_move.c | 7 +++++++ 5 files changed, 22 insertions(+) diff --git a/ChangeLog b/ChangeLog index 4bc8cb171..fd9c87edc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2015-08-11 Oliver Kiddle + + * 36044: Doc/Zsh/zle.yo, Src/Zle/iwidgets.list, Src/Zle/zle_keymap.c, + Src/Zle/zle_move.c: deactivate-region widget for escape in visual mode + + * 35952: Jun-ichi Takimoto: Src/Zle/zle_bindings.c: bind escape in + vi mode so it is a full key sequence and later keys aren't dropped + 2015-08-11 Jun-ichi Takimoto * 36067: Doc/Zsh/builtins.yo, Doc/Zsh/compsys.yo, diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo index 3cdb4fe00..697b636d8 100644 --- a/Doc/Zsh/zle.yo +++ b/Doc/Zsh/zle.yo @@ -2107,6 +2107,11 @@ tindex(clear-screen) item(tt(clear-screen) (tt(^L ESC-^L)) (tt(^L)) (tt(^L)))( Clear the screen and redraw the prompt. ) +tindex(deactivate-region) +item(tt(deactivate-region))( +Make the current region inactive. This disables vim-style visual +selection mode if it is active. +) tindex(describe-key-briefly) item(tt(describe-key-briefly))( Reads a key sequence, then prints the function bound to that sequence. diff --git a/Src/Zle/iwidgets.list b/Src/Zle/iwidgets.list index 657e4ef27..2b2654c5d 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 d355f41a4..c16e32e1b 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 d751c4333..cf8f34595 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 -- cgit 1.4.1