-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Given the following tab layout: name(index). The current index is 2 and history is considered empty: MessageList TermFoo [TermBar] Viewer 0 1 2 3 If we focus TermFoo, index 2 is added to history and current index becomes 1: MessageList [TermFoo] TermBar Viewer 0 1 2 3 Now, if we close TermFoo, the last item in the history (2) is popped and selected: MessageList TermBar [Viewer] 0 1 2 This leads to selecting the message viewer whereas TermBar should have been selected. A different issue happens when the tab history index is out of bounds. For example: MessageList TermFoo [TermBar] 0 1 2 Move to TermFoo, 2 is pushed to history: MessageList [TermFoo] TermBar 0 1 2 Close TermFoo, last index in history (2) is invalid, current index remains selected but not completely: MessageList [TermBar] 0 1 The widget/terminal in TermBar will not be focused or made visible to the ui (via (Visible).Show(true)) until one key is pressed. Effectively delaying interaction with the program running in it. Replace a list of index with a list of pointers to *Tab objects for the history. This makes it impervious to removal, reordering and removes the need to recompute the history indexes. Limit the history to 256 items to avoid memory hog after a long time. When removing the current tab, ensure "something" is selected. If the history is empty, select the next best thing. Suggested-by: Koni Marti <[email protected]> Reported-by: Brandon Sprague <[email protected]> Signed-off-by: Robin Jarry <[email protected]> Tested-by: Bence Ferdinandy <[email protected]>
- Loading branch information
Showing
1 changed file
with
97 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters