From 3ee9354b3c634d6e1da1b65b93ff988da366c59d Mon Sep 17 00:00:00 2001 From: Chris Allegretta Date: Sun, 10 Jun 2001 20:41:20 +0000 Subject: [PATCH] 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) git-svn-id: svn://svn.savannah.gnu.org/nano/branches/nano_1_0_branch/nano@680 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- BUGS | 3 ++- ChangeLog | 3 +++ cut.c | 9 +++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/BUGS b/BUGS index 3cddb9db..37ecb86b 100644 --- a/BUGS +++ b/BUGS @@ -114,7 +114,8 @@ properly (discovered by David Lawrence Ramsey) (59) [FIXED]. - On BSD systenms, marked cutting sna paste often screws up the last line in the cutbuffer (discovered by Barry Pederson) (60) [FIXED] - +- Blank lines are not kept when cutting with -k (discovered by Rocco) + (61) [FIXED]. ** Open BUGS ** diff --git a/ChangeLog b/ChangeLog index 609f3c88..77e03c06 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ CVS code - cut_marked_segment() - 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) - 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 487a92cb..3debe206 100644 --- a/cut.c +++ b/cut.c @@ -164,6 +164,15 @@ int do_cut_text(void) #ifndef NANO_SMALL 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) { + filestruct *junk; + + junk = copy_node(current->next); + add_to_cutbuffer(junk); + } do_delete(); SET(KEEP_CUTBUFFER); marked_cut = 2; -- 2.39.5