Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[BUG] Completion menu order doesn't (always) respect locale
- X-seq: zsh-workers 42292
- From: dana <dana@xxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [BUG] Completion menu order doesn't (always) respect locale
- Date: Wed, 17 Jan 2018 01:37:28 -0600
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=7/L1U1fLeCRGwjq0SXpyrI3ZCyeeL6FYBghfBFnLr/E=; b=s7Uyqrn2u2rxsafTKY7AX5z6zgW9uo6U1d7Ri6ynqSVB2/Y5zgeOuRqpbYhj7oZZZA TQCkj4RLwGRQjX5PC0Un5J2mYk8mHgn5dw7vUN9VQjOEaBBH7ceDOXr6HvWrqHNz0wY/ V2wAAWzP5uOT8VLKfL9BIto+cWW5MRIpGoDC7T4ZjOBc/LumqAHfFtI3yWVY0JSDd0Qg 6trGhX/CLxfyT46WAFpTGraoWEAPj/3qONesYzwt2Ukh5UNVqvlrp32w5gwHkTHLzxcm B6N/wjaSOS2ntBi+iTU75sBmdny+D5lJHIhgJJGFLaj9wATcJQ6M3FKEUU0s8o4+jnYf MCMw==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
The way completion possibilities are sorted in the menu has been bothering me,
but i was inspired to actually look into it today when i noticed that one
particular command was being sorted the way i wanted.
Here is an (abbreviated) example of the behaviour i see:
% export LC_ALL=C
% pgrep -<TAB>
-F -G -L -P -U -a -d -f -g -i -l -n -o -q -t -u -v -x
% export LC_ALL=en_GB.UTF-8
% pgrep -<TAB>
-F -G -L -P -U -a -d -f -g -i -l -n -o -q -t -u -v -x
% export LC_ALL=C
% pkill -<TAB>
-F -G -L -P -U -a -f -g -i -n -o -q -t -u -v -x
% export LC_ALL=en_GB.UTF-8
% pkill -<TAB>
-a -f -F -g -G -i -L -n -o -P -q -t -u -U -v -x
pkill is doing what i want — it respects my locale's collation settings. pgrep
is not — it always uses C/ASCII sorting.
The difference seems to be that pkill has 'grouped' options — i.e., multiple
options with the same description. In this case, the grouped ones are the
names of the signals, which all have the description 'signal'. If you
`unset signals` so that the function can't generate those options, pkill loses
its grouped options and it (mis)behaves like pgrep.
I tracked this down as far as cd_prep(). When there are grouped options, it
calls eltpcmp(), which in turn calls strcoll(). When there AREN'T grouped
options... well, it doesn't do that. Had to stop looking there.
The inconsistency affects many different completions. For example, ls and top
respect the locale, but ping and typeset do not. It's really irritating now that
i've noticed it.
I might look into it more later, but maybe someone already has an idea about it?
In the mean time, to at least make them consistent, i can set LC_COLLATE=C in
_main_complete.
dana
Messages sorted by:
Reverse Date,
Date,
Thread,
Author