mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-05 08:41:15 +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>
|
2000-06-19 Peter Stephenson <pws@cambridgesiliconradio.com>
|
||||||
|
|
||||||
* unpost: additions to Completion/Commands/.distfiles and
|
* unpost: additions to Completion/Commands/.distfiles and
|
||||||
|
|
|
@ -17,31 +17,32 @@ styles=(
|
||||||
break-keys c:
|
break-keys c:
|
||||||
command c:command
|
command c:command
|
||||||
completer c:completer
|
completer c:completer
|
||||||
completions c:
|
completions c:bool
|
||||||
condition c:
|
condition c:bool
|
||||||
cursor c:cursor
|
cursor c:cursor
|
||||||
disable-stat c:bool
|
disable-stat c:bool
|
||||||
domains c:
|
domains c:
|
||||||
expand c:
|
expand c:
|
||||||
|
fake c:fake
|
||||||
file-patterns c:filepat
|
file-patterns c:filepat
|
||||||
file-sort c:fsort
|
file-sort c:fsort
|
||||||
force-list c
|
force-list c:
|
||||||
format c:
|
format c:
|
||||||
glob c:
|
glob c:bool
|
||||||
group-name c:
|
group-name c:
|
||||||
group-order c:tag
|
group-order c:tag
|
||||||
groups c:_groups
|
groups c:_groups
|
||||||
guarded-completer c:completer
|
|
||||||
hidden c:bool
|
hidden c:bool
|
||||||
hosts c:_hosts
|
hosts c:_hosts
|
||||||
hosts-ports c:host-port
|
hosts-ports c:host-port
|
||||||
users-hosts-ports c:user-host-port
|
users-hosts-ports c:user-host-port
|
||||||
ignore-line c:bool
|
ignore-line c:ignline
|
||||||
ignore-parents c:ignorepar
|
ignore-parents c:ignorepar
|
||||||
ignored-patterns c:
|
ignored-patterns c:
|
||||||
insert-ids c:insert-ids
|
insert-ids c:insert-ids
|
||||||
insert-tab c:bool
|
insert-tab c:bool
|
||||||
insert-unambiguous c:bool
|
insert-unambiguous c:bool
|
||||||
|
keep-prefix c:keep-prefix
|
||||||
last-prompt c:bool
|
last-prompt c:bool
|
||||||
list c:listwhen
|
list c:listwhen
|
||||||
list-colors c:
|
list-colors c:
|
||||||
|
@ -49,6 +50,8 @@ styles=(
|
||||||
list-prompt c:
|
list-prompt c:
|
||||||
list-rows-first c:bool
|
list-rows-first c:bool
|
||||||
local c:
|
local c:
|
||||||
|
match-original c:match-orig
|
||||||
|
matcher c:
|
||||||
matcher-list c:
|
matcher-list c:
|
||||||
max-errors c:
|
max-errors c:
|
||||||
menu c:boolauto
|
menu c:boolauto
|
||||||
|
@ -62,6 +65,7 @@ styles=(
|
||||||
prefix-hidden c:bool
|
prefix-hidden c:bool
|
||||||
prefix-needed c:bool
|
prefix-needed c:bool
|
||||||
prompt c:
|
prompt c:
|
||||||
|
remote-access c:bool
|
||||||
remove-all-dups c:bool
|
remove-all-dups c:bool
|
||||||
select-prompt c:
|
select-prompt c:
|
||||||
select-scroll c:
|
select-scroll c:
|
||||||
|
@ -71,9 +75,12 @@ styles=(
|
||||||
squeeze-slashes c:bool
|
squeeze-slashes c:bool
|
||||||
stop c:stop
|
stop c:stop
|
||||||
stop-keys c:
|
stop-keys c:
|
||||||
subst-globs-only c:
|
subst-globs-only c:bool
|
||||||
substitute c:
|
substitute c:bool
|
||||||
|
suffix c:bool
|
||||||
tag-order c:tag
|
tag-order c:tag
|
||||||
|
try-to-use-pminst c:bool
|
||||||
|
use-compctl c:urgh
|
||||||
users c:_users
|
users c:_users
|
||||||
users-hosts c:user-host
|
users-hosts c:user-host
|
||||||
verbose c:bool
|
verbose c:bool
|
||||||
|
@ -256,6 +263,26 @@ while [[ -n $state ]]; do
|
||||||
compadd - menu single longer
|
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}
|
${=ostate}
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -38,6 +38,8 @@ if [[ -z "$_comp_no_ignore" ]]; then
|
||||||
case "$hidden" in
|
case "$hidden" in
|
||||||
true|yes|on|1) _comp_ignore=( "$_comp_ignore[@]" "$words[@]" );;
|
true|yes|on|1) _comp_ignore=( "$_comp_ignore[@]" "$words[@]" );;
|
||||||
current) _comp_ignore=( "$_comp_ignore[@]" "$words[CURRENT]" );;
|
current) _comp_ignore=( "$_comp_ignore[@]" "$words[CURRENT]" );;
|
||||||
|
current-shown) [[ "$compstate[old_list]" = *shown* ]] &&
|
||||||
|
_comp_ignore=( "$_comp_ignore[@]" "$words[CURRENT]" );;
|
||||||
other) _comp_ignore=( "$_comp_ignore[@]"
|
other) _comp_ignore=( "$_comp_ignore[@]"
|
||||||
"${(@)words[1,CURRENT-1]}"
|
"${(@)words[1,CURRENT-1]}"
|
||||||
"${(@)words[CURRENT+1,-1]}" );;
|
"${(@)words[CURRENT+1,-1]}" );;
|
||||||
|
|
|
@ -55,10 +55,12 @@ exp=("$word")
|
||||||
|
|
||||||
if [[ "$force" = *s* ]] ||
|
if [[ "$force" = *s* ]] ||
|
||||||
zstyle -T ":completion:${curcontext}:" substitute; then
|
zstyle -T ":completion:${curcontext}:" substitute; then
|
||||||
exp=( "${(e)exp//\\[
|
[[ ! -o ignorebraces && "${#${exp}//[^\{]}" = "${#${exp}//[^\}]}" ]] &&
|
||||||
]/ }" )
|
eval exp\=\( ${${(q)exp}:gs/\\{/\{/:gs/\\}/\}/} \)
|
||||||
|
exp=( ${(e)exp//\\[
|
||||||
|
]/ } )
|
||||||
else
|
else
|
||||||
exp=( "${exp:s/\\\$/\$}" )
|
exp=( ${exp:s/\\\$/\$} )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If the array is empty, store the original string again.
|
# 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
|
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
|
will be considered possible completions. If it is set to
|
||||||
`tt(current)', the word the cursor is on will not be considered a
|
`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
|
possible completion. The same happens if the value is
|
||||||
the current one will not be considered to be a possible completion.
|
`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
|
The values `tt(current)' and `tt(current-shown)' are a bit like the
|
||||||
tt(accept-exact). It means that only strings with missing characters
|
opposite of the tt(accept-exact). It means that only strings with
|
||||||
will be completed.
|
missing characters will be completed.
|
||||||
|
|
||||||
Note that you almost certainly don't want to set this to `true' or
|
Note that you almost certainly don't want to set this to `true' or
|
||||||
`tt(other)' for a general
|
`tt(other)' for a general
|
||||||
|
|
|
@ -1434,7 +1434,19 @@ get_comp_string(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (p < curs) {
|
} else if (p < curs) {
|
||||||
|
if (*p == Outbrace) {
|
||||||
|
cant = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (*p == Inbrace) {
|
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) {
|
if (bbeg) {
|
||||||
Brinfo new;
|
Brinfo new;
|
||||||
int len = bend - bbeg;
|
int len = bend - bbeg;
|
||||||
|
@ -1470,6 +1482,18 @@ get_comp_string(void)
|
||||||
hascom = 1;
|
hascom = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} 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 (p == curs) {
|
||||||
if (bbeg) {
|
if (bbeg) {
|
||||||
Brinfo new;
|
Brinfo new;
|
||||||
|
@ -1501,7 +1525,7 @@ get_comp_string(void)
|
||||||
if (*p == Comma) {
|
if (*p == Comma) {
|
||||||
if (!bbeg)
|
if (!bbeg)
|
||||||
bbeg = p;
|
bbeg = p;
|
||||||
hascom = 1;
|
hascom = 2;
|
||||||
} else if (*p == Outbrace) {
|
} else if (*p == Outbrace) {
|
||||||
Brinfo new;
|
Brinfo new;
|
||||||
int len;
|
int len;
|
||||||
|
|
Loading…
Reference in a new issue