and NONEWLINES is set, there is no next line at which to put the
cutting point for a redo. So put it at the very end of the cut.
This fixes Savannah bug #46541.
+ * src/text.c (add_undo, update_undo, do_undo, do_redo), src/nano.h:
+ Store and retrieve the correct file size before and after an action.
+ This fixes Savannah bug #45523.
2015-11-29 Benno Schulenberg <bensberg@justemail.net>
* src/color.c (reset_multis): Evaluate correctly whether to reset
/* Where did this action begin or end. */
char *strdata;
/* String type data we will use for copying the affected line back. */
+ size_t wassize;
+ /* The file size before the action. */
+ size_t newsize;
+ /* The file size after the action. */
int xflags;
/* Some flag data we need. */
openfile->current_undo = openfile->current_undo->next;
openfile->last_action = OTHER;
openfile->placewewant = xplustabs();
+ openfile->totsize = u->wassize;
set_modified();
}
openfile->current_undo = u;
openfile->last_action = OTHER;
openfile->placewewant = xplustabs();
+ openfile->totsize = u->newsize;
set_modified();
}
#endif /* !NANO_TINY */
u->mark_begin_lineno = openfile->current->lineno;
u->mark_begin_x = openfile->current_x;
u->mark_set = FALSE;
+ u->wassize = openfile->totsize;
u->xflags = 0;
switch (u->type) {
/* We need to start copying data into the undo buffer
* or we won't be able to restore it later. */
case ADD:
+ u->wassize--;
break;
case BACK:
/* If the next line is the magic line, don't ever undo this
assert(openfile->undotop != NULL);
u = openfile->undotop;
+ u->newsize = openfile->totsize;
+
switch (u->type) {
case ADD: {
#ifdef DEBUG