elvish icon indicating copy to clipboard operation
elvish copied to clipboard

Mixed slashes on Windows

Open fgimian opened this issue 1 year ago • 6 comments

What happened, and what did you expect to happen?

Hi there, firstly forgive me if I'm missing something as this is my first day using Elvish.

On Windows, Elvish seems a little mixed up about which slashes to use on a Windows system:

Suppose I'm trying to get to C:\Users\<username>\source:

  • Using cd ~\so and hitting tab does not provide completions
  • Using cd ~/so works and completes with mixed slashes cd C:\Users\Fots/source\
  • After completing the source path, hitting enter and then tab, forward slashes are used but the / from the first completion is not normalised (e.g. C:\Users\Fots/source\checksum-validator\)
  • Using path:join dir1 dir2 uses \ characters as expected (dir1\dir2)

I think this feels a bit awkward to work with.

My hope would be that both / and \ would trigger completions and paths would always be normalised to use the native \ separators to remain as widely compatible with CLI tools.

Huge thanks for your time Fotis

Output of "elvish -version"

0.20.1+official

Code of Conduct

fgimian avatar Aug 01 '24 10:08 fgimian

Hmm, the reason it's this way is that if the user typed a / it could be intentional and Elvish should respect that. You can always get \ by, well, typing \ in the first place.

@fgimian Is there a specific reason you'd use / instead of \ when typing paths?

xiaq avatar Aug 07 '24 20:08 xiaq

Hmm, the reason it's this way is that if the user typed a / it could be intentional and Elvish should respect that. You can always get \ by, well, typing \ in the first place.

@fgimian Is there a specific reason you'd use / instead of \ when typing paths?

Thanks for the response. I found that Elvish would not offer completions when using \, while / did. This is ultimately the only reason I was using it. Is it possible I'm missing something?

Cheers Fotis

fgimian avatar Aug 07 '24 23:08 fgimian

Hmm, the reason it's this way is that if the user typed a / it could be intentional and Elvish should respect that. You can always get \ by, well, typing \ in the first place. @fgimian Is there a specific reason you'd use / instead of \ when typing paths?

Thanks for the response. I found that Elvish would not offer completions when using \, while / did. This is ultimately the only reason I was using it. Is it possible I'm missing something?

Aha, I see what the problem is now. I was only testing completion after something like cd .\, which does work. But cd ~\ doesn't work.

The problem is actually a bit deeper than tab completion - on the language level, Elvish can't expand ~\foo correctly because tilde expansion assumes /. I'll fix that.

xiaq avatar Aug 08 '24 10:08 xiaq

Hmm, the reason it's this way is that if the user typed a / it could be intentional and Elvish should respect that. You can always get \ by, well, typing \ in the first place. @fgimian Is there a specific reason you'd use / instead of \ when typing paths?

Thanks for the response. I found that Elvish would not offer completions when using \, while / did. This is ultimately the only reason I was using it. Is it possible I'm missing something?

Aha, I see what the problem is now. I was only testing completion after something like cd .\, which does work. But cd ~\ doesn't work.

The problem is actually a bit deeper than tab completion - on the language level, Elvish can't expand ~\foo correctly because tilde expansion assumes /. I'll fix that.

Ahh, and yeah you're right, I usually base my paths from ~. 😄

Thanks so much for all your help! Fotis

fgimian avatar Aug 08 '24 12:08 fgimian

Hmm, the reason it's this way is that if the user typed a / it could be intentional and Elvish should respect that. You can always get \ by, well, typing \ in the first place.

@fgimian Is there a specific reason you'd use / instead of \ when typing paths?

Thanks for the response. I found that Elvish would not offer completions when using \, while / did. This is ultimately the only reason I was using it. Is it possible I'm missing something?

Aha, I see what the problem is now. I was only testing completion after something like cd .\, which does work. But cd ~\ doesn't work.

The problem is actually a bit deeper than tab completion - on the language level, Elvish can't expand ~\foo correctly because tilde expansion assumes /. I'll fix that.

Hey Qi, I'm sincerely sorry to bother you about this but was wondering if you've had the opportunity to solve this issue?

Thanks heaps! Fotis

fgimian avatar Jan 04 '25 06:01 fgimian

The tilde expansion issue is #474

iandol avatar Jan 04 '25 14:01 iandol