Skip to content

Conversation

scop
Copy link
Owner

@scop scop commented Aug 20, 2022

If a directory with the same name as an already found man page candidate from manpath is present, they both end up in completions as a duplicate with the trailing slash included.

To work around, skip file based completion altogether when a man page from manpath is among found candidates. A workaround for the workaround, i.e. "forcing" file based completion, is to prefix the argument with a ./.

Closes #420

If a directory with the same name as an already found man page candidate
from manpath is present, they both end up in completions as a duplicate
with the trailing slash included.

To work around, skip file based completion altogether when a man page
from manpath is among found candidates. A workaround for the workaround,
i.e. "forcing" file based completion, is to prefix the argument with a
`./`.

Closes #420
@scop
Copy link
Owner Author

scop commented Aug 20, 2022

Draft: I'm not sure I'm happy with this. Let's discuss in #420.

# shellcheck disable=SC2053
if [[ $prev != $mansect ]]; then
# File based completion for the rest, prepending ./ if needed
if [[ $prev != $mansect && -z ${COMPREPLY-} ]]; then
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could instead loop through the completions found before start below and check and remove duplicates from file based ones, but that'd be very slow when there are lots of man page completions from man path (e.g. man <TAB> gives 9000+ on the system I'm looking at).

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.

man xyz stays xy if directory with same name present

1 participant