mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 13:12:42 +00:00
Merge pull request #86085 from TheSofox/text-undo-cleanup
Cleanup in undo in `TextEdit` and `LineEdit`
This commit is contained in:
commit
af3fb0a2b8
@ -1452,15 +1452,14 @@ void LineEdit::undo() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (undo_stack_pos == nullptr) {
|
||||
if (undo_stack.size() <= 1) {
|
||||
return;
|
||||
}
|
||||
undo_stack_pos = undo_stack.back();
|
||||
} else if (undo_stack_pos == undo_stack.front()) {
|
||||
if (!has_undo()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (undo_stack_pos == nullptr) {
|
||||
undo_stack_pos = undo_stack.back();
|
||||
}
|
||||
|
||||
deselect();
|
||||
|
||||
undo_stack_pos = undo_stack_pos->prev();
|
||||
@ -1479,10 +1478,7 @@ void LineEdit::redo() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (undo_stack_pos == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (undo_stack_pos == undo_stack.back()) {
|
||||
if (!has_redo()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4175,7 +4175,7 @@ void TextEdit::redo() {
|
||||
}
|
||||
_push_current_op();
|
||||
|
||||
if (undo_stack_pos == nullptr) {
|
||||
if (!has_redo()) {
|
||||
return; // Nothing to do.
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user