Repository: godotengine/godot (language: cpp)

Issue:
Script Editor - Error Panel stays open after error fixed
### Tested versions

4.4.stable

### System information

Godot v4.4.stable - Windows 10 (build 19045) - Multi-window, 1 monitor - OpenGL 3 (Compatibility) - NVIDIA GeForce GTX 1650 (NVIDIA; 32.0.15.7260) - AMD Ryzen 3 3100 4-Core Processor (8 threads)

### Issue description

Script Editor - Error Panel stays open after error fixed
in order to close the panel, need to cause an error to have the expand collapse button, this fresh first error after fix also collapses the panel.

### Steps to reproduce

create a script.
make an error,
expand the error panel
fix the error in script
> now you have the panel open with no errors but also no way to hide this Error Panel

### Minimal reproduction project (MRP)

Any simple project would do.


Discussion / hints:
It seems like the behaviour is whenever the number of errors changes, the panel is closed, unless the number of errors changes to 0. The logic for deciding if the error button is shown is in `CodeTextEditor::set_error_count`, which hides the error panel if `p_error_count > 0`, and doesn't change the error panel's visibility otherwise. 

https://github.com/godotengine/godot/blob/0028fd625e2c5b202e204bc12828cbca043213d3/editor/code_editor.cpp#L1667-L1676

This seems like the opposite of what you might expect, where you want to hide the error panel if there are no errors left, but leave it in its current state otherwise. This expected behaviour is actually how the warning panel behaves.

https://github.com/godotengine/godot/blob/0028fd625e2c5b202e204bc12828cbca043213d3/editor/code_editor.cpp#L1678-L1684

The change in behaviour seems to have been introduced in https://github.com/godotengine/godot/commit/02cc187 where the call to `_set_show_errors_panel` was put in the wrong place

Fix patch:
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index bc678b5ba1be..1b77ae749e40 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -1668,9 +1668,9 @@ void CodeTextEditor::set_error_count(int p_error_count) {
 	error_button->set_text(itos(p_error_count));
 	error_button->set_visible(p_error_count > 0);
 	if (p_error_count > 0) {
-		_set_show_errors_panel(false);
 		idle->set_wait_time(idle_time_with_errors); // Parsing should happen sooner.
 	} else {
+		_set_show_errors_panel(false);
 		idle->set_wait_time(idle_time);
 	}
 }


Test patch: