diff options
author | Bart Schaefer <schaefer@ipost.com> | 2021-05-15 13:23:31 -0700 |
---|---|---|
committer | Bart Schaefer <schaefer@ipost.com> | 2021-05-15 13:23:31 -0700 |
commit | 231c049c022963f65f869b9c12e763473207b42a (patch) | |
tree | 1988ea722c23f8086de62f64a0b397d6022c7e76 /Functions | |
parent | 9e38ab81785c4ac755a7e78d2fe7a7db92bdf375 (diff) | |
download | zsh-231c049c022963f65f869b9c12e763473207b42a.tar.gz zsh-231c049c022963f65f869b9c12e763473207b42a.tar.xz zsh-231c049c022963f65f869b9c12e763473207b42a.zip |
48707: fix keymap handling when zed invokes read-from-minibuffer; update doc
Diffstat (limited to 'Functions')
-rw-r--r-- | Functions/Zle/zed-set-file-name | 27 |
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 +} |