zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh-workers@zsh.org
Subject: Re: Vimode problem (key press dropping)
Date: Mon, 10 Aug 2015 14:34:53 +0200	[thread overview]
Message-ID: <21840.1439210093@thecus.kiddle.eu> (raw)
In-Reply-To: <150729082244.ZM10238@torch.brasslantern.com>

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


      reply	other threads:[~2015-08-10 12:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5d9984411ba10dee4321a408e2763317@riseup.net>
     [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:31       ` Jun T.
2015-07-29 15:22   ` Bart Schaefer
2015-08-10 12:34     ` Oliver Kiddle [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=21840.1439210093@thecus.kiddle.eu \
    --to=okiddle@yahoo.co.uk \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).