You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Deleting a script open in the code editor auto-closes it, even if it has unsaved changes. This works as expected when directly selecting and deleting one or multiple scripts.
When deleting a folder containing open scripts, however, the auto-close does not work as expected. Instead, the deleted scripts remain open in the Code editor, and their name is changed to "Uns[unsaved]" with the dirty symbol "(*)".
Furthermore, if you try to Close All or Close Other Tabs to batch close such leftover files, then press either Discard, Cancel or Save, you can encounter one of the three following errors:
Error 1:
After the first Discard/Cancel/Save, you may see:
Signal 'visibility_changed' is already connected to given callable 'ScriptEditor::_queue_close_tabs' in that object.
If you selected Discard or Save, the file is closed (it is never saved). The second file will be renamed just "unsaved".
You can then Discard/Cancel/Save again, but if whatever you choose, it will stop the batch operation there.
In other words, you can close at most 2 files.
Here is a GIF focused on the batch close stopping after two files:
Error 2
Sometimes, instead of Error 1, batch close works, but you'll see a repeated error (one per file). For 5 files (total, saved or unsaved deleted):
scene/gui/tab_bar.cpp:597 - Index p_current = 4 is out of bounds (get_tab_count() = 4).
scene/gui/tab_bar.cpp:597 - Index p_current = 3 is out of bounds (get_tab_count() = 3).
scene/gui/tab_bar.cpp:597 - Index p_current = 2 is out of bounds (get_tab_count() = 2).
scene/gui/tab_bar.cpp:597 - Index p_current = 1 is out of bounds (get_tab_count() = 1).
scene/gui/tab_bar.cpp:597 - Index p_current = 0 is out of bounds (get_tab_count() = 0).
Error 3:
Often, after Error 1 or Error 2, you'll also see this:
Can't make active a Viewport that is already active.
Can't make active a Viewport that is already active.
Of course, fixing the first issue should fix the later errors. However, if there are other ways to make unsaved deleted files appear, then the errors on batch close should be fixed too.
(one technique to have extra safety is to fix the later errors first, then fix the first bug at the end)
Steps to reproduce
Open the Script editor and open new_script and all its numbered variants under new folder
Delete new folder
Main bug: the scripts deleted together with the new folder are not auto-closed. Instead, they remain open in the Code editor, and their name is changed to "Uns[unsaved]" with the dirty symbol "(*)"
Then to trigger side-effect errors:
Right-click or File > Close All or Close Other Tabs
In popup, select Discard/Cancel/Save (Discard shows better how files don't all close, and Save shows better how files don't save)
See Error 1 or Error 2 + optionally Error 3
If you see Error 1, you have a second popup. Select Discard/Cancel/Save again.
Note that there is no further popup, so we could not close all the files.
The text was updated successfully, but these errors were encountered:
hsandt
changed the title
Code editor: deleting folder containing scripts does not auto-close scripts. Closing them later causes errors.
Code editor: deleting folder containing scripts does not auto-close scripts. Batch closing them later causes errors.
Mar 18, 2023
Godot version
v4.0.stable.official [92bee43]
System information
Linux Ubuntu 22.04 with Unity desktop
Issue description
Deleting a script open in the code editor auto-closes it, even if it has unsaved changes. This works as expected when directly selecting and deleting one or multiple scripts.
When deleting a folder containing open scripts, however, the auto-close does not work as expected. Instead, the deleted scripts remain open in the Code editor, and their name is changed to "Uns[unsaved]" with the dirty symbol "(*)".
Furthermore, if you try to Close All or Close Other Tabs to batch close such leftover files, then press either Discard, Cancel or Save, you can encounter one of the three following errors:
Error 1:
After the first Discard/Cancel/Save, you may see:
If you selected Discard or Save, the file is closed (it is never saved). The second file will be renamed just "unsaved".
You can then Discard/Cancel/Save again, but if whatever you choose, it will stop the batch operation there.
In other words, you can close at most 2 files.
Here is a GIF focused on the batch close stopping after two files:
Error 2
Sometimes, instead of Error 1, batch close works, but you'll see a repeated error (one per file). For 5 files (total, saved or unsaved deleted):
Error 3:
Often, after Error 1 or Error 2, you'll also see this:
Of course, fixing the first issue should fix the later errors. However, if there are other ways to make unsaved deleted files appear, then the errors on batch close should be fixed too.
(one technique to have extra safety is to fix the later errors first, then fix the first bug at the end)
Steps to reproduce
Main bug: the scripts deleted together with the new folder are not auto-closed. Instead, they remain open in the Code editor, and their name is changed to "Uns[unsaved]" with the dirty symbol "(*)"
Then to trigger side-effect errors:
Minimal reproduction project
v4.0 - Close other tabs with deleted scripts fails.zip
The text was updated successfully, but these errors were encountered: