Skip to content

fix(builtin.buffers): improve only_cwd handling with partial matches#2845

Merged
jamestrew merged 1 commit into
masterfrom
fix/buffers-cwd-only
Jan 4, 2024
Merged

fix(builtin.buffers): improve only_cwd handling with partial matches#2845
jamestrew merged 1 commit into
masterfrom
fix/buffers-cwd-only

Conversation

@jamestrew

Copy link
Copy Markdown
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
@jamestrew
jamestrew force-pushed the fix/buffers-cwd-only branch from 680728a to e357f6b Compare January 4, 2024 00:41
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 force-pushed the fix/buffers-cwd-only branch from e357f6b to 2cd7960 Compare January 4, 2024 00:46
@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
@jamestrew
jamestrew deleted the fix/buffers-cwd-only branch January 4, 2024 00:49
@serranomorante

Copy link
Copy Markdown

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
Copy Markdown
Contributor Author

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

@serranomorante

Copy link
Copy Markdown

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