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(builtin.buffers): improve only_cwd handling with partial matches #2845

Merged
merged 1 commit into from
Jan 4, 2024

Conversation

jamestrew
Copy link
Contributor

closes #2843

Previously, bad partial matches between cwd and target buffer path would result in non-cwd buffers showing up in the picker despite using only_cwd=true.

eg.
cwd = /foo/bar
target buffer = foo/bar1/baz.txt
The target buffer starts with the cwd path.

This is fixed by appending a path separator before comparing/matching: eg.
cwd = /foo/bar/
target buffer = foo/bar1/baz.txt

@jamestrew jamestrew marked this pull request as draft January 3, 2024 23:16
closes #2843

Previously, bad partial matches between cwd and target buffer path would
result in non-cwd buffers showing up in the picker despite using
`only_cwd=true`.

eg.
cwd = `/foo/bar`
target buffer = `foo/bar1/baz.txt`
The target buffer starts with the cwd path.

This is fixed by appending a path separator before comparing/matching:
eg.
cwd = `/foo/bar/`
target buffer = `foo/bar1/baz.txt`
@jamestrew jamestrew marked this pull request as ready for review January 4, 2024 00:48
@jamestrew jamestrew merged commit c621f71 into master Jan 4, 2024
13 checks passed
@jamestrew jamestrew deleted the fix/buffers-cwd-only branch January 4, 2024 00:49
@serranomorante
Copy link

Thanks @jamestrew
Please notice that if you put a hyphen in the name of the folders /foo/bar-1 and /foo/bar-12 it doesn't work.

@jamestrew
Copy link
Contributor Author

@serranomorante great catch!
I believe I've fix this in my latest PR

@serranomorante
Copy link

Thank you so much @jamestrew everything works now 👍

Conni2461 pushed a commit that referenced this pull request Mar 11, 2024
#2845)

closes #2843

Previously, bad partial matches between cwd and target buffer path would
result in non-cwd buffers showing up in the picker despite using
`only_cwd=true`.

eg.
cwd = `/foo/bar`
target buffer = `foo/bar1/baz.txt`
The target buffer starts with the cwd path.

This is fixed by appending a path separator before comparing/matching:
eg.
cwd = `/foo/bar/`
target buffer = `foo/bar1/baz.txt`

(cherry picked from commit c621f71)
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.

only_cwd on paths with partial matches
2 participants