-
Notifications
You must be signed in to change notification settings - Fork 8.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add restore recently closed panes #11471
Merged
4 commits merged into
microsoft:main
from
Rosefield:feature/gh960-restore-last-pane-or-tab
Jan 11, 2022
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
96b2b2f
GH960 Add restore recently closed panes
Rosefield a35ecd2
Merge remote-tracking branch 'origin/main' into feature/gh960-restore…
Rosefield 15bf2e6
Make cleanup consistent between tab/pane close
Rosefield a55d56a
Code review: use dynamic dispatch intead of statically checking tab t…
Rosefield File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -337,6 +337,7 @@ | |
"toggleShaderEffects", | ||
"wt", | ||
"quit", | ||
"restoreLastClosed", | ||
"unbound" | ||
], | ||
"type": "string" | ||
|
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
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
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
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
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
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
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
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
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
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
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity... when this has like 149 actions in it and you restore it... does the Terminal UI wildly flicker as it plays all the actions back until it settles? I'm concerned that either someone will interact with it in some way while it's playing back or that it will look horrendous on a slower system as it recreates a bunch of stuff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To disambiguate,
_previouslyClosedPanesAndTabs
itself contains vectors of actions, and when you restore the last closed thing it will pop one vector and run all of those. The size limit, whatever it ends up being, shouldn't meaningfully affect the performance of the UI. Technically this erase call will end up calling a memcpy and some destructors, but that should be fast.To answer your intended question, in the video above I show what it looks like to restore a tab with 7 panes in it. It does take a second for it to resolve everything since it is spawning new processes/terminal controls for each one. Of course that is in a debug build so it might be faster in a release build.
I did another test just quickly (still a debug build, with debugger attached), restoring a tab that had 20 powershell panes in it took about ~6 seconds and the UI was unresponsive during that time. That corresponds to ~40 actions being executed: 20 split panes and some move focus to put the panes in the right spots.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, down the line, we should display a message like "setting up your workspace..." or something like that rather than being unresponsive. That'd be some nice polish instead of sitting with an unresponsive UI haha.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah ok. I'm fine with taking it for the sake of getting the useful feature in, but Carlos is right that we should probably add some small polish to it in the future, if someone complains or we feel like it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the case of restoring a single pane, it won't be any slower than if the user did a split pane manually. It is only on the case where someone restores a tab with a bunch of panes on it that it takes some time. There is the benefit of the user (roughly) knowing what they are recreating, so they shouldn't be too surprised if it takes a second.
That being said, this is a fairly naive implementation so there is probably be room for improvement,