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(old_files): opts.cwd_only includes similarly named dirs #2308

Merged
merged 1 commit into from
Jan 7, 2023

Conversation

emmanueltouzery
Copy link
Contributor

Description

cwd_only would also include unrelated folders, provided the current folder name was a prefix
Example: current folder is /home/user/fold. Telescope would also offer files from /home/user/folder.

Type of change

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

How Has This Been Tested?

Create one folder named fold, another one named folder. Open and save fold/file1.txt and folder/file2.txt. Then run ":cd fold", and invoke lua require'telescope.builtin'.oldfiles{cwd_only=true}.

Without the fix, telescope will offer you both file1.txt and file2.txt. With the fix, telescope will offer you only file1.txt.

Configuration:

  • Neovim version (nvim --version): NVIM v0.8.0-1210-gd3
  • Operating system and version: fedora linux 37

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)

PS: could it be possible to also backport this fix to the 0.1 stable branch?

@kkharji kkharji self-assigned this Jan 6, 2023
cwd_only would also include unrelated folders, provided the current
folder name was a prefix. Add a trailing / to the folder name to be sure
to limit to this folder only.

Example: current folder is /home/user/fold. Telescope would also offer
files from /home/user/folder.
Copy link
Member

@kkharji kkharji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch @emmanueltouzery indeed it does include similar named directories. This PR indeed fixes it.

Thanks

@kkharji kkharji changed the title fix: cwd_only would not filter enough fix(old_files): opts.cwd_only includes similarly named dirs Jan 7, 2023
@kkharji kkharji merged commit 04af51d into nvim-telescope:master Jan 7, 2023
Conni2461 pushed a commit to emmanueltouzery/telescope.nvim that referenced this pull request Jan 7, 2023
Conni2461 pushed a commit that referenced this pull request Jan 7, 2023
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.

2 participants