Duplicate active half when duplicating split pane #18014

Closed
opened 2026-01-31 06:01:16 +00:00 by claunia · 8 comments
Owner

Originally created by @vertigo220 on GitHub (Jul 23, 2022).

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)

Originally created by @vertigo220 on GitHub (Jul 23, 2022). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> # Description of the new feature/enhancement <!-- A clear and concise description of what the problem is that the new feature would solve. Describe why and how a user would use this new functionality (if applicable). --> 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) <!-- A clear and concise description of what you want to happen. -->
Author
Owner

@zadjii-msft commented on GitHub (Jul 23, 2022):

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 commented on GitHub (Jul 23, 2022): Hmm. This is with the right-click context menu on the tab itself, yea? ![image](https://user-images.githubusercontent.com/18356694/180624997-27577c7d-34c6-4a33-85a2-326087d0ca72.png) 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.
Author
Owner

@vertigo220 commented on GitHub (Jul 24, 2022):

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 commented on GitHub (Jul 24, 2022): 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.
Author
Owner

@vertigo220 commented on GitHub (Jul 25, 2022):

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.

@vertigo220 commented on GitHub (Jul 25, 2022): 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.
Author
Owner

@4wk- commented on GitHub (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?

@4wk- commented on GitHub (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?
Author
Owner

@zadjii-msft commented on GitHub (Mar 10, 2023):

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

@zadjii-msft commented on GitHub (Mar 10, 2023): @4wk- That we're more specifically tracking in a combo of #4674 and #9957.
Author
Owner

@zadjii-msft commented on GitHub (Mar 10, 2023):

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.
@zadjii-msft commented on GitHub (Mar 10, 2023): 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](https://learn.microsoft.com/en-us/windows/terminal/tutorials/new-tab-same-directory), 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.
Author
Owner

@4wk- commented on GitHub (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- commented on GitHub (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](https://user-images.githubusercontent.com/1439550/224660944-76cf983e-eb30-4631-8574-73b67a348d5b.png) - 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](https://learn.microsoft.com/en-us/windows/terminal/tutorials/new-tab-same-directory) 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` .
Author
Owner

@4wk- commented on GitHub (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!

@4wk- commented on GitHub (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!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#18014