nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 96046f1e825aa9c67afcd000b188f96e14a07379
parent 387be713c8d435b27aa0c60709c0e63b70e082b0
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Tue, 31 Mar 2020 17:50:21 +0200

copying: when using M-6, copy the final line in the buffer just once

When using --nonewlines and the cursor has arrived at the end of the
final line, each press of M-6 would add another copy of that line to
the cutbuffer.  That is clearly not the right behavior.

Also, give feedback when a press of M-6 does not actually copy anything.

This fixes https://savannah.gnu.org/bugs/?58088.

The bug was old -- it existed since before version 2.2.0.

Diffstat:
Msrc/cut.c | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/cut.c b/src/cut.c @@ -576,6 +576,12 @@ void copy_text(void) return; } + if (openfile->current->next == NULL && at_eol && (ISSET(CUT_FROM_CURSOR) || + openfile->current_x == 0 || cutbuffer)) { + statusbar(_("Copied nothing")); + return; + } + addition = make_new_node(NULL); /* Create OR add to the cutbuffer, depending on the mode, the position