diff --git a/ble-color.sh b/ble-color.sh index 533ca491..fcb65ea5 100644 --- a/ble-color.sh +++ b/ble-color.sh @@ -492,6 +492,7 @@ function ble-highlight-layer:region/update-dirty-range { } function ble-highlight-layer:region/update { + local IFS=$_ble_term_IFS local omin=-1 omax=-1 osgr= olen=${#_ble_highlight_layer_region_osel[@]} if ((olen)); then omin=${_ble_highlight_layer_region_osel[0]} diff --git a/ble-core.sh b/ble-core.sh index be71cada..e30675df 100644 --- a/ble-core.sh +++ b/ble-core.sh @@ -88,8 +88,9 @@ function ble/util/restore-arrs { _ble_debug_check_leak_variable='local @var=__t1wJltaP9nmow__' function ble/debug/.check-leak-variable { if [[ ${!1} != __t1wJltaP9nmow__ ]]; then - echo "$1=${!1}:${*:2}" >> a.txt - eval "$1=__t1wJltaP9nmow__" + local IFS=$_ble_term_IFS + ble/util/print "$1=${!1}:${*:2}" >> a.txt + builtin eval "$1=__t1wJltaP9nmow__" fi } #%end @@ -241,7 +242,7 @@ function ble/string#common-suffix { ret=${a:u} } -## 関数 ble/string#split arr sep str... +## 関数 ble/string#split arr sep str ## 文字列を分割します。 ## 空白類を分割に用いた場合は、空要素は削除されます。 ## @@ -268,7 +269,7 @@ function ble/string#split-words { set +f fi } -## 関数 ble/string#split-lines arr text... +## 関数 ble/string#split-lines arr text ## 文字列を行に分割します。空行も省略されません。 ## ## @param[out] arr 分割した文字列を格納する配列名を指定します。 @@ -276,11 +277,11 @@ function ble/string#split-words { ## if ((_ble_bash>=40000)); then function ble/string#split-lines { - mapfile -t "$1" <<< "${*:2}" + mapfile -t "$1" <<< "$2" } else function ble/string#split-lines { - ble/util/mapfile "$1" <<< "${*:2}" + ble/util/mapfile "$1" <<< "$2" } fi ## 関数 ble/string#count-char text chars @@ -330,17 +331,17 @@ function ble/string#last-index-of { ((ret>=0)) } -## 関数 ble/string#toggle-case text... -## 関数 ble/string#touppwer text... -## 関数 ble/string#tolower text... +## 関数 ble/string#toggle-case text +## 関数 ble/string#toupper text +## 関数 ble/string#tolower text ## @param[in] text ## @var[out] ret _ble_util_string_lower_list=abcdefghijklmnopqrstuvwxyz _ble_util_string_upper_list=ABCDEFGHIJKLMNOPQRSTUVWXYZ function ble/string#toggle-case { local LC_ALL= LC_COLLATE=C - local text=$* - local -a buff ch + local text=$1 ch i + local -a buff=() for ((i=0;i<${#text};i++)); do ch=${text:i:1} if [[ $ch == [A-Z] ]]; then @@ -355,13 +356,13 @@ function ble/string#toggle-case { IFS= builtin eval 'ret="${buff[*]-}"' } 2>/dev/null if ((_ble_bash>=40000)); then - function ble/string#tolower { ret=${*,,}; } - function ble/string#toupper { ret=${*^^}; } + function ble/string#tolower { ret=${1,,}; } + function ble/string#toupper { ret=${1^^}; } else function ble/string#tolower { local LC_ALL= LC_COLLATE=C - local text=$* - local -a buff ch + local i text=$1 ch + local -a buff=() for ((i=0;i<${#text};i++)); do ch=${text:i:1} if [[ $ch == [A-Z] ]]; then @@ -374,8 +375,8 @@ else } 2>/dev/null function ble/string#toupper { local LC_ALL= LC_COLLATE=C - local text=$* - local -a buff ch + local i text=$1 ch + local -a buff=() for ((i=0;i<${#text};i++)); do ch=${text:i:1} if [[ $ch == [a-z] ]]; then @@ -389,7 +390,7 @@ else fi function ble/string#escape-for-sed-regex { - ret="$*" + ret=$1 if [[ $ret == *['\.[*^$/']* ]]; then local a b for a in \\ \. \[ \* \^ \$ \/; do @@ -398,7 +399,7 @@ function ble/string#escape-for-sed-regex { fi } function ble/string#escape-for-awk-regex { - ret="$*" + ret=$1 if [[ $ret == *['\.[*?+|^$(){}/']* ]]; then local a b for a in \\ \. \[ \* \? \+ \| \^ \$ \( \) \{ \} \/; do @@ -407,7 +408,7 @@ function ble/string#escape-for-awk-regex { fi } function ble/string#escape-for-extended-regex { - ret="$*" + ret=$1 if [[ $ret == *['\.[*?+|^$(){}']* ]]; then local a b for a in \\ \. \[ \* \? \+ \| \^ \$ \( \) \{ \}; do @@ -969,13 +970,13 @@ ble/util/isfunction ble/util/getmtime || function ble/util/getmtime { ble/util/strftime '%s %N'; } #------------------------------------------------------------------------------ -## 関数 ble/util/buffer text... +## 関数 ble/util/buffer text _ble_util_buffer=() function ble/util/buffer { - _ble_util_buffer[${#_ble_util_buffer[@]}]="$*" + _ble_util_buffer[${#_ble_util_buffer[@]}]=$1 } function ble/util/buffer.print { - ble/util/buffer "$*"$'\n' + ble/util/buffer "$1"$'\n' } function ble/util/buffer.flush { IFS= builtin eval 'builtin echo -n "${_ble_util_buffer[*]-}"' @@ -1336,7 +1337,7 @@ _ble_stackdump_title=stackdump function ble-stackdump { ((bleopt_stackdump_enabled)) || return 1 # builtin echo "${BASH_SOURCE[1]} (${FUNCNAME[1]}): assertion failure $*" >&2 - local i nl=$'\n' + local i nl=$'\n' IFS=$_ble_term_IFS local message="$_ble_term_sgr0$_ble_stackdump_title: $*$nl" for ((i=1;i<${#FUNCNAME[*]};i++)); do message="$message @ ${BASH_SOURCE[i]}:${BASH_LINENO[i-1]} (${FUNCNAME[i]})$nl" @@ -1348,6 +1349,7 @@ function ble-assert { local _ble_stackdump_title='assertion failure' if ! builtin eval -- "$expr"; then shift + local IFS=$_ble_term_IFS ble-stackdump "$expr$_ble_term_nl$*" return 1 else @@ -1388,7 +1390,7 @@ if ((_ble_bash>=40000)); then [[ $_processed ]] } function ble/util/idle.push { - ble/array#push _ble_util_idle_task "$*" + ble/array#push _ble_util_idle_task "$1" } else function ble/util/idle.do { false; } diff --git a/ble-decode.sh b/ble-decode.sh index c1ea69d4..b73daab6 100644 --- a/ble-decode.sh +++ b/ble-decode.sh @@ -240,6 +240,7 @@ ble-decode-kbd/.initialize ## @var[out] ret function ble-decode-kbd { local keys; ble/string#split-words keys "$*" + local IFS=$_ble_term_IFS local key code codes keys codes=() for key in "${keys[@]}"; do @@ -313,6 +314,7 @@ function ble-decode-unkbd/.single-key { ## @var[in] keys ## @var[out] ret function ble-decode-unkbd { + local IFS=$_ble_term_IFS local -a kspecs local key for key in $*; do @@ -527,9 +529,9 @@ function ble-decode-char { # シーケンスが登録されていない時 if [[ $_ble_decode_char2_reach ]]; then local reach rest - reach=($_ble_decode_char2_reach) + ble/string#split-words reach "$_ble_decode_char2_reach" rest=${_ble_decode_char2_seq:reach[1]} - rest=(${rest//_/ } $char) + ble/string#split-words rest "${rest//_/ } $char" _ble_decode_char2_reach= _ble_decode_char2_seq= @@ -719,6 +721,7 @@ function ble-decode-char/unbind { done } function ble-decode-char/dump { + local IFS=$_ble_term_IFS local tseq=$1 nseq ccode nseq=("${@:2}") builtin eval "local -a ccodes; ccodes=(\${!_ble_decode_cmap_$tseq[@]})" @@ -804,10 +807,10 @@ function ble-decode/DEFAULT_KEYMAP { ## 設定関数 ble/widget/.SHELL_COMMAND command ## ble-bind -cf で登録されたコマンドを処理します。 -function ble/widget/.SHELL_COMMAND { eval "$*"; } +function ble/widget/.SHELL_COMMAND { local IFS=$_ble_term_IFS; builtin eval -- "$*"; } ## 設定関数 ble/widget/.EDIT_COMMAND command ## ble-bind -xf で登録されたコマンドを処理します。 -function ble/widget/.EDIT_COMMAND { eval "$*"; } +function ble/widget/.EDIT_COMMAND { local IFS=$_ble_term_IFS; builtin eval -- "$*"; } ## 関数 kmap ; ble-decode-key/bind keycodes command @@ -1040,7 +1043,8 @@ function ble-decode-key { if [[ $bleopt_decode_error_kseq_discard ]]; then _ble_decode_key__seq= else - local -a keys=(${_ble_decode_key__seq//_/ } $key) + local -a keys + ble/string#split-words keys "${_ble_decode_key__seq//_/ } $key" _ble_decode_key__seq= # 2文字目以降を処理 ble-decode-key "${keys[@]:1}" @@ -1182,7 +1186,7 @@ function ble-decode-key/.invoke-command { # setup variables local WIDGET=$command KEYMAP=$_ble_decode_key__kmap - local -a KEYS=(${_ble_decode_key__seq//_/ } $key) + local -a KEYS; ble/string#split-words KEYS "${_ble_decode_key__seq//_/ } $key" _ble_decode_key__seq= ble-decode-key/.invoke-hook "$_ble_decode_KCODE_BEFORE_COMMAND" @@ -1197,7 +1201,7 @@ function ble-decode-key/.call-widget { # setup variables local WIDGET=$1 KEYMAP=$_ble_decode_key__kmap - local -a KEYS=($2) + local -a KEYS; ble/string#split-words KEYS "$2" builtin eval -- "$WIDGET" } @@ -1220,6 +1224,7 @@ function ble-decode/start-keylog { } function ble-decode/end-keylog { { + local IFS=$_ble_term_IFS echo '===== bytes =====' printf '%s\n' "${_ble_keylogger_bytes[*]}" echo diff --git a/ble-edit.sh b/ble-edit.sh index 6ddcd56d..e7104ea1 100644 --- a/ble-edit.sh +++ b/ble-edit.sh @@ -447,7 +447,7 @@ function ble/util/c2w+east { # **** ble-edit/draw **** @edit/draw function ble-edit/draw/put { - DRAW_BUFF[${#DRAW_BUFF[*]}]="$*" + DRAW_BUFF[${#DRAW_BUFF[*]}]=$1 } function ble-edit/draw/put.ind { local -i count=${1-1} @@ -721,7 +721,7 @@ function ble-edit/draw/trace/process-csi-sequence { # CUP "CSI H" # HVP "CSI f" local -a params - params=(${param//[^0-9]/ }) + ble/string#split-words params "${param//[^0-9]/ }" ((x=params[1]-1)) ((y=params[0]-1)) ((x<0&&(x=0),x>=cols&&(x=cols-1), @@ -1620,7 +1620,7 @@ function ble/textmap#getxy.out { fi local -a _pos - _pos=(${_ble_textmap_pos[$1]}) + ble/string#split-words _pos "${_ble_textmap_pos[$1]}" ((${_prefix}x=_pos[0])) ((${_prefix}y=_pos[1])) } @@ -1643,12 +1643,12 @@ function ble/textmap#getxy.cur { fi local -a _pos - _pos=(${_ble_textmap_pos[$1]}) + ble/string#split-words _pos "${_ble_textmap_pos[$1]}" # 追い出しされたか check if (($1<_ble_textmap_length)); then local -a _eoc - _eoc=(${_ble_textmap_pos[$1+1]}) + ble/string#split-words _eoc "${_ble_textmap_pos[$1+1]}" ((_eoc[2])) && ((_pos[0]=0,_pos[1]++)) fi @@ -1687,16 +1687,17 @@ function ble/textmap#get-index-at { ## 関数 ble/textmap#hit/.getxy.cur index ## @var[in,out] pos function ble/textmap#hit/.getxy.out { - set -- ${_ble_textmap_pos[$1]} - x=$1 y=$2 + local a + ble/string#split-words a "${_ble_textmap_pos[$1]}" + x=${a[0]} y=${a[1]} } function ble/textmap#hit/.getxy.cur { - local index=$1 - set -- ${_ble_textmap_pos[index]} - x=$1 y=$2 + local index=$1 a + ble/string#split-words a "${_ble_textmap_pos[index]}" + x=${a[0]} y=${a[1]} if ((index<_ble_textmap_length)); then - set -- ${_ble_textmap_pos[index+1]} - (($3)) && ((x=0,y++)) + ble/string#split-words a "${_ble_textmap_pos[index+1]}" + ((a[2])) && ((x=0,y++)) fi } @@ -2248,7 +2249,7 @@ function ble-edit/attach { _ble_edit_attached=1 if [[ ! ${_ble_edit_LINENO+set} ]]; then - _ble_edit_LINENO="${BASH_LINENO[*]: -1}" + _ble_edit_LINENO=${BASH_LINENO[${#BASH_LINENO[@]}-1]} ((_ble_edit_LINENO<0)) && _ble_edit_LINENO=0 unset LINENO; LINENO=$_ble_edit_LINENO _ble_edit_CMD=$_ble_edit_LINENO @@ -3132,6 +3133,7 @@ function ble/widget/bell { # **** insert **** @edit.insert function ble/widget/insert-string { + local IFS=$_ble_term_IFS local content="$*" local arg; ble-edit/content/get-arg 1 if ((arg<0)); then @@ -3145,11 +3147,11 @@ function ble/widget/insert-string { ble/widget/.insert-string "$content" } function ble/widget/.insert-string { - local ins="$*" - [[ $ins ]] || return + local insert=$1 + [[ $insert ]] || return 1 - local dx=${#ins} - _ble_edit_str.replace _ble_edit_ind _ble_edit_ind "$ins" + local dx=${#insert} + _ble_edit_str.replace "$_ble_edit_ind" "$_ble_edit_ind" "$insert" (( _ble_edit_mark>_ble_edit_ind&&(_ble_edit_mark+=dx), _ble_edit_ind+=dx @@ -4518,16 +4520,16 @@ function ble-edit/exec:gexec/.eval-TRAPDEBUG { if ((_ble_edit_exec_INT!=0)); then # エラーが起きている時 - local IFS=$' \t\n' + local IFS=$_ble_term_IFS local depth=${#FUNCNAME[*]} - local rex='^\ble-edit/exec:gexec/.' + local rex='^ble-edit/exec:gexec/.' if ((depth>=2)) && ! [[ ${FUNCNAME[*]:depth-1} =~ $rex ]]; then # 関数内にいるが、ble-edit/exec:gexec/. の中ではない時 builtin echo "${_ble_term_setaf[9]}[ble: $1]$_ble_term_sgr0 ${FUNCNAME[1]} $2" >&2 return 0 fi - local rex='^(\ble-edit/exec:gexec/.|trap - )' + local rex='^(ble-edit/exec:gexec/.|trap - )' if ((depth==1)) && ! [[ $BASH_COMMAND =~ $rex ]]; then # 一番外側で、ble-edit/exec:gexec/. 関数ではない時 builtin echo "${_ble_term_setaf[9]}[ble: $1]$_ble_term_sgr0 $BASH_COMMAND $2" >&2 @@ -4740,7 +4742,7 @@ function ble-edit/hist_expanded/.expand { ## @var[out] hist_expanded function ble-edit/hist_expanded.update { - local BASH_COMMAND="$*" + local BASH_COMMAND=$1 if [[ ! -o histexpand || ! ${BASH_COMMAND//[ ]} ]]; then hist_expanded=$BASH_COMMAND return 0 @@ -4888,7 +4890,7 @@ function ble-edit/undo/.check-hindex { # load if [[ ${_ble_edit_undo_history[hindex]} ]]; then - builtin eval "local -a data=(${_ble_edit_undo_history[hindex]})" + local data; builtin eval -- "data=(${_ble_edit_undo_history[hindex]})" _ble_edit_undo=("${data[@]:1}") _ble_edit_undo_index=${data[0]} else @@ -7275,8 +7277,7 @@ function ble-decode/EPILOGUE { function ble/widget/.SHELL_COMMAND { ble-edit/content/clear-arg - local -a BASH_COMMAND - BASH_COMMAND=("$*") + local BASH_COMMAND=$1 _ble_edit_line_disabled=1 ble/widget/.insert-newline diff --git a/ble.pp b/ble.pp index f2661b51..211a37d8 100644 --- a/ble.pp +++ b/ble.pp @@ -98,6 +98,7 @@ function ble/restore-bash-options { return 1 fi +_ble_init_original_IFS_set=${IFS+set} _ble_init_original_IFS=$IFS IFS=$' \t\n' @@ -460,7 +461,6 @@ function ble/base/initialize-cache-directory { #%x inc.r/@/form/ #%x inc.r/@/syntax-lazy/ #------------------------------------------------------------------------------ -# function .ble-time { echo "$*"; time "$@"; } function ble-initialize { ble-decode-initialize # 7ms @@ -509,8 +509,14 @@ function ble-detach { ble-initialize #%end -IFS=$_ble_init_original_IFS -unset _ble_init_original_IFS +# 状態復元 +if [[ $_ble_init_original_IFS_set ]]; then + IFS=$_ble_init_original_IFS +else + builtin unset -v IFS +fi +builtin unset -v _ble_init_original_IFS_set +builtin unset -v _ble_init_original_IFS function ble/base/process-blesh-arguments { local opt_attach=1 diff --git a/functions/getopt.sh b/functions/getopt.sh index 87b35194..50a437c1 100644 --- a/functions/getopt.sh +++ b/functions/getopt.sh @@ -81,10 +81,12 @@ function ble/getopt.init { OPTIND=1 OPTION= OPTARG= } function ble/getopt.print-argument-message { + local IFS=$_ble_term_IFS local index=$((OPTIND-1)) echo "${_optargs[0]##*/} (argument#$index \`${_optargs[index]}'): $*" >&2 } function ble/getopt.print-message { + local IFS=$_ble_term_IFS local index=$((OPTIND-1)) echo "${_optargs[0]##*/} (arguments): $*" >&2 } diff --git a/keymap/emacs.sh b/keymap/emacs.sh index ae6cdf70..ad64ae7b 100644 --- a/keymap/emacs.sh +++ b/keymap/emacs.sh @@ -47,6 +47,7 @@ function ble/keymap:emacs/is-command-white { # frequently used command is checked first return 0 elif [[ $1 == ble/widget/* ]]; then + local IFS=$_ble_term_IFS local cmd=${1#ble/widget/}; cmd=${cmd%%[$' \t\n']*} [[ $cmd == emacs/* || " ${_ble_keymap_emacs_white_list[*]} " == *" $cmd "* ]] && return 0 fi diff --git a/keymap/vi.sh b/keymap/vi.sh index 81945289..6582b327 100644 --- a/keymap/vi.sh +++ b/keymap/vi.sh @@ -81,7 +81,7 @@ function ble-edit/content/find-non-space { function ble/widget/nop { :; } function ble/keymap:vi/string#encode-rot13 { - local text=$* + local text=$1 local -a buff=() ch for ((i=0;i<${#text};i++)); do ch=${text:i:1} @@ -178,6 +178,7 @@ function ble/keymap:vi/imap-repeat/pop { ((top_index>=0)) && unset '_ble_keymap_vi_irepeat[top_index]' } function ble/keymap:vi/imap-repeat/push { + local IFS=$_ble_term_IFS ble/array#push _ble_keymap_vi_irepeat "${KEYS[*]-}:$WIDGET" } @@ -230,6 +231,7 @@ function ble/keymap:vi/imap/is-command-white { # frequently used command is checked first return 0 elif [[ $1 == ble/widget/* ]]; then + local IFS=$_ble_term_IFS local cmd=${1#ble/widget/}; cmd=${cmd%%[$' \t\n']*} [[ $cmd == vi_imap/* || " ${_ble_keymap_vi_imap_white_list[*]} " == *" $cmd "* ]] && return 0 fi @@ -757,6 +759,7 @@ function ble/keymap:vi/register#set-edit { ble/keymap:vi/register#set "$@" || return 1 local reg=$1 type=$2 content=$3 if [[ $reg == '' || $reg == 34 ]]; then + local IFS=$_ble_term_IFS local widget=${WIDGET%%[$' \t\n']*} if [[ $content == *$'\n'* || " $widget " == " ${_ble_keymap_vi_register_49_widget_list[*]} " ]]; then local n @@ -1264,7 +1267,8 @@ function ble/keymap:vi/operator:d { done # yank - IFS=$'\n' eval 'local yank_content="${atext[*]-}"' + IFS=$'\n' builtin eval 'local yank_content="${atext[*]-}"' + local IFS=$_ble_term_IFS local yank_type=B:"${afill[*]-}" ble/keymap:vi/register#set-edit "$reg" "$yank_type" "$yank_content" || return 1 @@ -1337,7 +1341,8 @@ function ble/keymap:vi/operator:y { ble/array#push atext "$stext" done - IFS=$'\n' eval 'local yank_content="${atext[*]-}"' + IFS=$'\n' builtin eval 'local yank_content="${atext[*]-}"' + local IFS=$_ble_term_IFS yank_type=B:"${afill[*]-}" else yank_type= @@ -2068,6 +2073,7 @@ function ble/widget/vi-command/linewise-goto.impl { # single char arguments function ble/keymap:vi/async-read-char.hook { + local IFS=$_ble_term_IFS local command=${@:1:$#-1} key=${@:$#} if ((key==(ble_decode_Ctrl|0x6B))); then # C-k ble-decode/keymap/push vi_digraph @@ -2078,6 +2084,7 @@ function ble/keymap:vi/async-read-char.hook { } function ble/keymap:vi/async-read-char { + local IFS=$_ble_term_IFS _ble_decode_key__hook="ble/keymap:vi/async-read-char.hook $*" return 148 } @@ -2133,6 +2140,7 @@ function ble/keymap:vi/mark/update-mark-history { local value=${_ble_keymap_vi_mark_local[imark]} ble/array#push save "$imark:$value" done + local IFS=$_ble_term_IFS _ble_keymap_vi_mark_history[_ble_keymap_vi_mark_hindex]="${save[*]-}" # load @@ -2401,6 +2409,7 @@ function ble/keymap:vi/repeat/record-special { return 1 } function ble/keymap:vi/repeat/record-normal { + local IFS=$_ble_term_IFS local -a repeat; repeat=("$KEYMAP" "${KEYS[*]-}" "$WIDGET" "$ARG" "$FLAG" "$REG" '') if [[ $KEYMAP == vi_[xs]map ]]; then repeat[6]=$_ble_keymap_vi_xmap_prev_edit @@ -2427,6 +2436,7 @@ function ble/keymap:vi/repeat/record-insert { _ble_keymap_vi_repeat_irepeat=("${_ble_keymap_vi_irepeat[@]}") elif ((${#_ble_keymap_vi_irepeat[@]})); then # 挿入モード突入操作が初期化されていたら、挿入操作がある時のみに記録 + local IFS=$_ble_term_IFS _ble_keymap_vi_repeat=(vi_nmap "${KEYS[*]-}" ble/widget/vi_nmap/insert-mode 1 '' '') _ble_keymap_vi_repeat_irepeat=("${_ble_keymap_vi_irepeat[@]}") fi @@ -2443,7 +2453,7 @@ function ble/keymap:vi/repeat/invoke { local repeat_arg=$_ble_edit_arg local repeat_reg=$_ble_keymap_vi_reg local KEYMAP=${_ble_keymap_vi_repeat[0]} - local -a KEYS=(${_ble_keymap_vi_repeat[1]}) + local -a KEYS; ble/string#split-words KEYS "${_ble_keymap_vi_repeat[1]}" local WIDGET=${_ble_keymap_vi_repeat[2]} if [[ $KEYMAP == vi_[onxs]map ]]; then if [[ $KEYMAP == vi_omap ]]; then @@ -2978,7 +2988,7 @@ function ble/widget/vi_nmap/paste.impl/block { local ret cols=$_ble_textmap_cols - local -a afill=(${_ble_edit_kill_type:2}) + local -a afill; ble/string#split-words afill "${_ble_edit_kill_type:2}" local atext; ble/string#split-lines atext "$_ble_edit_kill_ring" local ntext=${#atext[@]} diff --git a/lib/core-complete.sh b/lib/core-complete.sh index f3c55c9d..e06fe865 100644 --- a/lib/core-complete.sh +++ b/lib/core-complete.sh @@ -170,7 +170,7 @@ function ble-complete/action/variable/complete { # source function ble-complete/yield-candidate { - local CAND=$1 ACTION=$2 DATA="${*:3}" + local CAND=$1 ACTION=$2 DATA=$3 local SHOW=${1#$COMP_PREFIX} INSERT=$CAND "$ACTION/initialize" diff --git a/lib/core-syntax.sh b/lib/core-syntax.sh index 5da8d125..cbacd6c2 100644 --- a/lib/core-syntax.sh +++ b/lib/core-syntax.sh @@ -3752,7 +3752,9 @@ function ble-syntax/parse { local end0=${4:-$end} ((end==beg&&end0==beg&&_ble_syntax_dbeg<0)) && return - local -ir iN=${#text} shift=end-end0 + local IFS=$_ble_term_IFS + + local -ir iN=${#text} shift=$((end-end0)) #%if !release if ! ((0<=beg&&beg<=end&&end<=iN&&beg<=end0)); then ble-stackdump "X1 0 <= beg:$beg <= end:$end <= iN:$iN, beg:$beg <= end0:$end0 (shift=$shift text=$text)" @@ -4830,7 +4832,7 @@ function ble-highlight-layer:syntax/update-error-table { if ((jN)); then for ((j=0;j=DMAX0?(a+=DMAX-DMAX0):(a>=DMIN&&(a=DMIN)), diff --git a/lib/vim-surround.sh b/lib/vim-surround.sh index 39de6122..e8b27f01 100644 --- a/lib/vim-surround.sh +++ b/lib/vim-surround.sh @@ -136,10 +136,12 @@ function ble/lib/vim-surround.sh/async-inputtarget.hook { fi } function ble/lib/vim-surround.sh/async-inputtarget { + local IFS=$_ble_term_IFS _ble_decode_key__hook="ble/lib/vim-surround.sh/async-inputtarget.hook init:digit $*" return 148 } function ble/lib/vim-surround.sh/async-inputtarget-noarg { + local IFS=$_ble_term_IFS _ble_decode_key__hook="ble/lib/vim-surround.sh/async-inputtarget.hook init $*" return 148 } diff --git a/term.sh b/term.sh index 948ea4e1..5e37028e 100644 --- a/term.sh +++ b/term.sh @@ -18,13 +18,15 @@ function ble/term.sh/register-varname { } function ble/term.sh/define-cap { - local name="$1" def="$2" + local IFS=$_ble_term_IFS + local name=$1 def=$2 shift 2 ble/util/assign "$name" "ble/term.sh/tput $* || echo -n \"\$def\"" ble/term.sh/register-varname "$name" } function ble/term.sh/define-cap.2 { - local name="$1" def="$2" + local IFS=$_ble_term_IFS + local name=$1 def=$2 shift 2 ble/util/assign "$name" "echo -n x;ble/term.sh/tput $* || echo -n \"\$def\";echo -n x" builtin eval "$name=\${$name#x}; $name=\${$name%x}"