Skip to content

Commit

Permalink
decode: recognize "DA1" response sent by some terminals
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Jul 17, 2019
1 parent 63d21c2 commit 362ab05
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
17 changes: 17 additions & 0 deletions memo.txt
Expand Up @@ -3251,6 +3251,23 @@ bash_tips
Done (実装ログ)
-------------------------------------------------------------------------------

2019-07-17

* decode: DA1 応答の読み取りに失敗して変な文字列が入力される (reported by miba072) [#D1135]
https://github.com/akinomyoga/ble.sh/issues/28

どうも DA2 に対して DA1 応答が為されている様である。DA1 に応答する様に修正した。

後、よく考えたら認識できないキーシーケンスはその時点で破棄するべきでは。
と思ったがデフォルトで破棄する設定になっている様な…。
或いは ble-0.3 の時点では状況が違っただろうか。
どうも調べると 0.3 では CSI seq に関してはちゃんと処理していない様だ。
うーん。色々修正しなければならなそう。

念の為、以前 0.4 で何処で修正したのかを確認する。
2019-04-01 ab1b8b0 である。#D1056 だ。
うーん。ab1b8b0 を覗いたら別に他に影響も無さそうなので cherry-pick してしまう事にした。

2019-07-16

* highlight: ファイル名のディレクトリ部分の着色で、 [#D1134]
Expand Down
9 changes: 7 additions & 2 deletions src/decode.sh
Expand Up @@ -620,9 +620,14 @@ function ble-decode-char/csi/.decode {
fi
fi
elif ((char==99)); then # c
if rex='^>'; [[ $_ble_decode_csi_args =~ $rex ]]; then
if rex='^[?>]'; [[ $_ble_decode_csi_args =~ $rex ]]; then
# DA1 応答 "CSI ? Pm c" (何故か DA2 要求に対して DA1 で返す端末がある?)
# DA2 応答 "CSI > Pm c"
ble/term/DA2/notify "${_ble_decode_csi_args:1}"
if [[ $_ble_decode_csi_args == '?'* ]]; then
ble/term/DA1/notify "${_ble_decode_csi_args:1}"
else
ble/term/DA2/notify "${_ble_decode_csi_args:1}"
fi
csistat=$_ble_decode_KCODE_IGNORE
return
fi
Expand Down
2 changes: 1 addition & 1 deletion src/history.sh
Expand Up @@ -223,7 +223,7 @@ if ((_ble_bash>=40000)); then
# 47ms _ble_history 初期化 (37000項目)
(3) _ble_history_load_bgpid=
if [[ $opt_cygwin ]]; then
# 620ms Cygwin (99000項目)
# 620ms Cygwin (99000項目) cf #D0701
source "$history_tmpfile"
else
builtin mapfile -O "$arg_offset" -t _ble_history < "$history_tmpfile"
Expand Down
6 changes: 3 additions & 3 deletions src/util.sh
Expand Up @@ -2749,10 +2749,10 @@ function ble/term/bracketed-paste-mode/leave {

#---- DA2 ---------------------------------------------------------------------

_ble_term_DA1R=
_ble_term_DA2R=
function ble/term/DA2/notify {
_ble_term_DA2R=$1
}
function ble/term/DA1/notify { _ble_term_DA1R=$1; }
function ble/term/DA2/notify { _ble_term_DA2R=$1; }

#---- DSR(6) ------------------------------------------------------------------
# CPR (CURSOR POSITION REPORT)
Expand Down

0 comments on commit 362ab05

Please sign in to comment.