Terminal: Feature Request - Duplicate tab (Basic)

Created on 24 Jun 2019  路  21Comments  路  Source: microsoft/terminal

Summary

Add "Duplicate Tab" option to open same profile in different tab

Area-User Interface In-PR Issue-Feature Product-Terminal Resolution-Fix-Committed

Most helpful comment

@CoskunSunali 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.

All 21 comments

How sould you be able to trigger the duplication of a tab?

So, what do you mean by "duplicate"? I have a few ways to interpret this:

  • "Simple": same thing as opening a new tab of the same profile via the drop down menu
  • "Partial State Copy": new tab has the same profile but is in the same directory (if applicable). This is similar to #1437
  • "Full State Copy": keep the command history intact and be in the same directory

Also, if there's interest in the latter two, what are some things in the "state" that should be maintained?

NOTE: I think we wouldn't be able to do the last one today, but we can definitely make strides towards it in the long run :)

@dnagl, triggering could be using Keyboard combo such as Ctrl+Shift+D
@carlos-zamora , excellent breakdown, I was thinking "Simple", duplicating the current profile only.

However, I see no reason 2, 3 can't be in the long run Roadmap too as you noted.

Re "state":
My use case is SSHing from local shell to multiple remote servers, so duplicating the SSH session from current profile would be very useful.

Personally, I think this would be a great thing to have as an option in a flyout menu when you right-click on a tab. Similar to when you right-click a tab in Edge.

@J00MZ I am with you that this is a bigger feature and to provide a simple implmentation to duplicate a tab with the current used profile would be the first step in the right direction.

@carlos-zamora A flyout menu would be a good idea. However, this functionality should be available also by using a keyboard shorcut.

Maybe I am able to provide a simple implementation of this feature request and bring it into the master of the project with a pull request.

@dnagl Yup! We're on the same page. And we can't do the flyout menu until #760 gets resolved anyways.

I'd very much appreciate it if you implement this. 馃槉 Let me know if you have any questions! (and definitely add me as a reviewer so I get a notification when it comes in)

@carlos-zamora "Simple" + custom shortcut is good enough
@J00MZ if has the "Simple" way, can use commandline in profile.json to implement FAKE "Full State Copy",

"commandline" : "wsl.exe -d Legacy -- /path_to/ssh_script",

@xmm1989218 I've used the command line in profile.json for similar stuff, such as defaulting to a specific directory which has my custom .bashrc, but I'd classify it as a "hack", not feature.

@J00MZ your right. it is hack. if has many ssh-host will seem ugly. it just works at light startup job

@carlos-zamora I have some problems to get the keybindings to work properly. Maybe you could have a look at the code in my repository and the last commit on the featurebranch. When I am pressing CTRL+SHIFT+D the method AppKeyBindings::TryKeyChord gets called but there is no element in _keyShortcuts for the keybinding

Repository

Edit

I fixed the problem. I was adding the keybinding in the wrong profiles.json file

Would a duplicate Tab maintain the same history and current output?

@mdtauk see @carlos-zamora reply re the options this could be implemented.

@carlos-zamora I cannot add you as a reviewer to the pull request. Am I missing some permissions for this action?

Huh. I guess you do need permissions for that. Found it though. I'll try and get to it tomorrow. Thanks!

:tada:This issue was addressed in #1685, which has now been successfully released as Windows Terminal Preview v0.3.2142.0.:tada:

Handy links:

It seems that new tab and duplicate tab features work the same way for me when I use it for WSL. E.g. they both create a new tab and nothing else.

I SSHed into a server using Ubuntu, duplicated the tab, SSH session is not carried over. I switched to a directory and duplicated the tab, the directory was set to the default startingDirectory which is //wsl$/Ubuntu/home/coskun.

So why would I use the duplicate feature? No pun intended, just trying to understand what is the advantage of using the duplicate feature over creating a new tab.

@CoskunSunali
The duplicate tab feature defaults to the profile you are using now.
Opening a new tab defaults to your default profile.

If you use various different profiles in Terminal, it's very convenient to duplicate your current working one rather than the default one.

For example, my default profile is Ubuntu 18 WSL, but I may want to duplicate my Powershell or Ubuntu 16 WSL tabs.

image

@J00MZ That totally makes sense. Thank you for the insights.

Sorry for the spam. Are there any plans for implementing state duplication? E.g. carrying over the SSH session?

@CoskunSunali 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.

@zadjii-msft and @J00MZ Thanks a lot for your time replying and explaining. Appreciated.

Was this page helpful?
0 / 5 - 0 ratings