zsh-users
 help / color / mirror / code / Atom feed
* Sort order
@ 2003-12-13 16:02 Jesper Holmberg
  2003-12-13 19:15 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Jesper Holmberg @ 2003-12-13 16:02 UTC (permalink / raw)
  To: Zsh-users List

I have these language settings in my environment:

LC_CTYPE=sv_SE
LC_COLLATE=sv_SE

1. One effect of these settings is that capital and non-capital letters
   are sorted together in an ls-listing.

If I have these files:

fale1.txt File1.txt

and do an ls, they will be listed in the above order.

2. Another effect is that ls knows how to sort Swedish characters. The files

lare  lere  låre

are sorted in that order when doing an ls, which is the correct one.

However, zsh doesn't seem to respect these settings when doing a
menu-complete. In example 1, if I write:

cat <tab>

zsh will suggest: 

File1.txt before fale1.txt

In example 2, zsh will suggest the files in the order:

låre lare lere


This sometimes makes me choose the wrong file, as I expect the completions
in the same order as they were when I listed them with ls.

Is it possible to acheive the same behavior in menu-completion?

Jesper

This is zsh 4.1.1 under Debian


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Sort order
  2003-12-13 16:02 Sort order Jesper Holmberg
@ 2003-12-13 19:15 ` Bart Schaefer
  2003-12-13 23:23   ` Jesper Holmberg
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2003-12-13 19:15 UTC (permalink / raw)
  To: Zsh-users List

On Dec 13,  5:02pm, Jesper Holmberg wrote:
}
} I have these language settings in my environment:
} 
} LC_CTYPE=sv_SE
} LC_COLLATE=sv_SE
} 
} However, zsh doesn't seem to respect these settings when doing a
} menu-complete.

Unfortunately the completion code doesn't appear to make use of the
locale-specific sorting order.  I suspect this is because in some
locales the ordering is not strictly defined, and the completion
code must have a strict ordering for duplicate match detection.  Or
it may just be an oversight.

However, none of this should apply to file names unless you're using
default (compctl) completion, because compsys uses shell globbing to
sort file matches and the globbing code _should_ be using locales.

If you give the command

	print -l *

do you see the files in same order that "ls" displays them, or in the
same order that menu completion offers them?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Sort order
  2003-12-13 19:15 ` Bart Schaefer
@ 2003-12-13 23:23   ` Jesper Holmberg
  2003-12-15 18:08     ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Jesper Holmberg @ 2003-12-13 23:23 UTC (permalink / raw)
  To: Zsh-users List

* On Sat Dec 13, Bart Schaefer wrote:
> On Dec 13,  5:02pm, Jesper Holmberg wrote:
> }
> } I have these language settings in my environment:
> } 
> } LC_CTYPE=sv_SE
> } LC_COLLATE=sv_SE
> } 
> } However, zsh doesn't seem to respect these settings when doing a
> } menu-complete.

...

> However, none of this should apply to file names unless you're using
> default (compctl) completion, because compsys uses shell globbing to
> sort file matches and the globbing code _should_ be using locales.
> 
> If you give the command
> 
> 	print -l *
> 
> do you see the files in same order that "ls" displays them, or in the
> same order that menu completion offers them?

print -l * works fine:

% ls
lare  lere  låre
% print -l *
lare
lere
låre

So, print -l * gives the right order, but still menu-completion offers me
the order låre lare lere.

Jesper


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Sort order
  2003-12-13 23:23   ` Jesper Holmberg
@ 2003-12-15 18:08     ` Bart Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2003-12-15 18:08 UTC (permalink / raw)
  To: Zsh-users List

On Dec 14, 12:23am, Jesper Holmberg wrote:
}
} > } LC_CTYPE=sv_SE
} > } LC_COLLATE=sv_SE
} > 
} > If you give the command
} > 
} > 	print -l *
} > 
} > do you see the files in same order that "ls" displays them, or in the
} > same order that menu completion offers them?
} 
} So, print -l * gives the right order, but still menu-completion offers me
} the order låre lare lere.

There appears to be a bug masquerading as an optimization in the file-sort
style.

When either no ordering (style not set), or name ordering, is requested,
_path_files puts the names into a sorted group so that the completion
system reorders them internally, thereby bypassing the LC_COLLATE order.

If on the other hand you request any non-name ordering, or reverse name
ordering, then _path_files orders the names with globbing and puts them
into an unsorted group so that completion skips the internal reordering.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-12-15 18:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-13 16:02 Sort order Jesper Holmberg
2003-12-13 19:15 ` Bart Schaefer
2003-12-13 23:23   ` Jesper Holmberg
2003-12-15 18:08     ` Bart Schaefer

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).