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

Swap panes #4922

Open
kostrse opened this issue Mar 14, 2020 · 7 comments
Open

Swap panes #4922

kostrse opened this issue Mar 14, 2020 · 7 comments
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal Help Wanted We encourage anyone to jump in on these. Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal.
Milestone

Comments

@kostrse
Copy link

kostrse commented Mar 14, 2020

Right now, after splitting my screen onto two panes, I cannot find a way to swap the panes between each other.

In tmux it's possible to move/swap opened panes in different ways.

Moving panes around in tmux:

C-a {          move the current pane to the previous position
C-a }          move the current pane to the next position
C-a C-o        rotate window ‘up’ (i.e. move all panes)
C-a M-o        rotate window ‘down’
C-a !          move the current pane into a new separate
               window (‘break pane’)
C-a :move-pane -t :3.2
               split window 3's pane 2 and move the current pane there

Related tmux commands:

  • swap-pane e.g. :swap-pane -s (first pane index) -t (second pane index)
  • move-pane
@kostrse kostrse added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Mar 14, 2020
@ghost ghost added Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Mar 14, 2020
@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 Mar 16, 2020
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Mar 16, 2020
@zadjii-msft zadjii-msft added this to the Terminal Backlog milestone Mar 16, 2020
@zadjii-msft
Copy link
Member

This is fairly similar to another request that's already being tracked in #1000

A switch panes option? Like a switchLeft, switchRight, switchUp, switchDown, to allow the user to rearrange the panes layout (#1000 (comment))

but this is unique enough that I'll leave it open to track independently. Thanks!

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

Yanking triage off this one

ghost pushed a commit that referenced this issue Jul 22, 2021
…2) (#10638)

<!-- 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 swap a pane with an adjacent (Up/Down/Left/Right) neighbor.

<!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> 
## References
This work potentially touches on: #1000 #2398 and #4922
<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist
* [x] Closes a component of #1000 (partially, comment), #4922 (partially, `SwapPanes` function is added but not hooked up, no detach functionality)
* [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA
* [x] Tests added/passed
* [ ] 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

Its been a while since I've written C++ code, and it is my first time working on a Windows application. I hope that I have not made too many mistakes.

Work currently done:
- Add boilerplate/infrastructure for argument parsing, hotkeys, event handling
- Adds the `MovePane` function that finds the focused pane, and then tries to find
  a pane that is visually adjacent to according to direction.
- First pass at the `SwapPanes` function that swaps the tree location of two panes
- First working version of helpers `_FindFocusAndNeighbor` and `_FindNeighborFromFocus`
  that search the tree for the currently focused pane, and then climbs back up the tree
  to try to find a sibling pane that is adjacent to it. 
- An `_IsAdjacent' function that tests whether two panes, given their relative offsets, are adjacent to each other according to the direction.

Next steps:
- Once working these functions (`_FindFocusAndNeighbor`, etc) could be utilized to also solve #2398 by updating the `NavigateFocus` function.
- Do we want default hotkeys for the new actions?

<!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
At this point, compilation and manual testing of functionality (with hotkeys) by creating panes, adding distinguishers to each pane, and then swapping them around to confirm they went to the right location.
Rosefield added a commit to Rosefield/terminal that referenced this issue Jul 22, 2021
…2) (microsoft#10638)

<!-- 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 swap a pane with an adjacent (Up/Down/Left/Right) neighbor.

<!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> 
## References
This work potentially touches on: microsoft#1000 microsoft#2398 and microsoft#4922
<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist
* [x] Closes a component of microsoft#1000 (partially, comment), microsoft#4922 (partially, `SwapPanes` function is added but not hooked up, no detach functionality)
* [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA
* [x] Tests added/passed
* [ ] 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

Its been a while since I've written C++ code, and it is my first time working on a Windows application. I hope that I have not made too many mistakes.

Work currently done:
- Add boilerplate/infrastructure for argument parsing, hotkeys, event handling
- Adds the `MovePane` function that finds the focused pane, and then tries to find
  a pane that is visually adjacent to according to direction.
- First pass at the `SwapPanes` function that swaps the tree location of two panes
- First working version of helpers `_FindFocusAndNeighbor` and `_FindNeighborFromFocus`
  that search the tree for the currently focused pane, and then climbs back up the tree
  to try to find a sibling pane that is adjacent to it. 
- An `_IsAdjacent' function that tests whether two panes, given their relative offsets, are adjacent to each other according to the direction.

Next steps:
- Once working these functions (`_FindFocusAndNeighbor`, etc) could be utilized to also solve microsoft#2398 by updating the `NavigateFocus` function.
- Do we want default hotkeys for the new actions?

<!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
At this point, compilation and manual testing of functionality (with hotkeys) by creating panes, adding distinguishers to each pane, and then swapping them around to confirm they went to the right location.
@zadjii-msft
Copy link
Member

With #10638 merged, I'm gonna leave this open to track implementing the swapPane(from={id}, to={it}) action. I'm gonna pop the rotatePanes action into it's own separate issue for tracking purposes.

@Rosefield
Copy link
Contributor

To note, there is now a Pane::SwapPanes function , so all that needs to be done for swap-pane(from{id}, to={id}) is adding the boilerplate for the command and actually calling SwapPanes.

@zadjii-msft
Copy link
Member

Oh hey look, this was added in #10780!

@ghost ghost added the Needs-Tag-Fix Doesn't match tag requirements label Dec 9, 2021
@Rosefield
Copy link
Contributor

With #10638 merged, I'm gonna leave this open to track implementing the swapPane(from={id}, to={it}) action. I'm gonna pop the rotatePanes action into it's own separate issue for tracking purposes.

I'm fairly certain that I did not implement this specifically, at least it isn't user accessible, see my comment above. While SwapPanes lets you do all kinds of things, the UI doesn't let you swap 2 arbitrary panes by their IDs.

@zadjii-msft
Copy link
Member

zadjii-msft commented Dec 9, 2021

That's what I get for not reading and getting high on closing out issues 😜

@zadjii-msft zadjii-msft reopened this Dec 9, 2021
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Dec 9, 2021
@zadjii-msft zadjii-msft removed this from the Terminal Backlog milestone Jan 4, 2022
@zadjii-msft zadjii-msft added this to the Backlog milestone Jan 4, 2022
@zadjii-msft zadjii-msft added Help Wanted We encourage anyone to jump in on these. Issue-Task It's a feature request, but it doesn't really need a major design. and removed Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. labels Jul 5, 2022
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 Help Wanted We encourage anyone to jump in on these. Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal.
Projects
Status: Should be written
Development

No branches or pull requests

4 participants