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

Path conversion doesn't always work on paste #161

Closed
kenijo opened this issue Apr 6, 2019 · 8 comments
Closed

Path conversion doesn't always work on paste #161

kenijo opened this issue Apr 6, 2019 · 8 comments

Comments

@kenijo
Copy link

kenijo commented Apr 6, 2019

I have been able to drag and drop a file from explorer to wsltty and the path conversion works great.
I haven't been able to paste a path (shift+insert or mouse right click) and get the conversion to work.

Is it possible to add this function? wslbridge included in ConEmu handles it fine so I am guessing it is not implemented in the wsltty version.

@kenijo
Copy link
Author

kenijo commented Apr 6, 2019

I would say Win32 <-> WSL since I posted the question in wsltty.
But if you are asking the question maybe I am missing something else.

@mintty
Copy link
Owner

mintty commented Apr 6, 2019

Path conversion is applied only for drag-and-drop (or, reversely, for Control+click link activation).
When pasting text, it is not applied; you could simply wish to quote something copied from a plain text file, which happens to be a path name; I see no reasonable way to decide whether it's meant as a working path.

@mintty
Copy link
Owner

mintty commented Apr 6, 2019

See also mintty/mintty#785 (comment).

@kenijo
Copy link
Author

kenijo commented Apr 6, 2019

Thank you for pointing me to this comment, very informative. I couldn't fin it yesterday.

I think if you consider that WSL as its own environment and everything that happens in there is supposed to be WSL related only (hence pasting a path inside wsltty should be wsl formated) then it could make a case for it. I see value in both approach.

Maybe an option to enable path conversion on pasting could be viable?

Would running everything pasted through wslpath to convert it to WSL format (and everything copied to convert it to Win32 format) impact the application performances to much?

@mintty
Copy link
Owner

mintty commented Apr 11, 2019

Actually my previous comment was wrong. Whether path conversion is applied depends on the property tag of the Windows clipboard. So if you copy e.g. a folder, its name will be path-converted, whether you use drag-and-drop, Shift+Ins or Paste from the menu. I'll check whether that also works in WSL.
That means if you select some text that happens to be a path name, however you paste it, it will not be converted. I think this makes my previous argument and the comment I referred to even more valid.
If you have another idea, please describe your preferred design precisely.

@kenijo
Copy link
Author

kenijo commented Apr 16, 2019

Here is what I tried in wsltty:

  • copy a file itself in Windows Explorer (CTRL+C or right click) and paste in WSLTTY: C:\myfile.txt turns into /mnt/c/myfile.txt
  • copy a path from the Windows Explorer location bar and paste in WSLTTY: C:\myfile.txt stays as is.

I tried the same in ConEmu and the results are almost opposite:

  • copy a file itself in Windows Explorer (CTRL+C or right click) and paste in WSLTTY: C:\myfile.txt doesn't do anything.
  • copy a path from the Windows Explorer location bar and paste in WSLTTY: C:\myfile.txt turns into /mnt/c/myfile.txt.

Both programs use the wslbridge-backend but with different results.

Anyway, my idea (and I have no idea if this is doable) was to send intercept copy / paste events and send it through wslpath such as:

  • paste in WSLTTY -> wslpath -u myargument
    If the result triggers an error then paste as the original (this means "myargument" was not a Windows path); otherwise the path got properly converted.
  • copy from WSLTTY -> wslpath -w myargument
    If the result triggers an error then copy as the original (this means "myargument" was not a Unix path); otherwise the path got properly converted.

Again, I am just throwing an idea here as I don't have a very good understanding of how all this works.

mintty added a commit to mintty/mintty that referenced this issue Apr 30, 2019
@mintty
Copy link
Owner

mintty commented May 12, 2019

  • copy a path from the Windows Explorer location bar and paste in WSLTTY: C:\myfile.txt stays as is.

If you do this via drag-and-drop, it will also be a path clipboard type and thus be converted.

mintty added a commit to mintty/mintty that referenced this issue May 20, 2019
@mintty mintty changed the title Path convertion doesn't work on paste Path conversion doesn't always work on paste May 28, 2019
@mintty
Copy link
Owner

mintty commented May 28, 2019

Released 3.0.1.

@mintty mintty closed this as completed May 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants