Skip to content

Question: confusing behavior of built-in command completions like cd #651

@CicadaSeventeen

Description

@CicadaSeventeen

Hello,

I and a few colleagues are currently working on adding Unicode (i.e., non-ASCII) natural language file/directory completion support for Bash and other shells.

Our method involves "hacking" (redefining and overriding) functions such as _comp_compgen_filedir or _comp_compgen__call_builtin. You can view a few existing solutions here:

This approach currently works in environments using only bash-completion (without ble.sh), functioning correctly for both external commands and built-in commands being completed.

However, when using ble.sh, only external commands like ls and rmdir are completed correctly (while basic auto-completion functions as expected, see attached image). Built-in commands such as cd and pushd (which are highlighted as red by default in ble.sh), do not utilise our custom completion method. I also noted that other built-in commands (highlighted as purple by default in ble.sh) do not have this issue and work correctly with our custom completion.

Image Image Image Image

above: only read named cd not works here

I am unsure what is special about the completion mechanism for built-in commands highlighted in red in ble.sh. Does it employ an implementation method different from standard bash-completion? I attempted to locate the relevant points by searching the source code but, unfortunately, was unsuccessful. I would greatly appreciate any explanation or assistance you can offer.

Thank you.


P.S. I know your native language is Japanese. I have heard that some people in Japan also desire similar completion functionality. I am personally re-implementing another Unicode completion scheme (see https://github.com/CicadaSeventeen/polLingua_Completion), which, unlike other implementations, focuses more on the possibility of supporting multiple natural languages instead of a single language. Although Japanese support is temporarily unavailable due to some difficulties, it should be supported in the future. However, this is another off-topic discussion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions