Skip to content

Conversation

@TheDying0fLight
Copy link
Contributor

@TheDying0fLight TheDying0fLight commented Dec 10, 2025

When closing a tab while not at the end of the history all entries after the current idx are deleted. This PRs goal is to ensure that the rest of the history is kept.

Note: There currently is an issue with the history when working with script files (see #113619). So I only used files from the internal documentation for testing this

Example

------- history -----
0 :  AABB
1 :  float <--- this is closed
2 :  ClassDB
3 :  bool
curr idx:  1

Closing 1: float

Without PR

------- history -----
0 :  AABB
curr idx:  0

With PR

------- history -----
0 :  AABB
1 :  ClassDB
2 :  bool
curr idx:  0

@TheDying0fLight TheDying0fLight requested a review from a team as a code owner December 10, 2025 17:27
@TheDying0fLight TheDying0fLight changed the title Keep tail of ScriptEditor tab history when closing tab Keep end of ScriptEditor tab history when closing tab Dec 10, 2025
@kitbdev kitbdev added this to the 4.6 milestone Dec 11, 2025
@HolonProduction
Copy link
Member

I will say that from a purely UX perspective I would expect the following behaviour:

------- history -----
0 :  AABB
1 :  float <--- this is closed
2 :  ClassDB
3 :  bool
curr idx:  1
------- history -----
0 :  AABB
1 :  float <--- this is still part of the history and will reopen the editor when navigated to
2 :  ClassDB
3 :  bool
curr idx:  0

But I think that's not possible with the current data structures used?

@TheDying0fLight
Copy link
Contributor Author

TheDying0fLight commented Dec 13, 2025

I agree with your suggestion

When I just remove the part which removes them from the history I get this on indexes with closed files

  ERROR: ./scene/gui/tab_container.cpp:793 - Condition "p_child->get_parent() != this" is true. Returning: -1
  ERROR: Cannot deselect tabs, deselection is not enabled.

But I think it would not be difficult to check if the file is open and then reopen it if it isn't? I will look some more into it

@TheDying0fLight TheDying0fLight force-pushed the keep-more-tab-history-when-closing-tab branch from e0ca7b9 to 2262ead Compare December 14, 2025 12:49
@TheDying0fLight
Copy link
Contributor Author

TheDying0fLight commented Dec 14, 2025

@HolonProduction I think this implements your suggestion. One issue I currently still see with this is when a file is reopened which does not exist anymore. But before digging myself deeper into it I wanted to know what you think about this approach

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants