From ab899b76c790d1cb13b76716d4d99b6bd7ac983c Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 30 Jul 2004 11:09:16 +0000 Subject: 20222: turn on max function depth plus unposted reference to this in README plus unposted neatening of 20219 history-pattern-search --- Functions/Zle/history-pattern-search | 4 +++- Functions/Zle/read-from-minibuffer | 32 +++++++++++++++++--------------- 2 files changed, 20 insertions(+), 16 deletions(-) (limited to 'Functions') diff --git a/Functions/Zle/history-pattern-search b/Functions/Zle/history-pattern-search index 02f85a2fb..a6b12bd9c 100644 --- a/Functions/Zle/history-pattern-search +++ b/Functions/Zle/history-pattern-search @@ -28,7 +28,9 @@ else fi # Read pattern. Prompt could be made customisable. -read-from-minibuffer "pat ($dir): " +read-from-minibuffer "pat ($dir): " $_last_history_pattern_search + +_last_history_pattern_search=$REPLY # Abort if bad status or nothing entered [[ $? -ne 0 || -z $REPLY ]] && return 0 diff --git a/Functions/Zle/read-from-minibuffer b/Functions/Zle/read-from-minibuffer index c3848ae9f..ba75cbdce 100644 --- a/Functions/Zle/read-from-minibuffer +++ b/Functions/Zle/read-from-minibuffer @@ -5,15 +5,17 @@ local opt keys integer stat while getopts "k:" opt; do - case $opt in - (k) - keys=$OPTARG - ;; - - (*) - return 1 - ;; - esac + 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 done (( OPTIND > 1 )) && shift $(( OPTIND - 1 )) @@ -27,13 +29,13 @@ ${1:-? }" POSTDISPLAY= if [[ -n $keys ]]; then - zle -R - read -k $keys - stat=$? + zle -R + read -k $keys + stat=$? else - zle recursive-edit - stat=$? - (( stat )) || REPLY=$BUFFER + zle recursive-edit + stat=$? + (( stat )) || REPLY=$BUFFER fi LBUFFER=$savelbuffer -- cgit 1.4.1