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

Re: Shift-Insert overwrites ZLE CUTBUFFER

On Thu, Oct 27, 2016 at 12:01 AM, Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
> What I mean is that it's not easy to do from shell code.  In the source
> code obviously the implementation is deliberately pushing the kill ring,
> so it wouldn't be technically difficult to *not* do so, but that would
> mean reversing an earlier design decision.

I assumed the kill ring was used for implementation convenience.
If this was a deliberate design decision, I don't understand how this
is desirable to the user.
This doesn't seem to be documented, so I think it's OK to change it.

> Something like this sort of works:
>   my-bracketed-paste {
>     zle .bracketed-paste "$@" && {
>       local pasted=$CUTBUFFER
>       # Swap the top two killed items to fake out ^Y
>       CUTBUFFER=$killring[1]
>       killring[1]=$pasted
>     }
>   }
>   zle -N bracketed-paste my-bracketed-paste
> But I wouldn't have called that an "easy way".

Nice, thanks for showing me!

> Various other approaches involving saving/restoring CUTBUFFER and killring
> are also possible.

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