-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
implement drag&drop path in '+' button (#10073) #10160
implement drag&drop path in '+' button (#10073) #10160
Conversation
FYI, there's a |
Thanks for the tip, I totally forgot about that script. Hope it will pass now. |
|
||
std::wstring pathText = path.wstring(); | ||
|
||
// Handle edge case of "C:\\", seems like the "StartingDirectory" doesn't like path which ends with '\' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait what? My experience with StartingDirectory
tells me this can't be true ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This edge case happens when you press shift
and drop the C:
drive on it, you get the following error:
[error 0x8007010b when launching `cmd.exe']
Could not access starting directory "C:\WINDOWS\SysWOW64""
D: drive
[error 0x8007010b when launching `cmd.exe']
Could not access starting directory "D:""
While trying to debug the value of pathText
I notice normal folders don't end with \
while C
& D
drives do.
removing that \
solved the problem...maybe it solved it by avoiding it?
can you please help me understand why it happens?
note that pressing shift
is critical since normal drop works just fine.
If you think it should work without this if
will trying to debug it further.
if (items.Size() == 1) | ||
{ | ||
std::filesystem::path path(items.GetAt(0).Path().c_str()); | ||
if (!std::filesystem::is_directory(path)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonder how well std::filesystem::is_directory
handles UNC paths.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested it with \\HOST\folder
and \\HOST\folder\file.txt
, std::filesystem::is_directory
handles it just fine.
Sadly darg & drop
this UNC path only works with windows powershell
.
Command Prompt gives the following error:
'\\HOST\folder'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
Microsoft Windows [Version 10.0.19042.985]
(c) Microsoft Corporation. All rights reserved.
C:\Windows>
while ubuntu
just default to the home folder.
@Daniel599 Thanks for the contribution! The core developers of the project are probably busy preparing for Build 2021. So it might take a while for them to review this. |
@skyline75489 any update regarding this PR? |
@Daniel599 sry about not responding. The engineer who is more eligible to review this is currently out of the office for vacation and won’t have the time until next month. There’s only limited engineering power at the moment. So it might take a while for people to get to this PR. |
Hi @Daniel599 sorry for not responding for a long time.😅 The team is currently preparing for 1.10 release, and this PR is likely to miss the 1.10 train. Wonder if @zadjii-msft has interest to take a look and probably ship this in 1.11. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm good with this. Apologies for the delay. We had discussed this at a team meeting and then I think things happened to the major people at that meeting. Like @zadjii-msft going on paternity leave, me visiting my family and then having my son get sick (and then getting sick), and a few other kerfluffles like prepping the 1.10 release.
I'm not the biggest authority on the team at XAML or the Terminal UI... but the code looks fair enough to me and I like the de-duplication of the tab/window opening stuff. So I'll give you one check.
// - Bound in Drag&Drop of the Xaml editor to the [+] button. | ||
// Arguments: | ||
// <unused> | ||
void TabRowControl::OnNewTabButtonDrop(IInspectable const&, winrt::Windows::UI::Xaml::DragEventArgs const&) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have to make and bind this if nothing is going to happen? Is this some XAML trickery?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so, I did copy-cat of the other Drag&Drop stuff.
I`ll try to remove it and see what happens
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whichever way it works, I'm fine with it. It was just an interesting curiosity to me.
…/alt+ drop, by refactor the click lambdas into a function
Thank you for the update, hope you are feeling well now. |
sorry for the delay, I'm checking out the code locally right now to give it a review. Probably won't get a full build before EOD but hopefully will early tomorrow. |
Ah again the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, sorry for the delay reviewing this. The code is nice and straightforward, and I like that it stealthily also works with alt+drag&drop.
I am seeing weird edge cases with C:\
, but you know what, I'm just gonna merge this for now and file some follow ups.
Thanks for doing this!
Hello @zadjii-msft! Because this pull request has the 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 (
|
🎉 Handy links: |
Summary of the Pull Request
This PR implements the ability to drop directories/files on the '+' button which in turn will open the tab/pane/window in the given starting path.
In order to do this, I refactored the click's lambda into a method and re-used it
Sadly I wasn't able to add note about the alt/shift feature (any ideas how to do this?)
Also most of the code is "look-a-like" from other places within the project, as I don't have much experience in windows development.
References
implements #10073
PR Checklist
** tests were done manually both of the old feature (alt/shift+click) on the '+' and on the profiles
** no idea what to add there, if any.
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed
tested manually.