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 39365
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Off-by-one with select-*-shell-word text object?
- Date: Fri, 16 Sep 2016 22:47:07 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1474058828; bh=b9KIG+1c5STyUvo6ovoud9vySsCm+J1bqICj5p6yW9g=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=sY4R6GK3uOAH7vEGtS3nTn9kv/unSomfZcnd3hQxR3XcvgM3E24MVxPxu08OCFeIM1jW2Wx1yP+SSykgbFb8tVRHykvmqcIPMnPDeyialj6XVeVSwZcLMPEwGBD5AXipVJUhV2Sb8M9yA/f6MQrj/X84O9ZzSr72VjyZtM3gCOa7nT6Fghm7S0rW7IkamDiJIM5yMT9vC9F+iHpAKFHcQgv1J9PU9WM58VkoTHE0/xlfPLX4tlgEryOwYCrVaf3ETOPmP6kfO9YNq59NtX1PxBqFbMr+2/xLAMfFf6cL2SEpNkHQueN1dCMRALYuqyazoZKmIYIbAItYN+aBH1Hq0A==
- In-reply-to: <160916102137.ZM11290@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>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author