-
Notifications
You must be signed in to change notification settings - Fork 320
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 a few completion bugs and add a few small features #934
Conversation
d1a213a
to
a972afa
Compare
- matchLongest now operates on runes instead of bytes so we don't complete part of a multibyte character. - Fix some places that mixed string and rune slice indices.
When selecting a menu completion for a file in a subdirectory, the entire filename would be appended to the command line, even if you had already typed part of it.
a972afa
to
fef5f69
Compare
The first use of cmd-menu-complete-back after opening the completion menu was incorrectly selecting the before-last completion instead of the last completion.
Also skip files with stat errors instead of returning.
f, err := os.Stat(name) | ||
f, err := os.Lstat(name) | ||
if err != nil { | ||
fl, err := os.Lstat(name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why this was doing a stat and an lstat. Maybe the stat is for the isDir check later that adds a trailing path separator. However on my Linux machine lstat on a symlink that points to a directory returns a FileInfo with the directory mode bit set, and this behavior is required by POSIX.1-2008.
This is useful when completing filenames. For example cmap <c-y> :cmd-menu-accept; cmd-menu-complete can be used to accept the selected directory completion, then complete files in the directory.
2f9ffdd
to
e044db1
Compare
@p-ouellette Thanks for the patch. |
Thank you for taking the time to review it. |
Please see the commit log for details.