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

Pasting path to linux conversion has stopped working #740

Closed
dirkesquire opened this Issue Jun 17, 2016 · 14 comments

Comments

Projects
None yet
7 participants
@dirkesquire

dirkesquire commented Jun 17, 2016

Problem description

Hello, I am using latest build of ConEmu 160612.

I am having a problem when pasting paths into ConEmu. I am using a Git Bash shell:
"%ConEmuDrive%\Program Files\Git\bin\sh.exe"

Up until I did the recent ConEmu update, it used to work very well that I would copy a path from Windows Explorer and paste into ConEmu and it would transform it into a format understood by bash correctly.

For example I would copy "C:\Files\Username\Directory" to the clipboard then in ConEmu type:
'cd' and then press either Ctrl+V or right click and it would paste the path as a unix path so I would end up with the following:
cd /C/Files/Username/Directory.

After doing the most recent update this no longer works. It gets paste with the 'C:...' and then get an error:
bash: cd: C:FilesUsernameDirectory: No such file or directory

Please help, I have no idea to where to begin to look for the problem or setting for this. I can appreciate the problem might not be directly in ConEmu, but I have no idea, if you could point me in the right direction that would be great. It used to work, and I used to find it a very useful feature. It stopped working directly after my most recent update of ConEmu.

Versions

ConEmu build: 160612 x64
OS version: Windows 10 x64
Used shell version (git-bash)

Steps to reproduce

  1. Type 'cd ' into the prompt
  2. Paste "C:\Files\Username\Directory"
  3. Press enter

Actual results

$ cd C:\Files\Username\Directory
bash: cd: C:FilesUsernameDirectory: No such file or directory

Expected results

$ cd /C/Files/Username/Directory.

Name@Computer MINGW64 /C/Files/Username/Directory
$

@dirkesquire

This comment has been minimized.

Show comment
Hide comment
@dirkesquire

dirkesquire Jun 24, 2016

Hello, many thanks for working on a patch.

I subsequently, did an update to 160619, but it still doesn't appear to be working. Is the fix included in this release?

Hello, many thanks for working on a patch.

I subsequently, did an update to 160619, but it still doesn't appear to be working. Is the fix included in this release?

@Maximus5

This comment has been minimized.

Show comment
Hide comment
@Maximus5

Maximus5 Jun 24, 2016

Owner

As commit message states. The 160619 is working properly, just checked.

Owner

Maximus5 commented Jun 24, 2016

As commit message states. The 160619 is working properly, just checked.

@dirkesquire

This comment has been minimized.

Show comment
Hide comment
@dirkesquire

dirkesquire Jul 4, 2016

Thank you for working on this.

I don't doubt that you fixed something, and but there is still some problem lurking.

I noticed it did work correctly one time only since I installed the update, but after that not (hence my clarification 10 days ago). I've given it two weeks, and restarted a few times in the hopes it would miraculously start working again, but currently if I paste "C:\Files\Username\Directory" into the prompt (either with right click or Ctrl-V) I still get this:

$ cd C:\Files\Username\Directory
bash: cd: C:FilesUsernameDirectory: No such file or directory

It used to be that it would immediately escape the path into a linux compatible path on paste.

copying windows path

Thank you for working on this.

I don't doubt that you fixed something, and but there is still some problem lurking.

I noticed it did work correctly one time only since I installed the update, but after that not (hence my clarification 10 days ago). I've given it two weeks, and restarted a few times in the hopes it would miraculously start working again, but currently if I paste "C:\Files\Username\Directory" into the prompt (either with right click or Ctrl-V) I still get this:

$ cd C:\Files\Username\Directory
bash: cd: C:FilesUsernameDirectory: No such file or directory

It used to be that it would immediately escape the path into a linux compatible path on paste.

copying windows path

@Maximus5

This comment has been minimized.

Show comment
Hide comment
@Maximus5

Maximus5 Jul 4, 2016

Owner

Have you read commit message?
Show your Paste settings.

Owner

Maximus5 commented Jul 4, 2016

Have you read commit message?
Show your Paste settings.

@dirkesquire

This comment has been minimized.

Show comment
Hide comment
@dirkesquire

dirkesquire Jul 4, 2016

OK yes I have read your commit message thank you. But since I am no expert in your software I don't fully understand how multi/single line paste works or why I would need to, but I believe I have figured out a bit more how it works now. The problem is confirmed to be not with single-line mode but with multi-line mode.

I have managed to figure out that:
a) When I right-click to paste it uses Multi-Line mode (even if I am pasting a single line with no line breaks), and this hasn't been fixed yet because (based off your commit message) your fix is only for single line mode.
b) If in the Paste settings 'Multi-Line' is selected for Ctrl+V then this takes precedence even if I am only pasting a single line (i.e. no line breaks). This explains the problem I was having.
d) If I set Ctrl-V to 'single-line' mode then it works. But if I set Ctrl-V to 'multi-line' mode it does not.

To be honest I've always found the Paste settings a bit odd. The reason I like to have multi-line on is because I often paste python scripts into ConEmu so I find it useful. My most common use case is 1) CD to a directory, 2) Run python shell, 3) Be able to paste a multiple line scripts code.

I can understand you might not want to escape paths if a user is pasting more than one line (because it could be confusing). But perhaps we can detect if the user is infact pasting multiple lines rather than having an either/OR approach dictated by a setting. Perhaps an 'automatic' mode for Ctrl-V?

OK yes I have read your commit message thank you. But since I am no expert in your software I don't fully understand how multi/single line paste works or why I would need to, but I believe I have figured out a bit more how it works now. The problem is confirmed to be not with single-line mode but with multi-line mode.

I have managed to figure out that:
a) When I right-click to paste it uses Multi-Line mode (even if I am pasting a single line with no line breaks), and this hasn't been fixed yet because (based off your commit message) your fix is only for single line mode.
b) If in the Paste settings 'Multi-Line' is selected for Ctrl+V then this takes precedence even if I am only pasting a single line (i.e. no line breaks). This explains the problem I was having.
d) If I set Ctrl-V to 'single-line' mode then it works. But if I set Ctrl-V to 'multi-line' mode it does not.

To be honest I've always found the Paste settings a bit odd. The reason I like to have multi-line on is because I often paste python scripts into ConEmu so I find it useful. My most common use case is 1) CD to a directory, 2) Run python shell, 3) Be able to paste a multiple line scripts code.

I can understand you might not want to escape paths if a user is pasting more than one line (because it could be confusing). But perhaps we can detect if the user is infact pasting multiple lines rather than having an either/OR approach dictated by a setting. Perhaps an 'automatic' mode for Ctrl-V?

@Maximus5

This comment has been minimized.

Show comment
Hide comment
@Maximus5

Maximus5 Jul 4, 2016

Owner

Well, ConEmu may check for paths, if clipboard does not contain \n.

Owner

Maximus5 commented Jul 4, 2016

Well, ConEmu may check for paths, if clipboard does not contain \n.

Maximus5 added a commit that referenced this issue Jul 11, 2016

gh-740: Try to convert paths to cygwin style if clipboard doesn't con…
…tain `\n` while pasting to cygwin/msys shells.
@lucasvc

This comment has been minimized.

Show comment
Hide comment
@lucasvc

lucasvc Aug 4, 2016

To clarify, when copying the path C:\Files with space\Username\Directory (no newline) and pasting into a CygWin bash, which should be the expected result?

When pasting I got the path /C/Files with space/Username/Directory, which doesn't exist - CygWin maps units to the /cygdrive/<unit_lower_case> by default.
IMHO, is better to let the original path on pasting, if you envelope it with double quotes, CygWin will convert correctly.

lucasvc commented Aug 4, 2016

To clarify, when copying the path C:\Files with space\Username\Directory (no newline) and pasting into a CygWin bash, which should be the expected result?

When pasting I got the path /C/Files with space/Username/Directory, which doesn't exist - CygWin maps units to the /cygdrive/<unit_lower_case> by default.
IMHO, is better to let the original path on pasting, if you envelope it with double quotes, CygWin will convert correctly.

@garyhodgson

This comment has been minimized.

Show comment
Hide comment
@garyhodgson

garyhodgson Oct 12, 2016

Is there any way to turn this auto-conversion off? LIke lucasvc, when I paste a path in cygwin the converted path isn't recognised, which is pretty frustrating. It worked fine a while back (which is perhaps the change which triggered this issue?)

A flag to turn off all path conversions would be great.

Is there any way to turn this auto-conversion off? LIke lucasvc, when I paste a path in cygwin the converted path isn't recognised, which is pretty frustrating. It worked fine a while back (which is perhaps the change which triggered this issue?)

A flag to turn off all path conversions would be great.

@dirkesquire

This comment has been minimized.

Show comment
Hide comment
@dirkesquire

dirkesquire Oct 12, 2016

Yes you can. Well Maximus isn't the most patient explainer out there, but I figured out from his responses that you can turn it off by going into settings > Keys & Macro > Paste Mode > Do Nothing.

Yes you can. Well Maximus isn't the most patient explainer out there, but I figured out from his responses that you can turn it off by going into settings > Keys & Macro > Paste Mode > Do Nothing.

@garyhodgson

This comment has been minimized.

Show comment
Hide comment
@garyhodgson

garyhodgson Oct 12, 2016

Thanks for the response Dirk! Sadly I can't seem to get it to work as expected. In my version (161009a) the settings menu option is called "Paste" and when I select "Do Nothing" then pressing Shift+Insert results in ";2~" being printed :(

Cheers anyhow.

Thanks for the response Dirk! Sadly I can't seem to get it to work as expected. In my version (161009a) the settings menu option is called "Paste" and when I select "Do Nothing" then pressing Shift+Insert results in ";2~" being printed :(

Cheers anyhow.

@lucasvc

This comment has been minimized.

Show comment
Hide comment
@lucasvc

lucasvc Oct 14, 2016

@dirkesquire Using "Do Nothing" configuration, as @garyhodgson writes weirds characters using Ctrl+V or Shift+Insert.

But I've realized that when the path is copied begining with a double quote ("), it is pasted as we expect (Windows path).

lucasvc commented Oct 14, 2016

@dirkesquire Using "Do Nothing" configuration, as @garyhodgson writes weirds characters using Ctrl+V or Shift+Insert.

But I've realized that when the path is copied begining with a double quote ("), it is pasted as we expect (Windows path).

@zeroleo12345

This comment has been minimized.

Show comment
Hide comment
@zeroleo12345

zeroleo12345 Nov 3, 2016

+1. version (161009a) not find the toggle to turn auto-conversion off

+1. version (161009a) not find the toggle to turn auto-conversion off

@0anton

This comment has been minimized.

Show comment
Hide comment
@0anton

0anton May 5, 2017

Dear colleagues,

I work often with windows paths in cygwin environment / ConEmu. Autoconverting of paths inserted from the clipboard makes my life quite difficult - need to paste them firstly into notepad, add quotes, then ConEmu does not autoconvert them into unix path. I'd like to have the separated shortcuts - e.g. Shift-Insert for unconverted paste and say App-Insert for converted paste. Or at least possibility to disable autoconvert paste feature. There is no way currently!

Kind regards,
Anton Golubev

0anton commented May 5, 2017

Dear colleagues,

I work often with windows paths in cygwin environment / ConEmu. Autoconverting of paths inserted from the clipboard makes my life quite difficult - need to paste them firstly into notepad, add quotes, then ConEmu does not autoconvert them into unix path. I'd like to have the separated shortcuts - e.g. Shift-Insert for unconverted paste and say App-Insert for converted paste. Or at least possibility to disable autoconvert paste feature. There is no way currently!

Kind regards,
Anton Golubev

@gene-pavlovsky

This comment has been minimized.

Show comment
Hide comment
@gene-pavlovsky

gene-pavlovsky Jul 25, 2017

The Keys&Macro mentions auto-conversion for Cygwin in the description of the second paste shortcut, which I don't use (). The first paste shortcut (Shift+Ins) is the one I use, and it does auto-convert paths to Cygwin (/cygdrive/...). I'm using /mnt so to make ConEmu output /mnt/... I have to add :m:/mnt to the new_console task option for Cygwin bash. But it would be good to be able to disable it, for example some of my tasks are ssh to remote servers (Cygwin ssh), doesn't make sense to convert my local Cygwin paths if I paste them there.

The Keys&Macro mentions auto-conversion for Cygwin in the description of the second paste shortcut, which I don't use (). The first paste shortcut (Shift+Ins) is the one I use, and it does auto-convert paths to Cygwin (/cygdrive/...). I'm using /mnt so to make ConEmu output /mnt/... I have to add :m:/mnt to the new_console task option for Cygwin bash. But it would be good to be able to disable it, for example some of my tasks are ssh to remote servers (Cygwin ssh), doesn't make sense to convert my local Cygwin paths if I paste them there.

Maximus5 added a commit that referenced this issue Aug 7, 2017

gh-740: Flexible config allowing or disallowing POSIX paths conversion.
  * If mount prefix is disabled with `-new_console:p:-` switch autoconversion is disabled.
  * GuiMacro `Paste` doesn't do autoconversion with exception of mode `Paste(8)` which does.
  * Checkboxes ‘Allow Windows to POSIX path conversion’ on ‘Paste’ and ‘App distinct’ setting pages.

Maximus5 added a commit that referenced this issue Aug 7, 2017

gh-740: Flexible config allowing or disallowing POSIX paths conversion.
  * If mount prefix is disabled with `-new_console:p:-` switch autoconversion is disabled.
  * GuiMacro `Paste` doesn't do autoconversion with exception of mode `Paste(8)` which does.
  * Checkboxes ‘Allow Windows to POSIX path conversion’ on ‘Paste’ and ‘App distinct’ setting pages.

@Maximus5 Maximus5 closed this Nov 13, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment