You've already forked godot
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:
@@ -476,6 +476,7 @@
|
|||||||
node.CallDeferred(Node3D.MethodName.Rotate, new Vector3(1f, 0f, 0f), 1.571f);
|
node.CallDeferred(Node3D.MethodName.Rotate, new Vector3(1f, 0f, 0f), 1.571f);
|
||||||
[/csharp]
|
[/csharp]
|
||||||
[/codeblocks]
|
[/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].
|
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] 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.
|
[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.
|
||||||
|
|||||||
@@ -676,7 +676,6 @@ void ScriptEditor::_save_history() {
|
|||||||
void ScriptEditor::_save_previous_state(Dictionary p_state) {
|
void ScriptEditor::_save_previous_state(Dictionary p_state) {
|
||||||
if (lock_history) {
|
if (lock_history) {
|
||||||
// Done as a result of a deferred call triggered by set_edit_state().
|
// Done as a result of a deferred call triggered by set_edit_state().
|
||||||
lock_history = false;
|
|
||||||
return;
|
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) {
|
void ScriptEditor::_update_history_pos(int p_new_pos) {
|
||||||
Node *n = tab_container->get_current_tab_control();
|
Node *n = tab_container->get_current_tab_control();
|
||||||
|
|
||||||
@@ -3873,6 +3876,10 @@ void ScriptEditor::_update_history_pos(int p_new_pos) {
|
|||||||
if (seb) {
|
if (seb) {
|
||||||
lock_history = true;
|
lock_history = true;
|
||||||
seb->set_edit_state(history[history_pos].state);
|
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();
|
seb->ensure_focus();
|
||||||
|
|
||||||
Ref<Script> scr = seb->get_edited_resource();
|
Ref<Script> scr = seb->get_edited_resource();
|
||||||
|
|||||||
@@ -524,6 +524,7 @@ class ScriptEditor : public PanelContainer {
|
|||||||
|
|
||||||
bool waiting_update_names;
|
bool waiting_update_names;
|
||||||
bool lock_history = false;
|
bool lock_history = false;
|
||||||
|
void _unlock_history();
|
||||||
|
|
||||||
void _help_class_open(const String &p_class);
|
void _help_class_open(const String &p_class);
|
||||||
void _help_class_goto(const String &p_desc);
|
void _help_class_goto(const String &p_desc);
|
||||||
|
|||||||
Reference in New Issue
Block a user