Browse Source

[Fix #516] Define ZLE functions separately

master
Sorin Ionescu 11 years ago
parent
commit
e1974ad58d
  1. 41
      modules/editor/init.zsh

41
modules/editor/init.zsh

@ -107,31 +107,40 @@ function editor-info {
} }
zle -N editor-info zle -N editor-info
# Ensures that $terminfo values are valid and updates editor information when # Updates editor information when the keymap changes.
# the keymap changes. function zle-keymap-select {
function zle-keymap-select zle-line-init zle-line-finish { zle editor-info
}
zle -N zle-keymap-select
# Enables terminal application mode and updates editor information.
function zle-line-init {
# The terminal must be in application mode when ZLE is active for $terminfo # The terminal must be in application mode when ZLE is active for $terminfo
# values to be valid. # values to be valid.
if (( $+terminfo[smkx] && $+terminfo[rmkx] )); then if (( $+terminfo[smkx] )); then
case "$0" in # Enable terminal application mode.
(zle-line-init) echoti smkx
# Enable terminal application mode.
echoti smkx
;;
(zle-line-finish)
# Disable terminal application mode.
echoti rmkx
;;
esac
fi fi
# Update editor information. # Update editor information.
zle editor-info zle editor-info
} }
zle -N zle-keymap-select
zle -N zle-line-finish
zle -N zle-line-init zle -N zle-line-init
# Disables terminal application mode and updates editor information.
function zle-line-finish {
# The terminal must be in application mode when ZLE is active for $terminfo
# values to be valid.
if (( $+terminfo[rmkx] )); then
# Disable terminal application mode.
echoti rmkx
fi
# Update editor information.
zle editor-info
}
zle -N zle-line-finish
# Toggles emacs overwrite mode and updates editor information. # Toggles emacs overwrite mode and updates editor information.
function overwrite-mode { function overwrite-mode {
zle .overwrite-mode zle .overwrite-mode

Loading…
Cancel
Save