zsh-workers
 help / color / mirror / code / Atom feed
From: Danielle McLean <gopsychonauts@gmail.com>
To: zsh-workers@zsh.org
Cc: danielsh@apache.org
Subject: zsh/complist colours improperly handle multibyte characters
Date: Fri, 21 Oct 2016 12:09:34 +1100	[thread overview]
Message-ID: <etPan.58096283.690aeb81.31f@dani-mac.newcastle.edu.au> (raw)

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.


             reply	other threads:[~2016-10-21  1:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20161021011017eucas1p1d1fceae920242e69b4426bc41cb3c064@eucas1p1.samsung.com>
2016-10-21  1:09 ` Danielle McLean [this message]
2016-10-21  4:07   ` Bart Schaefer
2016-10-23 17:30     ` Peter Stephenson
2016-10-23 18:23       ` Bart Schaefer
     [not found]     ` <20161023184641.4549e10a@ntlworld.com>
     [not found]       ` <161023105652.ZM3309@torch.brasslantern.com>
2016-10-23 18:59         ` Peter Stephenson
2016-10-23 19:34           ` Bart Schaefer
2016-10-25 10:44             ` Peter Stephenson
2016-10-25 15:59               ` Bart Schaefer
2016-10-25 16:05                 ` Peter Stephenson
2016-10-21  8:33   ` Peter Stephenson
2016-10-21 15:48     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=etPan.58096283.690aeb81.31f@dani-mac.newcastle.edu.au \
    --to=gopsychonauts@gmail.com \
    --cc=danielsh@apache.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).