From 38d4f3ad5db9b798f6aa436d00acb17cc7adf43a Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 30 Jun 2019 18:42:47 +0200 Subject: [PATCH] copying: do not prevent M-6 from copying emptiness into the cutbuffer The check mistakenly prevented the user from copying a region that ended at EOF. Removing the check also gives the tidy user a way to clear the cutbuffer, with M-A M-6 or ^6 M-6, for example. This fixes https://savannah.gnu.org/bugs/?56563. Reported-by: Liu Hao --- src/cut.c | 4 ---- src/nano.c | 4 +--- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/cut.c b/src/cut.c index 647ff50f..8b20de7f 100644 --- a/src/cut.c +++ b/src/cut.c @@ -406,10 +406,6 @@ void copy_text(void) ssize_t is_current_lineno = openfile->current->lineno; size_t is_current_x = openfile->current_x; - /* If there is nothing to copy, don't even try. */ - if (openfile->current->next == NULL && openfile->current->data[0] == '\0') - return; - do_cut_text(TRUE, mark_is_set, FALSE, FALSE); /* If the mark was set, restore the viewport and cursor position. */ diff --git a/src/nano.c b/src/nano.c index 232095c7..cb16a37b 100644 --- a/src/nano.c +++ b/src/nano.c @@ -288,10 +288,8 @@ void extract(linestruct *top, size_t top_x, linestruct *bot, size_t bot_x) bool mark_inside = FALSE; bool same_line = FALSE; - if (top == bot && top_x == bot_x) { - statusline(ALERT, "Extracting nothing -- please report a bug"); + if (top == bot && top_x == bot_x) return; - } #endif /* Partition the buffer so that it contains only the text from -- 2.22.0