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.
master
Benno Schulenberg 2020-03-31 17:50:21 +02:00
parent 387be713c8
commit 96046f1e82
1 changed files with 6 additions and 0 deletions

View File

@ -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