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 a few completion bugs and add a few small features #934

Merged
merged 8 commits into from
Oct 1, 2022

Conversation

p-ouellette
Copy link
Contributor

@p-ouellette p-ouellette commented Sep 12, 2022

Please see the commit log for details.

- 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.
@p-ouellette p-ouellette changed the title fix some multibyte character completion bugs Fix a few completion bugs Sep 24, 2022
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.
Comment on lines -283 to -285
f, err := os.Stat(name)
f, err := os.Lstat(name)
if err != nil {
fl, err := os.Lstat(name)
Copy link
Contributor Author

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.
@p-ouellette p-ouellette changed the title Fix a few completion bugs Fix a few completion bugs and add a few small features Sep 29, 2022
@gokcehan
Copy link
Owner

gokcehan commented Oct 1, 2022

@p-ouellette Thanks for the patch.

@gokcehan gokcehan merged commit cb7aa13 into gokcehan:master Oct 1, 2022
@p-ouellette
Copy link
Contributor Author

Thank you for taking the time to review it.

@p-ouellette p-ouellette deleted the unicode-complete branch October 5, 2022 04:56
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.

None yet

2 participants