but at least make sure it throws and error and does not crash
(cherry picked from commit 333de40180
)
This commit is contained in:
parent
85c6d1b37d
commit
d662f5aa63
|
@ -3736,12 +3736,16 @@ void TextEdit::undo() {
|
||||||
_do_text_op(op, true);
|
_do_text_op(op, true);
|
||||||
current_op.version=op.prev_version;
|
current_op.version=op.prev_version;
|
||||||
if(undo_stack_pos->get().chain_backward) {
|
if(undo_stack_pos->get().chain_backward) {
|
||||||
do {
|
while(true) {
|
||||||
|
ERR_BREAK(!undo_stack_pos->prev());
|
||||||
undo_stack_pos = undo_stack_pos->prev();
|
undo_stack_pos = undo_stack_pos->prev();
|
||||||
op = undo_stack_pos->get();
|
op = undo_stack_pos->get();
|
||||||
_do_text_op(op, true);
|
_do_text_op(op, true);
|
||||||
current_op.version = op.prev_version;
|
current_op.version = op.prev_version;
|
||||||
} while(!undo_stack_pos->get().chain_forward);
|
if (undo_stack_pos->get().chain_forward) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor_set_line(undo_stack_pos->get().from_line);
|
cursor_set_line(undo_stack_pos->get().from_line);
|
||||||
|
@ -3760,12 +3764,16 @@ void TextEdit::redo() {
|
||||||
_do_text_op(op, false);
|
_do_text_op(op, false);
|
||||||
current_op.version = op.version;
|
current_op.version = op.version;
|
||||||
if(undo_stack_pos->get().chain_forward) {
|
if(undo_stack_pos->get().chain_forward) {
|
||||||
do {
|
|
||||||
|
while(true) {
|
||||||
|
ERR_BREAK(!undo_stack_pos->next());
|
||||||
undo_stack_pos=undo_stack_pos->next();
|
undo_stack_pos=undo_stack_pos->next();
|
||||||
op = undo_stack_pos->get();
|
op = undo_stack_pos->get();
|
||||||
_do_text_op(op, false);
|
_do_text_op(op, false);
|
||||||
current_op.version = op.version;
|
current_op.version = op.version;
|
||||||
} while(!undo_stack_pos->get().chain_backward);
|
if (undo_stack_pos->get().chain_backward)
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cursor_set_line(undo_stack_pos->get().to_line);
|
cursor_set_line(undo_stack_pos->get().to_line);
|
||||||
cursor_set_column(undo_stack_pos->get().to_column);
|
cursor_set_column(undo_stack_pos->get().to_column);
|
||||||
|
|
Loading…
Reference in New Issue