Skip to content

Commit

Permalink
util (modifyOtherKeys): use the kitty protocol in kitty 0.23+
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Nov 23, 2021
1 parent a6b4e2c commit ec91574
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 7 deletions.
3 changes: 2 additions & 1 deletion docs/ChangeLog.md
Expand Up @@ -217,11 +217,12 @@
- complete: work around `bash-completion` bugs (reported by oc1024) `#D1533` 9d4ad56
- main: work around MSYS2 .inputrc (reported by n1kk) `#D1534` 9e786ae
- util (`modifyOtherKeys`): work around a quirk of Kitty (reported by NoahGorny) `#D1549` f599525
- util (`modifyOtherKeys`): update the workaround for a new quiark of kitty `#D1627` 3e4ecf5
- util (`modifyOtherKeys`): use the kitty protocol for kitty 0.23+ which removes the support of `modifyOtherKeys` `#D1681` 0000000
- global: work around empty `vi_imap` cache by `tmux-resurrect` `#D1562` 560160b
- decode: identify `kitty` and treat `\e[27u` as isolated ESC (reported by lyiriyah) `#D1585` c2a84a2
- complete: suppress known error messages of `bash-completion` (reported by oc1024, Lun4m) `#D1622` d117973
- decode: work around kitty keypad keys in modifyOtherKeys (reported by Nudin) `#D1626` 27c80f9
- util (`modifyOtherKeys`): update the workaround for a new quiark of kitty `#D1627` 3e4ecf5
- main: work around `set -B` and `set -k` `#D1628` a860769
- term: disable `modifyOtherKeys` and do not send `DA2` for `st` (requested by Shahabaz-Bagwan) `#D1632` 92c7b26
- cmap: add `st`-specific escape sequences for cursor keys `#D1633` acfb879
Expand Down
34 changes: 34 additions & 0 deletions note.txt
Expand Up @@ -5448,6 +5448,40 @@ bash_tips
Done (実装ログ)
-------------------------------------------------------------------------------

2021-11-23

* util (modifyOtherKeys): kitty は modifyOtherKeys を廃止する (reported by kovid) [#D1681]
https://github.com/akinomyoga/ble.sh/issues/110#issuecomment-975732850

* ok: kitty のインストーラのリンクからダウンロードできない。証明書がおかし
い。と思ったら単に vm の時刻がずれていただけだった。

* Ubuntu 20 の VM に残っていた kitty 0.20.3 では既に CSI > 1 u には対応して
いる様子である。DA2R は 1;4000;20 である。然し何だか C-S-? に対する振る舞
いが分からなかったので kitty 0.23.1 に上げてしまった。DA2R は 1;4000;23
である。

* 然し、ctrl+shift+a などが全く効かない。と思って気づいたのだが、どうやら
kitty がそれを解釈している様である。C-S-up, C-S-down はスクロールで C-S-h
は clear-screen か何かだろうか。C-S-a は無反応で C-S-g はちゃんと制御シー
ケンスが送られる。つまり、kitty に割り当てられていない C-S-? に関してはちゃ
んと送信する事ができる。然し、試した感じだと殆どの C-S-? は kitty によっ
て上書きされている様である。

* kitty の ctrl+shift+a を無効にする方法はないのだろうか? うーん。結局一つ
ずつ解除していくしかない様だ。取り敢えず全部解除したらそれっぽい感じになっ
た。

* どの version から CSI > u と CSI < u が存在するのだろうか。というかそもそ
も現在の version でも CSI >4;2m は効くという事なのだろうか。

https://github.com/kovidgoyal/kitty/issues/4075
https://github.com/kovidgoyal/kitty/commit/d6a43a7729d50b6f452ccdb93c746b0e115ebd38

どうやら kitty から modifyOtherKeys が完全に削除される運びとなった様だ。発
端は vim から kitty の modifyOtherKeys の振る舞いが変だという指摘を受けて、
逆上して全削除という事に相成った様だ。

2021-11-12

* main: "alias set=export" としている人がいる (reported by eadmaster) [#D1680]
Expand Down
33 changes: 27 additions & 6 deletions src/util.sh
Expand Up @@ -5624,12 +5624,33 @@ function ble/term/modifyOtherKeys/.update {
(2) ble/util/buffer $'\e[>5;1m\e[>5;2m' ;;
esac ;;
(kitty)
# Note #D1549: 1 では無効にならない。変な振る舞い。
# Note #D1626: 更に最近の kitty では \e[>4;0m でも駄目で \e[>4m としなければならない様だ。
case $1 in
(0|1) ble/util/buffer $'\e[>4;0m\e[>4m' ;;
(2) ble/util/buffer $'\e[>4;1m\e[>4;2m\e[m' ;;
esac
local da2r
ble/string#split da2r ';' "$_ble_term_DA2R"
if ((da2r[2]>=23)); then
# Note: Kovid removed the support for modifyOtherKeys in kitty 0.24 after
# vim has pointed out the quirk of kitty. The kitty keboard mode only
# has push/pop operations so that they need to be balanced.
case $1 in
(0|1) # pop keyboard mode
# When this is empty, ble.sh has nto yet pushed any keyboard modes, so
# we just ignore the keyboard mode change.
[[ $_ble_term_modifyOtherKeys_current ]] || return 0

((_ble_term_modifyOtherKeys_current>=2)) &&
ble/util/buffer $'\e[<u' ;;
(2) # push keyboard mode
((_ble_term_modifyOtherKeys_current>=2)) &&
ble/util/buffer $'\e[>1u' ;;
esac
else
# Note #D1549: 1 では無効にならない。変な振る舞い。
# Note #D1626: 更に最近の kitty では \e[>4;0m でも駄目で \e[>4m としなければならない様だ。
case $1 in
(0|1) ble/util/buffer $'\e[>4;0m\e[>4m' ;;
(2) ble/util/buffer $'\e[>4;1m\e[>4;2m\e[m' ;;
esac
fi
_ble_term_modifyOtherKeys_current=$1
return 0 ;;
esac

Expand Down

0 comments on commit ec91574

Please sign in to comment.