Skip to content

[BUG] Dashes in session path turns into backslashes #242

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

Closed
Lucirukei opened this issue Jun 30, 2023 · 8 comments
Closed

[BUG] Dashes in session path turns into backslashes #242

Lucirukei opened this issue Jun 30, 2023 · 8 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed windows Windows related issues

Comments

@Lucirukei
Copy link

Describe the bug
Having dashes (-) in the project directory name, or any other directory in the project path, breaks loading sessions with the search/picker.
The dashes gets turned into backslashes.
See screenshots for example. I have a repo called test-repo-test, but it shows up as test\repo\test, meaning I can't load it with the picker.

To Reproduce
Steps to reproduce the behavior:

  1. Save a session of a project directory with dashes in the name.
  2. Use the Autosession search command
  3. Try to load the session with dashes, now backslashes, in the name
  4. See error

Expected behavior
See the project path as it should be, with dashes in the name rather than backslashes.
Select the project path and have it load.

Screenshots
auto-session_dash-projects1
cant-find-dir

Baseline (please complete the following information):

  • Result of set sessionoptions?:
    sessionoptions=blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions
  • OS. e.g uname -a:
    Windows 10 Pro (22H2) x64
  • Neovim version nvim --version
    NVIM v0.9.1
  • URL to your current config (if public)
    Not public.
    But I've tested with only Lazy and auto-session installed, and no other settings. Same problem.
@Lucirukei Lucirukei added the bug Something isn't working label Jun 30, 2023
@Lucirukei Lucirukei changed the title [BUG] Dashes [BUG] Dashes in session path turns into backslashes Jun 30, 2023
@rmagatti rmagatti added help wanted Extra attention is needed windows Windows related issues labels Nov 21, 2023
@BugLight
Copy link
Contributor

I could not reproduce on my OS X Ventura (NVIM version is 0.9.1 too). Seems to be a windows specific bug.
I can later try on my windows laptop and maybe I'll be able to fix it.

@rmagatti
Copy link
Owner

Yeah. The reality is I don't really officially support Windows with auto-session. All Windows support has been pretty much added by the community, which is amazing to see! Hopefully someone can dive into this one soon!

@Anthony-E-B
Copy link

Same issue with git, having a dash in a git branch name (I have the auto_session_use_git_branch set to true) results in an incorrect, uselessely unescaped path.
image
Here the branch name was 54-sandbox.

I don't recall hvaing this issue until really recently tho, but can't find the update that broke it.

@cameronr
Copy link
Collaborator

cameronr commented Jul 8, 2024

#315 improves this case so while it's still converting dashes to backslashes, it will load the session when selected. For example, I have a directory called "dash-test" and the session file is rendered as "dash\test":

Screenshot 2024-07-08 at 14 12 24

Selecting it does load it successfully:
Screenshot 2024-07-08 at 14 20 14

@cameronr
Copy link
Collaborator

@rmagatti what about url encoding the filename of the session? Then we could use the same encoding scheme on all platforms and have it be fully reversible while only being slightly more cumbersome to look at via ls (which shouldn't be an issue for an end user anyway)?

@cameronr
Copy link
Collaborator

cameronr commented Jul 16, 2024

Actually, now that I think about it, I wonder if it's possible to make it work by being careful/consistent with how paths are treated. I'll look into this a bit more.

@rmagatti
Copy link
Owner

Urlencode would be good, I do remember considering that at the time but don't quite remember why I didn't go with that. Perhaps there wasn't a good option to do that in Lua with Neovim at the time or something like that

@cameronr
Copy link
Collaborator

cameronr commented Aug 2, 2024

@rmagatti I think this can be closed now

@rmagatti rmagatti closed this as completed Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed windows Windows related issues
Projects
None yet
Development

No branches or pull requests

5 participants