summaryrefslogtreecommitdiff
path: root/Functions/Zle/zed-set-file-name
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2022-04-11 00:17:48 +0200
committerAxel Beckert <abe@deuxchevaux.org>2022-04-11 00:17:48 +0200
commitb09f4483416c54c1782824633dfabaf2ec0265b6 (patch)
tree304bc82642862525ae680c7fbaa249663b10ad57 /Functions/Zle/zed-set-file-name
parent12eb3e5356f2fc3351eed58ef1cef1b8fb83b504 (diff)
parent6e55c920503071e917619b8cb1a188cd35d772db (diff)
downloadzsh-b09f4483416c54c1782824633dfabaf2ec0265b6.tar.gz
zsh-b09f4483416c54c1782824633dfabaf2ec0265b6.zip
New upstream version 5.8.1.2-test
Diffstat (limited to 'Functions/Zle/zed-set-file-name')
-rw-r--r--Functions/Zle/zed-set-file-name27
1 files changed, 22 insertions, 5 deletions
diff --git a/Functions/Zle/zed-set-file-name b/Functions/Zle/zed-set-file-name
index da3421e71..745610660 100644
--- a/Functions/Zle/zed-set-file-name
+++ b/Functions/Zle/zed-set-file-name
@@ -2,8 +2,25 @@ emulate -L zsh
autoload -Uz read-from-minibuffer
-zle -K zed-normal-keymap
-
-local REPLY
-read-from-minibuffer "File name: "
-zed_file_name=$REPLY
+case $curcontext in
+ (zed:::)
+ local curcontext=zed-set-file-name:::
+ # The call to vared from zed does the equivalent of
+ # bindkey -A zed main
+ # which confuses read-from-minibuffer. Fix it.
+ bindkey -A zed-normal-keymap main;;
+ (zed-set-file-name:::)
+ zle -M "zed-set-file-name: may not be called recursively"
+ return 1;;
+ (*)
+ zle -M "zed-set-file-name: not called from within zed"
+ return 1;;
+esac
+{
+ local REPLY
+ read-from-minibuffer "File name: "
+ zed_file_name=$REPLY
+} always {
+ # Re-install the zed keymap in the way vared should have all along
+ zle -K zed
+}