Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Off-by-one with select-*-shell-word text object?
- X-seq: zsh-workers 39369
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Off-by-one with select-*-shell-word text object?
- Date: Sat, 17 Sep 2016 01:30:33 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1474068634; bh=J+C//gKiInx5+L9fYpnEG5SngMfs5cC+2uPALM1/3ns=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=Ozefcly+pqGy66O8ps2TMFQsN4FtYauQlr6TgHiXymZt4xI0ML2bKj5EmjyGwjGGy/GnOkXhfza3WNEiduIsmZ/xnT35SV6eXgVqQ9etWube3I1buPGbsso2uPBdui5TP8sWp6Ly+++uMtDeFfsmqDlGn/JRGNUCB3+6arEax47PQD6sk5syzgmBCSP8G/pHB8HX8sMRI7RxJwohrZy62Qz8IflJ+i0ruNuak0Kipxm5ShCc4DUX6Rr0p3BAQrrT732SQf1/+hZ+XB8WwaQaTTYUrI35Fa4EJrbmdDjL1C0AjigSn/LkMzNp+CX58eVl50OUiSQ0Y3s8ZCnLH5gkIg==
- In-reply-to: <160916142248.ZM26196@torch.brasslantern.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: <160916102137.ZM11290@torch.brasslantern.com> <76020.1474058827@hydra.kiddle.eu> <160916142248.ZM26196@torch.brasslantern.com>
Bart wrote:
> } Or a ZLE_ flag - actually two to cover
>
> I think one flag to force the equivalent of set_bindk = 1 would do?
> (zle_main.c:1358)
That seems like a nice simple solution. Especially if there aren't
any that need set_bindk = 0 as you suggest below.
> It also occurs to me to wonder whether set_bindk = 0 *ever* makes sense
> for builtin widgets. Can somebody give me an example of a builtin that
> would care about the widget name of its user-defined caller?
I think it matters for the k2 == bindk test in getvirange(). That's
the code that ensures that pressing the same key twice indicates
that the vi command should operate on a line. Builtin widgets that
call getvirange() all have the ZLE_VIOPER flag set so could be
selected for on the basis of that.
zlecallhook sets set_bindk. That doesn't seem entirely useful
($WIDGET is zle-keymap-select etc) but if it did the opposite, that
could matter here because you'd get something like vi-cmd-mode
instead of the calling widget.
run-help, which-command and zap-to-char suffer from the same
issue as the text object widgets: they use bindk to select their
behaviour.
So any thoughts on this solution?
Oliver
diff --git a/Src/Zle/zle_thingy.c b/Src/Zle/zle_thingy.c
index 9107154..345534e 100644
--- a/Src/Zle/zle_thingy.c
+++ b/Src/Zle/zle_thingy.c
@@ -756,7 +756,10 @@ bin_zle_call(char *name, char **args, UNUSED(Options ops), UNUSED(char func))
}
t = rthingy(wname);
- ret = execzlefunc(t, args, setbindk);
+ /* for internal widgets we don't want bindk set except for when getting
+ * a vi range to detect a repeated key */
+ ret = execzlefunc(t, args, setbindk ||
+ (t->widget && (t->widget->flags & (WIDGET_INT | ZLE_VIOPER)) == WIDGET_INT));
unrefthingy(t);
if (saveflag)
zmod = modsave;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author