From: Chris Allegretta Date: Tue, 12 Jun 2001 23:23:18 +0000 (+0000) Subject: Better fix for -k bug X-Git-Tag: v1.0.3~14 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=df99d71a833eeb10d3937057568070854048d294;p=nano.git Better fix for -k bug git-svn-id: svn://svn.savannah.gnu.org/nano/branches/nano_1_0_branch/nano@684 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index e4c5a3b6..616d7a7f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,8 +4,8 @@ CVS code - - Add bizarre copy of bot node, else *BSD goes ballistic (fixes BUG #60) 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) - files.c: do_browser() - Don't shift the size of the file is it's less than 1K. Fixed diff --git a/cut.c b/cut.c index 1fbb0a29..13717c66 100644 --- a/cut.c +++ b/cut.c @@ -165,16 +165,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); }