From cd6fd2b0a3641774e7854ff8298d1d82643c4b4a Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Tue, 7 May 2019 23:24:49 +0200 Subject: 44274: allow finer control of completion match soring with compadd's -o option --- Test/Y01completion.ztst | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'Test') diff --git a/Test/Y01completion.ztst b/Test/Y01completion.ztst index f1c981f26..ff266306f 100644 --- a/Test/Y01completion.ztst +++ b/Test/Y01completion.ztst @@ -138,6 +138,46 @@ F:regression test workers/31611 >FI:{\|foo} >FI:{\~foo} + comptesteval "_tst() { compadd -onum,rev -J versions r1.10 r1.1 r1.2 r2.3 r2.34 }" + comptest $'tst r\t' +0:reverse numeric sorting of matches +>line: {tst r}{} +>NO:{r2.34} +>NO:{r2.3} +>NO:{r1.10} +>NO:{r1.2} +>NO:{r1.1} + + comptesteval "_tst() { local expl; _wanted times expl time compadd -o match r1.10 r1.2 r2.3 r2.34 }" + comptesteval "zstyle ':completion:*:tst:*' sort reverse numeric" + comptest $'tst r\t' +0:reverse numeric sorting of matches via a style +>line: {tst r}{} +>DESCRIPTION:{time} +>NO:{r2.34} +>NO:{r2.3} +>NO:{r1.10} +>NO:{r1.2} + + comptesteval "_tst() { local disp=(a b c); compadd -o -J letters -d disp 3 2 1 }" + comptest $'tst \t' +0:sort in match rather than display name order +>line: {tst }{} +>NO:{c} +>NO:{b} +>NO:{a} + + comptesteval "_tst() { local expl; _wanted times expl time compadd 3am 12pm 3pm 10pm }" + comptesteval "zstyle ':completion:*:tst:*' sort false" + comptest $'tst \t' +0:sorting disabled via the sort style +>line: {tst }{} +>DESCRIPTION:{time} +>NO:{3am} +>NO:{12pm} +>NO:{3pm} +>NO:{10pm} + %clean zmodload -ui zsh/zpty -- cgit 1.4.1