nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] input: do not auto-indent when something is pasted into


From: Benno Schulenberg
Subject: Re: [PATCH 2/2] input: do not auto-indent when something is pasted into nano from outside
Date: Mon, 6 Jan 2020 20:07:42 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2

Op 06-01-2020 om 08:36 schreef Brand Huntsman:
> Pasting with auto-indent enabled always does the wrong thing with indented 
> lines and this fixes it. But wrapping pasted lines might be wanted, and this 
> removes that feature.

Wrapping pasted lines might be wanted, yes.  But also when pasting lines
within nano (with ^U, from another file) automatic hard-wrapping does not
occur -- lines do not get wrapped.  People that use --breaklonglines are
already used to having to ^J any paragraphs that they have edited, so I
do not see a problem with making an "outside" paste work exactly the same
as an "inside" paste.

But the main reason for making it that way is that, when fulfilling
https://savannah.gnu.org/bugs/?54950, it would get implemented by
stashing the cutbuffer, reading the input stream byte-by-byte into
an empty cutbuffer (skipping anything out of byte range), until the
bracketed-paste STOP sequence is encountered, then perform the exact
equivalent of a ^U (so that the paste can be undo as a whole), and
restore the cutbuffer.  Reading all pasted stuff directly into a
buffer will preclude any automatic hard-wrapping and tab-expansion;
it will work similar to scoop_stdin().

If our only goal is to suppress autoindent when an outside paste is
occurring, there is no need to detect bracketed pastes.  See upcoming
patch.  It's not perfect, but works well enough.

Benno

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]