Skip to content

Commit

Permalink
global: improve the workaround of bash-4.2 declare -gA by separate …
Browse files Browse the repository at this point in the history
…assignments
  • Loading branch information
akinomyoga committed Jul 28, 2022
1 parent b708ee2 commit 0b7de99
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions ble-decode.sh
Expand Up @@ -49,12 +49,13 @@ ble_decode_MaskFlag=0x7FC00000

ble_decode_IsolatedESC=$((0x07FF))

if ((_ble_bash>=40300||_ble_bash>=40000&&!_ble_bash_loaded_in_function)); then
if ((_ble_bash>=40200||_ble_bash>=40000&&!_ble_bash_loaded_in_function)); then
_ble_decode_kbd_ver=4
_ble_decode_kbd__n=0
builtin unset -v _ble_decode_kbd__k2c
if ((_ble_bash>=40300)); then
if ((_ble_bash>=40200)); then
declare -gA _ble_decode_kbd__k2c
_ble_decode_kbd__k2c=()
else
declare -A _ble_decode_kbd__k2c
fi
Expand Down
8 changes: 4 additions & 4 deletions ble-syntax-lazy.sh
Expand Up @@ -69,11 +69,11 @@ fi
#------------------------------------------------------------------------------
# グローバル変数の定義 (関数内からではできないのでここで先に定義)

if ((_ble_bash>=40300||_ble_bash>=40000&&!_ble_bash_loaded_in_function)); then
if ((_ble_bash>=40200||_ble_bash>=40000&&!_ble_bash_loaded_in_function)); then
builtin unset -v _ble_syntax_highlight_filetype
builtin unset -v _ble_syntax_highlight_lscolors_ext
if ((_ble_bash>=40300)); then
declare -gA _ble_syntax_highlight_filetype=()
if ((_ble_bash>=40200)); then
declare -gA _ble_syntax_highlight_filetype
_ble_syntax_highlight_filetype=()
else
declare -A _ble_syntax_highlight_filetype=()
fi
Expand Down
2 changes: 1 addition & 1 deletion lib/core-syntax.sh
Expand Up @@ -4543,7 +4543,7 @@ function ble-syntax/highlight/cmdtype2 {
## @param[in] word
## シェル展開・クォート除去を実行する前の文字列を指定します。
## @var[out] type
if ((_ble_bash>=40300||_ble_bash>=40000&&!_ble_bash_loaded_in_function)); then
if ((_ble_bash>=40200||_ble_bash>=40000&&!_ble_bash_loaded_in_function)); then
# Note: 連想配列 _ble_syntax_highlight_filetype は ble-syntax-lazy.sh で先に定義される。

_ble_syntax_highlight_filetype_version=-1
Expand Down

0 comments on commit 0b7de99

Please sign in to comment.