Fix regression accepting pathname completion#1582
Conversation
|
Findings (most severe first)
Tests / Edge Cases
If you want, I can sketch a minimal patch for the pathname regex + targeted tests. |
bbafa1b to
17d3d1c
Compare
scottnemes
left a comment
There was a problem hiding this comment.
Nice! Verified path completion behavior is working as expected.
Ensure that when accepting a pathname completion, the path as typed is accepted and not modified into an invalid path. Changes * use a Literal for the include argument to last_word() * create a separate length-measurement string for pathname completions, based on a different last-word cleanup regex * remove some todo comments from tests which are now resolved The logic of length_based_on_path assumes that if _any_ of the suggestions are pathnames, then _all_ of the suggestions are pathnames, which is currently true, and likely to remain true. It would be nice to have a test which simulated accepting the first suggestion, to check that the filled-in completion does not get mangled, as happened before.
17d3d1c to
75f144e
Compare
Description
Ensure that when accepting a pathname completion, the path as typed is accepted and not modified into an invalid path. See #1557 for an image. The regression is most evident when typing a path with a leading
./.Changes
Literalfor theincludeargument tolast_word()The logic of
length_based_on_pathassumes that if any of the suggestions are pathnames, then all of the suggestions are pathnames, which is currently true, and likely to remain true.It would be nice to have a test which simulated accepting the first suggestion, to check that the filled-in completion does not get mangled, as happened before.
Let's say this fixes #1557, because it fixes the actual regression. There are some other behaviors listed there which may not be desirable but were not caused by #1500 . Let's open separate issues if we want to do further work on pathname completion. For example, there is no pathname completion for
\edit <pathname>at all. And completion on~/does not seem to provide candidates.I'm also not 100% clear on the subtleties of
last_word(), and why thealphanum_underscorecleanup regex is the best one for this case, but it does work exactly right per @scottnemes 's diagnosis, and the relevant change was indeed introduced in #1500. Maybe there should be a cleanup regex namedpathnames, for clarity.Checklist
changelog.mdfile.AUTHORSfile (or it's already there).