} function_type;
typedef enum {
- ADD, DEL, REPLACE, SPLIT, UNSPLIT, CUT, UNCUT, INSERT, OTHER
+ ADD, DEL, REPLACE, SPLIT, UNSPLIT, CUT, UNCUT, ENTER, INSERT, OTHER
} undo_type;
#ifdef ENABLE_COLOR
openfile->current_x += strlen(u->strdata);
break;
case SPLIT:
- undidmsg = _("line split");
+ undidmsg = _("line wrap");
f->data = nrealloc(f->data, strlen(f->data) + strlen(u->strdata) + 1);
strcpy(&f->data[strlen(f->data) - 1], u->strdata);
if (u->xflags & UNDO_SPLIT_MADENEW) {
undidmsg = _("text uncut");
redo_cut(u);
break;
+ case ENTER:
+ undidmsg = _("line break");
+ if (f->next) {
+ f->data = nrealloc(f->data, strlen(f->data) + strlen(f->next->data) + 1);
+ strcat(f->data, f->next->data);
+ filestruct *foo = f->next;
+ unlink_node(foo);
+ delete_node(foo);
+ }
+ break;
case INSERT:
undidmsg = _("text insert");
cutbuffer = NULL;
u->strdata = f->data;
f->data = data;
break;
+
default:
undidmsg = _("Internal error: unknown type. Please save your work");
break;
}
+ renumber(f);
do_gotolinecolumn(u->lineno, u->begin, FALSE, FALSE, FALSE, TRUE);
statusbar(_("Undid action (%s)"), undidmsg);
openfile->current_undo = openfile->current_undo->next;
free(f->data);
f->data = data;
break;
+ case ENTER:
+ undidmsg = _("line break");
+ do_gotolinecolumn(u->lineno, u->begin+1, FALSE, FALSE, FALSE, FALSE);
+ do_enter();
+ break;
case SPLIT:
- undidmsg = _("line split");
+ undidmsg = _("line wrap");
t = make_new_node(f);
t->data = mallocstrcpy(NULL, &u->strdata[u->begin]);
data = mallocstrncpy(NULL, f->data, u->begin);
assert(openfile->current != NULL && openfile->current->data != NULL);
#ifndef NANO_TINY
- update_undo(SPLIT);
+ update_undo(ENTER);
/* Do auto-indenting, like the neolithic Turbo Pascal editor. */
u->cutbottom = last_cutu->cutbottom;
}
break;
+ case ENTER:
+ break;
case OTHER:
statusbar(_("Internal error: unknown type. Please save your work."));
break;