Skip to content
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

Allow moving panes to other tabs #7075

Closed
dan1994 opened this issue Jul 25, 2020 · 5 comments · Fixed by #10780
Closed

Allow moving panes to other tabs #7075

dan1994 opened this issue Jul 25, 2020 · 5 comments · Fixed by #10780
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.

Comments

@dan1994
Copy link

dan1994 commented Jul 25, 2020

Description of the new feature/enhancement

Simply put, I would like to be able to take a single pane and either transform it into a tab, or add it as a pane of a different tab.
In my opinion this is useful when a specific tab gets overcrowded with panes, and gets cumbersome.
You could close the panes you want to move and reopen new ones in a different tab, but then you lose output of previous commands, environment changes you made, etc.

As for how this might appear to the user, I think it would have to be a drag & drop kind of thing for the use case of moving the pane to an existing tab (Also allowing to rearrange panes in the same tab which would be nice). Keyboard shortcuts might work too, but I think it'll make it hard to reach the exact arrangement of tabs.

@dan1994 dan1994 added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Jul 25, 2020
@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Jul 25, 2020
@zadjii-msft
Copy link
Member

You know what, we shockingly don't have a dupe for this in #1000. I think we were already planning on adding this, but it looks like it wasn't previously tracked. Thanks for keeping us honest!

@zadjii-msft zadjii-msft added Area-User Interface Issues pertaining to the user interface of the Console or Terminal Product-Terminal The new Windows Terminal. labels Jul 27, 2020
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Jul 27, 2020
@zadjii-msft zadjii-msft added this to the Terminal Backlog milestone Jul 27, 2020
@dan1994
Copy link
Author

dan1994 commented Jul 27, 2020

Thank you for the great work. As someone coming from linux, transitioning to Terminal + WSL is a delight!

@DHowett DHowett removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Jul 27, 2020
@usama8800
Copy link

Does this also include swapping panes on the same tab?

@Don-Vito
Copy link
Contributor

Don-Vito commented Nov 24, 2020

Does this also include swapping panes on the same tab?

I thinks it is tracked separately here #4922

@ghost ghost added the In-PR This issue has a related PR label Jul 24, 2021
@ghost ghost closed this as completed in #10780 Aug 12, 2021
@ghost ghost removed the In-PR This issue has a related PR label Aug 12, 2021
ghost pushed a commit that referenced this issue Aug 12, 2021
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? -->
## Summary of the Pull Request
Add functionality to move a pane to another tab. If the tab index is greater than the number of current tabs a new tab will be created with the pane as its root. Similarly, if the last pane on a tab is moved to another tab, the original tab will be closed.

This is largely complete, but I know that I'm messing around with things that I am unfamiliar with, and would like to avoid footguns where possible. 

<!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> 
## References
#4587 

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist
* [x] Closes #7075
* [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA
* [ ] Tests added/passed
* [x] Documentation updated. If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx
* [x] Schema updated.
* [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

<!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments
Things done:
- Moving a pane to a new tab appears to work. Moving a pane to an existing tab mostly works. Moving a pane back to its original tab appears to work.
- Set up {Attach,Detach}Pane methods to add or remove a pane from a pane. Detach is slightly different than Close in that we want to persist the tree structure and terminal controls.
- Add `Detached` event on a pane that can be subscribed to to remove other event handlers if desired. 
- Added simple WalkTree abstraction for one-off recursion use cases that calls a provided function on each pane in order (and optionally terminates early).
- Fixed an in-prod bug with closing panes. Specifically, if you have a tree (1; 2 3) and close the 1 pane, then 3 will lose its borders because of these lines clearing the border on both children https://github.com/microsoft/terminal/blob/main/src/cascadia/TerminalApp/Pane.cpp#L1197-L1201 .

To do:
- Right now I have `TerminalTab` as a friend class of `Pane` so I can access some extra properties in my `WalkTree` callbacks, but there is probably a better choice for the abstraction boundary.

Next Steps:
- In a future PR Drag & Drop handlers could be added that utilize the Attach/Detach infrastructure to provide a better UI.
- Similarly once this is working, it should be possible to convert an entire tab into a pane on an existing tab (Tab::DetachRoot on original tab followed by Tab::AttachPane on the target tab).
- Its been 10 years, I just really want to use concepts already.

<!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
Manual testing by creating pane(s), and moving them between tabs and creating new tabs and destroying tabs by moving the last remaining pane.
@ghost ghost added the Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. label Aug 12, 2021
@ghost
Copy link

ghost commented Aug 31, 2021

🎉This issue was addressed in #10780, which has now been successfully released as Windows Terminal Preview v1.11.2421.0.:tada:

Handy links:

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants