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

fix(__internal) : fix slash problem in oldfiles #3260

Merged
merged 2 commits into from
Sep 22, 2024

Conversation

Jaehaks
Copy link
Contributor

@Jaehaks Jaehaks commented Aug 18, 2024

Description

  • Problems

Problem with slash and backslash being mixed up is chronic issue of neovim in Windows. it makes telescope prompt perceive same path differently when it execute to oldfiles picker.

some function like nvim_buf_get_name() or vim.v.oldfiles give paths which are mixed up with slash and backslash.

  • What it did For windows,

it always needs to change slash(/) to backslash() when function which deal with path because entry_maker works properly only the case that path string has \ not /.

  • Effect
  1. oldfiles picker doesn't show duplicated list
  2. defaults.path_display configuration feature will works well at oldfiles pikcer

Fixes #1683
It is related with PR #3103 what i submitted but opened

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list relevant details about your configuration

  • [ v ] Test A
  1. open oldfiles picker
  2. path_display feature will works all entry of oldfiles.
    (before the issue is fixed, the path which has slash and backslash being mixed up cannot be applied by path_display
    even though vim.opt.shellslash is true
    image

I checked with formatter stylua also and add some simple comment about it

Configuration:

  • Neovim version (nvim --version): v0.10.0
  • Operating system and version: Windows 10

Checklist:

  • My code follows the style guidelines of this project (stylua)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (lua annotations)

- Problems

Problem with slash and backslash being mixed up is chronic issue of
neovim in Windows. it makes telescope prompt perceive same path
differently when it execute to oldfiles picker.

some function like `nvim_buf_get_name()` or `vim.v.oldfiles` give paths
which are mixed up with slash and backslash.

- What it did
For windows, it always needs to change slash(/) to backslash(\) when
function which deal with path because entry_maker works properly only
the case that path string has \ not /.

- Effect

1) oldfiles picker doesn't show duplicated list
2) `defaults.path_display` configuration feature will works well at
   oldfiles pikcer
@jamestrew
Copy link
Contributor

Sorry is this the same fix as #3103
Looks largely the same to me.

@Jaehaks
Copy link
Contributor Author

Jaehaks commented Sep 11, 2024

@jamestrew
Ok, I agree that the modification of plenary.nvim is fundamental solution.
I hope your PR is accepted :)

@Jaehaks Jaehaks closed this Sep 11, 2024
@jamestrew
Copy link
Contributor

Sorry I must've confused you with a comment I deleted about plenary.
I think this PR could still be helpful since this code path is dealing with file paths before plenary even comes into play.

I just wanted to confirm that this fixes the same issue as #3103 -- seems like a simpler fix so I'd probably prefer this PR over #3103 if that's alright.

I would probably just ask to remove all but the first -- for slash problem in windows comment.

@jamestrew jamestrew reopened this Sep 20, 2024
@Jaehaks
Copy link
Contributor Author

Jaehaks commented Sep 20, 2024

@jamestrew

Ok, New commit is uploaded with erased comments except of first one.
This PR is same with #3103, just I modified more precise because I don't know how to upload new commit before.

@jamestrew jamestrew merged commit 175178e into nvim-telescope:master Sep 22, 2024
12 checks passed
@jamestrew
Copy link
Contributor

Thanks!

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

Successfully merging this pull request may close these issues.

Duplicates path entries on Windows
2 participants