1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-23 17:01:05 +02:00

zcalc completion idiosyncracies with :!

This commit is contained in:
Peter Stephenson 2008-06-13 14:27:37 +00:00
parent 627c7db0e5
commit aadd07e05f
2 changed files with 8 additions and 10 deletions

View file

@ -22,7 +22,7 @@ _zcalc_line_escapes() {
_zcalc_line() { _zcalc_line() {
local expl local expl
if [[ CURRENT -eq 1 && $words[1] != ":!"* ]]; then if [[ CURRENT -eq 1 && $words[1] != ":"(\\|)"!"* ]]; then
local -a alts local -a alts
if [[ $words[1] = (|:*) ]]; then if [[ $words[1] = (|:*) ]]; then
alts=("command-escapes:command escape:_zcalc_line_escapes") alts=("command-escapes:command escape:_zcalc_line_escapes")
@ -35,15 +35,13 @@ _zcalc_line() {
fi fi
case $words[1] in case $words[1] in
(":!"*) (":"(\\|)"!"*)
if [[ $words[1] = ":!" ]]; then if [[ $words[1] = ":"(\\|)"!" && CURRENT -gt 1 ]]; then
shift words shift words
(( CURRENT >1 && CURRENT-- )) (( CURRENT-- ))
else else
words[1]=${words[1]##:\!} words[1]=${words[1]##:(\\|)\!}
if (( CURRENT == 1 )); then compset -P ':(\\|)!'
compset -P ":\!"
fi
fi fi
_normal _normal
;; ;;

View file

@ -179,9 +179,9 @@ while vared -cehp "${(%)ZCALCPROMPT}" line; do
line="${${line##[[:blank:]]#}%%[[:blank:]]#}" line="${${line##[[:blank:]]#}%%[[:blank:]]#}"
case "$line" in case "$line" in
# Escapes begin with a colon # Escapes begin with a colon
(:(\\|)!*) (:(\\|)\!*)
# shell escape: handle completion's habit of quoting the ! # shell escape: handle completion's habit of quoting the !
eval ${line##:\![[:blank:]]#} eval ${line##:(\\|)\![[:blank:]]#}
line= line=
continue continue
;; ;;