mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-11 00:00:06 +00:00
don't trust cnorm as it's incorrect in some combinations of terminals and terminfo (#1699)
This commit is contained in:
parent
fd5fa09504
commit
e72264e01c
2 changed files with 16 additions and 3 deletions
|
@ -6999,7 +6999,7 @@ function _p9k_reset_prompt() {
|
||||||
zle .reset-prompt
|
zle .reset-prompt
|
||||||
(( ${+functions[z4h]} )) || zle -R
|
(( ${+functions[z4h]} )) || zle -R
|
||||||
} always {
|
} always {
|
||||||
(( _p9k__can_hide_cursor )) && echoti cnorm
|
(( _p9k__can_hide_cursor )) && print -rn -- $_p9k__cnorm
|
||||||
_p9k__cursor_hidden=0
|
_p9k__cursor_hidden=0
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
@ -7121,6 +7121,14 @@ _p9k_init_vars() {
|
||||||
typeset -gi _p9k__restore_prompt_fd
|
typeset -gi _p9k__restore_prompt_fd
|
||||||
typeset -gi _p9k__redraw_fd
|
typeset -gi _p9k__redraw_fd
|
||||||
typeset -gi _p9k__can_hide_cursor=$(( $+terminfo[civis] && $+terminfo[cnorm] ))
|
typeset -gi _p9k__can_hide_cursor=$(( $+terminfo[civis] && $+terminfo[cnorm] ))
|
||||||
|
if (( _p9k__can_hide_cursor )); then
|
||||||
|
# See https://github.com/romkatv/powerlevel10k/issues/1699
|
||||||
|
if [[ $terminfo[cnorm] == *$'\e[?25h'(|'\e'*) ]]; then
|
||||||
|
typeset -g _p9k__cnorm=$'\e[?25h'
|
||||||
|
else
|
||||||
|
typeset -g _p9k__cnorm=$terminfo[cnorm]
|
||||||
|
fi
|
||||||
|
fi
|
||||||
typeset -gi _p9k__cursor_hidden
|
typeset -gi _p9k__cursor_hidden
|
||||||
typeset -gi _p9k__non_hermetic_expansion
|
typeset -gi _p9k__non_hermetic_expansion
|
||||||
typeset -g _p9k__time
|
typeset -g _p9k__time
|
||||||
|
@ -7656,7 +7664,7 @@ function _p9k_on_widget_deactivate-region() { _p9k_check_visual_mode; }
|
||||||
function _p9k_on_widget_zle-line-init() {
|
function _p9k_on_widget_zle-line-init() {
|
||||||
(( _p9k__cursor_hidden )) || return 0
|
(( _p9k__cursor_hidden )) || return 0
|
||||||
_p9k__cursor_hidden=0
|
_p9k__cursor_hidden=0
|
||||||
echoti cnorm
|
print -rn -- $_p9k__cnorm
|
||||||
}
|
}
|
||||||
|
|
||||||
function _p9k_on_widget_zle-line-finish() {
|
function _p9k_on_widget_zle-line-finish() {
|
||||||
|
|
|
@ -222,7 +222,12 @@ function hide_cursor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_cursor() {
|
function show_cursor() {
|
||||||
echoti cnorm 2>/dev/null
|
local cnorm=${terminfo[cnorm]-}
|
||||||
|
if [[ $cnorm == *$'\e[?25h'(|'\e'*) ]]; then
|
||||||
|
print -n '\e[?25h'
|
||||||
|
else
|
||||||
|
print -n $cnorm
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function consume_input() {
|
function consume_input() {
|
||||||
|
|
Loading…
Reference in a new issue