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 39367
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Off-by-one with select-*-shell-word text object?
- Date: Fri, 16 Sep 2016 14:22:48 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=xycT5/iaAaBr1NTIPiZRgL+xJyyO8h0IG/30itaFLpI=; b=LVm3MrFYsH1jlJ8BvgGPgyt8TLvFBmKbSFnlBA//+0Bagy5VH+LCr6STVe8SwZ5q9j FIQXaSatDV9dhfb/76snxz1oed+AWAIlobCobSmc5snAoferpvfyTJXr3JgpamDptpo8 crhQGTYQBx4oVsq0yG/4ye2Z1kMNZ/dxisbQ7C6dKsQjt6DiyVBY4pN1KP01R0Jizg2J GkIPltiPpHCWgpKgh0Xvr+yPYsxYLjPq3gBpIB4SNvccsJ7JUSYdd40HeOjrFcRj9bZn PMLo0dlzLPJ7nt0NaCx2n/FG7iygaH7FW6cW3e6KNxWVZfJVMqMLtpMdwmCnSG2RTCiH GaOQ==
- In-reply-to: <76020.1474058827@hydra.kiddle.eu>
- 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>
On Sep 16, 10:47pm, Oliver Kiddle wrote:
} Subject: Re: Off-by-one with select-*-shell-word text object?
}
} 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'
}
} 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.
Aha! Indeed, this works:
quote-this-word() { zle select-in-shell-word -w ; zle quote-region }
} For select-a-shell-word including the preceding space is intentional.
That should probably be documented, then. Currently the doc says the
adjacent blanks are selected for -a-blank-word and -a-word, but does
not mention that for -a-shell-word. I suppose it could be inferred
from name similarity, but that shouldn't be necessary.
} Looking at execzlefunc, I can't see an alternative way to get the
} actual widget being run. Have I missed anything?
Although it's not ideal to have a built-in widget that requires the
use of the -w flag when calling from a user-defined widget, it's also
probably OK if properly documented.
} Or it needs six small wrapper functions for the actual widgets.
This would be in line with the way similar widgets with a common
core have been implemented in the past. However:
} Or a ZLE_ flag - actually two to cover
} select-in-word/select-in-blank-word.
I think one flag to force the equivalent of set_bindk = 1 would do?
(zle_main.c:1358)
I don't have a preference here, except:
It occurs to me that using this same sort of flag on the menu-complete
and reverse-menu-complete Thingys might have fixed the problem that
you addressed a different way in workers/38043.
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?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author