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

Scenario: Add support for panes #1000

Open
33 of 59 tasks
zadjii-msft opened this issue May 24, 2019 · 51 comments
Open
33 of 59 tasks

Scenario: Add support for panes #1000

zadjii-msft opened this issue May 24, 2019 · 51 comments
Assignees
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal Issue-Scenario Product-Terminal The new Windows Terminal.
Milestone

Comments

@zadjii-msft
Copy link
Member

zadjii-msft commented May 24, 2019

image

This is the megathread for tracking all the work related to Panes in the Windows Terminal.

1.0 Features

1.0 Features

1.x features / bugs

2.0 Features / Bugs

Panes Titlebar Follow-ups - See #4998

Backlog items

Theming items

@zadjii-msft zadjii-msft added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label May 24, 2019
@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 May 24, 2019
@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 May 24, 2019
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label May 24, 2019
@zadjii-msft zadjii-msft added this to the Terminal v1.0 milestone May 24, 2019
@DHowett-MSFT DHowett-MSFT removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels May 24, 2019
zadjii-msft added a commit that referenced this issue Jun 7, 2019
* Start working on adding support for panes

  See #1000 for the panes megathread on remaining work.

  The functionality will be there, but the keybinding won't be there, so people have to
  opt-in to it.
@DHowett-MSFT
Copy link
Contributor

DHowett-MSFT commented Jun 8, 2019

We didn't commit the keybinding constants in with which people could opt. ☹️

@decriptor
Copy link

I noticed that @zadjii-msft added the keybindings for panes back. I'm assuming it made it into 0.1.1621.0?

If I add this block:

                "command" : "splitHorizontal",
                "keys" : 
                [
                    "ctrl+shift+-"
                ]
            },
            {
                "command" : "splitVertical",
                "keys" : 
                [
                    "ctrl+shift+|"
                ]
            },

Only Horizontal works. I noticed that if I close Windows Terminal it deletes the splitVertical keybinding from profiles.json.

@zadjii-msft
Copy link
Member Author

@decriptor I believe that's because '|' isn't actually a key we support in the keybindings quite yet - see #1212

@decriptor
Copy link

@zadjii-msft I believe you are right. I used ctrl+1 as a test and it didn't remove it.

@Jaykul
Copy link
Contributor

Jaykul commented Jun 26, 2019

I know you really want it, @zadjii-msft but you have #998 on your list twice ;-)

@zadjii-msft
Copy link
Member Author

@Jaykul good catch, those are supposed to be separate issues.

@akulbe
Copy link

akulbe commented Jul 3, 2019

@zadjii-msft and @Jaykul - just let me know where to send the care packages (hoppy beverages / candy / beef jerky / etc) 😆

Cannot wait for panes to be implemented!

@Fumler
Copy link

Fumler commented Jul 24, 2019

Any chance of getting "focus follows mouse" like in iterm2 and other terminals? So if this setting is turned on, the active pane would be the pane you have your mouse pointer over, without having to click it first.

@Trolldemorted
Copy link

I wrote a startup script which chains multiple split-pane commands, but it always splits one of the results of the last split:

grafik

Can I convice wt somehow to also split the left or top right pane? As you can see the resulting segmentation is neither ideal, nor what all users want.

If not, is there a feature request for that?

@anthonyvdotbe
Copy link
Contributor

@Trolldemorted as is mentioned in the OP:

#4340 Choose Direction to Split Pane

@Trolldemorted
Copy link

#4340 would allow me to specify whether I want to split the right or left pane, but not to split both, right?

@anthonyvdotbe
Copy link
Contributor

Ah yes. What about #3759?

@Trolldemorted
Copy link

Depending how they solve it it might partially cover that, but it won't cover the "commit a batch script in your repository which starts wt in a grid layout" use case, correct? Every user would have to create a profile manually, or we'd have to touch the users' profiles in our batch script.

@zadjii-msft
Copy link
Member Author

So, #4340 "Choose Direction to Split Pane" might be helpful yes, but then you'll still get stuck splitting panes down just one branch of the tree.

What you really want is probably #6580, which will let you move-focus in the commandline, so you'll be able to navigate to other panes and split those.

Also maybe helpful in the future:

@Trolldemorted
Copy link

Thanks @zadjii-msft ! Let's hope #6580 will make it to the roadmap soon.

Can I specify an initial command for the shells somehow? Right now I am using -d . powershell.exe -NoExit -Command someshellcommand, but I am unable to rerun that command with arrow up + enter (it doesn't show up, only old commands from old shells are showing). Tried to do it with add-history, but without success.

ghost pushed a commit that referenced this issue Dec 11, 2020
Adds a "move to previous pane" and "move to next pane" keybinding, which
navigates to the last/first focused pane

We assign pane IDs on creation and maintain a vector of active pane IDs
in MRU order. Navigating panes by MRU then requires specifying which
pane ID we want to focus. 

From our offline discussion (thanks @zadjii-msft for the concise
description):

> For the record, the full spec I'm imagining is:
> 
> { command": { "action": "focus(Next|Prev)Pane", "order": "inOrder"|"mru", "useSwitcher": true|false } },
> 
> and order defaults to mru, and useSwitcher will default to true, when
> there is a switcher. So 
> 
> { command": { "action": "focusNextPane" } },
> { command": { "action": "focusNextPane", "order": "mru" } },
> 
> these are the same action. (but right now we don't support the order
> param)
>  
> Then there'll be another PR for "focusPane(target=id)"
> 
> Then a third PR for "focus(Next|Prev)Pane(order=inOrder)"

> for the record, I prefer this approach over the "one action to rule
> them all" version with both target and order/direction as params,
> because I don't like the confusion of what happens if there's both
> target and order/direction provided. 

References #1000 
Closes #2871
mpela81 pushed a commit to mpela81/terminal that referenced this issue Jan 28, 2021
Adds a "move to previous pane" and "move to next pane" keybinding, which
navigates to the last/first focused pane

We assign pane IDs on creation and maintain a vector of active pane IDs
in MRU order. Navigating panes by MRU then requires specifying which
pane ID we want to focus. 

From our offline discussion (thanks @zadjii-msft for the concise
description):

> For the record, the full spec I'm imagining is:
> 
> { command": { "action": "focus(Next|Prev)Pane", "order": "inOrder"|"mru", "useSwitcher": true|false } },
> 
> and order defaults to mru, and useSwitcher will default to true, when
> there is a switcher. So 
> 
> { command": { "action": "focusNextPane" } },
> { command": { "action": "focusNextPane", "order": "mru" } },
> 
> these are the same action. (but right now we don't support the order
> param)
>  
> Then there'll be another PR for "focusPane(target=id)"
> 
> Then a third PR for "focus(Next|Prev)Pane(order=inOrder)"

> for the record, I prefer this approach over the "one action to rule
> them all" version with both target and order/direction as params,
> because I don't like the confusion of what happens if there's both
> target and order/direction provided. 

References microsoft#1000 
Closes microsoft#2871
@JelteF
Copy link

JelteF commented May 7, 2021

"#6459 Pane focus follows mouse" can be checked off the list, a fix for it has been merged a while back.

@zadjii-msft zadjii-msft removed this from the Terminal v2.0 milestone May 7, 2021
@zadjii-msft
Copy link
Member Author

@JelteF Thanks! Cleaned that up a bit ☺️

@diegopaludo
Copy link

Hi,

There are option to move panes like tmux ?

@ghost ghost added In-PR This issue has a related PR and removed In-PR This issue has a related PR labels Jul 12, 2021
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 zadjii-msft added this to the Megathreads milestone Jan 4, 2022
zadjii-msft added a commit that referenced this issue Mar 26, 2024
Instead of `Pane` hosting a `TermControl` directly, it now hosts an
`IPaneContent`. This is an abstraction between the TermControl and the
pane itself, to allow for arbitrary implementations of `IPaneContent`,
with things that might not be terminals.

## References and Relevant Issues

* #997
* #1000

## Detailed Description of the Pull Request / Additional comments

This PR by itself doesn't do much. It's just a refactoring. 
- It doesn't actually add any other types of pane content. 
- It overall just tries to move code whenever possible, with as little
refactoring as possible. There are some patterns from before that don't
super scale well to other types of pane content (think: the `xyzChanged`
events on `IPaneContent`).
- There's a few remaining places where Pane is explicitly checking if
its content is a terminal. We probably shouldn't, but meh

There are two follow-up PRs to this PR:
* #16171 
* #16172 

In addition, there's more work to be done after these merge:
* TODO! issue number for "Replace `IPaneContent::xyzChanged` with
`PropertyChanged` events"
* TODO! issue number for "Re-write state restoration so panes don't
produce `NewTerminalArgs`"

## Validation Steps Performed

* It still launches
* It still works
* Broadcasting still works
* The weird restart connection thing from #16001 still works

## PR Checklist
- [x] Closes #997


## other PRs
* #16170 <-- you are here 
* #16171
* #16172
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-Scenario Product-Terminal The new Windows Terminal.
Projects
None yet
Development

No branches or pull requests