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
master
Chris Allegretta 2009-04-25 03:31:30 +00:00
parent b843a51b79
commit e061a0d604
4 changed files with 7 additions and 6 deletions

View File

@ -1214,7 +1214,7 @@ void iso_me_harder_funcmap(short func)
else if (func == DO_RIGHT) else if (func == DO_RIGHT)
do_right(); do_right();
else if (func == DO_ENTER) else if (func == DO_ENTER)
do_enter(); do_enter(FALSE);
else if (func == DO_EXIT) else if (func == DO_EXIT)
do_exit(); do_exit();
else if (func == DO_FIRST_LINE) else if (func == DO_FIRST_LINE)

View File

@ -1853,7 +1853,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
output[i] = '\n'; output[i] = '\n';
/* Newline to Enter, if needed. */ /* Newline to Enter, if needed. */
else if (output[i] == '\n') { else if (output[i] == '\n') {
do_enter(); do_enter(FALSE);
i++; i++;
continue; continue;
} }

View File

@ -624,7 +624,7 @@ void do_unindent(void);
void do_undo(void); void do_undo(void);
void do_redo(void); void do_redo(void);
#endif #endif
void do_enter(void); void do_enter(bool undoing);
#ifndef NANO_TINY #ifndef NANO_TINY
RETSIGTYPE cancel_command(int signal); RETSIGTYPE cancel_command(int signal);
bool execute_command(const char *command); bool execute_command(const char *command);

View File

@ -608,7 +608,7 @@ void do_redo(void)
case ENTER: case ENTER:
undidmsg = _("line break"); undidmsg = _("line break");
do_gotolinecolumn(u->lineno, u->begin+1, FALSE, FALSE, FALSE, FALSE); do_gotolinecolumn(u->lineno, u->begin+1, FALSE, FALSE, FALSE, FALSE);
do_enter(); do_enter(TRUE);
break; break;
case SPLIT: case SPLIT:
undidmsg = _("line wrap"); undidmsg = _("line wrap");
@ -671,7 +671,7 @@ void do_redo(void)
#endif /* !NANO_TINY */ #endif /* !NANO_TINY */
/* Someone hits Enter *gasp!* */ /* Someone hits Enter *gasp!* */
void do_enter(void) void do_enter(bool undoing)
{ {
filestruct *newnode = make_new_node(openfile->current); filestruct *newnode = make_new_node(openfile->current);
size_t extra = 0; size_t extra = 0;
@ -679,7 +679,8 @@ void do_enter(void)
assert(openfile->current != NULL && openfile->current->data != NULL); assert(openfile->current != NULL && openfile->current->data != NULL);
#ifndef NANO_TINY #ifndef NANO_TINY
update_undo(ENTER); if (!undoing)
add_undo(ENTER);
/* Do auto-indenting, like the neolithic Turbo Pascal editor. */ /* Do auto-indenting, like the neolithic Turbo Pascal editor. */