mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-29 19:00:57 +02:00
allow _expand to expand braces; better detection of braces to complete in C (11973)
This commit is contained in:
parent
2769b19881
commit
a295e82c1e
6 changed files with 82 additions and 17 deletions
|
@ -1,3 +1,10 @@
|
|||
2000-06-19 Sven Wischnowsky <wischnow@zsh.org>
|
||||
|
||||
* 11973: Completion/Builtins/_zstyle, Completion/Core/_description,
|
||||
Completion/Core/_expand, Doc/Zsh/compsys.yo, Src/Zle/zle_tricky.c:
|
||||
allow _expand to expand braces; better detection of braces to
|
||||
complete inC
|
||||
|
||||
2000-06-19 Peter Stephenson <pws@cambridgesiliconradio.com>
|
||||
|
||||
* unpost: additions to Completion/Commands/.distfiles and
|
||||
|
|
|
@ -17,31 +17,32 @@ styles=(
|
|||
break-keys c:
|
||||
command c:command
|
||||
completer c:completer
|
||||
completions c:
|
||||
condition c:
|
||||
completions c:bool
|
||||
condition c:bool
|
||||
cursor c:cursor
|
||||
disable-stat c:bool
|
||||
domains c:
|
||||
expand c:
|
||||
fake c:fake
|
||||
file-patterns c:filepat
|
||||
file-sort c:fsort
|
||||
force-list c
|
||||
force-list c:
|
||||
format c:
|
||||
glob c:
|
||||
glob c:bool
|
||||
group-name c:
|
||||
group-order c:tag
|
||||
groups c:_groups
|
||||
guarded-completer c:completer
|
||||
hidden c:bool
|
||||
hosts c:_hosts
|
||||
hosts-ports c:host-port
|
||||
users-hosts-ports c:user-host-port
|
||||
ignore-line c:bool
|
||||
ignore-line c:ignline
|
||||
ignore-parents c:ignorepar
|
||||
ignored-patterns c:
|
||||
insert-ids c:insert-ids
|
||||
insert-tab c:bool
|
||||
insert-unambiguous c:bool
|
||||
keep-prefix c:keep-prefix
|
||||
last-prompt c:bool
|
||||
list c:listwhen
|
||||
list-colors c:
|
||||
|
@ -49,6 +50,8 @@ styles=(
|
|||
list-prompt c:
|
||||
list-rows-first c:bool
|
||||
local c:
|
||||
match-original c:match-orig
|
||||
matcher c:
|
||||
matcher-list c:
|
||||
max-errors c:
|
||||
menu c:boolauto
|
||||
|
@ -62,6 +65,7 @@ styles=(
|
|||
prefix-hidden c:bool
|
||||
prefix-needed c:bool
|
||||
prompt c:
|
||||
remote-access c:bool
|
||||
remove-all-dups c:bool
|
||||
select-prompt c:
|
||||
select-scroll c:
|
||||
|
@ -71,9 +75,12 @@ styles=(
|
|||
squeeze-slashes c:bool
|
||||
stop c:stop
|
||||
stop-keys c:
|
||||
subst-globs-only c:
|
||||
substitute c:
|
||||
subst-globs-only c:bool
|
||||
substitute c:bool
|
||||
suffix c:bool
|
||||
tag-order c:tag
|
||||
try-to-use-pminst c:bool
|
||||
use-compctl c:urgh
|
||||
users c:_users
|
||||
users-hosts c:user-host
|
||||
verbose c:bool
|
||||
|
@ -256,6 +263,26 @@ while [[ -n $state ]]; do
|
|||
compadd - menu single longer
|
||||
;;
|
||||
|
||||
fake)
|
||||
_message 'prefix and names'
|
||||
;;
|
||||
|
||||
ignline)
|
||||
_wanted values expl boolean compadd true false current current-shown other
|
||||
;;
|
||||
|
||||
keep-prefix)
|
||||
_wanted values expl boolean compadd true false changed
|
||||
;;
|
||||
|
||||
match-orig)
|
||||
_wanted values expl boolean compadd only both
|
||||
;;
|
||||
|
||||
urgh)
|
||||
_wanted values expl no compadd no false off 0
|
||||
;;
|
||||
|
||||
_*)
|
||||
${=ostate}
|
||||
;;
|
||||
|
|
|
@ -38,6 +38,8 @@ if [[ -z "$_comp_no_ignore" ]]; then
|
|||
case "$hidden" in
|
||||
true|yes|on|1) _comp_ignore=( "$_comp_ignore[@]" "$words[@]" );;
|
||||
current) _comp_ignore=( "$_comp_ignore[@]" "$words[CURRENT]" );;
|
||||
current-shown) [[ "$compstate[old_list]" = *shown* ]] &&
|
||||
_comp_ignore=( "$_comp_ignore[@]" "$words[CURRENT]" );;
|
||||
other) _comp_ignore=( "$_comp_ignore[@]"
|
||||
"${(@)words[1,CURRENT-1]}"
|
||||
"${(@)words[CURRENT+1,-1]}" );;
|
||||
|
|
|
@ -55,10 +55,12 @@ exp=("$word")
|
|||
|
||||
if [[ "$force" = *s* ]] ||
|
||||
zstyle -T ":completion:${curcontext}:" substitute; then
|
||||
exp=( "${(e)exp//\\[
|
||||
]/ }" )
|
||||
[[ ! -o ignorebraces && "${#${exp}//[^\{]}" = "${#${exp}//[^\}]}" ]] &&
|
||||
eval exp\=\( ${${(q)exp}:gs/\\{/\{/:gs/\\}/\}/} \)
|
||||
exp=( ${(e)exp//\\[
|
||||
]/ } )
|
||||
else
|
||||
exp=( "${exp:s/\\\$/\$}" )
|
||||
exp=( ${exp:s/\\\$/\$} )
|
||||
fi
|
||||
|
||||
# If the array is empty, store the original string again.
|
||||
|
|
|
@ -1207,12 +1207,15 @@ This style is tested for the tags used when generating matches. If it
|
|||
is set to `true', then none of the words that are already on the line
|
||||
will be considered possible completions. If it is set to
|
||||
`tt(current)', the word the cursor is on will not be considered a
|
||||
possible completion and if it is set to `tt(other)' all words except
|
||||
the current one will not be considered to be a possible completion.
|
||||
possible completion. The same happens if the value is
|
||||
`tt(current-shown)', but only if the list of completions is currently
|
||||
shown on the screen. Finally, if it is set to `tt(other)' all words
|
||||
except the current one will not be considered to be a possible
|
||||
completion.
|
||||
|
||||
The value `tt(current)' is a bit like the opposite of the
|
||||
tt(accept-exact). It means that only strings with missing characters
|
||||
will be completed.
|
||||
The values `tt(current)' and `tt(current-shown)' are a bit like the
|
||||
opposite of the tt(accept-exact). It means that only strings with
|
||||
missing characters will be completed.
|
||||
|
||||
Note that you almost certainly don't want to set this to `true' or
|
||||
`tt(other)' for a general
|
||||
|
|
|
@ -1434,7 +1434,19 @@ get_comp_string(void)
|
|||
}
|
||||
}
|
||||
} else if (p < curs) {
|
||||
if (*p == Outbrace) {
|
||||
cant = 1;
|
||||
break;
|
||||
}
|
||||
if (*p == Inbrace) {
|
||||
char *tp = p;
|
||||
|
||||
if (!skipparens(Inbrace, Outbrace, &tp)) {
|
||||
i += tp - p - 1;
|
||||
dp += tp - p - 1;
|
||||
p = tp - 1;
|
||||
continue;
|
||||
}
|
||||
if (bbeg) {
|
||||
Brinfo new;
|
||||
int len = bend - bbeg;
|
||||
|
@ -1470,6 +1482,18 @@ get_comp_string(void)
|
|||
hascom = 1;
|
||||
}
|
||||
} else {
|
||||
if (*p == Inbrace) {
|
||||
char *tp = p;
|
||||
|
||||
if (!skipparens(Inbrace, Outbrace, &tp)) {
|
||||
i += tp - p - 1;
|
||||
dp += tp - p - 1;
|
||||
p = tp - 1;
|
||||
continue;
|
||||
}
|
||||
cant = 1;
|
||||
break;
|
||||
}
|
||||
if (p == curs) {
|
||||
if (bbeg) {
|
||||
Brinfo new;
|
||||
|
@ -1501,7 +1525,7 @@ get_comp_string(void)
|
|||
if (*p == Comma) {
|
||||
if (!bbeg)
|
||||
bbeg = p;
|
||||
hascom = 1;
|
||||
hascom = 2;
|
||||
} else if (*p == Outbrace) {
|
||||
Brinfo new;
|
||||
int len;
|
||||
|
|
Loading…
Reference in a new issue