Unverified Commit 3f34ce4d authored by CrispyConductor's avatar CrispyConductor Committed by GitHub
Browse files

fix(vi-mode): fix keymap indicator on zle-line-finish (#9620)

* Update VI_KEYMAP on zle-line-finish.  Fixes next prompt draw.

* Also fix vi-mode prompt redraw in case previous prompt was canceled

* Do not redraw fix prompt if VI_MODE_RESET_PROMPT_ON_MODE_CHANGE is unset

* Use a local variable instead of global in function
parent e5d206c8
...@@ -50,13 +50,17 @@ zle -N zle-keymap-select ...@@ -50,13 +50,17 @@ zle -N zle-keymap-select
# These "echoti" statements were originally set in lib/key-bindings.zsh # These "echoti" statements were originally set in lib/key-bindings.zsh
# Not sure the best way to extend without overriding. # Not sure the best way to extend without overriding.
function zle-line-init() { function zle-line-init() {
local prev_vi_keymap
prev_vi_keymap="${VI_KEYMAP:-}"
typeset -g VI_KEYMAP=main typeset -g VI_KEYMAP=main
[[ "$prev_vi_keymap" != 'main' ]] && [[ "${VI_MODE_RESET_PROMPT_ON_MODE_CHANGE:-}" = true ]] && zle reset-prompt
(( ! ${+terminfo[smkx]} )) || echoti smkx (( ! ${+terminfo[smkx]} )) || echoti smkx
_vi-mode-set-cursor-shape-for-keymap "${VI_KEYMAP}" _vi-mode-set-cursor-shape-for-keymap "${VI_KEYMAP}"
} }
zle -N zle-line-init zle -N zle-line-init
function zle-line-finish() { function zle-line-finish() {
typeset -g VI_KEYMAP=main
(( ! ${+terminfo[rmkx]} )) || echoti rmkx (( ! ${+terminfo[rmkx]} )) || echoti rmkx
_vi-mode-set-cursor-shape-for-keymap default _vi-mode-set-cursor-shape-for-keymap default
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment