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

Re: Autocompletion doesn't work with kanji



On Tue, 22 Dec 2009, Christoph Dittmann wrote:

> Benjamin R. Haskell wrote:
> > How about replacing the _last_try line with:
> > print -lr ${CURSOR:q:q} >&2
> > 
> > It'll look ugly, but it's a quick check to see if something's amiss in 
> > your $CURSOR variable.
> 
> Ok, when I enter 'grep æ A<TAB>' (with the kanji character), it gives
> me 2 lines:
> $ grep æ A8
> A<cursor ends up here>
> 
> However, without a kanji character it prints the following 3 lines:
> $ grep x A8
>   grep x A<cursor is now here>
> A1  A2
> 
> 
> (Again, that's in a directory containing only the two files A1 A2.)
> 
> If the $CURSOR variable is supposed to count characters and not bytes, 
> it looks like it's doing that correctly, as it shows 8 in both cases.

Huh, I can finally reproduce Christoph's problem.

[ I really liked my "ISO-2022-JP contained a quote" theory. :-) ]

Running under zsh -x, w/ the same set up: in a directory containing only 
A1 and A2, and a zstyle -e of the form:

zstyle -e ':completion:*' completer $'\nSOMETHING\nreply=(_files)'

After:

$ blah æ A<Tab>

If the SOMETHING contains certain references to $CURSOR, prefix contains 
'AA' instead of 'A' (and CURSOR is advanced by one).

For various SOMETHINGs:

CURSOR=$CURSOR        # doesn't break
print -lr $CURSOR >&2 # does    break
_throwaway=$CURSOR    # does    break


I'm falling back to the usual suspect (_path_files).

Best,
Ben


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