summaryrefslogtreecommitdiff
path: root/Functions/Zle/replace-string
diff options
context:
space:
mode:
authorFrank Terbeck <ft@bewatermyfriend.org>2011-12-01 10:02:04 +0100
committerFrank Terbeck <ft@bewatermyfriend.org>2011-12-01 10:02:04 +0100
commitd8da5ea2f2bc5f837d0b364fff2636ebdb2f90ca (patch)
tree9fd9a57486ac4702608d92088ffd91f52971244f /Functions/Zle/replace-string
parentaf2bb4fdb09414d21922d3fafe4e3a0ac1332f01 (diff)
parent9d71f4c207fb34e8d64af0443c83231b1cc3b494 (diff)
downloadzsh-d8da5ea2f2bc5f837d0b364fff2636ebdb2f90ca.tar.gz
zsh-d8da5ea2f2bc5f837d0b364fff2636ebdb2f90ca.zip
Merge commit 'zsh-4.3.13' into debian
Diffstat (limited to 'Functions/Zle/replace-string')
-rw-r--r--Functions/Zle/replace-string20
1 files changed, 15 insertions, 5 deletions
diff --git a/Functions/Zle/replace-string b/Functions/Zle/replace-string
index bc608e577..a3416a403 100644
--- a/Functions/Zle/replace-string
+++ b/Functions/Zle/replace-string
@@ -3,7 +3,15 @@ setopt extendedglob
autoload -Uz read-from-minibuffer replace-string-again
-local p1="Replace: " p2=" with: "
+local p1 p2
+
+if [[ -n $_replace_string_src ]]; then
+ p1="[$_replace_string_src -> $_replace_string_rep]"$'\n'
+fi
+
+p1+="Replace: "
+p2=" with: "
+
# Saving curwidget is necessary to avoid the widget name being overwritten.
local REPLY previous curwidget=$WIDGET
@@ -14,10 +22,12 @@ else
fi
read-from-minibuffer $p1 ${previous:+$_replace_string_src} || return 1
-typeset -g _replace_string_src=$REPLY
+if [[ -n $REPLY ]]; then
+ typeset -g _replace_string_src=$REPLY
-read-from-minibuffer "$p1$_replace_string_src$p2" \
- ${previous:+$_replace_string_rep} || return 1
-typeset -g _replace_string_rep=$REPLY
+ read-from-minibuffer "$p1$_replace_string_src$p2" \
+ ${previous:+$_replace_string_rep} || return 1
+ typeset -g _replace_string_rep=$REPLY
+fi
replace-string-again $curwidget