Skip to content

Commit

Permalink
decode: identify "kitty" and treat "\e[27u" as isolated ESC
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Sep 23, 2021
1 parent 6987ae8 commit 2f7404e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/decode.sh
Expand Up @@ -669,6 +669,7 @@ function ble-decode-char/csi/consume {
elif ((64<=char&&char<127)); then
_ble_decode_csi_mode=0
ble-decode-char/csi/.decode "$char"
((csistat==27)) && csistat=$_ble_decode_IsolatedESC
else
_ble_decode_csi_mode=0
fi ;;
Expand Down
11 changes: 9 additions & 2 deletions src/util.sh
Expand Up @@ -3158,6 +3158,13 @@ function ble/term/modifyOtherKeys/.update {
esac
_ble_term_modifyOtherKeys_current=$1
}
function ble/term/modifyOtherKeys/.iskitty {
[[ $TERM == xterm-kitty ]] && return 0
[[ $_ble_term_DA2R == '1;'* ]] || return 1
local da2r
ble/string#split da2r ';' "$_ble_term_DA2R"
((4000<=da2r[1]&&da2r[1]<4100&&3<=da2r[2]))
}
function ble/term/modifyOtherKeys/.supported {
# libvte は SGR(>4) を直接画面に表示してしまう
[[ $_ble_term_DA2R == '1;'* ]] && return 1
Expand All @@ -3184,10 +3191,10 @@ function ble/term/modifyOtherKeys/leave {
local value=$bleopt_term_modifyOtherKeys_external
if [[ $value == auto ]]; then
value=1
# 問題を起こす端末で無効化。
if [[ $TERM == xterm-kitty ]]; then
if ble/term/modifyOtherKeys/.iskitty; then
value=0 # Kitty は 1 では無効にならない。変な振る舞い
else
# 問題を起こす端末で無効化。
ble/term/modifyOtherKeys/.supported || value=
fi
fi
Expand Down

0 comments on commit 2f7404e

Please sign in to comment.