* case insensitive completion
@ 2008-05-12 12:36 sergio
2008-05-12 12:52 ` Peter Stephenson
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: sergio @ 2008-05-12 12:36 UTC (permalink / raw)
To: Zsh hackers list
Hello.
I want to make case insensitive completion for russian language.
>From the manpage:
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}
but analog with russian:
zstyle ':completion:*' matcher-list 'm:{а-яА-Я}={А-Яа-я}
doesn't work
Also, this doesn't work too:
zstyle ':completion:*' matcher-list
'm:{абвгдеёжзийклмнопрстуфхцчшщъыьэюя}={АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ}'
'm:{я}={Я}' doesn't work for letter 'я', but 'm:{z}={Z}' works for
letter 'z'.
This works:
zstyle ':completion:*' matcher-list '+m:{a-zA-Z}={A-Za-z}' '+m:а=А'
'+m:б=Б' '+m:в=В' '+m:г=Г' '+m:д=Д' '+m:е=Е' '+m:ё=Ё' '+m:ж=Ж' '+m:з=З'
'+m:и=И' '+m:й=Й' '+m:к=К' '+m:л=Л' '+m:м=М' '+m:н=Н' '+m:о=О' '+m:п=П'
'+m:р=Р' '+m:с=С' '+m:т=Т' '+m:у=У' '+m:ф=Ф' '+m:х=Х' '+m:ц=Ц' '+m:ч=Ч'
'+m:ш=Ш' '+m:щ=Щ' '+m:ъ=Ъ' '+m:ы=Ы' '+m:ь=Ь' '+m:э=Э' '+m:ю=Ю' '+m:я=Я'
'+m:А=а' '+m:Б=б' '+m:В=в' '+m:Г=г' '+m:Д=д' '+m:Е=е' '+m:Ё=ё' '+m:Ж=ж'
'+m:З=з' '+m:И=и' '+m:Й=й' '+m:К=к' '+m:Л=л' '+m:М=м' '+m:Н=н' '+m:О=о'
'+m:П=п' '+m:Р=р' '+m:С=с' '+m:Т=т' '+m:У=у' '+m:Ф=ф' '+m:Х=х' '+m:Ц=ц'
'+m:Ч=ч' '+m:Ш=ш' '+m:Щ=щ' '+m:Ъ=ъ' '+m:Ы=ы' '+m:Ь=ь' '+m:Э=э' '+m:Ю=ю'
'+m:Я=я'
but this is not very well ):
zsh can lower and uppercase russian letters:
% qwe=йцу
% echo ${(U)qwe}
ЙЦУ
% echo ${(L)${(U)qwe}}
йцу
and in EXTENDED_GLOB there is globbing flag i which works right for
rissian language:
% setopt EXTENDED_GLOB
% ls (#i)йцу
ЙцУ ЙЦУ
P.S.
Have zsh something for case switching.
It will be great to write something like:
zstyle ':completion:*' matcher-list 'm:$a=swithcase($a)
--
sergio
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: case insensitive completion
2008-05-12 12:36 case insensitive completion sergio
@ 2008-05-12 12:52 ` Peter Stephenson
2008-05-13 5:40 ` Andrey Borzenkov
2008-05-14 9:47 ` Peter Stephenson
2 siblings, 0 replies; 5+ messages in thread
From: Peter Stephenson @ 2008-05-12 12:52 UTC (permalink / raw)
To: Zsh hackers list
On Mon, 12 May 2008 16:36:37 +0400
sergio <zsh@sergio.spb.ru> wrote:
> Hello.
>
> I want to make case insensitive completion for russian language.
>
> >From the manpage:
> zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}
>
> but analog with russian:
> zstyle ':completion:*' matcher-list 'm:{а-яА-Я}={А-Яа-я}
> doesn't work
Yes, this is a known problem. The code that handles this is pretty hacky
and hasn't been converted to handle multibyte character sets. This is one
of the big remaining problems with the multibyte support.
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: case insensitive completion
2008-05-12 12:36 case insensitive completion sergio
2008-05-12 12:52 ` Peter Stephenson
@ 2008-05-13 5:40 ` Andrey Borzenkov
2008-05-14 9:47 ` Peter Stephenson
2 siblings, 0 replies; 5+ messages in thread
From: Andrey Borzenkov @ 2008-05-13 5:40 UTC (permalink / raw)
To: zsh-workers; +Cc: sergio
[-- Attachment #1: Type: text/plain, Size: 566 bytes --]
On Monday 12 May 2008, sergio wrote:
[...]
> but analog with russian:
> zstyle ':completion:*' matcher-list 'm:{а-яА-Я}={А-Яа-я}
> doesn't work
>
[...]
> This works:
> zstyle ':completion:*' matcher-list '+m:{a-zA-Z}={A-Za-z}' '+m:а=А'
...
> but this is not very well ):
>
it would have been OK if it were not so slow :(
unfortunately as written code heavily depends on character being
exactly one byte long.
so anything outside ASCII characters won't work right now (including
extended characters from ISO-8859-1 in UTF-8 locale).
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: case insensitive completion
2008-05-12 12:36 case insensitive completion sergio
2008-05-12 12:52 ` Peter Stephenson
2008-05-13 5:40 ` Andrey Borzenkov
@ 2008-05-14 9:47 ` Peter Stephenson
2008-05-14 14:12 ` sergio
2 siblings, 1 reply; 5+ messages in thread
From: Peter Stephenson @ 2008-05-14 9:47 UTC (permalink / raw)
To: Zsh hackers list
On Mon, 12 May 2008 16:36:37 +0400
sergio <zsh@sergio.spb.ru> wrote:
> zstyle ':completion:*' matcher-list 'm:{а-яА-Я}={А-Яа-я}
> doesn't work
I think this really needs fixing a more general way. You don't care what
the character set is, you just want to make lower and upper case match. So
really you want to be able to use ctype-style character specifications:
zstyle ':completion:*' matcher-list \
'm:{[:lower:][:upper:]}={[:upper:][:lower:]}'
More general ctype tests would also be useful in:
compadd -M 'r:|[.,_-]=* r:|=*'
which could be
compadd -M 'r:|[[:punct:]]=* r:|=*'
and it's a bit confusing that that doesn't currently work---it's not
spelled out in the completion documentation.
That doesn't leave much for individual multibyte characters in
correspondence classes to do, but it still shouldn't be too difficult to
turn the tables into explicit sets of characters tested the way character
classes in globbing are tested (which is fully general, although based on
the wchar_t ordering, which isn't necessarily Unicode code points).
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: case insensitive completion
2008-05-14 9:47 ` Peter Stephenson
@ 2008-05-14 14:12 ` sergio
0 siblings, 0 replies; 5+ messages in thread
From: sergio @ 2008-05-14 14:12 UTC (permalink / raw)
To: Zsh hackers list
Peter Stephenson wrote:
> I think this really needs fixing a more general way. You don't care what
> the character set is, you just want to make lower and upper case match.
Yes!
> zstyle ':completion:*' matcher-list \
> 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}'
For ascii this doesn't work too :(
--
sergio
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-05-14 14:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-12 12:36 case insensitive completion sergio
2008-05-12 12:52 ` Peter Stephenson
2008-05-13 5:40 ` Andrey Borzenkov
2008-05-14 9:47 ` Peter Stephenson
2008-05-14 14:12 ` sergio
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).