1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-31 18:41:20 +00:00

Merge pull request #113619 from HolonProduction/once-upon-a-time-there-was-a-file-which-one-i-dont-know-the-history-was-locked

Ensure correct unlocking of script editor history
This commit is contained in:
Thaddeus Crews
2025-12-11 12:12:42 -06:00
3 changed files with 10 additions and 1 deletions

View File

@@ -476,6 +476,7 @@
node.CallDeferred(Node3D.MethodName.Rotate, new Vector3(1f, 0f, 0f), 1.571f);
[/csharp]
[/codeblocks]
For methods that are deferred from the same thread, the order of execution at idle time is identical to the order in which [code skip-lint]call_deferred[/code] was called.
See also [method Callable.call_deferred].
[b]Note:[/b] In C#, [param method] must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the [code]MethodName[/code] class to avoid allocating a new [StringName] on each call.
[b]Note:[/b] If you're looking to delay the function call by a frame, refer to the [signal SceneTree.process_frame] and [signal SceneTree.physics_frame] signals.

View File

@@ -676,7 +676,6 @@ void ScriptEditor::_save_history() {
void ScriptEditor::_save_previous_state(Dictionary p_state) {
if (lock_history) {
// Done as a result of a deferred call triggered by set_edit_state().
lock_history = false;
return;
}
@@ -3854,6 +3853,10 @@ void ScriptEditor::_update_selected_editor_menu() {
}
}
void ScriptEditor::_unlock_history() {
lock_history = false;
}
void ScriptEditor::_update_history_pos(int p_new_pos) {
Node *n = tab_container->get_current_tab_control();
@@ -3873,6 +3876,10 @@ void ScriptEditor::_update_history_pos(int p_new_pos) {
if (seb) {
lock_history = true;
seb->set_edit_state(history[history_pos].state);
// `set_edit_state()` can modify the caret position which might trigger a
// request to save the history. Since `TextEdit::caret_changed` is emitted
// deferred, we need to defer unlocking of the history as well.
callable_mp(this, &ScriptEditor::_unlock_history).call_deferred();
seb->ensure_focus();
Ref<Script> scr = seb->get_edited_resource();

View File

@@ -524,6 +524,7 @@ class ScriptEditor : public PanelContainer {
bool waiting_update_names;
bool lock_history = false;
void _unlock_history();
void _help_class_open(const String &p_class);
void _help_class_goto(const String &p_desc);