Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
zsh/complist colours improperly handle multibyte characters
- X-seq: zsh-workers 39695
- From: Danielle McLean <gopsychonauts@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: zsh/complist colours improperly handle multibyte characters
- Date: Fri, 21 Oct 2016 12:09:34 +1100
- Cc: danielsh@xxxxxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:user-agent; bh=yR4en5y1hRx+NDZ/8XeNHzW9d7eKdSUSWbfn+7SpHrw=; b=VDc5UojEAQoHYUyd0omNmcVFX/FLruUAWYT5/xXhL5g99qdAhZpwhQhgp7iBggJ2Jh IbVfyFFcaP0VbmtpjGOTnVyDCD6xOjAX25IaFV3z0xnvkezuxw5TcCR+zWVdmR2OdvOS qr/h79/3YqTLv0skYGgEsKQFGgh/rnBy/ZuOGTIYnxTOcdiOsxluiQaCH01isngpHc+6 dwWJZSMMRozMWkPDahcKiE+1nkxZL7TAWKudcLvLgaJKlObVmkNt93EF3ehJOIAkQUX7 8fpkMnGrjOwhnE1uSzq7VXH+e+qAMXikV99TmyQjE0jVLLcHDS7OUNJVQ8v3bz/xUqzP w2qg==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
Although zsh patterns usually have full support for multibyte characters, a zsh pattern containing certain multibyte characters will fail to match if provided to zsh/complist using $ZLS_COLORS or the list-colors zstyle. For example, the following zstyles will fail to match and colour anything:
zstyle :completion:*:options list-separator │
zstyle :completion:*:options =*│*=32
ls -l<TAB>
This is not the case for *all* multibyte characters. For example, the following zstyles successfully colour the entire option green:
zstyle :completion:*:options list-separator ©
zstyle :completion:*:options =*©*=32
ls -l<TAB>
Additionally, when applying multiple colours with a (#b) pattern, multibyte characters break the colouring even if matched with a wildcard like * rather than a literal. In this example, the options are blue and their descriptions green - except for the last two characters of the description which are not coloured:
zstyle :completion:*:options list-separator │
zstyle :completion:*:options "=(#b)([^ ]#)(*)=0=34=32"
ls -l<TAB>
This issue also occurs if © is used as the separator: the complist will colour all but the last character of the description, in that case.
I believe the reason behind this behaviour is that in UTF-8, © is a two-byte character and │ is a three-byte character. Presumably, zsh/complist's pattern parsing is only aware of one- and two-byte chars, and its (#b)-based grouping mistakenly assumes that all characters are single bytes.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author