diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-07-25 12:18:23 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-07-25 12:18:23 +0000 |
commit | c83d16f8ee5721de1da3e8449c30a31ca1372d28 (patch) | |
tree | af5c704f6d02ad081058ff0428abedbe180dbabf | |
parent | e1708022d206dfe183bbce3d03c7e5e02abc3a59 (diff) | |
download | zsh-c83d16f8ee5721de1da3e8449c30a31ca1372d28.tar.gz zsh-c83d16f8ee5721de1da3e8449c30a31ca1372d28.tar.xz zsh-c83d16f8ee5721de1da3e8449c30a31ca1372d28.zip |
another fix for 15477 (separator strings); add list-separator style (15484)
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | Completion/AIX/Command/_lscfg | 5 | ||||
-rw-r--r-- | Completion/AIX/Type/_logical_volumes | 7 | ||||
-rw-r--r-- | Completion/Base/Utility/_describe | 6 | ||||
-rw-r--r-- | Completion/Unix/Type/_printers | 8 | ||||
-rw-r--r-- | Completion/Zsh/Command/_zstyle | 5 | ||||
-rw-r--r-- | Completion/Zsh/Context/_subscript | 5 | ||||
-rw-r--r-- | Doc/Zsh/compsys.yo | 6 | ||||
-rw-r--r-- | Src/Zle/computil.c | 7 |
9 files changed, 41 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog index b18bffad1..f138b1e66 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2001-07-25 Sven Wischnowsky <wischnow@zsh.org> + * 15484: Completion/AIX/Command/_lscfg, + Completion/AIX/Type/_logical_volumes, + Completion/Base/Utility/_describe, + Completion/Unix/Type/_printers, Completion/Zsh/Command/_zstyle, + Completion/Zsh/Context/_subscript, Doc/Zsh/compsys.yo, + Src/Zle/computil.c: another fix for 15477 (separator strings); + add list-separator style + * 15482: Doc/Zsh/compwid.yo, Src/Zle/compcore.c, Src/Zle/computil.c: fixlet for 15477, don't let it remove consecutive dummy matches diff --git a/Completion/AIX/Command/_lscfg b/Completion/AIX/Command/_lscfg index 4667a0bd7..f9e8f15cd 100644 --- a/Completion/AIX/Command/_lscfg +++ b/Completion/AIX/Command/_lscfg @@ -1,6 +1,6 @@ #compdef lscfg -local state line expl curcontext="$curcontext" disp list devs +local state line expl curcontext="$curcontext" disp list devs sep _arguments -C -s \ '-l[display device information for named device]:device:->device' \ @@ -9,7 +9,8 @@ _arguments -C -s \ if [[ "$state" = device ]]; then devs=( ${${${${(f)"$(lscfg)"}[6,-1]:# *}##??}/ ##[^ ]# #/:} ) if zstyle -T ":completion:${curcontext}:devices" verbose; then - zformat -a list ' -- ' "$devs[@]" + zstyle -s ":completion:${curcontext}:devices" list-separator sep || sep=-- + zformat -a list " $sep " "$devs[@]" disp=(-ld list) else disp=() diff --git a/Completion/AIX/Type/_logical_volumes b/Completion/AIX/Type/_logical_volumes index 53949fab2..1dd351360 100644 --- a/Completion/AIX/Type/_logical_volumes +++ b/Completion/AIX/Type/_logical_volumes @@ -1,11 +1,12 @@ #autoload -local expl list names disp +local expl list names disp sep list=( $(lsvg -l $(lsvg)|sed -e '2d'|awk '/[^:]* / {if ( $7 != "N/A" ) print $1 ":" $7; else print $1}' ) ) names=(${list%%:*}) -if zstyle -T ":completion:${curcontext}" verbose; then - zformat -a list ' -- ' $list +if zstyle -T ":completion:${curcontext}:" verbose; then + zstyle -s ":completion:${curcontext}:" list-separator sep || sep=-- + zformat -a list " $sep " $list disp=(-d list) else disp=() diff --git a/Completion/Base/Utility/_describe b/Completion/Base/Utility/_describe index 2783c25d1..bed75a318 100644 --- a/Completion/Base/Utility/_describe +++ b/Completion/Base/Utility/_describe @@ -23,12 +23,13 @@ fi zstyle -T ":completion:${curcontext}:$_type" verbose && _showd=yes +zstyle -s ":completion:${curcontext}:$_type" list-separator _sep || _sep=-- + if zstyle -T ":completion:${curcontext}:$_type" list-grouped; then local _argv _new _strs _mats _opts _i=2 _argv=( "$@" ) _grp=(-g) - _sep='-- ' _new=( "$1" ) shift @@ -68,7 +69,6 @@ if zstyle -T ":completion:${curcontext}:$_type" list-grouped; then set - "$_argv[@]" else _grp=() - _sep=' -- ' fi _descr="$1" @@ -83,7 +83,7 @@ while _tags; do while _next_label "$_type" _expl "$_descr"; do if [[ -n "$_showd" ]]; then - compdescribe -I "$_hide" "$_sep" _expl "$_grp[@]" "$@" + compdescribe -I "$_hide" "$_sep " _expl "$_grp[@]" "$@" else compdescribe -i "$_hide" "$@" fi diff --git a/Completion/Unix/Type/_printers b/Completion/Unix/Type/_printers index 1b42de5cb..03f950c9c 100644 --- a/Completion/Unix/Type/_printers +++ b/Completion/Unix/Type/_printers @@ -1,6 +1,6 @@ #autoload -local expl ret=1 list disp +local expl ret=1 list disp sep if (( $+commands[lsallq] )); then # Use AIX's command to list print queues @@ -8,6 +8,8 @@ if (( $+commands[lsallq] )); then return fi +zstyle -s ":completion:${curcontext}:printers" list-separator sep || sep=-- + if (( ! $+_lp_cache )); then local file entry names i @@ -42,7 +44,7 @@ if (( ! $+_lp_cache )); then fi if zstyle -T ":completion:${curcontext}:printers" verbose; then - zformat -a list ' -- ' "$_lp_cache[@]" + zformat -a list " $sep " "$_lp_cache[@]" disp=(-ld list) else disp=() @@ -53,7 +55,7 @@ _wanted printers expl printer \ (( $+_lp_alias_cache )) || return 1 if zstyle -T ":completion:${curcontext}:printers" verbose; then - zformat -a list ' -- ' "$_lp_alias_cache[@]" + zformat -a list " $sep " "$_lp_alias_cache[@]" disp=(-ld list) else disp=() diff --git a/Completion/Zsh/Command/_zstyle b/Completion/Zsh/Command/_zstyle index c72109433..d8005ee30 100644 --- a/Completion/Zsh/Command/_zstyle +++ b/Completion/Zsh/Command/_zstyle @@ -59,6 +59,7 @@ styles=( list-packed c:bool list-prompt c: list-rows-first c:bool + list-separator c:separator list-suffixes c:bool local c: match-original c:match-orig @@ -310,6 +311,10 @@ while [[ -n $state ]]; do _message 'pattern matching prefix to keep' ;; + separator) + _message 'separator string' + ;; + urgh) _wanted values expl no compadd no false off 0 ;; diff --git a/Completion/Zsh/Context/_subscript b/Completion/Zsh/Context/_subscript index 224fbb148..6328ba10d 100644 --- a/Completion/Zsh/Context/_subscript +++ b/Completion/Zsh/Context/_subscript @@ -1,6 +1,6 @@ #compdef -subscript- -local expl ind osuf=']' flags +local expl ind osuf=']' flags sep if [[ "$1" = -q ]]; then osuf='] ' @@ -91,7 +91,8 @@ elif [[ ${(Pt)${compstate[parameter]}} = array* ]]; then list=( "$list[@]" '' ) fi done - zformat -a list ' -- ' "$list[@]" + zstyle -s ":completion:${curcontext}:indexes" list-separator sep || sep=-- + zformat -a list " $sep " "$list[@]" disp=( -d list) else disp=() diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index 22352b550..b5582b458 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -1563,6 +1563,12 @@ typed pathname components and this style is set to `true', all components starting with the first one for which more than one match could be generated will be shown. ) +kindex(list-separator, completion style) +item(tt(list-separator))( +The value of this style is used in completion listing to separate the +string to complete from a description when possible (e.g. when +completing options). It defaults to `tt(-)tt(-)' (two hyphens). +) kindex(local, completion style) item(tt(local))( This style is used by completion functions which generate URLs as diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c index 902bb123c..a0f7603e2 100644 --- a/Src/Zle/computil.c +++ b/Src/Zle/computil.c @@ -504,11 +504,12 @@ cd_get(char **params) case CRT_DESC: { VARARR(char, buf, - cd_state.pre + cd_state.suf + cd_state.slen + 1); + cd_state.pre + cd_state.suf + cd_state.slen + 3); char *sufp = NULL; - memcpy(buf + cd_state.pre, cd_state.sep, cd_state.slen); - sufp = buf + cd_state.pre + cd_state.slen; + memcpy(buf + cd_state.pre + 2, cd_state.sep, cd_state.slen); + buf[cd_state.pre] = buf[cd_state.pre + 1] = ' '; + sufp = buf + cd_state.pre + cd_state.slen + 2; mats = mp = (char **) zalloc((run->count + 1) * sizeof(char *)); dpys = dp = (char **) zalloc((run->count + 1) * sizeof(char *)); |