Skip to content

Commit

Permalink
highlight: fix remaininig highlighting of vanishing words
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Dec 2, 2020
1 parent 15111cf commit bf8fdc8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions ble-core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,14 @@ function ble/util/array-reverse {
"
}

function ble/util/array-fill-range {
_ble_util_array_prototype.reserve $(($2-$1))
local _ble_script='
local -a sARR; sARR=("${_ble_util_array_prototype[@]::$3-$2}")
ARR=("${ARR[@]::$2}" "${sARR[@]/#/$4}" "${ARR[@]:$3}")'
builtin eval -- "${_ble_script//ARR/$1}"
}

function ble/util/declare-print-definitions {
if [[ $# -gt 0 ]]; then
declare -p "$@" | awk -v _ble_bash="$_ble_bash" -v OSTYPE="$OSTYPE" '
Expand Down
6 changes: 3 additions & 3 deletions ble-syntax.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1920,7 +1920,7 @@ function ble-syntax/parse {
((0<=i1&&i1<=beg&&end<=i2&&i2<=iN)) || ble-stackdump "X2 0 <= $i1 <= $beg <= $end <= $i2 <= $iN"
#%end

ble-syntax/vanishing-word/register _ble_syntax_tree 0 i1 j2 0 i1
ble-syntax/vanishing-word/register _ble_syntax_tree 0 "$i1" "$j2" 0 "$i2"

ble-syntax/parse/shift

Expand Down Expand Up @@ -2602,9 +2602,9 @@ function ble-highlight-layer:syntax/word/.apply-attribute {
wbeg<wend)) || return

if [[ $attr =~ ^[0-9]+$ ]]; then
ble-highlight-layer:syntax/fill _ble_highlight_layer_syntax2_table "$wbeg" "$wend" "$attr"
ble/util/array-fill-range _ble_highlight_layer_syntax2_table "$wbeg" "$wend" "$attr"
else
ble-highlight-layer:syntax/fill _ble_highlight_layer_syntax2_table "$wbeg" "$wend" ''
ble/util/array-fill-range _ble_highlight_layer_syntax2_table "$wbeg" "$wend" ''
fi
}

Expand Down

0 comments on commit bf8fdc8

Please sign in to comment.