+2008-10-13 Chris Allegretta <chrisa@asty.org>
+ * Remove CUTTOEND as an undo type as it's unneeded, fix u->to_end logic in undo struct.
+ * undo.c (update_undo): Don't free cutbuffer if NULL, fix for Savannah bug #24499
+
2008-10-04 Chris Allegretta <chrisa@asty.org>
* cut.c (Add_undo): Save last cut undo information so it can be used for next uncut, fixes
Savannah bug 24183.
} function_type;
typedef enum {
- ADD, DEL, REPLACE, SPLIT, UNSPLIT, CUT, CUTTOEND, UNCUT, INSERT, OTHER
+ ADD, DEL, REPLACE, SPLIT, UNSPLIT, CUT, UNCUT, INSERT, OTHER
} undo_type;
/* Structure types. */
#ifdef DEBUG
fprintf(stderr, "Undoing multi-^K cut, u->linescut = %d\n", u->linescut);
#endif
- for (i = 0, t = openfile->current; i < u->linescut; i++) {
+ for (i = 0, t = openfile->current; i < u->linescut && t->next != NULL ; i++) {
#ifdef DEBUG
fprintf(stderr, "Advancing, lineno = %d, data = \"%s\"\n", t->lineno, t->data);
renumber(f);
break;
case CUT:
- case CUTTOEND:
undidmsg = _("text cut");
undo_cut(u);
break;
renumber(f);
break;
case CUT:
- case CUTTOEND:
undidmsg = _("text cut");
redo_cut(u);
break;
u->strdata = data;
break;
case CUT:
- case CUTTOEND:
u->mark_set = openfile->mark_set;
if (u->mark_set) {
u->mark_begin_lineno = openfile->mark_begin->lineno;
u->mark_begin_x = openfile->mark_begin_x;
}
- u->to_end = (current_action == CUTTOEND);
+ u->to_end = (ISSET(CUT_TO_END)) ? TRUE : FALSE;
last_cutu = u;
break;
case UNCUT:
/* Change to an add if we're not using the same undo struct
that we should be using */
if (action != fs->last_action
- || (action != CUT && action != CUTTOEND && action != INSERT
+ || (action != CUT && action != INSERT
&& openfile->current->lineno != fs->current_undo->lineno)) {
add_undo(action);
return;
#endif
break;
case CUT:
- case CUTTOEND:
+ if (!cutbuffer)
+ break;
if (u->cutbuffer)
free(u->cutbuffer);
u->cutbuffer = copy_filestruct(cutbuffer);