From: Chris Allegretta Date: Sat, 25 Apr 2009 03:31:30 +0000 (+0000) Subject: Add undoing check for do_enter so redo doesn't blow up. X-Git-Tag: v2.1.10~6 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=e061a0d604ecc36acdf54fb9d2d5d1b125ef8bae;p=nano.git Add undoing check for do_enter so redo doesn't blow up. Hate to piecemeal these fixed but system unstability is teh suck. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4392 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/src/global.c b/src/global.c index 1816b52c..6345aeda 100644 --- a/src/global.c +++ b/src/global.c @@ -1214,7 +1214,7 @@ void iso_me_harder_funcmap(short func) else if (func == DO_RIGHT) do_right(); else if (func == DO_ENTER) - do_enter(); + do_enter(FALSE); else if (func == DO_EXIT) do_exit(); else if (func == DO_FIRST_LINE) diff --git a/src/nano.c b/src/nano.c index e59526e2..19a81cd0 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1853,7 +1853,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls) output[i] = '\n'; /* Newline to Enter, if needed. */ else if (output[i] == '\n') { - do_enter(); + do_enter(FALSE); i++; continue; } diff --git a/src/proto.h b/src/proto.h index ba59e51e..752bb1e4 100644 --- a/src/proto.h +++ b/src/proto.h @@ -624,7 +624,7 @@ void do_unindent(void); void do_undo(void); void do_redo(void); #endif -void do_enter(void); +void do_enter(bool undoing); #ifndef NANO_TINY RETSIGTYPE cancel_command(int signal); bool execute_command(const char *command); diff --git a/src/text.c b/src/text.c index 1c809203..62ef1ff9 100644 --- a/src/text.c +++ b/src/text.c @@ -608,7 +608,7 @@ void do_redo(void) case ENTER: undidmsg = _("line break"); do_gotolinecolumn(u->lineno, u->begin+1, FALSE, FALSE, FALSE, FALSE); - do_enter(); + do_enter(TRUE); break; case SPLIT: undidmsg = _("line wrap"); @@ -671,7 +671,7 @@ void do_redo(void) #endif /* !NANO_TINY */ /* Someone hits Enter *gasp!* */ -void do_enter(void) +void do_enter(bool undoing) { filestruct *newnode = make_new_node(openfile->current); size_t extra = 0; @@ -679,7 +679,8 @@ void do_enter(void) assert(openfile->current != NULL && openfile->current->data != NULL); #ifndef NANO_TINY - update_undo(ENTER); + if (!undoing) + add_undo(ENTER); /* Do auto-indenting, like the neolithic Turbo Pascal editor. */