2003-03-28 12:34:07 +01:00
|
|
|
emulate -L zsh
|
|
|
|
setopt extendedglob
|
|
|
|
|
|
|
|
local opt keys
|
|
|
|
integer stat
|
|
|
|
|
|
|
|
while getopts "k:" opt; do
|
2004-07-30 13:09:16 +02:00
|
|
|
case $opt in
|
|
|
|
# Read the given number of keys. This is a bit
|
|
|
|
# ropey for more than a single key.
|
|
|
|
(k)
|
|
|
|
keys=$OPTARG
|
|
|
|
;;
|
|
|
|
|
|
|
|
(*)
|
|
|
|
return 1
|
|
|
|
;;
|
|
|
|
esac
|
2003-03-28 12:34:07 +01:00
|
|
|
done
|
|
|
|
(( OPTIND > 1 )) && shift $(( OPTIND - 1 ))
|
|
|
|
|
2008-04-03 13:38:55 +02:00
|
|
|
local pretext="$PREDISPLAY$LBUFFER$RBUFFER$POSTDISPLAY
|
|
|
|
"
|
|
|
|
local LBUFFER="$2"
|
|
|
|
local RBUFFER="$3"
|
|
|
|
local PREDISPLAY="$pretext${1:-? }"
|
|
|
|
local POSTDISPLAY=
|
|
|
|
local -a region_highlight
|
|
|
|
region_highlight=("P${#pretext} ${#PREDISPLAY} bold")
|
2003-02-03 12:05:53 +01:00
|
|
|
|
2003-03-28 12:34:07 +01:00
|
|
|
if [[ -n $keys ]]; then
|
2004-07-30 13:09:16 +02:00
|
|
|
zle -R
|
|
|
|
read -k $keys
|
|
|
|
stat=$?
|
2003-03-28 12:34:07 +01:00
|
|
|
else
|
2006-03-21 20:19:05 +01:00
|
|
|
zle recursive-edit -K main
|
2004-07-30 13:09:16 +02:00
|
|
|
stat=$?
|
|
|
|
(( stat )) || REPLY=$BUFFER
|
2003-03-28 12:34:07 +01:00
|
|
|
fi
|
2003-02-03 12:05:53 +01:00
|
|
|
|
|
|
|
return $stat
|