cutting: let M-T cut a trailing empty line, but not nothing at all

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

Bug existed since version 4.0, commit 67873e96.
master
Benno Schulenberg 2020-02-26 12:35:38 +01:00
parent acd9046093
commit 43754bd11d
1 changed files with 4 additions and 3 deletions

View File

@ -589,9 +589,10 @@ void copy_text(void)
/* Cut from the current cursor position to the end of the file. */
void cut_till_eof(void)
{
if ((openfile->current == openfile->filebot && openfile->current->data[0] == '\0') ||
(!ISSET(NO_NEWLINES) && openfile->current->next == openfile->filebot &&
openfile->current->data[openfile->current_x] == '\0')) {
if (openfile->current->data[openfile->current_x] == '\0' &&
(openfile->current->next == NULL ||
(!ISSET(NO_NEWLINES) && openfile->current_x > 0 &&
openfile->current->next == openfile->filebot))) {
statusbar(_("Nothing was cut"));
return;
}