zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh-workers@zsh.org
Subject: Re: Off-by-one with select-*-shell-word text object?
Date: Fri, 16 Sep 2016 22:47:07 +0200	[thread overview]
Message-ID: <76020.1474058827@hydra.kiddle.eu> (raw)
In-Reply-To: <160916102137.ZM11290@torch.brasslantern.com>

Bart wrote:
> Noticed during recent zsh-users thread:
>
> torch% quote-this-word() { zle select-in-shell-word; zle quote-region }
> torch% zle -N quote-this-word
> torch% bindkey "''" quote-this-word
> torch% echo foo''
> torch% echo' foo'
>
> Note the left-quote has now included the space preceding the word.  I at
> first suspected another vi-mode vs. emacs-mode difference, but:
>
> torch% bindkey -v "''" quote-this-word

You'd need to do vicmd bindings to identify a vi-mode vs. emacs-mode
difference: bindkey -a. However, it is neither that nor an off-by-one
error.

The problem is that both select-in-shell-word and select-a-shell-word
are handled by a single function that tests the value of bindk to
see which widget it is running. bindk apparently points to the
quote-this-word shell widget so that isn't doing what was intended.
In this case you're getting select-a-shell-word behaviour as a result.
For select-a-shell-word including the preceding space is intentional.

Looking at execzlefunc, I can't see an alternative way to get the
actual widget being run. Have I missed anything? I could add another
global variable for that. Or a ZLE_ flag - actually two to cover
select-in-word/select-in-blank-word. Or it needs six small wrapper
functions for the actual widgets. Have you got any preference in
the choice between those or alternative ideas?

Oliver


  reply	other threads:[~2016-09-16 20:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-16 17:21 Bart Schaefer
2016-09-16 20:47 ` Oliver Kiddle [this message]
2016-09-16 21:22   ` Bart Schaefer
2016-09-16 23:30     ` Oliver Kiddle
2016-09-17  3:02       ` Bart Schaefer
2016-09-17  7:42         ` Daniel Shahaf
2016-09-17 14:29           ` Bart Schaefer
2016-09-19  7:00             ` Daniel Shahaf
2016-09-19 10:01               ` Oliver Kiddle
2016-09-19 15:19                 ` Bart Schaefer

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=76020.1474058827@hydra.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).