Skip to content

Commit

Permalink
util, decode, vi: fix leak variables
Browse files Browse the repository at this point in the history
- util: esc from ble/util/keyseq2chars
- util: a, b from ble/string#escape-for-bash-specialchars
- decode: qseq1, nseq1 from ble/decode/cmap/.generate-binder-template
- vi: ret from ble/keymap:vi/update-mode-indicator
  • Loading branch information
akinomyoga committed Feb 19, 2023
1 parent 58de996 commit 9e2e823
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/init-term.sh
Expand Up @@ -34,7 +34,6 @@ function ble/init:term/define-cap.2 {
}

_ble_term_sgr_term2ansi=()
ble/init:term/register-varname _ble_term_sgr_term2ansi
_ble_term_rex_sgr=$'\e''\[([0-9;:]+)m'
function ble/init:term/define-sgr-param {
local name=$1 seq=$2 ansi=$3
Expand All @@ -60,6 +59,7 @@ function ble/init:term/define-sgr-param {

function ble/init:term/initialize {
local -a varnames=()
ble/init:term/register-varname _ble_term_sgr_term2ansi

# xenl (end of line behavior)
_ble_term_xenl=1
Expand Down
4 changes: 2 additions & 2 deletions src/decode.sh
Expand Up @@ -2042,8 +2042,8 @@ function ble-decode-bind/cmap/.generate-binder-template {
for ccode in "${ccodes[@]}"; do
local ret
ble-decode-bind/c2dqs "$ccode"
qseq1=$qseq$ret
nseq1="$nseq $ccode"
local qseq1=$qseq$ret
local nseq1="$nseq $ccode"

builtin eval "local ent=\${_ble_decode_cmap_$tseq[ccode]}"
if [[ ${ent%_} ]]; then
Expand Down
3 changes: 2 additions & 1 deletion src/util.sh
Expand Up @@ -782,6 +782,7 @@ function ble/string#escape-for-bash-specialchars {

# 上の処理で extglob の ( も quote されてしまうので G の時には戻す。
if [[ $2 == *G* ]] && shopt -q extglob; then
local a b
a='!\(' b='!(' ret=${ret//"$a"/"$b"}
a='@\(' b='@(' ret=${ret//"$a"/"$b"}
a='?\(' b='?(' ret=${ret//"$a"/"$b"}
Expand Down Expand Up @@ -3831,7 +3832,7 @@ function ble/util/keyseq2chars {
local mods=
local rex='^([^\]+)|^\\([CM]-|[0-7]{1,3}|x[0-9a-fA-F]{1,2}|.)?'
while [[ $keyseq ]]; do
local text=${keyseq::1}
local text=${keyseq::1} esc
[[ $keyseq =~ $rex ]] &&
text=${BASH_REMATCH[1]} esc=${BASH_REMATCH[2]}

Expand Down

0 comments on commit 9e2e823

Please sign in to comment.