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

Re: bracketed paste - chopping trailing newlines



On Sat, Sep 12, 2015 at 1:07 AM, Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Sep 10,  7:11pm, Daniel Shahaf wrote:
> }
> } Yes, I also feel I'm repeating myself.  I've already made my case a few
> } times.  I've also suggested fixes and implemented them.  I have been
> } trying to reach consensus, but so far haven't succeeded.  As you can
> } imagine, by now I'm rather frustrated.
>
> This may be a situation where it's not possible to get consensus.  We
> have I think three different approaches (Oliver's, Carsten's, yours)
> none of the three agrees with either of the others, and we haven't
> tried conducting any sort of poll.

If three developers on the mailing list can't agree, chances are at
least one user will be unhappy with whatever we decide.

> } 1. Don't strip newlines at paste
> } 2. Highlight pastes
> } 3. Strip newlines at accept-line that immediately follows a paste
> }
> } I think all objections to (2) have been addressed, apart from the
> } question of whether to use standout or underline.  I think standout is
> } easier to spot and doesn't clash with zle_highlight[region]'s default
>
> I'm of two minds here.  One, there is a relationship between paste and
> the region -- if the region is active, the paste replaces it.  However,
> if there is no active region, the paste does not make it active (even
> though it sets MARK/CURSOR to the opposite ends and e.g. kill-region
> will kill the pasted text).  So two, making the paste look the same as
> an active region may be misleading ... or, maybe it's OK because it's
> almost the same thing.

I personally find it very surprising that pasting would interact with
the region in any way at all, yanking normally doesn't. If this is
some special vi thing, maybe it should only be replaced in vi mode. I
don't think the region and pasted text have anything in common or are
"almost the same thing", and I don't think they should be, unless we
also make yanked text act the same way, which I also don't think we
should.

(My interest here is mostly academic since I won't use any of this
builtin behavior. I would personally prefer if nothing gets deleted,
nothing gets stripped, and generally nothing in general happens except
the text gets pasted, like I asked it to be. I don't think anyone ever
complained to me about the behavior of the widget I made, but then
again, they all added it on purpose).

> I guess I agree with Oliver about the newline stripping.

We have at least two options that decide if and how we print a single
newline before drawing the prompt, maybe there is room for some here
as well.

-- 
Mikael Magnusson



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