From a75bc41faf269cec23525af320fbf493a833210a Mon Sep 17 00:00:00 2001 From: Chris Allegretta Date: Tue, 12 Jun 2001 23:22:26 +0000 Subject: [PATCH] Better for for -k bug git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@683 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 4 ++-- cut.c | 12 ++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 574c44cb..fb137a8a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -51,8 +51,8 @@ Cvs code - added to the cutbuffer without changing the contents of the file. This allows writing selection to separate files. do_cut_text() - - If the next line is empty when using -k, create a dummy line - and add it to the cutbuffer (fixes bug #61) + - If the line is empty when using -k and wasn't already added, + create a dummy line and add it to the cutbuffer (fixes bug #61) - faq.html: - Brought the FAQ up to date, many little changes (Jordi). - files.c: diff --git a/cut.c b/cut.c index 8ba6763f..13fdc70d 100644 --- a/cut.c +++ b/cut.c @@ -185,16 +185,12 @@ int do_cut_text(void) if (ISSET(CUT_TO_END) && !ISSET(MARK_ISSET)) { if (current_x == strlen(current->data)) { - /* If the next line is empty, create a dummy line and add it - to the cutbuffer */ - if ((current->next != NULL && strlen(current->next->data) == 0) || - (current == fileage && strlen(current->data) == 0)) { + /* If the line is empty and we didn't just cut a non-blank + line, create a dummy line and add it to the cutbuffer */ + if (current_x == 0 && marked_cut != 1) { filestruct *junk; - if (current == fileage) - junk = copy_node(current); - else - junk = copy_node(current->next); + junk = copy_node(current); add_to_cutbuffer(junk); }