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
master
Chris Allegretta 2001-05-17 03:41:00 +00:00
parent 63ba2d63ff
commit 9fe015cca3
2 changed files with 12 additions and 2 deletions

View File

@ -29,6 +29,8 @@ Cvs code -
- cut.c: - cut.c:
add_to_cutbuffer() add_to_cutbuffer()
- Remove useless statements (Rocco). - Remove useless statements (Rocco).
cut_marked_segment()
- Add bizarre copy of bot node, else *BSD goes ballistic.
- faq.html: - faq.html:
- Brought the FAQ up to date, many little changes (Jordi). - Brought the FAQ up to date, many little changes (Jordi).
- files.c: - files.c:

12
cut.c
View File

@ -61,7 +61,7 @@ void add_to_cutbuffer(filestruct * inptr)
void cut_marked_segment(filestruct * top, int top_x, filestruct * bot, void cut_marked_segment(filestruct * top, int top_x, filestruct * bot,
int bot_x) int bot_x)
{ {
filestruct *tmp, *next; filestruct *tmp, *next, *botcopy;
char *tmpstr; char *tmpstr;
/* Set up the beginning of the cutbuffer */ /* 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 * 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. */ * 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; top->next = next;
if (next != NULL) if (next != NULL)
next->prev = top; next->prev = top;