1
1

undo: make sure the current line is defined before it is referenced

After undoing an <Enter> or redoing a line join, it is likely that the
"eaten" and freed line was the current line.  In fact, goto_line_posx()
should not refer to it any more, but... accommodate for this and just
set openfile->current to a valid value before calling goto_line_posx().

This fixes https://savannah.gnu.org/bugs/?62952.

Bug existed since version 6.3, commit eea3e1f0.
Этот коммит содержится в:
Benno Schulenberg 2022-08-24 15:45:24 +02:00
родитель 25ceefbd89
Коммит 9410a55679

Просмотреть файл

@ -540,6 +540,7 @@ void do_undo(void)
line->has_anchor |= line->next->has_anchor;
unlink_node(line->next);
renumber_from(line);
openfile->current = line;
goto_line_posx(u->head_lineno, original_x);
break;
case BACK:
@ -746,6 +747,7 @@ void do_redo(void)
strcat(line->data, u->strdata);
unlink_node(line->next);
renumber_from(line);
openfile->current = line;
goto_line_posx(u->tail_lineno, u->tail_x);
break;
case REPLACE: