commit 9fe015cca30775f4c507f6387a8a3fcd009b2de0
parent 63ba2d63ff9379e84ba9b3b0283077020f0dda91
Author: Chris Allegretta <chrisa@asty.org>
Date: Thu, 17 May 2001 03:41:00 +0000
cut_marked_segment() - Add bizarre copy of bot node, else *BSD goes ballistic.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@660 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -29,6 +29,8 @@ Cvs code -
- cut.c:
add_to_cutbuffer()
- Remove useless statements (Rocco).
+ cut_marked_segment()
+ - Add bizarre copy of bot node, else *BSD goes ballistic.
- faq.html:
- Brought the FAQ up to date, many little changes (Jordi).
- files.c:
diff --git 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;