Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: bracketed paste mode in xterm and urxvt



On Tue, Jun 16, 2015 at 12:11 AM, Oliver Kiddle <okiddle@xxxxxxxxxxx> wrote:
> On 9 Jun, Bart wrote:
>> This sounds like the same dilemma that we had with ZLE_RPROMPT_INDENT,
>> which we addressed with a variable rather than an option.  This would
>> address several problems:  namespace (ZLE-specific stuff should really
>> stop leaking into the base shell options); a place to store the string
>> to use in case it turns out not to be the same for all terminal types;
>> and distinguishing among unset/set/empty/non-empty semantics.
>
> That makes sense, thanks.
>
> So this next attempt uses ZLE_BRACKETED_PASTE_ON/OFF though I'm open to
> better ideas.
> I've not made them special, just initialised them with a call to
> setsparam as that seemed simple enough for the purpose. Is that
> reasonable or should they be special?
>
> I also looked around for places where keys are read and handled such
> that bracketedpaste() would not be called. I've not done anything in
> the case of single bytes such as for the vi r and f commands but I have
> added handling for the history and completion incremental searches and
> for the execute-named-command widget. It would be possible to avoid this
> special handling by adding logic to getkeycmd() so that they get a
> stream of self-insert widgets. That would somehow defeat the
> purpose of bracketed paste, however.
>
> In both the incremental search modes, backspace works like undo so the
> entire paste is undone. This same effect is also apparent if you press
> backspace after changing search direction with Ctrl-S or Ctrl-R.
>
> +int
> +bracketedpaste(UNUSED(char **args))
> +{
> +    int n;
> +    ZLE_STRING_T wpaste;
> +    char *pbuf = bracketedstring();
> +
> +    wpaste = stringaszleline((zmult == 1) ? pbuf :
> +       quotestring(pbuf, NULL, QT_BACKSLASH), 0, &n, NULL, NULL);
> +    zmult = 1;

This feature appears to be undocumented? I also think the
documentation for the widget should list the default bindings, as
other widgets do.

It might also be nice if the widget could take a parameter as an
argument to store the text in, rather than insert it into the command
line always.

-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author