Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Autocompletion doesn't work with kanji



Hi,

today I stumbled upon a problem with autocompletion and Japanese kanji
characters. My ~/.zshrc only contains the following 3 lines and nothing
else:
zstyle -e ':completion:*' completer '
    _foo_bar="$HISTNO$BUFFER$CURSOR"
    reply=(_complete _match _ignored _prefix _files)'

Usually I use the .zshrc from the grml project. When I noticed the kanji
problem, I tried to extract a minimal piece of code where it still
happens. The above 3 lines are what I ended up with.

I noticed that I can rename _foo_bar to anything and the problem
persists. However, removing the line with _foo_bar completely also makes
the problem disappear. But removing this line would break the real grml
.zshrc, so this is not a solution.

Steps to reproduce the problem:
1. In some empty directory, create the files A1 and A2:
   $ touch A1 A2
2. Type "grep foo A" in zsh and hit <tab>. After hitting <tab> once, the
   autocompletion menu will appear thanks to the 4 lines in ~/.zhsrc.
   Hitting <tab> again will cycle through "A1" and "A2".
   So far, so good.
3. Now try again with "grep æ A". The grep search pattern here is the
   single Kanji used for "book". This time, after hitting <tab> once,
   something strange happens. The input line now looks like this:
   $ grep æ AA
   There are 2 A's now and the autocompletion menu did not appear.
   Hitting enter at this point simply prints (as one might expect):
   grep: AA: No such file or directory

On the other hand, "grep ã A<tab>" (with a hiragana "a" instead of the
kanji) works flawlessly. So the problem does not always show itself as
soon as there are Japanese characters. However, I could not find a
pattern in which characters work and which do not.

My current locale is "en_US.UTF-8".

Only zsh completion seems to be affected by this problem. If I ignore
completion and write the filenames manually, grep works as it should.

Could this be a bug in zsh or a bug in the grml .zshrc, i.e. in the
3 lines I listed at the top?

Best regards,
Christoph



Messages sorted by: Reverse Date, Date, Thread, Author