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

Fix drag and drop on '+' button for drive letters #10842

Merged
2 commits merged into from Aug 3, 2021

Conversation

ianjoneill
Copy link
Contributor

@ianjoneill ianjoneill commented Aug 1, 2021

Fixes dragging and dropping drive letters onto the '+' button.

Manually tested - dragging and dropping the C:\ drive onto the '+' button works when creating a new tab, splitting or creating a new window. Dragging and dropping a regular directory still works.

Closes #10723

@ghost ghost added Area-User Interface Issues pertaining to the user interface of the Console or Terminal Issue-Task It's a feature request, but it doesn't really need a major design. Priority-3 A description (P3) Product-Terminal The new Windows Terminal. labels Aug 1, 2021
@@ -255,10 +255,10 @@ namespace winrt::TerminalApp::implementation

std::wstring pathText = path.wstring();

// Handle edge case of "C:\\", seems like the "StartingDirectory" doesn't like path which ends with '\'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm actually quite surprised by this premise. The reason we have issues with StartingDirectory when passed through the commandline are ones of escaping.

Does it really beef it if we don't do this trick at all? huh.

Copy link
Member

@DHowett DHowett Aug 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(because the commandline escaping for wt results in "C:\" being parsed as C:\" (terminating quote captured in path))

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - this is purely for the "Open in new window" case

If I comment out the pathText.push_back(L'.') and drop on C:\ with shift pressed, the new window fails to parse the command line:

image

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drag and dropping C:\ to get a new tab or split the current window works fine, it's just the new window case that fails.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OH. Okay.

We should fix this in the New Window commandline generator, honestly. That would also fix it for shift-clicking the cmd2 profile I created to test this. 😄

I suspect that this code lives in NewTerminalArgs::ToCommandline.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done - with the added bonus that this now has a test 🙂

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it! Thank you!

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love that you added a test, thanks!

@DHowett DHowett added zPreview-Service-Queued-1.13 A floating label that tracks the current Preview version for servicing purposes. zStable-Service-Queued-1.12 A floating label that tracks the current Stable version for servicing purposes. AutoMerge Marked for automatic merge by the bot when requirements are met and removed zStable-Service-Queued-1.12 A floating label that tracks the current Stable version for servicing purposes. labels Aug 3, 2021
@ghost
Copy link

ghost commented Aug 3, 2021

Hello @DHowett!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit cccaab8 into microsoft:main Aug 3, 2021
@DHowett DHowett removed the zPreview-Service-Queued-1.13 A floating label that tracks the current Preview version for servicing purposes. label Aug 25, 2021
@ghost
Copy link

ghost commented Aug 31, 2021

🎉Windows Terminal Preview v1.11.2421.0 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
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 AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Task It's a feature request, but it doesn't really need a major design. Priority-3 A description (P3) Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

D&D on the '+' button: Dragging a drive letter (c:\) behaves weird
3 participants