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

Add the "Move Tab to New Window" item to the context menu of the tabs #15127

Closed
zadjii-msft opened this issue Apr 6, 2023 · 37 comments · Fixed by #15376
Closed

Add the "Move Tab to New Window" item to the context menu of the tabs #15127

zadjii-msft opened this issue Apr 6, 2023 · 37 comments · Fixed by #15376
Labels
Area-UserInterface Issues pertaining to the user interface of the Console or Terminal good first issue This is a fix that might be easier for someone to do as a first contribution Help Wanted We encourage anyone to jump in on these. In-PR This issue has a related PR Issue-Task It's a feature request, but it doesn't really need a major design. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal.
Milestone

Comments

@zadjii-msft
Copy link
Member

          Is it supposed to add the "Move Tab to New Window" item to the context menu of the tabs

Screenshot_2023-04-06_08-54-54
like Mozilla Firefox
Screenshot_2023-04-06_08-55-44
in the context of this task?

Screenshots of Windows Terminal Preview 1.17.1023 and Mozilla Firefox 111.0.1 (64-bit), Microsoft Windows 10.0.19045.2788.

Originally posted by @Korb in #1256 (comment)

@microsoft-github-policy-service microsoft-github-policy-service bot 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 Apr 6, 2023
@carlos-zamora carlos-zamora added Help Wanted We encourage anyone to jump in on these. Area-UserInterface Issues pertaining to the user interface of the Console or Terminal Product-Terminal The new Windows Terminal. Issue-Task It's a feature request, but it doesn't really need a major design. good first issue This is a fix that might be easier for someone to do as a first contribution and removed 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 Apr 26, 2023
@carlos-zamora carlos-zamora added this to the Backlog milestone Apr 26, 2023
@Jaswir
Copy link
Contributor

Jaswir commented May 11, 2023

Want to tackle my first issue for this project.
Having trouble getting the project build in visual studio which I need to Run & Debug.

I installed all the prerequisites as described in README as far as I know.
And am able to build it with Powershell.

Had some trouble with Configuration manager when first opening the project in Visual Studio.
https://stackoverflow.com/questions/72852490/current-solution-contains-incorrect-configuration-mappings

Cleared everything between
GlobalSection(ProjectConfigurationPlatforms) = postSolution
and
EndGlobalSection

For the OpenConsole.sln file.

Properties for Cascadia Package have been set in the Debug menu to "Native Only" for "Application process" and "Background task process".

x64 Platform has been selected.

This is what I get:
image

I tried x86 , makes no difference.
Turned off Windows Defender, doesn't make a difference
https://stackoverflow.com/questions/16680717/error-msb6006-mt-exe-exited-with-code-31

@zadjii-msft
Copy link
Member Author

zadjii-msft commented May 11, 2023

Oh you can almost certainly ignore the warning that VS shows about the incorrect configurations. I'd revert all your changes to OpenConsole.sln, then make sure you pick:

And that should just work.

Our sln is a crazy hodgepodge of c++ and C# code and unsurprisingly, VS does not care for that 😅

Lemme know if you run into any other issues

@Jaswir
Copy link
Contributor

Jaswir commented May 12, 2023

@zadjii-msft

Reverted all changes to OpenConsole.sln by removing and recloning the project.

Picked:
image

Restored and updated submodules
git submodule update --init --recursive

Ignored warning about incorrect configurations.
In the Debug menu, I changed "Application process" and "Background task process" to "Native Only".

Build it, had an issue with nuget packages:

Nuget Package Restore 2023-05-12 114632

Solved that by building with Powershell. This installed the packages, but this time build ended with errors.
Afterwards I deleted the Obj and Bin folder of the project and build it with visual studio, getting the same erros as before, but getting similar errors with PowerShell now as well:

Same Errors

image

image

@zadjii-msft
Copy link
Member Author

(_ConsoIeGenerateAdditionaIWinmdManifests target) —>
    mt.exe: command line error c1010007: Unexpected/ Unknown option "...\Microsoft.Termina1.Control\Microsoft.Terminal.Control.winmd". Use the / ? option for help on usage and samples. 
    The command `mt.exe -winmd:...\Termina1.Control\Microsoft.Terminal.Control.winmd -dll:Microsoft.Terminal.Control.dll -out:...WindowsTerminal\Microsoft.Terminal.Control.manifest exited with code 31

Huh. I've literally never seen that before. That'll require some searching.

When you built it from the command-line the first time, it worked and you didn't run into that?

Utterly bewildering.

@ianjoneill
Copy link
Contributor

Silly question - does the username covered up with the blue splodge contain any odd characters - like a space?

@Jaswir
Copy link
Contributor

Jaswir commented May 12, 2023

@ianjoneill

Yes It contains a space.

Update 1:
I tried building with Powershell in two separate locations one in my User folder, the other in C:.
In C: I don't get the mt.exe errors Getting Nuget package restore errors so that's an improvement :)
Thanks.

Update 2 :

image

@Jaswir
Copy link
Contributor

Jaswir commented May 12, 2023

@ianjoneill @zadjii-msft

Got it running in VS thanks very much to @ianjoneill !
and @zadjii-msft for the configuration Manager ignore tip.
image

@Jaswir
Copy link
Contributor

Jaswir commented May 12, 2023

@zadjii-msft @ianjoneill

“That'll require some searching.”
Would you have done that? What is like protocol in this Open Source project in terms of help you can expect from Members ?

Can I expect you to do the searching. Or is it more like you expect me to do the searching and try various different things. And I can expect a small hint here and there?

PS: I'll get to picking up this issue now I got Debugger working.

@zadjii-msft
Copy link
Member Author

“That'll require some searching.”
Would you have done that?

I mean, yea? I was planning on trying to look into that error myself if you couldn't figure it out. Pretty much my biggest priority is helping keep folks unblocked. I'm all for giving hints - heck, I've got an entire project board full of "walkthroughs" I've written for issues: https://aka.ms/terminal-walkthroughs.

Speaking of which, I should probably write one for this issue too!

@zadjii-msft
Copy link
Member Author

Note

Walkthrough

  • I'd start by looking at TerminalTab::_CreateContextMenu. That's where we set up the tab context menu.
  • Almost all the buttons work by triggering a WINRT_CALLBACK, which is ultimately handled by a handler set up in TerminalPage::_InitializeTab (in TabManagement.cpp)
  • To actually do the moving, you'll want to build a MoveTabArgs with the Window set to "new".
    • You'll want to then call TerminalPage._MoveTab
  • The trick here will be being able to move an unfocused tab. "Find" has a similar issue. It might be a sensible place to do a page->_SetFocusedTab(*tab); first, to manually focus that tab.

@zadjii-msft zadjii-msft moved this from Should be written to Walkthrough in issue in Terminal Walkthroughs May 12, 2023
@Jaswir
Copy link
Contributor

Jaswir commented May 15, 2023

@zadjii-msft Your walkthroughs look really cool, in the sense that you build it like a game!! I love that.

Btw, the software not being able to be build when someone has a username that contains a space. This may be a new issue? If so, I could make a new issue for it.
Can't help but being bugged by not having the project in my preferable location.

@Jaswir
Copy link
Contributor

Jaswir commented May 15, 2023

Made some progress, got the UI part done.
UI_Part_done_mostly

Button will need a new Glyph though. I assume you have like an artist for that?

Still need to build the functionality, currently duplicates duplicate tab functionality.

@Jaswir
Copy link
Contributor

Jaswir commented May 15, 2023

I started exploring the code base a bit and have some questions:

Where are cpp files inside solution explorer, like where is TerminalTab.cpp?
Can find it in file explorer, but not solution explorer. Is this a cpp thing or? (more used to c#)
And if it is there, how can I find it? I remember something about shortcuts for that, but not sure.

where_are_cpp_files_inside_solution_explorer
but_inside_file_explorer

@Jaswir
Copy link
Contributor

Jaswir commented May 16, 2023

Functionality added, here's the preview:
Functionality_done_onto_commit

Will be working towards pull request.

@zadjii-msft
Copy link
Member Author

That looks great!

Presumably you figured it out, but the .cpp files are nested under the .h files (usually). Some of them are nested under the .idl's or .xaml's. Honestly, I don't know why VS chooses to do it that way 🤷 I've honestly only ever used the "Go to files" shortcut (which I think is sound to ctrl+shift+t) in VS. Way easier than trying to navigate the project structure. Just type bits of the file name and go. But then again, I'm more of a Sublime / VsCode user than a VS one - I just use big VS for building and debugging 😆

@Jaswir
Copy link
Contributor

Jaswir commented May 17, 2023

@zadjii-msft

image

What do you mean with TerminalApp? The code files named TerminalApp? Like TerminalApp.h, TerminalApp.cs
Or files in the TerminalApp Project inside the VS Solution?
This one, see below
image

@Jaswir
Copy link
Contributor

Jaswir commented May 17, 2023

@zadjii-msft

!! Making sure you notice it needs a different Glyph, currently uses the Duplicate glyph.
I assume you have like an artist for that?

@zadjii-msft
Copy link
Member Author

Ah yea - those are probably a little out of date. But yea TerminalApp in that context means "The TerminalApp project". Which these days is probably more accurately "anything that uses C++/WinRT".

I'd honestly just use one of the following two icons from the built-in Segoe Fluent Icons

Glyph Unicode point Description
image e8a7 OpenInNewWindow
image e78b NewWindow

OpenInNewWindow looks good to me.

@Jaswir
Copy link
Contributor

Jaswir commented May 17, 2023

@zadjii-msft

I Noticed you hadn't commented for a couple days. When are you available to respond to questions? Do you have certain days you are working on this project?

@Jaswir
Copy link
Contributor

Jaswir commented May 17, 2023

@zadjii-msft

Did the Pull Request.

By contributing to this Open Source Project. I intend to become a better Engineer. Would appreciate any tips/advice you can give.

Let me know if something need to be changed.

@Jaswir
Copy link
Contributor

Jaswir commented May 18, 2023

@zadjii-msft

I really appreciate the time and effort you took to write the Walkthrough for this.

But that made it way too easy for me.
Big part of the fun for me in solving these "programming puzzles"/bugs/features etc. is the detective work.
Looking for the files to adapt and what specific piece of code I need to adapt.
And pointing out the specific files and even the methods especially took the fun out of it.

In the future I would very much like less hand holding.
That being said I am still new to c++ so don't go overboard.

@Jaswir
Copy link
Contributor

Jaswir commented May 18, 2023

@zadjii-msft

About your second point.
image

I don't get point 2:
"using the active profile in the current directory."
I interpreted this to mean that the current tab information (active profile in current directory) is used for the tab you want to move. And so you don't create a new tab, but move the current tab (using the active profile in the current directory) to the new window.

I have looked at it and on further inspection Duplicate Tab doesn't work how I expected it to work...
Duplicate_Not_working_As_Expected_Question_mark

Duplicate just creates a tab with same terminal type e.g. Powershell
But what I expect is an actually duplicated tab, so this:

image

@Jaswir
Copy link
Contributor

Jaswir commented May 18, 2023

@zadjii-msft

Actually, why is, the duplicate not working like that?
Or am I saying something really silly.

Not sure about why duplicating would be useful. Don't think I often do that for a terminal window.

PS: Have been getting a bit more into windows terminal lately. Check out this pimp:

image

@Jaswir
Copy link
Contributor

Jaswir commented May 18, 2023

@zadjii-msft

That looks great!

Presumably you figured it out, but the .cpp files are nested under the .h files (usually). Some of them are nested under the .idl's or .xaml's. Honestly, I don't know why VS chooses to do it that way 🤷 I've honestly only ever used the "Go to files" shortcut (which I think is sound to ctrl+shift+t) in VS. Way easier than trying to navigate the project structure. Just type bits of the file name and go. But then again, I'm more of a Sublime / VsCode user than a VS one - I just use big VS for building and debugging 😆

Hadn't figured it out yet. Thanks! I am familiar with the ctrl+shift+t shortcut in VS.

So you have 2 windows open VSCode program and one VS? And then VSCode on one screen and VS on the other or?
Can you maybe show me your screen setup? I am really used to working with just VS. But I think I need to adapt. VSCode would indeed have the cpp files in the src. I know I can use ctrl+shift+t but it helps for me in my head that I can also see the file in the folder system. But the thing is if I would be looking for the files myself it would be hard in VS much easier in VSCode.

@zadjii-msft
Copy link
Member Author

So you have 2 windows open VSCode program and one VS? And then VSCode on one screen and VS on the other or?

Basically, yea. I've got three monitors, so my typical layout looks a bit like:
image

I used Sublime for years, (and still do sometimes), so my mental model of the codebase entirely revolves around:

  • ctrl+p: go to a file in the project by name with a fuzzy match
  • ctrl+r: navigate to a function / class in this file by name
  • ctrl+g: go to a line in this file

For me, that's just become way easier than trying to navigate the file tree UI.


I don't get point 2:
"using the active profile in the current directory."
I interpreted this to mean that the current tab information (active profile in current directory) is used for the tab you want to move. And so you don't create a new tab, but move the current tab (using the active profile in the current directory) to the new window.

Ah, so, to clarify:

  • A "terminal pane" is really a combo of a bunch of state - the buffer, the connection to the client app (e.g. cmd.exe), and then any runtime state, like the tab title, CWD, etc.
  • "Duplicate tab" can't recreate the state of the buffer or the state of the connected clients. Like, if you had a tab running cmd.exe, which ran ssh, which ran vim... the Terminal can't recreate that. So we don't even bother. Instead, we just use what we do know - the profile used for that tab, the tab title, and possibly the CWD, and we create a new connection and a new buffer for that new tab.
  • "Move tab to new window" is different. It's not making a new connection or buffer - it's literally just moving the existing one. So the original text you had

    Moves tab to a new window using the active profile in the current directory

    • IMO, that has a subtle implication that the active profile and CWD will be used to make a new connection. Which isn't true - it's effectively just tearing out the current tab.

Does that all make sense? It's a real subtlety and a more confusing bit of how the Terminal works behind the scenes.


I really appreciate the time and effort you took to write the Walkthrough for this.

But that made it way too easy for me.

Thanks! To be honest, that sounds like the walkthrough did exactly it's purpose - help get you oriented in an unfamiliar codebase. Now that you've got it building and know your way around running the project locally, feel free to go tackle something a bit more challenging. I'll look forward to the PR 😄

@Jaswir
Copy link
Contributor

Jaswir commented May 19, 2023

@zadjii-msft

Thanks! To be honest, that sounds like the walkthrough did exactly it's purpose - help get you oriented in an unfamiliar codebase. Now that you've got it building and know your way around running the project locally, feel free to go tackle something a bit more challenging. I'll look forward to the PR 😄

I am worried that next time I take on an issue and I ask a question, you'll provide me the filenames and specific functions again where changes need to be made. And feel like your response doesn't address my concern.

A big part of me helping out in this Open Source project is wanting to become a better Engineer. Getting pointed to the filenames and particularly the specific functions in the filename conflicts with that.

Basically the give a man a fish idea: “If you give a man a fish, you feed him for a day. If you teach a man to fish, you feed him for a lifetime.” A good Engineer is able to think for themselves, find the specific files and specific parts e.g. functions themselves.
In real life software engineering situations more often than not, there won't be someone pointing me to the filenames and functions. By having you point me to them, you are effectively doing the thinking for me. And so without that I'd be lost.

So I would like to know if it's also possible that you give me more vague hints? E.g. only point to the filename but not the functions. What kind of hints would you give to a junior / entry level engineer at Microsoft?

@zadjii-msft
Copy link
Member Author

Ah sorry, let me be more specific: IMO, just getting the project to build and run can often be its own problem. (as you so observed!) If you want more challenging issues, I'd be all for helping point you at some of those. I've found that for myself, starting with an easy win always gets me into a better headspace for harder problems later in the day / week.

These issues: https://github.com/orgs/microsoft/projects/686/views/4 are some that I think are probably a comparable difficulty, that I've never gotten around to writing walkthroughs for yet. Basically as you go up in difficulty, the hints I can give are going to get more abstract. I can always give less hints if you'd like 😛

What kind of hints would you give to a junior / entry level engineer at Microsoft

oof that's a good question - when's the last time we even had one of those 😅 Honestly I might just point them at a similar PR or two in the past and be like "alright, this issue is a lot like #foo, and maybe a little like #bar, so do it just like those two PRs".

@zadjii-msft
Copy link
Member Author

#14909 might be a good example - something similar to what you just did, so you're already familiar with the problem space. Not a ton of hints in that one either... (I can always look for others if that doesn't seem interesting 😉 )

@Jaswir
Copy link
Contributor

Jaswir commented May 20, 2023

@zadjii-msft

I added you on LinkedIn. You haven't added me back, why is that?
Btw I'll get to the second issue. Looking through your no walkthrough list.

@Jaswir
Copy link
Contributor

Jaswir commented May 20, 2023

Basically, yea. I've got three monitors, so my typical layout looks a bit like: image

I used Sublime for years, (and still do sometimes), so my mental model of the codebase entirely revolves around:

  • ctrl+p: go to a file in the project by name with a fuzzy match
  • ctrl+r: navigate to a function / class in this file by name
  • ctrl+g: go to a line in this file

For me, that's just become way easier than trying to navigate the file tree UI.

Do you also use this for pure C# projects? I wonder, cause there the file tree UI makes way more sense in Visual Studio than cpp. Other thing I wonder about, if you work like this, then how do you keep a model in your mind of how the entire codebase is connected?

Does the Windows Terminal Open Source Project have like a map or something? That describes how the various classes are connected? With map I am thinking about a piece of paper with rectangles that are connected with lines. Where rectangles

@Jaswir
Copy link
Contributor

Jaswir commented May 20, 2023

@zadjii-msft I like this one #6366
Lot's of people would be happy with that contribution. Gonna take a crack at it.

@zadjii-msft
Copy link
Member Author

zadjii-msft commented May 22, 2023

Do you also use this for pure C# projects? I wonder, cause there the file tree UI makes way more sense in Visual Studio than cpp

Honestly, I can't say I've written any serious production quality C#. A couple small projects here and there. An early prototype of the Terminal was C#. But noting more than a couple files. That being said, I used basically the same workflow for both C++ and my Python side projects. That way I don't really have to worry about how the project is laid out on the filesystem - as long as I know where I'm going, then it's easy enough to just pop open the file by name.

how do you keep a model in your mind of how the entire codebase is connected

image

But seriously though - I've been working through re-writes of the Console codebase for 8 years now. I helped design the architecture of the Terminal codebase itself. That's been my 9-5 for years, at this point, it's just instinct.

Does the Windows Terminal Open Source Project have like a map or something

No, but it really should. We used to have a giant wall in the office with every library we owned, the paths to the files, and how they all connected. Not sure if that survived in Redmond after all the office moves though. There's surely a photo floating around twitter somewhere, but I don't know how to find it.

Best I could find was these diagrams, which are admittedly from 2019, before the code was even OSS:

imageimageimage


couple others from a "scratch diagrams.pptx" I have:
image

image

@Jaswir
Copy link
Contributor

Jaswir commented May 22, 2023

@zadjii-msft

Maybe you should put this somewhere in the general docs for this project. It would probably also be valuable to others.

So the commandline clients are connected to the windows terminal via a ConPTY Process which is Conhost.exe do I understand that correctly?

@zadjii-msft
Copy link
Member Author

you should put this somewhere in the general docs for this project

Yep, that needs to be probably significantly updated. Probably will soon, likely as a part of #15065 & #6999.

commandline clients are connected to the windows terminal via a ConPTY Process which is Conhost.exe do I understand that correctly

Yep! That lets conpty emulate the Win32 Console API, while the Terminal only really needs to "speak" in ANSI escape "VT" sequences, which is more like every other terminal that exists.

microsoft-github-policy-service bot pushed a commit that referenced this issue May 25, 2023
)

## Summary of the Pull Request
Add the "Move Tab to New Window" item to the context menu of the tabs 

## References and Relevant Issues
#15127

## Detailed Description of the Pull Request / Additional comments
Add the "Move Tab to New Window" item to the context menu of the tabs. 

![Detailed_description_of_commit_PR1](https://github.com/microsoft/terminal/assets/15957528/915ac07b-1fdd-456b-b180-2645dbc29e48)

## Validation Steps Performed
Checked Code Style
https://github.com/microsoft/terminal/blob/main/doc/STYLE.md

## PR Checklist
- [ V] Closes #15127
-  [?] Tests added/passed
- [ X] Documentation updated
- If checked, please file a pull request on [our docs
repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx
- [ V] Schema updated (if necessary)

---------

Co-authored-by: Mike Griese <migrie@microsoft.com>
@github-project-automation github-project-automation bot moved this from Walkthrough in issue to Done in Terminal Walkthroughs May 25, 2023
@Jaswir
Copy link
Contributor

Jaswir commented May 26, 2023

@zadjii-msft

Awesome. What is the protocol for this Open Source Project in terms of releasing the fixes?
Are there specific times things are released to the Preview?
Also when do things get added to the Official Windows Terminal that's installed by default on Windows 11. It would be really cool to see a feature that I helped contribute with , that would make me proud. And do all of them get added? Or are some not? , Like a selection of things or something like that?

@zadjii-msft
Copy link
Member Author

What is the protocol for this Open Source Project in terms of releasing the fixes?
Are there specific times things are released to the Preview?

We usually release new Preview builds like, once every 3-6 months. Exact timing is usually pretty fungible, based on how the actual release cycle is going, or if there are major events (see: Build). I don't think we've really started discussion of when 1.19 will be yet.

when do things get added to the Official Windows Terminal

That's uh.... c o m p l i c a t e d. Technically, the version of the Terminal that actually ships with Windows 11 is like, Terminal 1.12. Yea. That old. There's internal rEaSoNs why that is, but essentially, people should immediately get the newest version of Terminal Stable (as of last week, 1.17), as soon as they log in and the Store gets them an update.

So basically, whenever Terminal 1.20 Preview comes out, 1.19 will get moved to the Stable channel, which is when this feature will be "pre-installed" on Windows 11.

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Tag-Fix Doesn't match tag requirements label May 29, 2023
@DHowett
Copy link
Member

DHowett commented May 29, 2023

That's uh.... c o m p l i c a t e d.

I just checked version 1.17.11461.0 into Windows for the insider program participants! 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-UserInterface Issues pertaining to the user interface of the Console or Terminal good first issue This is a fix that might be easier for someone to do as a first contribution Help Wanted We encourage anyone to jump in on these. In-PR This issue has a related PR Issue-Task It's a feature request, but it doesn't really need a major design. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants