Warning about a condition that should never occur,

instead of silently continuing.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5440 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2015-11-25 09:27:25 +00:00
parent 438cb110ff
commit 1b69dd629a
2 changed files with 12 additions and 7 deletions

View File

@ -3,6 +3,8 @@
of just the current line) is not needed for any kind of syntax, but of just the current line) is not needed for any kind of syntax, but
only when there are multiline regexes. And check for this not on only when there are multiline regexes. And check for this not on
every keystroke in a burst, but just once. every keystroke in a burst, but just once.
* src/text.c (do_undo): Warn about a condition that should never
occur, instead of silently continuing.
2015-11-24 Benno Schulenberg <bensberg@justemail.net> 2015-11-24 Benno Schulenberg <bensberg@justemail.net>
* doc/syntax/makefile.nanorc: Also recognize the extensions .make and * doc/syntax/makefile.nanorc: Also recognize the extensions .make and

View File

@ -564,14 +564,17 @@ void do_undo(void)
break; break;
case ENTER: case ENTER:
undidmsg = _("line break"); undidmsg = _("line break");
if (f->next) { filestruct *snipit = f->next;
filestruct *foo = f->next; if (snipit == NULL) {
f->data = charealloc(f->data, strlen(f->data) + strlen(&f->next->data[u->mark_begin_x]) + 1); statusbar(_("Internal error: line is missing. Please save your work."));
strcat(f->data, &f->next->data[u->mark_begin_x]); return;
if (foo == openfile->filebot)
openfile->filebot = f;
unlink_node(foo);
} }
f->data = charealloc(f->data, strlen(f->data) +
strlen(&f->next->data[u->mark_begin_x]) + 1);
strcat(f->data, &f->next->data[u->mark_begin_x]);
if (openfile->filebot == snipit)
openfile->filebot = f;
unlink_node(snipit);
goto_line_posx(u->lineno, u->begin); goto_line_posx(u->lineno, u->begin);
break; break;
case INSERT: case INSERT: