Feature Request: Ability to clone current tab #3405

Closed
opened 2026-01-30 23:20:32 +00:00 by claunia · 5 comments
Owner

Originally created by @nicoabie on GitHub (Aug 14, 2019).

Description of the new feature/enhancement

Ability to clone the current tab preserving the current directory

Proposed technical implementation details (optional)

Originally created by @nicoabie on GitHub (Aug 14, 2019). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 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 Ability to clone the current tab preserving the current directory <!-- 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). --> # Proposed technical implementation details (optional) <!-- A clear and concise description of what you want to happen. -->
claunia added the Issue-FeatureNeeds-TriageResolution-Duplicate labels 2026-01-30 23:20:32 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Aug 14, 2019):

This is a dupe of a bunch of related conversations:

https://github.com/microsoft/terminal/issues/1756#issuecomment-520048598

Just chiming in;

_ (profile,working dir, environment var, etc)._

Anything about the actual process on the other end is, in the general case, impossible to replicate. The connected process could be ssh.exe, whose environment variables and working directory have no bearing on the detectable environment and working directory from the terminal side. The same actually, weirdly enough, applies to WSL. It doesn't use "working directory" and it doesn't expose its environment variables to interested Windows processes in any way.

Powershell doesn't even set the current working directory, so its directory can't be detected (!) either.

https://github.com/microsoft/terminal/issues/2315#issuecomment-519317472

This is one of those things that is impossible in the general case but technically possible. There's a lot of intricacies here, like:

cmd
powershell
cd d:\users

well, powershell isn't the first process we launched. we'd ignore the path d:\users

(in powershell)
cd d:\users

we'd ignore d:\users because powershell doesn't actually set the current working directory (!!)

If your "shell" is ssh dustin@example.com (where we strictly define shell to be "the first process Terminal spawns on your behalf"), its working directory is always going to be C:\windows\system32 regardless of what the remote working directory is.

I'd rather not provide the feature than provide the feature with so many caveats that they'd fill a documentation page. ☹️ sorry.

https://github.com/microsoft/terminal/issues/1536#issuecomment-519107586

No, because that would likely be neigh impossible to do in a general sense. How would we duplicate an instance of vim for example? What if the foreground process has opened some sort of file for exclusive access - how could we duplicate that process?

If there's a way this can be done safely and generally I'm all ears for proposed technical solutions, but I don't think it's something that's possible, so I'm not going to be investigating it.


If this is generally technically possible, I'd love to implement it. But I'm/we're not sure that it'll work right in most scenarios, so I'd rather not add a feature that in the general case doesn't work the way you'd expect.

@zadjii-msft commented on GitHub (Aug 14, 2019): This is a dupe of a bunch of related conversations: ## https://github.com/microsoft/terminal/issues/1756#issuecomment-520048598 > > Just chiming in; > > > _ (profile,working dir, environment var, etc)._ > > Anything about the _actual process_ on the other end is, in the general case, impossible to replicate. The connected process could be `ssh.exe`, whose environment variables and working directory have no bearing on the detectable environment and working directory from the terminal side. The same actually, weirdly enough, applies to WSL. It doesn't use "working directory" and it doesn't expose its environment variables to interested Windows processes in any way. > > Powershell doesn't even _set_ the current working directory, so its directory can't be detected (!) either. ## https://github.com/microsoft/terminal/issues/2315#issuecomment-519317472 > > > This is one of those things that is impossible in the general case but _technically possible_. There's a lot of intricacies here, like: > > ``` > cmd > powershell > cd d:\users > ``` > > well, powershell isn't the first process we launched. we'd ignore the path `d:\users` > > ``` > (in powershell) > cd d:\users > ``` > > we'd ignore `d:\users` because powershell _doesn't actually set the current working directory_ (!!) > > If your "shell" is `ssh dustin@example.com` (where we strictly define shell to be "the first process Terminal spawns on your behalf"), its working directory is always going to be `C:\windows\system32` regardless of what the remote working directory is. > > I'd rather not provide the feature than provide the feature with so many caveats that they'd fill a documentation page. ☹️ sorry. ## https://github.com/microsoft/terminal/issues/1536#issuecomment-519107586 > > No, because that would likely be neigh impossible to do in a general sense. How would we duplicate an instance of vim for example? What if the foreground process has opened some sort of file for exclusive access - how could we duplicate that process? > > If there's a way this can be done safely and generally I'm all ears for proposed technical solutions, but I don't think it's something that's possible, so I'm not going to be investigating it. <hr> If this is _generally_ technically possible, I'd _love_ to implement it. But I'm/we're not sure that it'll work right in most scenarios, so I'd rather not add a feature that in the general case _doesn't_ work the way you'd expect.
Author
Owner

@ghost commented on GitHub (Aug 15, 2019):

This issue has been marked as duplicate and has not had any activity for 1 day. It will be closed for housekeeping purposes.

@ghost commented on GitHub (Aug 15, 2019): This issue has been marked as duplicate and has not had any activity for **1 day**. It will be closed for housekeeping purposes.
Author
Owner

@nicoabie commented on GitHub (Aug 20, 2019):

@zadjii-msft I'm not asking to clone a process the tab lauched.
It is a common use case to launch a terminal navigate to a directory and launch a few more.
That's what this feature request is asking, nothing else.

Can you reconsider opening this feature request again?

@nicoabie commented on GitHub (Aug 20, 2019): @zadjii-msft I'm not asking to clone a process the tab lauched. It is a common use case to launch a terminal navigate to a directory and launch a few more. That's what this feature request is asking, nothing else. Can you reconsider opening this feature request again?
Author
Owner

@zadjii-msft commented on GitHub (Aug 20, 2019):

I didn't close this based on the fact that it's impossible to clone a process's state generally - I closed it because it was a dupe of like 3 other feature requests. Also, we'd consider the path duplication if it was generally possible. Our current understanding is that we don't think that's possible - see my above comment, esp. the #1756 and #2315 comments on why we don't think that's possible.

@zadjii-msft commented on GitHub (Aug 20, 2019): I didn't close this based on the fact that it's impossible to clone a process's state generally - I closed it because it was a dupe of like 3 other feature requests. Also, we'd consider the path duplication _if it was generally possible_. Our current understanding is that we don't think that's possible - see my above comment, esp. the #1756 and #2315 comments on why we don't think that's possible.
Author
Owner

@nicoabie commented on GitHub (Aug 20, 2019):

Got it, thanks @zadjii-msft

@nicoabie commented on GitHub (Aug 20, 2019): Got it, thanks @zadjii-msft
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#3405