diff --git a/lib/init-cmap.sh b/lib/init-cmap.sh index 90e14c9c..c9b68cf7 100644 --- a/lib/init-cmap.sh +++ b/lib/init-cmap.sh @@ -125,10 +125,26 @@ function ble/init:cmap/initialize { ble-bind --csi '5~' end ble-bind --csi '6~' next else - ble-bind --csi '1~' home + # Note: openSUSE の /etc/inputrc.keys が home/end と find/select + # を別のキーと見做して誰も使わない keybinding を設定しているので、 + # home/end が上書きされてしまう。仕方がないので TERM=xterm の時 + # のみ find/select を独立したキーとして取り扱う事にする。これで + # 動かなくなる設定も存在するかもしれないが、取り敢えず openSUSE + # inputrc を優先させてみる事にする。 + # + + # 調べると DEC keyboard では home/end の位置に find/select と印字 + # されている。幾つかの端末で 1~/4~ が home/end になっているのはこ + # れが由来だろう。 + if [[ $kend == $'\e[F' && ( $TERM == xterm || $TERM == xterm-* || $TERM == kvt ) ]]; then + ble-bind --csi '1~' find + ble-bind --csi '4~' select + else + ble-bind --csi '1~' home + ble-bind --csi '4~' end + fi ble-bind --csi '2~' insert ble-bind --csi '3~' delete - ble-bind --csi '4~' end ble-bind --csi '5~' prior ble-bind --csi '6~' next fi @@ -264,6 +280,8 @@ function ble/init:cmap/initialize { # ble/init:cmap/bind-single-csi '3 z' delete # terminfo # ble/init:cmap/bind-single-csi '1 9 2 z' f11 # ble/init:cmap/bind-single-csi '1 9 3 z' f12 + ble/init:cmap/bind-single-csi '1 z' find # from xterm ctlseqs + ble/init:cmap/bind-single-csi '4 z' select # from xterm ctlseqs # 修飾キー 'CAN @ ?' # diff --git a/memo/ChangeLog.md b/memo/ChangeLog.md index a7ae66bb..8e3ecbd4 100644 --- a/memo/ChangeLog.md +++ b/memo/ChangeLog.md @@ -96,7 +96,7 @@ - keymap/vi: update mode names on change of `bleopt keymap_vi_mode_name_*` (motivated by huresche) `#D1565` 11ac106 - main: show notifications against debug versions of Bash `#D1612` 8f974aa - term: update `vte` identification `#D1620` 00e74d8 -- edit: suppress only `stderr` with `internal_suppress_bash_output` (motivated by rashil2000) `#D1646` 0000000 +- edit: suppress only `stderr` with `internal_suppress_bash_output` (motivated by rashil2000) `#D1646` a30887f ## Fixes @@ -160,7 +160,7 @@ - global: work around readonly `TMOUT` (reported by farmerbobathan) `#D1630` 44e6ec1 - complete: fix a task scheduling bug of referencing two different clocks (reported by rashil2000) `#D1636` fea5f5b - canvas: update prompt trace on `char_width_mode` change (reported by Barbarossa93) `#D1642` 68ee111 -- decode (`cmap/initialize`): fix unquoted special chars in the cmap cache `#D1647` 0000000 +- decode (`cmap/initialize`): fix unquoted special chars in the cmap cache `#D1647` 7434d2d ## Optimization @@ -179,7 +179,7 @@ - util (`ble/util/assign`): work around subshell conflicts `#D1578` 6e4bb12 - history: use `mapfile -d ''` to load history in Bash 5.2 `#D1603` 72c274e - prompt: use `${PS1@P}` when the prompt contains only safe prompt sequences `#D1617` 8b5da08 - - prompt: fix not properly set `$?` in `${PS1@P}` evaluation (reported by nihilismus) `#D1644` 0000000 + - prompt: fix not properly set `$?` in `${PS1@P}` evaluation (reported by nihilismus) `#D1644` 521aff9 ## Compatibility @@ -199,6 +199,7 @@ - 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 +- cmap: distinguish find/select from home/end for openSUSE `inputrc.keys` (reported by cornfeedhobo) `#D1648` 0000000 ## Internal changes and fixes diff --git a/note.txt b/note.txt index b2de8753..ac0c02b1 100644 --- a/note.txt +++ b/note.txt @@ -5372,6 +5372,33 @@ bash_tips Done (実装ログ) ------------------------------------------------------------------------------- +2021-09-21 + + * cmap: home/end が openSUSE で効かない (reported by cornfeedhobo) [#D1648] + https://web.libera.chat/?channel=#bash-it + + home/end が効かない。これもまた openSUSE の問題の可能性はある。 + これは /etc/inputrc.keys の以下の行が原因であった。 + + https://github.com/openSUSE/aaa_base/blob/master/files/etc/inputrc.keys#L233-L234 + + そもそも find/select は terminfo にも存在しないし、terminfo を参照している + だけでは判定する事は不可能である。つまり TERM を直接見て判断しないと + find/select を検出するのは不可能である。一方で openSUSE inputrc.keys は直接 + term を参照している。 + + また openSUSE に対して問題を報告しようと思ったが、xterm 決め打ちならば 1~, + 4~ は find/select とする事に明確な問題がある訳でもない様な気がする。問題が + 発生するとすれば screen の xterm-256color emulation であるが、どうも確認し + た感じだと手元の screen.xterm-256color と向こうの screen.xterm-256color で + khome, kend の内容が異なる様である。openSUSE の screen は khome, kend は + \e[H, \e[F になっているが、手元の screen.xterm-256color だと khome=\e[1~, + kend=\e[4~ になっている。 + + もう面倒なので find/select に対応する事にする。結局誰も使わないキーの様な気 + もするが、単にトラブルを避ける為に無視するキーの名前という事になる。 + →実際に openSUSE で試してみて動作する事を確認した。 + 2021-09-16 * decode: failglob で cmap 初期化時にエラーになる問題 [#D1647]