commit e061a0d604ecc36acdf54fb9d2d5d1b125ef8bae
parent b843a51b790c8000a802a766b8bb3e1e60eb6e69
Author: Chris Allegretta <chrisa@asty.org>
Date: Sat, 25 Apr 2009 03:31:30 +0000
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
Diffstat:
4 files changed, 7 insertions(+), 6 deletions(-)
diff --git 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
@@ -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
@@ -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
@@ -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. */