From 43754bd11d0e30000868278ec12389739b0c1d0e Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Wed, 26 Feb 2020 12:35:38 +0100 Subject: [PATCH] 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. --- src/cut.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cut.c b/src/cut.c index b0df70f1..6d7f87e1 100644 --- a/src/cut.c +++ b/src/cut.c @@ -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; }