From 6a8e784d1a0f87648ad760cc6291116d96ed05bd Mon Sep 17 00:00:00 2001 From: Chris Allegretta Date: Thu, 17 May 2001 03:41:00 +0000 Subject: [PATCH] cut_marked_segment() - Add bizarre copy of bot node, else *BSD goes ballistic. git-svn-id: svn://svn.savannah.gnu.org/nano/branches/nano_1_0_branch/nano@660 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 3 +++ cut.c | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ddac7762..c121a3b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ CVS code - +- cut.c: + cut_marked_segment() + - Add bizarre copy of bot node, else *BSD goes ballistic. - nano.c: do_alt_speller() - Try to go to the same line we were on before before spell check diff --git a/cut.c b/cut.c index f5a3232a..487a92cb 100644 --- a/cut.c +++ b/cut.c @@ -61,7 +61,7 @@ void add_to_cutbuffer(filestruct * inptr) void cut_marked_segment(filestruct * top, int top_x, filestruct * bot, int bot_x) { - filestruct *tmp, *next; + filestruct *tmp, *next, *botcopy; char *tmpstr; /* Set up the beginning of the cutbuffer */ @@ -103,7 +103,15 @@ void cut_marked_segment(filestruct * top, int top_x, filestruct * bot, * up a newline when we're grabbing the last line of the mark. For * the same reason, we don't do an extra totsize decrement. */ - add_to_cutbuffer(bot); + + /* I honestly do not know why this is needed. After many hours of + using gdb on an OpenBSD box, I can honestly say something is + screwed somewhere. Not doing this causes update_line to annihilate + the last line copied into the cutbuffer when the mark is set ?!?!? */ + botcopy = copy_node(bot); + add_to_cutbuffer(botcopy); + free(bot); + top->next = next; if (next != NULL) next->prev = top; -- 2.39.5