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

Duplicate active half when duplicating split pane #13579

Closed
vertigo220 opened this issue Jul 23, 2022 · 8 comments
Closed

Duplicate active half when duplicating split pane #13579

vertigo220 opened this issue Jul 23, 2022 · 8 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-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2) Product-Terminal The new Windows Terminal. Resolution-Fix-Available It's available in an Insiders build or a release
Milestone

Comments

@vertigo220
Copy link

Description of the new feature/enhancement

When a pane is split then duplicated, the right half is always the one duplicated. It should duplicate whichever half has focus when right-clicking the tab.

Proposed technical implementation details (optional)

@vertigo220 vertigo220 added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Jul 23, 2022
@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 23, 2022
@zadjii-msft
Copy link
Member

Hmm. This is with the right-click context menu on the tab itself, yea?
image

Seems like whenever the inactive tab is split, it's like we make a new default profile pane, rather than duplicating the active pane. Curious. Thanks for the bug report! It should probably do the same thing when the tab is inactive, as it does when the tab is active.

@zadjii-msft zadjii-msft added Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal. and removed Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. labels Jul 23, 2022
@vertigo220
Copy link
Author

Yes, but I'm actually referring to the "Duplicate Tab" option. Open a tab, split it, change the directory on one half, then duplicate it, and the new tab created by the duplication has the path of one or the other of the split tab's panes, obviously. The problem is that it's very insistent on using whichever pane it feels like for the path in the new, duplicated tab. When I first tested it, it was always the right pane. Testing again just now, it was the left pane, then somehow I got it to switch to using the path from the right pane and I can't get it to switch back. It should use the path from whichever pane is active when the tab is duplicated.

The same problem applies to splitting an already split tab. The new pane has the same behavior as the new tab created when duplicating, and should have the path of the active pane when the tab is further split.

@vertigo220
Copy link
Author

To add to this, I've found more unexpected behavior I think may be related. I have the starting directory for a new tab set to use the parent process directory, which I apparently wrongfully assumed meant the parent tab, but AFAICT it uses the first tab's CWD. This appears to be what issue #3158 deals with, and if that's correct this isn't a bug, but definitely, as mentioned, unexpected. However, what definitely does appear to be a bug is that even duplicating a tab results in the new tab having the CWD of the first tab, and I suspect that's the source of the previously mentioned problems.

@zadjii-msft zadjii-msft added Help Wanted We encourage anyone to jump in on these. Area-User Interface Issues pertaining to the user interface of the Console or Terminal Priority-2 A description (P2) labels Jul 25, 2022
@zadjii-msft zadjii-msft added this to the Backlog milestone Jul 25, 2022
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Jul 25, 2022
@zadjii-msft zadjii-msft removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Jul 26, 2022
@4wk-
Copy link

4wk- commented Mar 10, 2023

Hello. I was about to create my own issue with a somewhate-related subject: shouldn't the "Duplicate tab" duplicate also the split pane layout?
From my understanding, when I right click on a tab that is splitted in 4 ways, I'm expecting the new created tab to be the same: being split in 4.
Am I the only one? Am I missing something?

@zadjii-msft
Copy link
Member

@4wk- That we're more specifically tracking in a combo of #4674 and #9957.

@zadjii-msft
Copy link
Member

To add, I think this was fixed at some point in the past. I at least can't repro it on the 1.18 selfhost build build I'm on currently. I'd suspect this was at least fixed in 1.17, probably sooner. I can't really recall which PR fixed this.

Of course, duplicating the CWD of a pane that assumes that you've got shell integration enabled, but this all looks working to me.

I tried both

  1. Open a non-default profile in a second tab
  2. Open a new pane in that tab with another non-default profile
  3. focus the first tab
  4. Right-click inactive tab...split tab -> Always splits the focused pane, and creates a copy of the focused pane

and also

  1. Open a tab,
  2. split it,
  3. change the directory on one half,
  4. then duplicate it -> new tab is created with the profile (and CWD if shell integration is enabled) of the active pane.

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Tag-Fix Doesn't match tag requirements label Mar 10, 2023
@zadjii-msft zadjii-msft added Resolution-Fix-Available It's available in an Insiders build or a release and removed Needs-Tag-Fix Doesn't match tag requirements labels Mar 10, 2023
@4wk-
Copy link

4wk- commented Mar 13, 2023

@zadjii-msft Thanks for your reply. [EDITED]
I'm not sure I understand you correctly, sorry. I am not talking about CWD at all, I'm talking about the "view/layout" of a given tab. What I am wondering if it's possible is:

  • open a new tab
  • right click on tab, and click "Split tab" (so now, we have one tab, split in two panes: windowsTerminalSplitTab
  • right click on tab, and click "Duplicate tab"

My expectation is: having a new second tab split in two panes too!
(So in total, 2 tabs, and both split in two)

I don't need the CWD to be kept, I'm just talking about tab layout. For my understanding, shell integration enabled is only to enable CWD (current working directory), and not about split tabs. Correct me if I'm wrong!

Sorry again if I'm not clear enough.
I am on Version: 1.16.10261.0 .

@4wk-
Copy link

4wk- commented Mar 23, 2023

@zadjii-msft After more reading, I can confirm that what I'm asking for is #4674: when using the "Duplicate tab" feature, panes should be kept the same (so if a tab is split in 3 panes, "Duplicate tab" should create a new tab with 3 panes in it).
And if I understand correctly, #9957 is needed before #4674 can be worked on. Thanks!

zadjii-msft added a commit that referenced this issue Aug 24, 2023
This PR's goal is to allow something like a `Tab` to raise a
ShortcutAction, by saying "this action should be performed on ME". We've
had a whole category of these issues in the past:

* #15734
* #15760 
* #13579
* #13942
* #13942
* Heck even dating back to #10832

So, this tries to remove a bit of that footgun. This probably isn't the
_final_ form of what this refactor might look like, but the code is
certainly better than before.

Basically, there's a few bits:

* `ShortcutActionDispatch.DoAction` now takes a `sender`, which can be
_anything_.
* Most actions that use a "Get the focused _thing_ then do something to
it" are changed to "If there was a sender, let's use that - otherwise,
we'll use the focused _thing_".
* TerminalTab was largely refactored to use this, instead of making
requests to the `TerminalPage` to just do a thing to it.

I've got a few TODO!s left, but wanted to get initial feedback. 
* [x] `TerminalPage::_HandleTogglePaneZoom`
* [x] `TerminalPage::_HandleFocusPane`
* [x] `TerminalPage::_MoveTab`


Closes #15734
DHowett pushed a commit that referenced this issue Sep 22, 2023
This PR's goal is to allow something like a `Tab` to raise a
ShortcutAction, by saying "this action should be performed on ME". We've
had a whole category of these issues in the past:

* #15734
* #15760
* #13579
* #13942
* #13942
* Heck even dating back to #10832

So, this tries to remove a bit of that footgun. This probably isn't the
_final_ form of what this refactor might look like, but the code is
certainly better than before.

Basically, there's a few bits:

* `ShortcutActionDispatch.DoAction` now takes a `sender`, which can be
_anything_.
* Most actions that use a "Get the focused _thing_ then do something to
it" are changed to "If there was a sender, let's use that - otherwise,
we'll use the focused _thing_".
* TerminalTab was largely refactored to use this, instead of making
requests to the `TerminalPage` to just do a thing to it.

I've got a few TODO!s left, but wanted to get initial feedback.
* [x] `TerminalPage::_HandleTogglePaneZoom`
* [x] `TerminalPage::_HandleFocusPane`
* [x] `TerminalPage::_MoveTab`

Closes #15734

(cherry picked from commit 30eb9ee)
Service-Card-Id: 90438493
Service-Version: 1.18
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-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2) Product-Terminal The new Windows Terminal. Resolution-Fix-Available It's available in an Insiders build or a release
Projects
None yet
Development

No branches or pull requests

3 participants