diff --git a/ble-decode.sh b/ble-decode.sh index 304be8ba..cf3ecedd 100644 --- a/ble-decode.sh +++ b/ble-decode.sh @@ -395,19 +395,23 @@ function ble-decode-char/csi/.modify-kcode { function ble-decode-char/csi/.decode { local char=$1 rex kcode if ((char==126)); then - if rex='^27;([1-9][0-9]*);?([1-9][0-9]*)$' && [[ $_ble_decode_csi_args =~ $rex ]]; then + if rex='^>?27;([0-9]+);?([0-9]+)$' && [[ $_ble_decode_csi_args =~ $rex ]]; then # xterm "CSI 2 7 ; ; ~" sequences - local kcode=$((BASH_REMATCH[2]&ble_decode_MaskChar)) - ble-decode-char/csi/.modify-kcode "${BASH_REMATCH[1]}" + local param1=$((10#${BASH_REMATCH[1]})) + local param2=$((10#${BASH_REMATCH[2]})) + local kcode=$((param2&ble_decode_MaskChar)) + ble-decode-char/csi/.modify-kcode "$param1" csistat=$kcode return fi if rex='^([1-9][0-9]*)(;([1-9][0-9]*))?$' && [[ $_ble_decode_csi_args =~ $rex ]]; then # "CSI ; ~" sequences - kcode=${_ble_decode_csimap_tilde[BASH_REMATCH[1]]} + local param1=$((10#${BASH_REMATCH[1]})) + local param3=$((10#${BASH_REMATCH[3]})) + kcode=${_ble_decode_csimap_tilde[param1]} if [[ $kcode ]]; then - ble-decode-char/csi/.modify-kcode "${BASH_REMATCH[3]}" + ble-decode-char/csi/.modify-kcode "$param3" csistat=$kcode return fi @@ -415,11 +419,13 @@ function ble-decode-char/csi/.decode { elif ((char==94||char==64)); then if rex='^[1-9][0-9]*$' && [[ $_ble_decode_csi_args =~ $rex ]]; then # rxvt "CSI ^", "CSI @" sequences - kcode=${_ble_decode_csimap_tilde[BASH_REMATCH[1]]} + local param1=$((10#${BASH_REMATCH[1]})) + local param3=$((10#${BASH_REMATCH[3]})) + kcode=${_ble_decode_csimap_tilde[param1]} if [[ $kcode ]]; then ((kcode|=ble_decode_Ctrl, char==64&&(kcode|=ble_decode_Shft))) - ble-decode-char/csi/.modify-kcode "${BASH_REMATCH[3]}" + ble-decode-char/csi/.modify-kcode "$param3" csistat=$kcode return fi @@ -430,7 +436,8 @@ function ble-decode-char/csi/.decode { kcode=${_ble_decode_csimap_alpha[char]} if [[ $kcode ]]; then if rex='^(1?|1;([1-9][0-9]*))$' && [[ $_ble_decode_csi_args =~ $rex ]]; then - ble-decode-char/csi/.modify-kcode "${BASH_REMATCH[2]}" + local param2=$((10#${BASH_REMATCH[2]})) + ble-decode-char/csi/.modify-kcode "$param2" csistat=$kcode return fi diff --git a/ble-edit.sh b/ble-edit.sh index 5c8cb800..6ff5ff01 100644 --- a/ble-edit.sh +++ b/ble-edit.sh @@ -555,10 +555,10 @@ function ble-edit/draw/trace/SGR/arg_next { fi if ((j<${#f[*]})); then - _ret=${f[j++]} + ((_ret=10#0${f[j++]})) else ((i++)) - _ret=${specs[i]%%:*} + ((_ret=10#0${specs[i]%%:*})) fi (($_var=_ret)) @@ -575,68 +575,69 @@ function ble-edit/draw/trace/SGR { for ((i=0,iN=${#specs[@]};i=cols&&(x=cols-1),