addet blesh

This commit is contained in:
pika 2024-08-18 03:40:38 +02:00
parent 58205a50b9
commit 8c8d8e9962
302 changed files with 74275 additions and 0 deletions

View file

@ -0,0 +1,306 @@
#!/usr/bin/env ksh
#!/bin/bash
_ble_measure_target=ksh
if ! type _ble_util_print &>/dev/null; then
_ble_util_unlocal() { unset -v "$@"; }
function _ble_util_print { printf '%s\n' "$1"; }
function _ble_util_print_lines { printf '%s\n' "$@"; }
fi
function _ble_measure__loop {
# Note: ksh requires to quote ;
eval "function _target { ${2:+"$2; "}return 0; }"
typeset __ble_i __ble_n=$1
for ((__ble_i=0;__ble_i<__ble_n;__ble_i++)); do
_target
done
}
## @fn _ble_measure__time n command
## @param[in] n command
## @var[out] ret
## 計測にかかった総時間を μs 単位で返します。
if ((BASH_VERSINFO[0]>=5)) ||
{ [[ ${ZSH_VERSION-} ]] && zmodload zsh/datetime &>/dev/null && [[ ${EPOCHREALTIME-} ]]; } ||
[[ ${SECONDS-} == *.??? ]]
then
## @fn _ble_measure__get_realtime
## @var[out] ret
if [[ ${EPOCHREALTIME-} ]]; then
_ble_measure_resolution=1 # [usec]
_ble_measure__get_realtime() {
typeset LC_ALL= LC_NUMERIC=C
ret=$EPOCHREALTIME
}
else
# Note: ksh does not have "local"-equivalent for the POSIX-style functions,
# so we do not set the locale here. Anyway, we do not care the
# interference with outer-scope variables since this script is used
# limitedly in ksh.
_ble_measure_resolution=1000 # [usec]
_ble_measure__get_realtime() {
ret=$SECONDS
}
fi
_ble_measure__time() {
_ble_measure__get_realtime 2>/dev/null; typeset __ble_time1=$ret
_ble_measure__loop "$1" "$2" &>/dev/null
_ble_measure__get_realtime 2>/dev/null; typeset __ble_time2=$ret
# convert __ble_time1 and __ble_time2 to usec
# Note: ksh does not support empty index as ${__ble_frac::6}.
typeset __ble_frac
[[ $__ble_time1 == *.* ]] || __ble_time1=${__ble_time1}.
__ble_frac=${__ble_time1##*.}000000 __ble_time1=${__ble_time1%%.*}${__ble_frac:0:6}
[[ $__ble_time2 == *.* ]] || __ble_time2=${__ble_time2}.
__ble_frac=${__ble_time2##*.}000000 __ble_time2=${__ble_time2%%.*}${__ble_frac:0:6}
((ret=__ble_time2-__ble_time1))
((ret==0&&(ret=_ble_measure_resolution)))
((ret>0))
}
elif [[ ${ZSH_VERSION-} ]]; then
_ble_measure_resolution=1000 # [usec]
# [ksh incompatible code stripped]
else
_ble_measure_resolution=1000 # [usec]
# [ksh incompatible code stripped]
fi
_ble_measure_base= # [nsec]
_ble_measure_base_nestcost=0 # [nsec/10]
typeset -a _ble_measure_base_real
typeset -a _ble_measure_base_guess
_ble_measure_count=1 # 同じ倍率で _ble_measure_count 回計測して最小を取る。
_ble_measure_threshold=100000 # 一回の計測が threshold [usec] 以上になるようにする
## @fn _ble_measure__read_arguments_get_optarg
## @var[in] args arg i c
## @var[in,out] iarg
## @var[out] optarg
_ble_measure__read_arguments_get_optarg() {
if ((i+1<${#arg})); then
optarg=${arg:$((i+1))}
i=${#arg}
return 0
elif ((iarg<${#args[@]})); then
optarg=${args[iarg++]}
return 0
else
_ble_util_print "ble_measure: missing option argument for '-$c'."
flags=E$flags
return 1
fi
}
## @fn _ble_measure__read_arguments args
## @var[out] flags
## @var[out] command count
_ble_measure__read_arguments() {
typeset -a args; args=("$@")
typeset iarg=0 optarg=
[[ ${ZSH_VERSION-} && ! -o KSH_ARRAYS ]] && iarg=1
while [[ ${args[iarg]} == -* ]]; do
typeset arg=${args[iarg++]}
case $arg in
(--) break ;;
(--help) flags=h$flags ;;
(--no-print-progress) flags=V$flags ;;
(--*)
_ble_util_print "ble_measure: unrecognized option '$arg'."
flags=E$flags ;;
(-?*)
typeset i= c= # Note: zsh prints the values with just "local i c"
for ((i=1;i<${#arg};i++)); do
c=${arg:$i:1}
case $c in
(q) flags=qV$flags ;;
([ca])
[[ $c == a ]] && flags=a$flags
_ble_measure__read_arguments_get_optarg && count=$optarg ;;
(T)
_ble_measure__read_arguments_get_optarg &&
measure_threshold=$optarg ;;
(B)
_ble_measure__read_arguments_get_optarg &&
__ble_base=$optarg ;;
(*)
_ble_util_print "ble_measure: unrecognized option '-$c'."
flags=E$flags ;;
esac
done ;;
(-)
_ble_util_print "ble_measure: unrecognized option '$arg'."
flags=E$flags ;;
esac
done
typeset IFS=$' \t\n'
if [[ ${ZSH_VERSION-} ]]; then
command="${args[$iarg,-1]}"
else
command="${args[*]:$iarg}"
fi
[[ $flags != *E* ]]
}
## @fn ble_measure [-q|-ac COUNT] command
## command を繰り返し実行する事によりその実行時間を計測します。
## -q を指定した時、計測結果を出力しません。
## -c COUNT を指定した時 COUNT 回計測して最小値を採用します。
## -a COUNT を指定した時 COUNT 回計測して平均値を採用します。
##
## @var[out] ret
## 実行時間を usec 単位で返します。
## @var[out] nsec
## 実行時間を nsec 単位で返します。
ble_measure() {
eval -- "${_ble_bash_POSIXLY_CORRECT_local_adjust-}"
typeset __ble_level=${#FUNCNAME[@]} __ble_base=
[[ ${ZSH_VERSION-} ]] && __ble_level=${#funcstack[@]}
typeset flags= command= count=$_ble_measure_count
typeset measure_threshold=$_ble_measure_threshold
_ble_measure__read_arguments "$@"; typeset ext=$?
if ((ext)); then
eval -- "${_ble_bash_POSIXLY_CORRECT_local_leave-}"
return "$ext"
fi
if [[ $flags == *h* ]]; then
_ble_util_print_lines \
'usage: ble_measure [-q|-ac COUNT|-TB TIME] [--] COMMAND' \
' Measure the time of command.' \
'' \
' Options:' \
' -q Do not print results to stdout.' \
' -a COUNT Measure COUNT times and average.' \
' -c COUNT Measure COUNT times and take minimum.' \
' -T TIME Set minimal measuring time.' \
' -B BASE Set base time (overhead of ble_measure).' \
' -- The rest arguments are treated as command.' \
' --help Print this help.' \
'' \
' Arguments:' \
' COMMAND Command to be executed repeatedly.' \
'' \
' Exit status:' \
' Returns 1 for the failure in measuring the time. Returns 2 after printing' \
' help. Otherwise, returns 0.'
eval -- "${_ble_bash_POSIXLY_CORRECT_local_leave-}"
return 2
fi
if [[ ! $__ble_base ]]; then
if [[ $_ble_measure_base ]]; then
# ble_measure/calibrate 実行済みの時
__ble_base=$((_ble_measure_base+_ble_measure_base_nestcost*__ble_level/10))
else
# それ以外の時は __ble_level 毎に計測
if [[ ! $_ble_measure_calibrate && ! ${_ble_measure_base_guess[__ble_level]} ]]; then
if [[ ! ${_ble_measure_base_real[__ble_level+1]} ]]; then
if [[ ${_ble_measure_target-} == ksh ]]; then
# Note: In ksh, we cannot do recursive call with dynamic scoping,
# so we directly call the measuring function
_ble_measure__time 50000 ''
((nsec=ret*1000/50000))
else
typeset _ble_measure_calibrate=1
ble_measure -qc3 -B 0 ''
_ble_util_unlocal _ble_measure_calibrate
fi
_ble_measure_base_real[__ble_level+1]=$nsec
_ble_measure_base_guess[__ble_level+1]=$nsec
fi
# 上の実測値は一つ上のレベル (__ble_level+1) での結果になるので現在のレベル
# (__ble_level) の値に補正する。レベル毎の時間が chatoyancy での線形フィッ
# トの結果に比例する仮定して補正を行う。
#
# linear-fit result with $f(x) = A x + B$ in chatoyancy
# A = 65.9818 pm 2.945 (4.463%)
# B = 4356.75 pm 19.97 (0.4585%)
typeset cA=6598 cB=435675
nsec=${_ble_measure_base_real[__ble_level+1]}
_ble_measure_base_guess[__ble_level]=$((nsec*(cB+cA*(__ble_level-1))/(cB+cA*__ble_level)))
_ble_util_unlocal cA cB
fi
__ble_base=${_ble_measure_base_guess[__ble_level]:-0}
fi
fi
typeset __ble_max_n=500000
typeset prev_n= prev_utot=
typeset -i n
for n in {1,10,100,1000,10000,100000}\*{1,2,5}; do
[[ $prev_n ]] && ((n/prev_n<=10 && prev_utot*n/prev_n<measure_threshold*2/5 && n!=50000)) && continue
typeset utot=0
[[ $flags != *V* ]] && printf '%s (x%d)...' "$command" "$n" >&2
if ! _ble_measure__time "$n" "$command"; then
eval -- "${_ble_bash_POSIXLY_CORRECT_local_leave-}"
return 1
fi
[[ $flags != *V* ]] && printf '\r\e[2K' >&2
((utot=ret,utot>=measure_threshold||n==__ble_max_n)) || continue
prev_n=$n prev_utot=$utot
typeset min_utot=$utot
# 繰り返し計測して最小値 (-a の時は平均値) を採用
if [[ $count ]]; then
typeset sum_utot=$utot sum_count=1 i
for ((i=2;i<=count;i++)); do
[[ $flags != *V* ]] && printf '%s' "$command (x$n $i/$count)..." >&2
if _ble_measure__time "$n" "$command"; then
((utot=ret,utot<min_utot)) && min_utot=$utot
((sum_utot+=utot,sum_count++))
fi
[[ $flags != *V* ]] && printf '\r\e[2K' >&2
done
if [[ $flags == *a* ]]; then
((utot=sum_utot/sum_count))
else
utot=$min_utot
fi
fi
# update base if the result is shorter than base
if ((min_utot<0x7FFFFFFFFFFFFFFF/1000)); then
typeset __ble_real=$((min_utot*1000/n))
[[ ${_ble_measure_base_real[__ble_level]} ]] &&
((__ble_real<_ble_measure_base_real[__ble_level])) &&
_ble_measure_base_real[__ble_level]=$__ble_real
[[ ${_ble_measure_base_guess[__ble_level]} ]] &&
((__ble_real<_ble_measure_base_guess[__ble_level])) &&
_ble_measure_base_guess[__ble_level]=$__ble_real
((__ble_real<__ble_base)) &&
__ble_base=$__ble_real
fi
typeset nsec0=$__ble_base
if [[ $flags != *q* ]]; then
typeset reso=$_ble_measure_resolution
typeset awk=ble/bin/awk
type -- "$awk" &>/dev/null || awk=awk
typeset -x title="$command (x$n)"
"$awk" -v utot="$utot" -v nsec0="$nsec0" -v n="$n" -v reso="$reso" '
function genround(x, mod) { return int(x / mod + 0.5) * mod; }
BEGIN { title = ENVIRON["title"]; printf("%12.3f usec/eval: %s\n", genround(utot / n - nsec0 / 1000, reso / 10.0 / n), title); exit }'
fi
typeset out
((out=utot/n))
if ((n>=1000)); then
((nsec=utot/(n/1000)))
else
((nsec=utot*1000/n))
fi
((out-=nsec0/1000,nsec-=nsec0))
ret=$out
eval -- "${_ble_bash_POSIXLY_CORRECT_local_leave-}"
return 0
done
eval -- "${_ble_bash_POSIXLY_CORRECT_local_return-}"
}

View file

@ -0,0 +1,170 @@
# Copyright 2015 Koichi Murase <myoga.murase@gmail.com>. All rights reserved.
# This script is a part of blesh (https://github.com/akinomyoga/ble.sh)
# provided under the BSD-3-Clause license. Do not edit this file because this
# is not the original source code: Various pre-processing has been applied.
# Also, the code comments and blank lines are stripped off in the installation
# process. Please find the corresponding source file(s) in the repository
# "akinomyoga/ble.sh".
#
# Source: /lib/core-cmdspec.sh
function ble/cmdspec/initialize { return 0; }
function ble/complete/opts/initialize {
ble/cmdspec/opts mandb-disable-man:no-options : false true
ble/cmdspec/opts mandb-disable-man times
ble/cmdspec/opts mandb-disable-man:mandb-help=%'help "$command"':stop-options-postarg pwd suspend
local help_opt_help=
if ((_ble_bash>=40400)); then
help_opt_help=' --help Show help.'
ble/cmdspec/opts +mandb-help=@"$help_opt_help" times pwd suspend
fi
local help_opt_basic=$help_opt_help'
-- (indicate the end of options)'
ble/cmdspec/opts mandb-disable-man:mandb-help=%'help "$command"':mandb-help=@"$help_opt_basic":stop-options-postarg \
alias bind cd command compgen complete compopt declare dirs disown enable \
exec export fc getopts hash help history jobs kill mapfile popd printf \
pushd read readonly set shopt trap type ulimit umask unalias unset wait
ble/cmdspec/opts mandb-disable-man:mandb-help=@"$help_opt_basic":stop-options-postarg . source fg bg builtin caller eval let
ble/cmdspec/opts mandb-disable-man:mandb-help=@"$help_opt_basic":stop-options-postarg break continue exit logout return shift
local conditional_operators='
-eq (NUM1 -eq NUM2) Arithmetic comparison ==.
-ne (NUM1 -ne NUM2) Arithmetic comparison !=.
-lt (NUM1 -lt NUM2) Arithmetic comparison < .
-le (NUM1 -le NUM2) Arithmetic comparison <=.
-gt (NUM1 -gt NUM2) Arithmetic comparison > .
-ge (NUM1 -ge NUM2) Arithmetic comparison >=.
-nt (FILE1 -nt FILE2) True if file1 is newer than file2 (according to modification date).
-ot (FILE1 -ot FILE2) True if file1 is older than file2.
-ef (FILE1 -ef FILE2) True if file1 is a hard link to file2.'
ble/cmdspec/opts disable-double-hyphen:mandb-help=%'help test':mandb-help=@"$conditional_operators" '[['
local test_operators=$conditional_operators'
-a (EXPR1 -a EXPR2) True if both expr1 AND expr2 are true.
-a (EXPR1 -o EXPR2) True if either expr1 OR expr2 is true.'
ble/cmdspec/opts disable-double-hyphen:mandb-help=%'help test':mandb-help=@"$test_operators":mandb-exclude='^--' 'test' '['
ble/cmdspec/opts +plus-options:mandb-exclude='^[-+]N$' dirs popd pushd
local complete_flags='
-A action The action may be one of the following to generate a list
of possible completions---alias, arrayvar, binding,
builtin, command, directory, disabled, enabled, export,
file, function, group, helptopic, hostname, job, keyword,
running, service, setopt, shopt, signal, stopped, user,
variable.
-o option Set completion option OPTION for each NAME
-a Alias names. May also be specified as `-A alias'\''.
-b Names of shell builtin commands. May also be specified as
`-A builtin'\''.
-c Command names. May also be specified as `-A command'\''.
-d Directory names. May also be specified as `-A
directory'\''.
-e Names of exported shell variables. May also be specified
as `-A export'\''.
-f File names. May also be specified as `-A file'\''.
-g Group names. May also be specified as `-A group'\''.
-j Job names, if job control is active. May also be specified
as `-A job'\''.
-k Shell reserved words. May also be specified as `-A
keyword'\''.
-s Service names. May also be specified as `-A service'\''.
-u User names. May also be specified as `-A user'\''.
-v Names of all shell variables. May also be specified as `-A
variable'\''.
-C command command is executed in a subshell environment, and its
output is used as the possible completions. Arguments are
passed as with the -F option.
-F function The shell function function is executed in the current
shell environment. When the function is executed, the
first argument ($1) is the name of the command whose
arguments are being completed, the second argument ($2) is
the word being completed, and the third argument ($3) is
the word preceding the word being completed on the current
command line. When it finishes, the possible completions
are retrieved from the value of the COMPREPLY array
variable.
-G globpat The pathname expansion pattern globpat is expanded to
generate the possible completions.
-P prefix prefix is added at the beginning of each possible
completion after all other options have been applied.
-S suffix suffix is appended to each possible completion after all
other options have been applied.
-W wordlist The wordlist is split using the characters in the IFS
special variable as delimiters, and each resultant word is
expanded. Shell quoting is honored within wordlist, in
order to provide a mechanism for the words to contain shell
metacharacters or characters in the value of IFS. The
possible completions are the members of the resultant list
which match the word being completed.
-X filterpat filterpat is a pattern as used for pathname expansion. It
is applied to the list of possible completions generated by
the preceding options and arguments, and each completion
matching filterpat is removed from the list. A leading !
in filterpat negates the pattern; in this case, any
completion not matching filterpat is removed.'
ble/cmdspec/opts +mandb-help-usage:mandb-help=@"$complete_flags" complete compgen
ble/cmdspec/opts +plus-options=o compopt
ble/cmdspec/opts mandb-disable-man:mandb-help=%'help declare':mandb-help=@"$help_opt_basic":stop-options-postarg typeset local
ble/cmdspec/opts +plus-options=aAilnrtux declare typeset local
ble/cmdspec/opts mandb-disable-man:mandb-help=%'help echo':stop-options-unless='^-[neE]+$' echo
ble/cmdspec/opts +mandb-help=@'
-s With the `fc -s [pat=rep ...] [command]'\'' format, COMMAND
is re-executed after the substitution OLD=NEW is performed.' fc
ble/cmdspec/opts +mandb-help=@'
-x If -x is supplied, COMMAND is run after all job
specifications that appear in ARGS have been replaced with
the process ID of that job'\''s process group leader.' jobs
ble/cmdspec/opts mandb-disable-man:mandb-help=%'help mapfile':mandb-help=@"$help_opt_basic":stop-options-postarg readarray
ble/cmdspec/opts +plus-options=abefhkmnptuvxBCEHPTo set
((_ble_bash>=40300)) &&
ble/cmdspec/opts +mandb-help-usage:mandb-help=@'
-n waits for a single job from the list of IDs, or, if no IDs
are supplied, for the next job to complete and returns its
exit status.' wait
((_ble_bash>=50000)) &&
ble/cmdspec/opts +mandb-help-usage:mandb-help=@'
-f If job control is enabled, waits for the specified ID to
terminate, instead of waiting for it to change status.' wait
((_ble_bash>=50100)) &&
ble/cmdspec/opts +mandb-help-usage:mandb-help=@'
-p the process or job identifier of the job for which the exit
status is returned is assigned to the variable VAR named by
the option argument. The variable will be unset initially,
before any assignment. This is useful only when the -n
option is supplied.' wait
ble/cmdspec/opts mandb-help rsync
}
ble/complete/opts/initialize
function ble/cmdinfo/cmd:declare/chroma.wattr {
local ret
if ((wtype==_ble_attr_VAR)); then
ble/syntax:bash/find-rhs "$wtype" "$wbeg" "$wlen" element-assignment &&
ble/progcolor/highlight-filename.wattr "$ret" "$wend"
else
ble/progcolor/eval-word || return "$?"
local wval=$ret
if ble/string#match "$wval" '^([_a-zA-Z][_a-zA-Z0-9]*)(\[.+\])?$'; then
local varname=${BASH_REMATCH[1]}
ble/syntax/highlight/vartype "$varname" global
ble/progcolor/wattr#setattr "$wbeg" "$ret"
ble/progcolor/wattr#setattr "$((wbeg+${#varname}))" d
elif ble/string#match "$wval" '^[-+]' && ble/progcolor/is-option-context; then
local ret; ble/color/face2g argument_option
ble/progcolor/wattr#setg "$wbeg" "$ret"
else
local ret; ble/color/face2g argument_error
ble/progcolor/wattr#setg "$wbeg" "$ret"
fi
fi
return 0
}
function ble/cmdinfo/cmd:declare/chroma {
local i "${_ble_syntax_progcolor_vars[@]/%/=}" # WA #D1570 checked
for ((i=1;i<${#comp_words[@]};i++)); do
local ref=${tree_words[i]}
[[ $ref ]] || continue
local progcolor_iword=$i
ble/progcolor/load-word-data "$ref"
ble/progcolor/@wattr ble/cmdinfo/cmd:declare/chroma.wattr
done
}
function ble/cmdinfo/cmd:typeset/chroma { ble/cmdinfo/cmd:declare/chroma "$@"; }
function ble/cmdinfo/cmd:local/chroma { ble/cmdinfo/cmd:declare/chroma "$@"; }
function ble/cmdinfo/cmd:readonly/chroma { ble/cmdinfo/cmd:declare/chroma "$@"; }
function ble/cmdinfo/cmd:export/chroma { ble/cmdinfo/cmd:declare/chroma "$@"; }

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,721 @@
# Copyright 2015 Koichi Murase <myoga.murase@gmail.com>. All rights reserved.
# This script is a part of blesh (https://github.com/akinomyoga/ble.sh)
# provided under the BSD-3-Clause license. Do not edit this file because this
# is not the original source code: Various pre-processing has been applied.
# Also, the code comments and blank lines are stripped off in the installation
# process. Please find the corresponding source file(s) in the repository
# "akinomyoga/ble.sh".
#
# Source: /lib/core-debug.sh
function ble/debug/setdbg {
ble/bin/rm -f "$_ble_base_run/dbgerr"
local ret
ble/util/readlink /proc/self/fd/3 3>&1
ln -s "$ret" "$_ble_base_run/dbgerr"
}
function ble/debug/print {
if [[ -e $_ble_base_run/dbgerr ]]; then
ble/util/print "$1" >> "$_ble_base_run/dbgerr"
else
ble/util/print "$1" >&2
fi
}
_ble_debug_check_leak_variable='local @var=__t1wJltaP9nmow__'
function ble/debug/leakvar#reset {
builtin eval "$1=__t1wJltaP9nmow__"
}
function ble/debug/leakvar#check {
local ext=$?
if [[ ${!1} != __t1wJltaP9nmow__ ]] && ble/variable#is-global "$1"; then
local IFS=$_ble_term_IFS
ble/util/print "$1=${!1}:${*:2} [${FUNCNAME[*]:1:5}]" >> ~/a.txt # DEBUG_LEAKVAR
builtin eval "$1=__t1wJltaP9nmow__"
fi
return "$?"
}
function ble/debug/leakvar#list {
local _ble_local_exclude_file=${_ble_base_repository:-$_ble_base}/make/debug.leakvar.exclude-list.txt
if [[ ! -f $_ble_local_exclude_file ]]; then
ble/util/print "$_ble_local_exclude_file: not found." >&2
return 1
fi
set | ble/bin/grep -Eavf "$_ble_local_exclude_file" | ble/bin/grep -Eao '^[[:alnum:]_]+='
return 0
}
function ble/debug/print-variables/.append {
local q=\' Q="'\''"
_ble_local_out=$_ble_local_out"$1='${2//$q/$Q}'"
}
function ble/debug/print-variables/.append-array {
local ret; ble/string#quote-words "${@:2}"
_ble_local_out=$_ble_local_out"$1=($ret)"
}
function ble/debug/print-variables {
(($#)) || return 0
local flags= tag= arg
local -a _ble_local_vars=()
while (($#)); do
arg=$1; shift
case $arg in
(-t) tag=$1; shift ;;
(-*) ble/util/print "print-variables: unknown option '$arg'" >&2
flags=${flags}e ;;
(*) ble/array#push _ble_local_vars "$arg" ;;
esac
done
[[ $flags == *e* ]] && return 1
local _ble_local_out= _ble_local_var=
[[ $tag ]] && _ble_local_out="$tag: "
ble/util/unlocal flags tag arg
for _ble_local_var in "${_ble_local_vars[@]}"; do
if ble/is-array "$_ble_local_var"; then
builtin eval -- "ble/debug/print-variables/.append-array \"\$_ble_local_var\" \"\${$_ble_local_var[@]}\""
else
ble/debug/print-variables/.append "$_ble_local_var" "${!_ble_local_var}"
fi
_ble_local_out=$_ble_local_out' '
done
ble/debug/print "${_ble_local_out%' '}"
}
_ble_debug_stopwatch=()
function ble/debug/stopwatch/start {
ble/array#push _ble_debug_stopwatch "${EPOCHREALTIME:-$SECONDS.000000}"
}
function ble/debug/stopwatch/stop {
local end=${EPOCHREALTIME:-$SECONDS.000000}
if local ret; ble/array#pop _ble_debug_stopwatch; then
local usec=$(((${end%%[.,]*}-${ret%%[,.]*})*1000000+(10#0${end#*[.,]}-10#0${ret#*[,.]})))
printf '[%3d.%06d sec] %s\n' "$((usec/1000000))" "$((usec%1000000))" "$1"
else
printf '[---.------ sec] %s\n' "$1"
fi
}
_ble_debug_profiler_magic=__GdWfuwABAUmlg__
_ble_debug_profiler_prefix=
_ble_debug_profiler_original_xtrace=
_ble_debug_profiler_original_xtrace_ps4=
function ble/debug/profiler/start {
[[ ! $_ble_debug_profiler_prefix ]] || return 1
if ((_ble_bash<50000)); then
ble/util/print "ble.sh: profiler is only supported in Bash 5.0+." >&2
return 2
fi
local prefix=${1:-prof.$$}
[[ $prefix == /* ]] || prefix=$PWD/$prefix
_ble_debug_profiler_prefix=$prefix
_ble_debug_profiler_original_xtrace=$bleopt_debug_xtrace
_ble_debug_profiler_original_xtrace_ps4=$bleopt_debug_xtrace_ps4
bleopt debug_xtrace="$prefix.xtrace"
bleopt debug_xtrace_ps4='+${#BASH_LINENO[@]} ${BASHPID:-$$} ${EPOCHREALTIME:-SECONDS} ${FUNCNAME:-(global)} ${LINENO:--} ${BASH_SOURCE:--} '"$_ble_debug_profiler_magic"' '
blehook EXIT!=ble/debug/profiler/stop
}
function ble/debug/profiler/stop {
[[ $_ble_debug_profiler_prefix ]] || return 1
local prefix=$_ble_debug_profiler_prefix
_ble_debug_profiler_prefix=
bleopt debug_xtrace="$_ble_debug_profiler_original_xtrace"
bleopt debug_xtrace_ps4="$_ble_debug_profiler_original_xtrace_ps4"
local -a awk_args=()
local opts=$bleopt_debug_profiler_opts ret
local -x profiler_line_output=
local -x profiler_line_html=
if ble/opts#extract-last-optarg "$opts" line; then
local file=$prefix.line.txt
[[ -s $file ]] && ble/array#push awk_args mode=line_stat "$file"
profiler_line_output=$file.part
[[ $ret == html ]] &&
profiler_line_html=$prefix.line.html
fi
local -x profiler_func_output=
local -x profiler_func_html=
if ble/opts#extract-last-optarg "$opts" func; then
local file=$prefix.func.txt
[[ -s $file ]] && ble/array#push awk_args mode=func_stat "$file"
profiler_func_output=$file.part
[[ $ret == html ]] &&
profiler_func_html=$prefix.func.html
fi
local -x profiler_tree_output=
local -x profiler_tree_threshold_duration=
if [[ :$opts: == *:tree:* ]]; then
profiler_tree_output=$prefix.tree.txt
profiler_tree_threshold_duration=${bleopt_debug_profiler_tree_threshold:-1.0} # [ms]
fi
local f1=$prefix.xtrace
ble/array#push awk_args mode=xtrace "$f1"
local nline
ble/util/print "ble/debug/profiler: counting lines..." >&2
ble/util/assign-words nline 'ble/bin/wc -l "$f1" 2>/dev/null'
ble/util/print $'\e[A\rble/debug/profiler: counting lines... '"$nline" >&2
ble/bin/awk -v magic="$_ble_debug_profiler_magic" -v nline="$nline" '
BEGIN {
xtrace_debug_enabled = 1;
print "ble/debug/profiler: collecting information..." >"/dev/stderr";
if (nline) progress_interval = int(nline / 100);
ipid = 0;
ilabel = 0;
ifname = 0;
_usec_sec0 = "";
lines_initialize();
funcs_initialize();
tree_initialize();
}
function to_percentage(value) {
value *= 100;
if (value >= 100) return sprintf("%d%%", int(value));
if (value >= 10) return sprintf("%.2f%%", value);
if (value >= 0.1) return sprintf("%.3f%%", value);
if (value >= 0.0001) return sprintf(".%04d%%", int(value * 10000));
return "0.0%";
}
function pids_register(pid) {
if (pid_mark[pid] == "") {
pid_mark[pid] = ipid;
pids[ipid++] = pid;
}
}
function pids_clear() {
ipid = 0;
delete pids;
delete pid_mark;
}
function parse_usec(text, _, sec, usec) {
sec = text;
usec = 0;
if (sub(/[.,].*/, "", sec)) {
usec = text
sub(/^.*[.,]0*/, "", usec);
}
if (_usec_sec0 == "")
_usec_sec0 = sec;
sec -= _usec_sec0;
return sec * 1000000 + usec;
}
function parse_line(_, s) {
s = $1;
level = gsub(/\+/, "", s);
depth = 1 + (s > 0 ? s : 0);
level += depth - 1;
pid = $2;
epoch = $3;
usec = parse_usec($3);
fname = $4;
lineno = $5;
source = $6;
for (i = 7; $i != magic && i <= NF; i++)
source = source " " $i;
label = sprintf("\x1b[35m%s\x1b[36m (%s:\x1b[32m%s\x1b[36m):\x1b[m", source, fname, lineno);
command = "";
if ($i == magic) {
command = $(++i);
for (i++; i <= NF; i++)
command = command " " $i;
}
}
function str_strip_ansi(str) {
gsub(/\x1b\[[ -?]*[@-~]/, "", str);
gsub(/\x1b[ -\/]*[0-~]/, "", str);
gsub(/[\x01-\x1F\x7F]/, "", str);
return str;
}
function str_html_escape(str) {
gsub(/&/, "\\&amp;", str);
gsub(/</, "\\&lt;", str);
gsub(/>/, "\\&gt;", str);
return str;
}
function str_ansi_escape(str) {
if (str ~ /[\x01-\x1F]/) {
gsub(/\x1b/, "\x1b[7m^[\x1b[27m", str);
gsub(/\x07/, "\x1b[7m^G\x1b[27m", str);
gsub(/\x08/, "\x1b[7m^H\x1b[27m", str);
gsub(/\x09/, "\x1b[7m^I\x1b[27m", str);
gsub(/\x0a/, "\x1b[7m^J\x1b[27m", str);
gsub(/\x0b/, "\x1b[7m^K\x1b[27m", str);
gsub(/\x0c/, "\x1b[7m^L\x1b[27m", str);
gsub(/\x0d/, "\x1b[7m^M\x1b[27m", str);
gsub(/[\x01-\x1A\x1C-\x1F]/ ,"?", str);
}
return str;
}
function lines_initialize() {
c_lines_output = ENVIRON["profiler_line_output"];
c_lines_enabled = c_lines_output != "";
if (!c_lines_enabled) return;
c_lines_html = ENVIRON["profiler_line_html"];
}
function lines_level_push(pid, level, usec, label, command, _, lv) {
if (!line_stat[label, "count"]++)
labels[ilabel++] = label;
lines_level_pop(pid, level, usec);
stk[pid, level, "label"] = label;
stk[pid, level, "begin"] = usec;
stk[pid, level, "child"] = 0.0;
stk[pid, level, "allstep_count"] = 0;
stk[pid, level, "substep_count"] = 0;
stk[pid, level, "substep_time"] = 0.0;
stk[pid, level, "command"] = command;
ilevel[pid] = level;
}
function lines_level_getParent(pid, lv) {
for (lv--; lv >= 1; lv--)
if (stk[pid, lv, "label"] != "") break;
return lv;
}
function lines_level_pop(pid, level, usec, _, lv, label, elapsed, plv) {
for (lv = ilevel[pid]; lv >= level; lv--) {
label = stk[pid, lv, "label"];
stk[pid, lv, "label"] = "";
if (label == "") continue;
elapsed = usec - stk[pid, lv, "begin"];
if (elapsed < 0) {
elapsed = 0.0;
}
line_stat[label, "total"] += elapsed;
line_stat[label, "child"] += stk[pid, lv, "child"];
if (lv >= 3)
stk[pid, lv - 2, "child"] += elapsed;
line_stat[label, "allstep_count"] += stk[pid, lv, "allstep_count"];
line_stat[label, "substep_count"] += stk[pid, lv, "substep_count"];
line_stat[label, "substep_time"] += stk[pid, lv, "substep_time"];
if ((plv = lines_level_getParent(pid, lv))) {
stk[pid, plv, "allstep_count"] += 1 + stk[pid, lv, "allstep_count"];
stk[pid, plv, "substep_count"]++;
stk[pid, plv, "substep_time"] += elapsed;
}
max_time = line_stat[label, "max_time"];
if (max_time == "" || elapsed > max_time) {
line_stat[label, "max_command"] = stk[pid, lv, "command"];
line_stat[label, "max_time"] = elapsed;
line_stat[label, "max_child"] = stk[pid, lv, "child"];
}
}
ilevel[pid] = lv;
}
function lines_text_header(_, line) {
line = sprintf("# %6s %8s %8s", "count", "subcount", "allcount");
line = line sprintf(" %10s %-6s %10s %-6s %10s", "total_msec", "TOTAL%", "self_msec", "SELF%", "child_msec");
line = line sprintf(" %10s %10s %10s", "max_msec", "max_self", "max_child");
printf("%s %s%s\n", line, "\x1b[35mSOURCE\x1b[36m (FUNCNAME):\x1b[32mLINENO\x1b[36m:\x1b[m", "COMMAND") > c_lines_output;
}
function lines_text_print(info, _, line) {
line = sprintf("%8d %8d %8d", info["count"], info["substep_count"], info["allstep_count"]);
line = line sprintf(" %10.3f %-6s %10.3f %-6s %10.3f", info["total_time"], info["total_time_percentage"], info["total_self"], info["total_self_percentage"], info["total_child"]);
line = line sprintf(" %10.3f %10.3f %10.3f", info["max_time"], info["max_self"], info["max_child"]);
printf("%s %s%s\n", line, info["label"], info["command"]) > c_lines_output;
}
function lines_html_header(_, line) {
line = sprintf("<!DOCTYPE html>\n");
line = line sprintf("<title>ble.sh xtrace profiling result</title>\n");
line = line sprintf("<style>table,td,th{border-collapse:collapse;border:1px solid black}td{max-width:40em;}</style>\n");
line = line sprintf("<table>\n");
line = line sprintf("<tr>\n");
line = line sprintf(" <th rowspan=2>count</th>\n");
line = line sprintf(" <th rowspan=2>substep</th>\n");
line = line sprintf(" <th rowspan=2>allstep</th>\n");
line = line sprintf(" <th colspan=3>total (msec)</th>\n");
line = line sprintf(" <th colspan=3>average (msec)</th>\n");
line = line sprintf(" <th colspan=3>max (msec)</th>\n");
line = line sprintf(" <th rowspan=2>command</th>\n");
line = line sprintf(" <th rowspan=2>location</th>\n");
line = line sprintf("</tr>\n");
line = line sprintf("<tr>\n");
line = line sprintf(" <th>sum</th>\n");
line = line sprintf(" <th>self</th>\n");
line = line sprintf(" <th>child</th>\n");
line = line sprintf(" <th>sum</th>\n");
line = line sprintf(" <th>self</th>\n");
line = line sprintf(" <th>child</th>\n");
line = line sprintf(" <th>sum</th>\n");
line = line sprintf(" <th>self</th>\n");
line = line sprintf(" <th>child</th>\n");
line = line sprintf("</tr>\n");
printf("%s", line) > c_lines_html;
}
function lines_html_print(info, _, line, label) {
label = str_strip_ansi(info["label"]);
sub(/:$/, "", label);
line = sprintf("<tr>\n");
line = line sprintf(" <td>%d</td>\n", info["count"]);
line = line sprintf(" <td>%d</td>\n", info["substep_count"]);
line = line sprintf(" <td>%d</td>\n", info["allstep_count"]);
line = line sprintf(" <td>%.3f</td>\n", info["total_time"]);
line = line sprintf(" <td>%.3f</td>\n", info["total_self"]);
line = line sprintf(" <td>%.3f</td>\n", info["total_child"]);
line = line sprintf(" <td>%.3f</td>\n", info["average_time"]);
line = line sprintf(" <td>%.3f</td>\n", info["average_self"]);
line = line sprintf(" <td>%.3f</td>\n", info["average_child"])
line = line sprintf(" <td>%.3f</td>\n", info["max_time"]);
line = line sprintf(" <td>%.3f</td>\n", info["max_self"]);
line = line sprintf(" <td>%.3f</td>\n", info["max_child"]);
line = line sprintf(" <td>%s</td>\n", str_html_escape(info["command"]));
line = line sprintf(" <td>%s</td>\n", str_html_escape(label));
line = line sprintf("</tr>\n");
printf("%s", line) > c_lines_html;
}
function lines_html_footer() {
printf("</table>\n") > c_lines_html;
}
function lines_save(_, i, label, count, info, total_time) {
lines_text_header();
if (c_lines_html) lines_html_header();
total_time = 0.0;
for (i = 0; i < ilabel; i++) {
label = labels[i];
total_time += line_stat[label, "total"] - line_stat[label, "child"];
}
total_time *= 0.001;
for (i = 0; i < ilabel; i++) {
label = labels[i];
count = line_stat[label, "count"];
info["count"] = count;
info["allstep_count"] = line_stat[label, "allstep_count"];
info["substep_count"] = line_stat[label, "substep_count"];
info["substep_time"] = line_stat[label, "substep_time"] * 0.001;
info["total_time"] = line_stat[label, "total"] * 0.001;
info["total_child"] = line_stat[label, "child"] * 0.001;
info["total_self"] = info["total_time"] - info["total_child"];
info["total_time_percentage"] = to_percentage(info["total_time"] / total_time);
info["total_self_percentage"] = to_percentage(info["total_self"] / total_time);
info["average_time"] = info["total_time"] / count;
info["average_self"] = info["total_self"] / count;
info["average_child"] = info["total_child"] / count
info["max_time"] = line_stat[label, "max_time"] * 0.001;
info["max_child"] = line_stat[label, "max_child"] * 0.001;
info["max_self"] = info["max_time"] - info["max_child"];
info["label"] = label;
info["command"] = line_stat[label, "max_command"];
lines_text_print(info);
if (c_lines_html) lines_html_print(info);
}
if (c_lines_html) lines_html_footer();
}
function lines_load_line(_, i, s, label, old_max_time, new_max_time) {
s = substr($0, index($0, "\x1b[35m"));
i = index(s, "\x1b[m");
label = substr(s, 1, i + 2);
if (!line_stat[label, "count"])
labels[ilabel++] = label;
line_stat[label, "count"] += $1;
line_stat[label, "substep_count"] += $2;
line_stat[label, "allstep_count"] += $3;
line_stat[label, "substep_time"] += 0.0; # not saved
line_stat[label, "total"] += int($4 * 1000 + 0.5);
line_stat[label, "child"] += int($8 * 1000 + 0.5);
old_max_time = line_stat[label, "max_time"];
new_max_time = int($9 * 1000 + 0.5);
if (old_max_time == "" || new_max_time > old_max_time) {
line_stat[label, "max_command"] = substr(s, i + 3);
line_stat[label, "max_time"] = new_max_time;
line_stat[label, "max_child"] = int($11 * 1000 + 0.5);
}
}
function lines_finalize() {
if (c_lines_enabled)
lines_save();
}
function funcs_initialize() {
c_funcs_output = ENVIRON["profiler_func_output"];
c_funcs_enabled = c_funcs_output != "";
if (!c_funcs_enabled) return;
c_funcs_html = ENVIRON["profiler_func_html"];
}
function funcs_depth_push(pid, depth, usec, fname, source, _, old_depth) {
if (!func_stat[fname, "mark"]++)
fnames[ifname++] = fname;
if (funcs_depth_pop(pid, depth, usec)) {
func_stk[pid, depth, "fname"] = fname;
func_stk[pid, depth, "begin"] = usec;
func_stk[pid, depth, "child"] = 0.0;
func_stk[pid, depth, "allcall_count"] = 0;
func_stk[pid, depth, "subcall_count"] = 0;
func_stk[pid, depth, "source"] = source;
idepth[pid] = depth;
}
}
function funcs_depth_getParent(pid, dep) {
for (dep--; dep >= 1; dep--)
if (func_stk[pid, dep, "fname"] != "") break;
return dep;
}
function funcs_depth_pop(pid, depth, usec, fname, _, dp, label, elapsed, pdp) {
for (dp = idepth[pid]; dp >= depth; dp--) {
if (dp == depth && fname == func_stk[pid, dp, "fname"]) {
idepth[pid] = dp;
return 0; # 前の関数の続き
}
fname = func_stk[pid, dp, "fname"];
func_stk[pid, dp, "fname"] = "";
if (fname == "") continue;
elapsed = usec - func_stk[pid, dp, "begin"];
if (elapsed < 0) elapsed = 0.0;
func_stat[fname, "count"]++;
func_stat[fname, "total"] += elapsed;
func_stat[fname, "child"] += func_stk[pid, dp, "child"];
func_stat[fname, "allcall_count"] += func_stk[pid, dp, "allcall_count"];
func_stat[fname, "subcall_count"] += func_stk[pid, dp, "subcall_count"];
if ((pdp = funcs_depth_getParent(pid, dp))) {
func_stk[pid, pdp, "child"] += elapsed;
func_stk[pid, pdp, "allcall_count"] += 1 + func_stk[pid, dp, "allcall_count"];
func_stk[pid, pdp, "subcall_count"]++;
}
func_stat[fname, "source"] = func_stk[pid, dp, "source"]; # always overwrite
max_time = func_stat[fname, "max_time"];
if (max_time == "" || elapsed > max_time) {
func_stat[fname, "max_time"] = elapsed;
func_stat[fname, "max_child"] = func_stk[pid, dp, "child"];
}
}
idepth[pid] = dp;
return 1;
}
function funcs_text_header(_, line) {
line = sprintf("# %6s %8s %8s", "count", "subcall", "allcall");
line = line sprintf(" %10s %-6s %10s %-6s %10s", "total_msec", "TOTAL%", "self_msec", "SELF%", "child_msec");
line = line sprintf(" %10s %10s %10s", "max_msec", "max_self", "max_child");
printf("%s %s (\x1b[35m%s\x1b[m)\n", line, "FUNCNAME", "SOURCE") > c_funcs_output;
}
function funcs_text_print(info, _, line) {
line = sprintf("%8d %8d %8d", info["count"], info["subcall_count"], info["allcall_count"]);
line = line sprintf(" %10.3f %-6s %10.3f %-6s %10.3f", info["total_time"], info["total_time_percentage"], info["total_self"], info["total_self_percentage"], info["total_child"]);
line = line sprintf(" %10.3f %10.3f %10.3f", info["max_time"], info["max_self"], info["max_child"]);
printf("%s %s (\x1b[35m%s\x1b[m)\n", line, info["fname"], info["source"]) > c_funcs_output;
}
function funcs_html_header(_, line) {
line = sprintf("<!DOCTYPE html>\n");
line = line sprintf("<title>ble.sh xtrace profiling result</title>\n");
line = line sprintf("<style>table,td,th{border-collapse:collapse;border:1px solid black}td{max-width:40em;}</style>\n");
line = line sprintf("<table>\n");
line = line sprintf("<tr>\n");
line = line sprintf(" <th rowspan=2>count</th>\n");
line = line sprintf(" <th rowspan=2>subcall</th>\n");
line = line sprintf(" <th rowspan=2>allcall</th>\n");
line = line sprintf(" <th colspan=3>total (ms)</th>\n");
line = line sprintf(" <th colspan=3>self (ms)</th>\n");
line = line sprintf(" <th colspan=2>child (ms)</th>\n");
line = line sprintf(" <th rowspan=2>function</th>\n");
line = line sprintf(" <th rowspan=2>location</th>\n");
line = line sprintf("</tr>\n");
line = line sprintf("<tr>\n");
line = line sprintf(" <th>sum</th>\n");
line = line sprintf(" <th>%%</th>\n");
line = line sprintf(" <th>max</th>\n");
line = line sprintf(" <th>sum</th>\n");
line = line sprintf(" <th>%%</th>\n");
line = line sprintf(" <th>max</th>\n");
line = line sprintf(" <th>sum</th>\n");
line = line sprintf(" <th>max</th>\n");
line = line sprintf("</tr>\n");
printf("%s", line) > c_funcs_html;
}
function funcs_html_print(info, _, line) {
line = sprintf("<tr>\n");
line = line sprintf(" <td>%s</td><td>%s</td><td>%s</td>\n", info["count"], info["subcall_count"], info["allcall_count"]);
line = line sprintf(" <td>%s</td><td>%s</td><td>%s</td>\n", info["total_time"], info["total_time_percentage"], info["max_time"]);
line = line sprintf(" <td>%s</td><td>%s</td><td>%s</td>\n", info["total_self"], info["total_self_percentage"], info["max_self"]);
line = line sprintf(" <td>%s</td><td>%s</td>\n", info["total_child"], info["max_child"]);
line = line sprintf(" <td><code>%s</code></td><td>%s</td>\n", info["fname"], info["source"]);
line = line sprintf("</tr>\n");
printf("%s", line) > c_funcs_html;
}
function funcs_html_footer() {
printf("</table>\n") > c_funcs_html;
}
function funcs_save(_, i, fname, count, info, total_time) {
funcs_text_header();
if (c_funcs_html) funcs_html_header();
total_time = 0.0;
for (i = 0; i < ifname; i++) {
fname = fnames[i];
total_time += func_stat[fname, "total"] - func_stat[fname, "child"];
}
total_time *= 0.001;
for (i = 0; i < ifname; i++) {
fname = fnames[i];
count = func_stat[fname, "count"];
info["count"] = count;
info["allcall_count"] = func_stat[fname, "allcall_count"];
info["subcall_count"] = func_stat[fname, "subcall_count"];
info["total_time"] = func_stat[fname, "total"] * 0.001;
info["total_child"] = func_stat[fname, "child"] * 0.001;
info["total_self"] = info["total_time"] - info["total_child"];
info["total_time_percentage"] = to_percentage(info["total_time"] / total_time);
info["total_self_percentage"] = to_percentage(info["total_self"] / total_time);
info["average_time"] = info["total_time"] / count;
info["average_self"] = info["total_self"] / count;
info["average_child"] = info["total_child"] / count
info["max_time"] = func_stat[fname, "max_time"] * 0.001;
info["max_child"] = func_stat[fname, "max_child"] * 0.001;
info["max_self"] = info["max_time"] - info["max_child"];
info["fname"] = fname;
info["source"] = func_stat[fname, "source"];
funcs_text_print(info);
if (c_funcs_html) funcs_html_print(info);
}
if (c_funcs_html) funcs_html_footer();
}
function funcs_load_line(_, fname, i, s, old_max_time, new_max_time) {
fname = $12;
if (!func_stat[fname, "mark"]) {
fnames[ifname++] = fname;
func_stat[fname, "mark"]++;
}
i = index($0, "\x1b[35m");
if (i > 0) {
s = substr($0, i + 5);
i = index(s, "\x1b[m");
func_stat[fname, "source"] = substr(s, 1, i - 1);
}
func_stat[fname, "count"] += $1;
func_stat[fname, "subcall_count"] += $2;
func_stat[fname, "allcall_count"] += $3;
func_stat[fname, "total"] += int($4 * 1000 + 0.5);
func_stat[fname, "child"] += int($8 * 1000 + 0.5);
old_max_time = func_stat[fname, "max_time"];
new_max_time = int($9 * 1000 + 0.5);
if (old_max_time == "" || new_max_time > old_max_time) {
func_stat[fname, "max_time"] = new_max_time;
func_stat[fname, "max_child"] = int($11 * 1000 + 0.5);
}
}
function funcs_finalize() {
if (c_funcs_enabled)
funcs_save();
}
function tree_initialize() {
c_tree_output = ENVIRON["profiler_tree_output"];
c_tree_enabled = c_tree_output != "";
if (!c_tree_enabled) return;
c_tree_threshold_duration = ENVIRON["profiler_tree_threshold_duration"] * 1000;
g_tree_min_level = "";
}
function tree_flush_command(level, now_usec, _, start_time, clk_start, clk_end, dur_usec, prev_cmd, prev_source, prev_lineno, prev_func, line, child, i, n) {
if (g_tree_record[level] == "") return;
start_time = g_tree_record[level, "epoch"];
clk_start = g_tree_record[level, "start"];
clk_end = now_usec;
dur_usec = clk_end - clk_start;
prev_cmd = str_ansi_escape(g_tree_record[level]);
prev_source = g_tree_record[level, "source"];
prev_lineno = g_tree_record[level, "lineno"];
prev_func = g_tree_record[level, "func"];
if (prev_cmd == "???") {
prev_source = "";
} else if (prev_source == "" && prev_func == "") {
prev_source = sprintf(" [(global):%d]", prev_lineno);
} else {
prev_source = sprintf(" [%s:%d (%s)]", prev_source, prev_lineno, prev_func);
}
n = 0 + g_tree_record[level, "#child"];
g_tree_record[level] = "";
g_tree_record[level, "#child"] = 0;
if (dur_usec < c_tree_threshold_duration) return;
line = sprintf("%17.6f %10.3fms %2d __tree__\x1b[1m%s\x1b[;34m%s\x1b[m", start_time, dur_usec * 0.001, level, prev_cmd, prev_source);
for (i = 0; i < n; i++) {
child = g_tree_record[level, "child", i];
gsub(/__tree__/, i < n - 1 ? "&| " : "& ", child);
sub(/__tree__.../, "__tree__+- ", child);
line = line "\n" child;
}
if (level > g_tree_min_level) {
if (g_tree_record[level - 1] == "") {
g_tree_record[level - 1] = "???";
g_tree_record[level - 1, "start"] = start_time;
g_tree_record[level - 1, "start"] = clk_start;
g_tree_record[level - 1, "#child"] = 0;
}
i = 0 + g_tree_record[level - 1, "#child"];
g_tree_record[level - 1, "child", i] = line;
g_tree_record[level - 1, "#child"] = i + 1;
} else {
gsub(/__tree__/, "", line);
print line >> c_tree_output;
}
}
function tree_flush_level(level, now_usec) {
for (; g_tree_level >= level; g_tree_level--)
tree_flush_command(g_tree_level, now_usec);
g_tree_level = level;
}
function tree_process_line(level, epoch, usec, source, lineno, funcname, command) {
tree_flush_level(level, usec);
if (g_tree_min_level == "" || g_tree_min_level > level)
g_tree_min_level = level;
g_tree_record[level] = command;
g_tree_record[level, "epoch"] = epoch;
g_tree_record[level, "start"] = usec;
g_tree_record[level, "source"] = source;
g_tree_record[level, "lineno"] = lineno;
g_tree_record[level, "func"] = funcname;
g_tree_last_usec = usec;
}
function tree_finalize() {
if (c_tree_enabled)
tree_flush_level(1, g_tree_last_usec);
}
function flush_stack(_, i) {
for (i = 0; i < ipid; i++) {
if (c_lines_enabled) lines_level_pop(pids[i], 1, proc[pids[i], "time"]);
if (c_funcs_enabled) funcs_depth_pop(pids[i], 1, proc[pids[i], "time"]);
}
pids_clear();
}
mode == "line_stat" { if ($0 ~ /^['"$_ble_term_space"']*[^#'"$_ble_term_space"']/) lines_load_line(); next; }
mode == "func_stat" { if ($0 ~ /^['"$_ble_term_space"']*[^#'"$_ble_term_space"']/) funcs_load_line(); next; }
progress_interval && ++iline % progress_interval == 0 {
print "\x1b[A\rble/debug/profiler: collecting information... " int((iline * 100) / nline) "%" >"/dev/stderr";
}
/^\+/ && index($0, magic) {
if (!xtrace_debug_enabled) next;
parse_line();
if (fname == "(global)") {
if (command ~ /^(ble-decode\/.hook|_ble_decode_hook) [0-9]+$/) flush_stack();
label = command;
sub(/^['"$_ble_term_space"']+|['"$_ble_term_space"'].*/, "", label);
label = sprintf("\x1b[35m%s\x1b[36m:\x1b[32m%s\x1b[36m (%s):\x1b[m", source, lineno, label);
}
pids_register(pid);
if (c_lines_enabled)
lines_level_push(pid, level, usec, label, command);
if (c_funcs_enabled)
funcs_depth_push(pid, depth, usec, fname, source);
if (c_tree_enabled)
tree_process_line(level, epoch, usec, source, lineno, fname, command);
proc[pid, "time"] = usec;
next;
}
/^---- \[.*\] ble\/base\/xtrace\/restore/ {
flush_stack();
xtrace_debug_enabled = 0;
}
/^---- \[.*\] ble\/base\/xtrace\/adjust/ {
xtrace_debug_enabled = 1;
}
END {
flush_stack();
print "ble/debug/profiler: writing result..." >"/dev/stderr";
lines_finalize();
funcs_finalize();
tree_finalize();
}
' "${awk_args[@]}" || return "$?"
local -a files_to_remove
files_to_remove=("$f1")
if [[ $profiler_line_output == *.part ]]; then
local file=${profiler_line_output%.part}
{
LANG=C ble/bin/grep '^#' "$file.part"
LANG=C ble/bin/grep -v '^#' "$file.part" | ble/bin/sort -nrk4
} >| "$file" &&
ble/array#push files_to_remove "$file.part"
fi
if [[ $profiler_func_output == *.part ]]; then
local file=${profiler_func_output%.part}
{
LANG=C ble/bin/grep '^#' "$file.part"
LANG=C ble/bin/grep -v '^#' "$file.part" | ble/bin/sort -nrk4
} >| "$file" &&
ble/array#push files_to_remove "$file.part"
fi
ble/bin/rm -f "${files_to_remove[@]}"
}

View file

@ -0,0 +1,172 @@
abort bell
accept-line accept-line
alias-expand-line alias-expand-line
arrow-key-prefix -
backward-byte backward-byte
backward-char backward-char
backward-delete-char delete-region-or delete-backward-char
backward-kill-line kill-backward-line
backward-kill-word kill-backward-cword
backward-word backward-cword
beginning-of-history history-beginning
beginning-of-line beginning-of-line
bracketed-paste-begin bracketed-paste
call-last-kbd-macro call-keyboard-macro
capitalize-word capitalize-eword
character-search character-search-forward
character-search-backward character-search-backward
clear-display clear-display
clear-screen clear-screen
complete complete
complete-command complete context=command
complete-filename complete context=filename
complete-hostname complete context=hostname
complete-into-braces complete insert_braces
complete-username complete context=username
complete-variable complete context=variable
copy-backward-word copy-backward-cword
copy-forward-word copy-forward-cword
copy-region-as-kill copy-region
dabbrev-expand dabbrev-expand
delete-char delete-forward-char
delete-char-or-list delete-forward-char-or-list
delete-horizontal-space delete-horizontal-space
digit-argument append-arg
display-shell-version display-shell-version
do-lowercase-version do-lowercase-version
downcase-word downcase-eword
dump-functions readline-dump-functions
dump-macros readline-dump-macros
dump-variables readline-dump-variables
dynamic-complete-history complete context=dynamic-history
edit-and-execute-command edit-and-execute-command
emacs-editing-mode nop
end-kbd-macro end-keyboard-macro
end-of-history history-end
end-of-line end-of-line
exchange-point-and-mark exchange-point-and-mark
execute-named-command emacs/execute-named-command
fetch-history history-goto
forward-backward-delete-char delete-forward-backward-char
forward-byte forward-byte
forward-char forward-char
forward-search-history history-isearch-forward
forward-word forward-cword
glob-complete-word complete context=glob
glob-expand-word complete context=glob:insert-all
glob-list-expansions complete context=glob:show_menu
history-and-alias-expand-line history-and-alias-expand-line
history-expand-line history-expand-line
history-search-backward history-search-backward empty=emulate-readline
history-search-forward history-search-forward empty=emulate-readline
history-substring-search-backward history-substring-search-backward
history-substring-search-forward history-substring-search-forward
insert-comment insert-comment
insert-completions complete insert_all
insert-last-argument insert-last-argument
kill-line kill-forward-line
kill-region kill-region-or kill-uword
kill-whole-line kill-line
kill-word kill-forward-cword
magic-space magic-space
menu-complete menu-complete
menu-complete-backward menu-complete backward
next-history history-next
next-screen-line forward-graphical-line
non-incremental-forward-search-history history-nsearch-forward
non-incremental-forward-search-history-again history-nsearch-forward-again
non-incremental-reverse-search-history history-nsearch-backward
non-incremental-reverse-search-history-again history-nsearch-backward-again
old-menu-complete menu-complete
operate-and-get-next accept-and-next
overwrite-mode overwrite-mode
possible-command-completions complete show_menu:context=command
possible-completions complete show_menu
possible-filename-completions complete show_menu:context=filename
possible-hostname-completions complete show_menu:context=hostname
possible-username-completions complete show_menu:context=username
possible-variable-completions complete show_menu:context=variable
previous-history history-prev
previous-screen-line backward-graphical-line
print-last-kbd-macro print-keyboard-macro
quoted-insert quoted-insert
re-read-init-file re-read-init-file
redraw-current-line redraw-line
reverse-search-history history-isearch-backward
revert-line emacs/revert
self-insert self-insert
set-mark set-mark
shell-backward-kill-word kill-backward-sword
shell-backward-word backward-sword
shell-expand-line shell-expand-line
shell-forward-word forward-sword
shell-kill-word kill-forward-sword
shell-transpose-words transpose-swords
skip-csi-sequence <IGNORE>
start-kbd-macro start-keyboard-macro
tab-insert tab-insert
tilde-expand tilde-expand
transpose-chars transpose-chars
transpose-words transpose-ewords
tty-status -
undo emacs/undo
universal-argument universal-arg
unix-filename-rubout kill-backward-fword
unix-line-discard kill-backward-line
unix-word-rubout kill-backward-uword
upcase-word upcase-eword
vi-append-eol -
vi-append-mode -
vi-arg-digit -
vi-prev-word vi-rlfunc/prev-word
vi-backward-word vi-command/backward-vword
vi-backward-bigword vi-command/backward-uword
vi-bword vi-command/backward-vword
vi-bWord vi-command/backward-uword
vi-end-word vi-rlfunc/end-word
vi-end-bigword vi-command/forward-uword-end
vi-eword vi-command/forward-vword-end
vi-eWord vi-command/forward-uword-end
vi-next-word vi-rlfunc/next-word
vi-forward-word vi-command/forward-vword
vi-forward-bigword vi-command/forward-uword
vi-fword vi-command/forward-vword
vi-fWord vi-command/forward-uword
vi-back-to-indent -
vi-change-case -
vi-change-char -
vi-change-to -
vi-char-search -
vi-column -
vi-complete -
vi-delete -
vi-delete-to -
vi-editing-mode vi-editing-mode
vi-eof-maybe -
vi-fetch-history history-goto
vi-first-print -
vi-goto-mark -
vi-insert-beg -
vi-insertion-mode -
vi-match -
vi-movement-mode -
vi-overstrike -
vi-overstrike-delete -
vi-put -
vi-redo -
vi-replace -
vi-rubout -
vi-search -
vi-search-again -
vi-set-mark -
vi-subst -
vi-tilde-expand -
vi-unix-word-rubout -
vi-yank-arg -
vi-yank-pop -
vi-yank-to -
yank yank
yank-last-arg insert-last-argument
yank-nth-arg insert-nth-argument
yank-pop yank-pop
paste-from-clipboard paste-from-clipboard

View file

@ -0,0 +1,171 @@
abort bell
accept-line accept-single-line-or-newline
alias-expand-line alias-expand-line
arrow-key-prefix -
backward-byte backward-byte
backward-char backward-char
backward-delete-char vi_imap/delete-region-or vi_imap/delete-backward-indent-or delete-backward-char
backward-kill-line kill-backward-line
backward-kill-word kill-backward-cword
backward-word backward-sword
beginning-of-history history-beginning
beginning-of-line beginning-of-line
bracketed-paste-begin vi_imap/bracketed-paste
call-last-kbd-macro call-keyboard-macro
capitalize-word capitalize-eword
character-search character-search-forward
character-search-backward character-search-backward
clear-display clear-display
clear-screen clear-screen
complete complete
complete-command complete context=command
complete-filename complete context=filename
complete-hostname complete context=hostname
complete-into-braces complete insert_braces
complete-username complete context=username
complete-variable complete context=variable
copy-backward-word copy-backward-sword
copy-forward-word copy-forward-sword
copy-region-as-kill copy-region-or copy-uword
dabbrev-expand dabbrev-expand
delete-char vi_imap/delete-region-or delete-forward-char
delete-char-or-list delete-forward-char-or-list
delete-horizontal-space delete-horizontal-space
digit-argument append-arg
display-shell-version display-shell-version
do-lowercase-version do-lowercase-version
downcase-word downcase-eword
dump-functions readline-dump-functions
dump-macros readline-dump-macros
dump-variables readline-dump-variables
dynamic-complete-history complete context=dynamic-history
edit-and-execute-command edit-and-execute-command
emacs-editing-mode emacs-editing-mode
end-kbd-macro end-keyboard-macro
end-of-history history-end
end-of-line end-of-line
exchange-point-and-mark exchange-point-and-mark
execute-named-command vi-command/execute-named-command
fetch-history history-goto
forward-backward-delete-char delete-forward-backward-char
forward-byte forward-byte
forward-char forward-char
forward-search-history history-isearch-forward
forward-word forward-uword
glob-complete-word complete context=glob
glob-expand-word complete context=glob:insert-all
glob-list-expansions complete context=glob:show_menu
history-and-alias-expand-line history-and-alias-expand-line
history-expand-line history-expand-line
history-search-backward history-search-backward empty=emulate-readline
history-search-forward history-search-forward empty=emulate-readline
history-substring-search-backward history-substring-search-backward
history-substring-search-forward history-substring-search-forward
insert-comment insert-comment
insert-completions complete insert_all
insert-last-argument insert-last-argument
kill-line kill-forward-line
kill-region kill-region-or kill-uword
kill-whole-line kill-line
kill-word kill-forward-uword
magic-space magic-space
menu-complete menu-complete
menu-complete-backward menu-complete backward
next-history history-next
next-screen-line forward-graphical-line
non-incremental-forward-search-history history-nsearch-forward
non-incremental-forward-search-history-again history-nsearch-forward-again
non-incremental-reverse-search-history history-nsearch-backward
non-incremental-reverse-search-history-again history-nsearch-backward-again
old-menu-complete menu-complete
operate-and-get-next accept-and-next
overwrite-mode vi_imap/overwrite-mode
possible-command-completions complete show_menu:context=command
possible-completions complete show_menu
possible-filename-completions complete show_menu:context=filename
possible-hostname-completions complete show_menu:context=hostname
possible-username-completions complete show_menu:context=username
possible-variable-completions complete show_menu:context=variable
previous-history history-prev
previous-screen-line backward-graphical-line
print-last-kbd-macro print-keyboard-macro
quoted-insert vi_imap/quoted-insert
re-read-init-file re-read-init-file
redraw-current-line redraw-line
reverse-search-history history-isearch-backward
revert-line -
self-insert self-insert
set-mark set-mark
shell-backward-kill-word kill-backward-sword
shell-backward-word backward-sword
shell-expand-line shell-expand-line
shell-forward-word forward-sword
shell-kill-word kill-forward-sword
shell-transpose-words transpose-swords
skip-csi-sequence <IGNORE>
start-kbd-macro start-keyboard-macro
tab-insert tab-insert
tilde-expand tilde-expand
transpose-chars transpose-chars
transpose-words transpose-ewords
tty-status -
undo -
universal-argument universal-arg
unix-filename-rubout kill-backward-fword
unix-line-discard kill-backward-line
unix-word-rubout kill-backward-uword
upcase-word upcase-eword
vi-append-eol -
vi-append-mode -
vi-arg-digit -
vi-back-to-indent -
vi-prev-word vi-rlfunc/prev-word
vi-backward-word vi-command/backward-vword
vi-backward-bigword vi-command/backward-uword
vi-bword vi-command/backward-vword
vi-bWord vi-command/backward-uword
vi-end-word vi-rlfunc/end-word
vi-end-bigword vi-command/forward-uword-end
vi-eword vi-command/forward-vword-end
vi-eWord vi-command/forward-uword-end
vi-next-word vi-rlfunc/next-word
vi-forward-word vi-command/forward-vword
vi-forward-bigword vi-command/forward-uword
vi-fword vi-command/forward-vword
vi-fWord vi-command/forward-uword
vi-change-case -
vi-change-char -
vi-change-to -
vi-char-search -
vi-column -
vi-complete -
vi-delete -
vi-delete-to -
vi-editing-mode nop
vi-eof-maybe -
vi-fetch-history history-goto
vi-first-print -
vi-goto-mark -
vi-insert-beg -
vi-insertion-mode nop
vi-match -
vi-movement-mode vi_imap/normal-mode
vi-overstrike -
vi-overstrike-delete -
vi-put -
vi-redo -
vi-replace vi_imap/overwrite-mode
vi-rubout -
vi-search -
vi-search-again -
vi-set-mark -
vi-subst -
vi-tilde-expand -
vi-unix-word-rubout vi_imap/delete-backward-word
vi-yank-arg -
vi-yank-pop -
vi-yank-to -
yank yank
yank-last-arg insert-last-argument
yank-nth-arg insert-nth-argument
yank-pop yank-pop

View file

@ -0,0 +1,172 @@
abort bell
accept-line accept-single-line-or vi-command/forward-first-non-space
alias-expand-line vi_nmap/@edit alias-expand-line
arrow-key-prefix -
backward-byte vi-command/backward-byte
backward-char vi-command/backward-char
backward-delete-char -
backward-kill-line -
backward-kill-word -
backward-word vi-command/backward-vword
beginning-of-history vi-command/history-beginning
beginning-of-line vi-command/beginning-of-line
bracketed-paste-begin vi-command/bracketed-paste
call-last-kbd-macro call-keyboard-macro
capitalize-word vi_nmap/capitalize-eword
character-search vi_nmap/@motion character-search-forward
character-search-backward vi_nmap/@motion character-search-backward
clear-display clear-display
clear-screen clear-screen
complete -
complete-command -
complete-filename -
complete-hostname -
complete-into-braces -
complete-username -
complete-variable -
copy-backward-word -
copy-forward-word -
copy-region-as-kill -
dabbrev-expand -
delete-char vi_nmap/kill-forward-char
delete-char-or-list -
delete-horizontal-space -
digit-argument vi-command/append-arg
display-shell-version vi_nmap/@adjust display-shell-version
do-lowercase-version do-lowercase-version
downcase-word vi_nmap/downcase-eword
dump-functions vi_nmap/@adjust readline-dump-functions
dump-macros vi_nmap/@adjust readline-dump-macros
dump-variables vi_nmap/@adjust readline-dump-variables
dynamic-complete-history -
edit-and-execute-command vi-command/edit-and-execute-command
emacs-editing-mode emacs-editing-mode
end-kbd-macro end-keyboard-macro
end-of-history vi-command/history-end
end-of-line vi-command/forward-eol
exchange-point-and-mark -
execute-named-command vi-command/execute-named-command
fetch-history history-goto
forward-backward-delete-char -
forward-byte vi-command/forward-byte
forward-char vi-command/forward-char
forward-search-history history-isearch-forward
forward-word vi-command/forward-vword
glob-complete-word -
glob-expand-word -
glob-list-expansions -
history-and-alias-expand-line vi_nmap/@edit history-and-alias-expand-line
history-expand-line vi_nmap/@edit history-expand-line
history-search-backward history-search-backward empty=emulate-readline
history-search-forward history-search-forward empty=emulate-readline
history-substring-search-backward history-substring-search-backward
history-substring-search-forward history-substring-search-forward
insert-comment vi-rlfunc/insert-comment
insert-completions -
insert-last-argument -
kill-line vi_nmap/kill-forward-line
kill-region -
kill-whole-line -
kill-word vi-rlfunc/kill-word
magic-space -
menu-complete -
menu-complete-backward -
next-history vi-command/history-next
next-screen-line -
non-incremental-forward-search-history history-nsearch-forward
non-incremental-forward-search-history-again history-nsearch-forward-again
non-incremental-reverse-search-history history-nsearch-backward
non-incremental-reverse-search-history-again history-nsearch-backward-again
old-menu-complete -
operate-and-get-next -
overwrite-mode vi_nmap/replace-mode
possible-command-completions complete show_menu:context=command
possible-completions complete show_menu
possible-filename-completions complete show_menu:context=filename
possible-hostname-completions complete show_menu:context=hostname
possible-username-completions complete show_menu:context=username
possible-variable-completions complete show_menu:context=variable
previous-history vi-command/history-prev
previous-screen-line -
print-last-kbd-macro print-keyboard-macro
quoted-insert vi-rlfunc/quoted-insert
re-read-init-file vi_nmap/@adjust re-read-init-file
redraw-current-line redraw-line
reverse-search-history history-isearch-backward
revert-line vi_nmap/revert
self-insert -
set-mark vi_nmap/charwise-visual-mode
shell-backward-kill-word -
shell-backward-word -
shell-expand-line vi_nmap/@edit shell-expand-line
shell-forward-word -
shell-kill-word -
shell-transpose-words -
skip-csi-sequence <IGNORE>
start-kbd-macro start-keyboard-macro
tab-insert -
tilde-expand vi_nmap/@edit tilde-expand
transpose-chars transpose-chars
transpose-words -
tty-status -
undo vi_nmap/undo
universal-argument -
unix-filename-rubout -
unix-line-discard vi-rlfunc/unix-line-discard
unix-word-rubout -
upcase-word vi_nmap/upcase-eword
vi-append-eol vi_nmap/append-mode-at-end-of-line
vi-append-mode vi_nmap/append-mode
vi-arg-digit vi-command/append-arg
vi-prev-word vi-rlfunc/prev-word
vi-backward-word vi-command/backward-vword
vi-backward-bigword vi-command/backward-uword
vi-bword vi-command/backward-vword
vi-bWord vi-command/backward-uword
vi-end-word vi-rlfunc/end-word
vi-end-bigword vi-command/forward-uword-end
vi-eword vi-command/forward-vword-end
vi-eWord vi-command/forward-uword-end
vi-next-word vi-rlfunc/next-word
vi-forward-word vi-command/forward-vword
vi-forward-bigword vi-command/forward-uword
vi-fword vi-command/forward-vword
vi-fWord vi-command/forward-uword
vi-back-to-indent -
vi-change-case vi-command/operator toggle_case
vi-change-char vi_nmap/replace-char
vi-change-to vi-rlfunc/change-to
vi-char-search vi-rlfunc/char-search
vi-column vi-command/nth-column
vi-complete -
vi-delete vi_nmap/kill-forward-char
vi-delete-to vi-rlfunc/delete-to
vi-editing-mode vi_nmap/insert-mode
vi-eof-maybe vi-rlfunc/eof-maybe
vi-fetch-history vi-command/history-goto
vi-first-print vi-command/first-non-space
vi-goto-mark vi-command/goto-mark
vi-insert-beg vi_nmap/insert-mode-at-first-non-space
vi-insertion-mode vi_nmap/insert-mode
vi-match vi-command/search-matchpair-or vi-command/percentage-line
vi-movement-mode nop
vi-overstrike -
vi-overstrike-delete -
vi-put vi-rlfunc/put
vi-redo vi_nmap/repeat
vi-replace vi_nmap/replace-mode
vi-rubout vi_nmap/kill-backward-char
vi-search vi-rlfunc/search
vi-search-again vi-rlfunc/search-again
vi-set-mark vi-command/set-mark
vi-subst vi-rlfunc/subst
vi-tilde-expand -
vi-undo vi_nmap/undo
vi-unix-word-rubout -
vi-yank-arg vi-rlfunc/yank-arg
vi-yank-pop -
vi-yank-to vi-rlfunc/yank-to
yank yank
yank-last-arg -
yank-nth-arg -
yank-pop -

View file

@ -0,0 +1,32 @@
Gebruik Kaart na Los Tronk
Използвайте „exit“, за да излезете от обвивката.
Utilitzeu ?exit? per a eixir de l'int?rpret d'ordres.
Shell lze ukončit příkazem „exit“.
Brug "exit" for at forlade skallen.
Benutze "exit" um die Shell zu verlassen.
Χρήση «exit» για έξοδο από το κέλυφος.
Use “exit” to leave the shell.
Use “exit” to leave the shell.
Uzu «exit» por eliri el la ŝelo.
Use "exit" para dejar el shell.
Kirjoita ”exit” poistuaksesi komentotulkista.
Utilisez « exit » pour quitter le shell.
Úsáid "exit" le scoir den mblaosc.
Use «exit» para deixar o shell.
Koristite „exit” za napuštanje ljuske.
„exit” használatával lehet elhagyni a parancsértelmezőt.
Gunakan "exit" untuk meninggalkan shell.
Usare "exit" per uscire dalla shell.
シェルから脱出するには "exit" を使用してください。
Naudokite „exit“, jei norite išeiti iš ap.
Gebruik "exit" om de shell te verlaten.
Użyj "exit", aby opuścić tę powłokę.
Use "exit" para sair da `shell'.
Na opustenie shellu použite „exit“.
Uporabite "exit", če želite zapustiti lupino.
Користите „exit“ да напустите шкољку.
Använd "exit" fär att lämna skalet.
Kabuğu bırakmak için "exit" kullanın.
Використовуйте "exit", щоб вийти з оболонки.
Dùng "exit" để rời hệ vỏ.
使用 "exit" 退出 shell 。

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,217 @@
# Copyright 2015 Koichi Murase <myoga.murase@gmail.com>. All rights reserved.
# This script is a part of blesh (https://github.com/akinomyoga/ble.sh)
# provided under the BSD-3-Clause license. Do not edit this file because this
# is not the original source code: Various pre-processing has been applied.
# Also, the code comments and blank lines are stripped off in the installation
# process. Please find the corresponding source file(s) in the repository
# "akinomyoga/ble.sh".
#
# Source: /lib/core-test.sh
function ble/test/getdir {
dir=$_ble_base_run/$$.test
[[ -d $dir ]] || ble/bin/mkdir -p "$dir"
}
_ble_test_dir=
function ble/test/chdir {
local dir
ble/test/getdir
ble/util/getpid
_ble_test_dir=$dir/$BASHPID.d
[[ -d $_ble_test_dir ]] ||
ble/bin/mkdir -p "$_ble_test_dir"
cd -L "$_ble_test_dir"
}
function ble/test/rmdir {
[[ -d $_ble_test_dir ]] &&
ble/bin/rm -rf "$_ble_test_dir"
return 0
}
_ble_test_logfile_fd=
function ble/test/log {
if [[ $_ble_test_logfile_fd ]]; then
ble/util/print "$1" >&"$_ble_test_logfile_fd"
fi
ble/util/print "$1"
}
function ble/test/log#open {
local file=$1
if ble/fd#alloc _ble_test_logfile_fd '>>$file'; then
local h10=----------
[[ -s $file ]] &&
ble/util/print "$h10$h10$h10$h10$h10$h10$h10" >&"$_ble_test_logfile_fd"
ble/util/print "[$(date +'%F %T %Z')] test: start logging" >&"$_ble_test_logfile_fd"
fi
}
function ble/test/log#close {
if [[ $_ble_test_logfile_fd ]]; then
ble/util/print "[$(date +'%F %T %Z')] test: end logging" >&"$_ble_test_logfile_fd"
ble/fd#close _ble_test_logfile_fd
_ble_test_logfile_fd=
fi
}
if ble/bin#freeze-utility-path colored; then
function ble/test/diff.impl {
ble/bin/colored diff -u "$@"
}
else
function ble/test/diff.impl {
diff -u "$@"
}
fi
function ble/test/diff {
local dir
ble/test/getdir
ble/util/getpid
local f1=$BASHPID.$1.expect
local f2=$BASHPID.$1.result
(
ble/util/joblist/__suppress__
cd "$dir"
ble/util/print "$2" >| "$f1"
ble/util/print "$3" >| "$f2"
ble/util/assign ret 'ble/test/diff.impl "$f1" "$f2"'
ble/test/log "$ret"
>| "$f1" >| "$f2"
)
}
_ble_test_section_failure_count=0
_ble_test_section_fd=
_ble_test_section_file=
_ble_test_section_title=section
_ble_test_section_count=0
function ble/test/start-section {
[[ $_ble_test_section_fd ]] && ble/test/end-section
_ble_test_section_title=$1
_ble_test_section_count=$2
local dir
ble/test/getdir
ble/util/getpid
_ble_test_section_file=$dir/$BASHPID
ble/fd#alloc _ble_test_section_fd '> "$_ble_test_section_file"'
}
function ble/test/end-section {
[[ $_ble_test_section_fd ]] || return 1
ble/fd#close _ble_test_section_fd
_ble_test_section_fd=
local ntest npass count=$_ble_test_section_count
local ntest nfail npass
builtin eval -- $(
ble/bin/awk '
BEGIN{test=0;fail=0;pass=0;}
/^test /{test++}
/^fail /{fail++}
/^pass /{pass++}
END{print "ntest="test" nfail="fail" npass="pass;}
' "$_ble_test_section_file")
local sgr=$'\e[32m' sgr0=$'\e[m'
((npass==ntest)) || sgr=$'\e[31m'
local ncrash=$((ntest-nfail-npass))
local nskip=$((count-ntest))
if ((ntest)); then
local percentage=$((npass*1000/ntest)) # Note: 切り捨て
ble/util/sprintf percentage '%6s' "$((percentage/10)).$((percentage%10))%" # "XXX.X%"
else
local percentage=---.-%
fi
ble/test/log "$sgr$percentage$sgr0 [section] $_ble_test_section_title: $sgr$npass/$ntest$sgr0 ($nfail fail, $ncrash crash, $nskip skip)"
if ((npass==ntest)); then
return 0
else
((_ble_test_section_failure_count++))
return 1
fi
}
function ble/test/section#incr {
local title=$1
[[ $_ble_test_section_fd ]] || return 1
ble/util/print "test $title" >&"$_ble_test_section_fd"
}
function ble/test/section#report {
local ext=$? title=$1
[[ $_ble_test_section_fd ]] || return 1
local code=fail; ((ext==0)) && code=pass
ble/util/print "$code $title" >&"$_ble_test_section_fd"
}
function ble/test/.read-arguments {
local xstdout xstderr xexit xret
local qstdout qstderr qexit qret
local -a buff=()
while (($#)); do
local arg=$1; shift
case $arg in
('#'*)
local ret; ble/string#trim "${arg#'#'}"
_ble_test_title=$ret ;;
(stdout[:=]*)
[[ $qstdout ]] && xstdout=$xstdout$'\n'
qstdout=1
xstdout=$xstdout${arg#*[:=]} ;;
(stderr[:=]*)
[[ $qstderr ]] && xstderr=$xstderr$'\n'
qstderr=1
xstderr=$xstderr${arg#*[:=]} ;;
(ret[:=]*)
qret=1
xret=${arg#*[:=]} ;;
(exit[:=]*)
qexit=1
xexit=${arg#*[:=]} ;;
(code[:=]*)
((${#buff[@]})) && ble/array#push buff $'\n'
ble/array#push buff "${arg#*[:=]}" ;;
(--depth=*)
_ble_test_caller_depth=${arg#*=} ;;
(--display-code=*)
_ble_test_display_code=${arg#*=} ;;
(*)
((${#buff[@]})) && ble/array#push buff ' '
ble/array#push buff "$arg" ;;
esac
done
[[ $qstdout ]] && _ble_test_item_expect[0]=$xstdout
[[ $qstderr ]] && _ble_test_item_expect[1]=$xstderr
[[ $qexit ]] && _ble_test_item_expect[2]=$xexit
[[ $qret ]] && _ble_test_item_expect[3]=$xret
((${#_ble_test_item_expect[@]})) || _ble_test_item_expect[2]=0
IFS= builtin eval '_ble_test_code="${buff[*]}"'
}
_ble_test_item_name=(stdout stderr exit ret)
function ble/test {
local _ble_test_code
local _ble_test_title
local _ble_test_caller_depth=0
local _ble_test_display_code=
local -a _ble_test_item_expect=()
ble/test/.read-arguments "$@"
local caller_lineno=${BASH_LINENO[_ble_test_caller_depth+0]}
local caller_source=${BASH_SOURCE[_ble_test_caller_depth+1]}
_ble_test_title="$caller_source:$caller_lineno${_ble_test_title+ ($_ble_test_title)}"
ble/test/section#incr "$_ble_test_title"
ble/util/assign stderr '
ble/util/assign stdout "$_ble_test_code" 2>&1'; exit=$?
local -a item_result=()
item_result[0]=$stdout
item_result[1]=$stderr
item_result[2]=$exit
item_result[3]=$ret
local i flag_error=
for i in "${!_ble_test_item_expect[@]}"; do
[[ ${item_result[i]} == "${_ble_test_item_expect[i]}" ]] && continue
if [[ ! $flag_error ]]; then
flag_error=1
ble/test/log $'\e[1m'"$_ble_test_title"$'\e[m: \e[91m'"${_ble_test_display_code:-$_ble_test_code}"$'\e[m'
fi
ble/test/diff "${_ble_test_item_name[i]}" "${_ble_test_item_expect[i]}" "${item_result[i]}"
done
if [[ $flag_error ]]; then
if [[ ! ${_ble_test_item_expect[1]+set} && $stderr ]]; then
ble/test/log "<STDERR>"
ble/test/log "$stderr"
ble/test/log "</STDERR>"
fi
ble/test/log
fi
[[ ! $flag_error ]]
ble/test/section#report "$_ble_test_title"
return 0
}

View file

@ -0,0 +1,113 @@
# Copyright 2015 Koichi Murase <myoga.murase@gmail.com>. All rights reserved.
# This script is a part of blesh (https://github.com/akinomyoga/ble.sh)
# provided under the BSD-3-Clause license. Do not edit this file because this
# is not the original source code: Various pre-processing has been applied.
# Also, the code comments and blank lines are stripped off in the installation
# process. Please find the corresponding source file(s) in the repository
# "akinomyoga/ble.sh".
#
# Source: /lib/init-bind.sh
function ble/init:bind/append {
local xarg="\"$1\":_ble_decode_hook $2; builtin eval -- \"\$_ble_decode_bind_hook\""
local rarg=$1 condition=$3${3:+' && '}
ble/util/print "${condition}builtin bind -x '${xarg//$q/$Q}'" >> "$fbind1"
ble/util/print "${condition}builtin bind -r '${rarg//$q/$Q}'" >> "$fbind2"
}
function ble/init:bind/append-macro {
local kseq1=$1 kseq2=$2 condition=$3${3:+' && '}
local sarg="\"$kseq1\":\"$kseq2\"" rarg=$kseq1
ble/util/print "${condition}builtin bind '${sarg//$q/$Q}'" >> "$fbind1"
ble/util/print "${condition}builtin bind -r '${rarg//$q/$Q}'" >> "$fbind2"
}
function ble/init:bind/bind-s {
local sarg=$1
ble/util/print "builtin bind '${sarg//$q/$Q}'" >> "$fbind1"
}
function ble/init:bind/generate-binder {
local fbind1=$_ble_base_cache/decode.bind.$_ble_bash.$bleopt_input_encoding.bind
local fbind2=$_ble_base_cache/decode.bind.$_ble_bash.$bleopt_input_encoding.unbind
ble/edit/info/show text "ble.sh: updating binders..."
>| "$fbind1"
>| "$fbind2"
local q=\' Q="'\\''"
local altdqs00='\xC0\x80'
local altdqs24='\xC0\x98'
local altdqs27='\xC0\x9B'
local esc00=$((40300<=_ble_bash&&_ble_bash<50000))
local bind18XX=0
if ((40400<=_ble_bash&&_ble_bash<50000)); then
ble/util/print "[[ -o emacs ]] && builtin bind 'set keyseq-timeout 1'" >> "$fbind1"
fbind2=$fbind1 ble/init:bind/append '\C-x\C-x' 24 '[[ -o emacs ]]'
elif ((_ble_bash<40300)); then
bind18XX=1
fi
local esc1B=3
local esc1B5B=1 bindAllSeq=0
local esc1B1B=$((40100<=_ble_bash&&_ble_bash<40300))
local i
for i in {128..255} {0..127}; do
local ret; ble/decode/c2dqs "$i"
if ((i==0)); then
if ((esc00)); then
ble/init:bind/append-macro '\C-@' "$altdqs00"
else
ble/init:bind/append "$ret" "$i"
fi
elif ((i==24)); then
if ((bind18XX)); then
ble/init:bind/append "$ret" "$i" '[[ ! -o emacs ]]'
else
ble/init:bind/append "$ret" "$i"
fi
elif ((i==27)); then
if ((esc1B==0)); then
ble/init:bind/append "$ret" "$i"
elif ((esc1B==2)); then
ble/init:bind/append-macro '\e' "$altdqs27"
elif ((esc1B==3)); then
ble/init:bind/append-macro '\e' '\xDF\xBC' # C-[
fi
else
((i==28&&_ble_bash>=50000)) && ret='\x1C'
ble/init:bind/append "$ret" "$i"
fi
if ((bind18XX)); then
if ((i==0)); then
ble/init:bind/append-macro "\C-x$ret" "$altdqs24$altdqs00" '[[ -o emacs ]]'
elif ((i==24)); then
ble/init:bind/append-macro "\C-x$ret" "$altdqs24$altdqs24" '[[ -o emacs ]]'
else
ble/init:bind/append-macro "\C-x$ret" "$altdqs24$ret" '[[ -o emacs ]]'
fi
fi
if ((esc1B==3)); then
if ((i==0)); then
ble/init:bind/append-macro '\e'"$ret" "$altdqs27$altdqs00"
elif ((bind18XX&&i==24)); then
ble/init:bind/append-macro '\e'"$ret" "$altdqs27$altdqs24"
else
ble/init:bind/append-macro '\e'"$ret" "$altdqs27$ret"
fi
else
if ((esc1B==1)); then
if ((i==91&&esc1B5B)); then
ble/init:bind/append-macro '\e[' "$altdqs27["
else
ble/init:bind/append "\\e$ret" "27 $i"
fi
fi
if ((i==27&&esc1B1B)); then
ble/init:bind/append-macro '\e\e' '\e[^'
ble/util/print "ble-bind -k 'ESC [ ^' __esc__" >> "$fbind1"
ble/util/print "ble-bind -f __esc__ '.CHARS 27 27'" >> "$fbind1"
fi
fi
done
if ((bindAllSeq)); then
ble/util/print 'source "$_ble_decode_bind_fbinder.bind"' >> "$fbind1"
ble/util/print 'source "$_ble_decode_bind_fbinder.unbind"' >> "$fbind2"
fi
ble/function#try ble/encoding:"$bleopt_input_encoding"/generate-binder
ble/edit/info/immediate-show text "ble.sh: updating binders... done"
}
ble/init:bind/generate-binder

View file

@ -0,0 +1,195 @@
# Copyright 2015 Koichi Murase <myoga.murase@gmail.com>. All rights reserved.
# This script is a part of blesh (https://github.com/akinomyoga/ble.sh)
# provided under the BSD-3-Clause license. Do not edit this file because this
# is not the original source code: Various pre-processing has been applied.
# Also, the code comments and blank lines are stripped off in the installation
# process. Please find the corresponding source file(s) in the repository
# "akinomyoga/ble.sh".
#
# Source: /lib/init-cmap.sh
function ble/init:cmap/bind-single-csi {
ble-bind -k "ESC [ $1" "$2"
ble-bind -k "CSI $1" "$2"
}
function ble/init:cmap/bind-single-ss3 {
ble-bind -k "ESC O $1" "$2"
ble-bind -k "SS3 $1" "$2"
}
function ble/init:cmap/bind-keypad-key {
local Ft=$1 name=$2
(($3&4)) && ble-bind --csi "$Ft" "$name"
(($3&1)) && ble/init:cmap/bind-single-ss3 "$Ft" "$name"
(($3&2)) && ble-bind -k "ESC ? $Ft" "$name"
}
function ble/init:cmap/initialize {
ble/edit/info/immediate-show text "ble/lib/init-cmap.sh: updating key sequences..."
local ret
ble-decode-kbd/generate-keycode insert
ble-decode-kbd/generate-keycode home
ble-decode-kbd/generate-keycode prior
ble-decode-kbd/generate-keycode delete
ble-decode-kbd/generate-keycode end
ble-decode-kbd/generate-keycode next
ble-decode-kbd/generate-keycode find
ble-decode-kbd/generate-keycode select
local kend; ble/util/assign kend 'tput @7 2>/dev/null || tput kend 2>/dev/null'
if [[ $kend == $'\e[5~' ]]; then
ble-bind --csi '1~' insert
ble-bind --csi '2~' home
ble-bind --csi '3~' prior
ble-bind --csi '4~' delete
ble-bind --csi '5~' end
ble-bind --csi '6~' next
else
if [[ $kend == $'\e[F' && ( $TERM == xterm || $TERM == xterm-* || $TERM == kvt ) ]]; then
ble-bind --csi '1~' find
ble-bind --csi '4~' select
else
ble-bind --csi '1~' home
ble-bind --csi '4~' end
fi
ble-bind --csi '2~' insert
ble-bind --csi '3~' delete
ble-bind --csi '5~' prior
ble-bind --csi '6~' next
fi
ble-bind --csi '7~' home
ble-bind --csi '8~' end
local kdch1; ble/util/assign kdch1 'tput kD 2>/dev/null || tput kdch1 2>/dev/null'
[[ $kdch1 == $'\x7F' || $TERM == sun* ]] && ble-bind -k 'DEL' delete
ble-bind --csi '11~' f1
ble-bind --csi '12~' f2
ble-bind --csi '13~' f3
ble-bind --csi '14~' f4
ble-bind --csi '15~' f5
ble-bind --csi '17~' f6
ble-bind --csi '18~' f7
ble-bind --csi '19~' f8
ble-bind --csi '20~' f9
ble-bind --csi '21~' f10
ble-bind --csi '23~' f11
ble-bind --csi '24~' f12
ble-bind --csi '25~' f13
ble-bind --csi '26~' f14
ble-bind --csi '28~' f15
ble-bind --csi '29~' f16
ble-bind --csi '31~' f17
ble-bind --csi '32~' f18
ble-bind --csi '33~' f19
ble-bind --csi '34~' f20
ble-bind --csi '200~' paste_begin
ble-bind --csi '201~' paste_end
ble/init:cmap/bind-keypad-key 'SP' SP 3 # kpspace
ble/init:cmap/bind-keypad-key 'A' up 5
ble/init:cmap/bind-keypad-key 'B' down 5
ble/init:cmap/bind-keypad-key 'C' right 5
ble/init:cmap/bind-keypad-key 'D' left 5
ble/init:cmap/bind-keypad-key 'E' begin 5
ble/init:cmap/bind-keypad-key 'F' end 5
ble/init:cmap/bind-keypad-key 'H' home 5
ble/init:cmap/bind-keypad-key 'I' TAB 3 # kptab (Note: CSI I は xterm SM(?1004) focus と重複)
ble/init:cmap/bind-keypad-key 'M' RET 7 # kpent
ble/init:cmap/bind-keypad-key 'P' f1 5 # kpf1 # Note: 普通の f1-f4
ble/init:cmap/bind-keypad-key 'Q' f2 5 # kpf2 # に対してこれらの
ble/init:cmap/bind-keypad-key 'R' f3 5 # kpf3 # シーケンスを送る
ble/init:cmap/bind-keypad-key 'S' f4 5 # kpf4 # 端末もある。
ble/init:cmap/bind-keypad-key 'j' '*' 7 # kpmul
ble/init:cmap/bind-keypad-key 'k' '+' 7 # kpadd
ble/init:cmap/bind-keypad-key 'l' ',' 7 # kpsep
ble/init:cmap/bind-keypad-key 'm' '-' 7 # kpsub
ble/init:cmap/bind-keypad-key 'n' '.' 7 # kpdec
ble/init:cmap/bind-keypad-key 'o' '/' 7 # kpdiv
ble/init:cmap/bind-keypad-key 'p' '0' 7 # kp0
ble/init:cmap/bind-keypad-key 'q' '1' 7 # kp1
ble/init:cmap/bind-keypad-key 'r' '2' 7 # kp2
ble/init:cmap/bind-keypad-key 's' '3' 7 # kp3
ble/init:cmap/bind-keypad-key 't' '4' 7 # kp4
ble/init:cmap/bind-keypad-key 'u' '5' 7 # kp5
ble/init:cmap/bind-keypad-key 'v' '6' 7 # kp6
ble/init:cmap/bind-keypad-key 'w' '7' 7 # kp7
ble/init:cmap/bind-keypad-key 'x' '8' 7 # kp8
ble/init:cmap/bind-keypad-key 'y' '9' 7 # kp9
ble/init:cmap/bind-keypad-key 'X' '=' 7 # kpeq
ble/init:cmap/bind-keypad-key 'I' focus 4 # Note: 1 (= SS3) は TAB と重複するので設定しない
ble/init:cmap/bind-keypad-key 'O' blur 5
ble/init:cmap/bind-single-csi 'Z' S-TAB
ble/init:cmap/bind-single-ss3 'a' C-up
ble/init:cmap/bind-single-csi 'a' S-up
ble/init:cmap/bind-single-ss3 'b' C-down
ble/init:cmap/bind-single-csi 'b' S-down
ble/init:cmap/bind-single-ss3 'c' C-right
ble/init:cmap/bind-single-csi 'c' S-right
ble/init:cmap/bind-single-ss3 'd' C-left
ble/init:cmap/bind-single-csi 'd' S-left
ble/init:cmap/bind-single-csi '2 $' S-insert # ECMA-48 違反
ble/init:cmap/bind-single-csi '3 $' S-delete # ECMA-48 違反
ble/init:cmap/bind-single-csi '5 $' S-prior # ECMA-48 違反
ble/init:cmap/bind-single-csi '6 $' S-next # ECMA-48 違反
ble/init:cmap/bind-single-csi '7 $' S-home # ECMA-48 違反
ble/init:cmap/bind-single-csi '8 $' S-end # ECMA-48 違反
ble/init:cmap/bind-single-csi '2 3 $' S-f11 # ECMA-48 違反
ble/init:cmap/bind-single-csi '2 4 $' S-f12 # ECMA-48 違反
ble/init:cmap/bind-single-csi '2 5 $' S-f13 # ECMA-48 違反
ble/init:cmap/bind-single-csi '2 6 $' S-f14 # ECMA-48 違反
ble/init:cmap/bind-single-csi '2 8 $' S-f15 # ECMA-48 違反
ble/init:cmap/bind-single-csi '2 9 $' S-f16 # ECMA-48 違反
ble/init:cmap/bind-single-csi '3 1 $' S-f17 # ECMA-48 違反
ble/init:cmap/bind-single-csi '3 2 $' S-f18 # ECMA-48 違反
ble/init:cmap/bind-single-csi '3 3 $' S-f19 # ECMA-48 違反
ble/init:cmap/bind-single-csi '3 4 $' S-f20 # ECMA-48 違反
ble/init:cmap/bind-single-csi '[ A' f1
ble/init:cmap/bind-single-csi '[ B' f2
ble/init:cmap/bind-single-csi '[ C' f3
ble/init:cmap/bind-single-csi '[ D' f4
ble/init:cmap/bind-single-csi '[ E' f5
ble/init:cmap/bind-single-csi '2 4 7 z' insert
ble/init:cmap/bind-single-csi '2 1 4 z' home
ble/init:cmap/bind-single-csi '2 2 0 z' end
ble/init:cmap/bind-single-csi '2 2 2 z' prior
ble/init:cmap/bind-single-csi '2 1 6 z' next
ble/init:cmap/bind-single-csi '2 2 4 z' f1
ble/init:cmap/bind-single-csi '2 2 5 z' f2
ble/init:cmap/bind-single-csi '2 2 6 z' f3
ble/init:cmap/bind-single-csi '2 2 7 z' f4
ble/init:cmap/bind-single-csi '2 2 8 z' f5
ble/init:cmap/bind-single-csi '2 2 9 z' f6
ble/init:cmap/bind-single-csi '2 3 0 z' f7
ble/init:cmap/bind-single-csi '2 3 1 z' f8
ble/init:cmap/bind-single-csi '2 3 2 z' f9
ble/init:cmap/bind-single-csi '2 3 3 z' f10
ble/init:cmap/bind-single-csi '2 3 4 z' f11
ble/init:cmap/bind-single-csi '2 3 5 z' f12
ble/init:cmap/bind-single-csi '1 z' find # from xterm ctlseqs
ble/init:cmap/bind-single-csi '4 z' select # from xterm ctlseqs
ble/init:cmap/bind-single-csi '2 J' S-home
ble/init:cmap/bind-single-csi 'J' C-end
ble/init:cmap/bind-single-csi 'K' S-end
ble/init:cmap/bind-single-csi '4 l' S-insert
ble/init:cmap/bind-single-csi 'L' C-insert
ble/init:cmap/bind-single-csi '4 h' insert
ble/init:cmap/bind-single-csi '2 K' S-delete
ble/init:cmap/bind-single-csi 'P' delete
_ble_decode_csimap_kitty_u=(
[57358]=capslock [57359]=scrolllock [57360]=numlock [57361]=print [57362]=pause [57363]=menu
[57376]=f13 [57377]=f14 [57378]=f15 [57379]=f16 [57380]=f17 [57381]=f18 [57382]=f19 [57383]=f20
[57384]=f21 [57385]=f22 [57386]=f23 [57387]=f24 [57388]=f25 [57389]=f26 [57390]=f27 [57391]=f28
[57392]=f29 [57393]=f30 [57394]=f31 [57395]=f32 [57396]=f33 [57397]=f34 [57398]=f35
[57399]=0 [57400]=1 [57401]=2 [57402]=3 [57403]=4 [57404]=5 [57405]=6 [57406]=7 [57407]=8 [57408]=9
[57409]='.' [57410]='/' [57411]='*' [57412]='-' [57413]='+' [57414]=RET [57415]='=' [57416]=','
[57417]=left [57418]=right [57419]=up [57420]=down
[57421]=prior [57422]=next [57423]=home [57424]=end [57425]=insert [57426]=delete [57427]=begin
[57428]=media_play [57429]=media_pause [57430]=media_play_pause [57431]=media_reverse
[57432]=media_stop [57433]=media_fast_forward [57434]=media_rewind [57435]=media_track_next
[57436]=media_track_prev [57437]=media_record [57438]=lower_volume [57439]=raise_volume
[57440]=mute_volume
[57441]=lshift [57442]=lcontrol [57443]=lalter [57444]=lsuper [57445]=lhyper [57446]=lmeta
[57447]=rshift [57448]=rcontrol [57449]=ralter [57450]=rsuper [57451]=rhyper [57452]=rmeta
[57453]=iso_shift3 [57454]=iso_shift5
)
local keyname
for keyname in "${_ble_decode_csimap_kitty_u[@]}"; do
ble-decode-kbd/generate-keycode "$keyname"
done
ble/edit/info/immediate-show text "ble/lib/init-cmap.sh: updating key sequences... done"
}
ble/init:cmap/initialize

View file

@ -0,0 +1,134 @@
# Copyright 2015 Koichi Murase <myoga.murase@gmail.com>. All rights reserved.
# This script is a part of blesh (https://github.com/akinomyoga/ble.sh)
# provided under the BSD-3-Clause license. Do not edit this file because this
# is not the original source code: Various pre-processing has been applied.
# Also, the code comments and blank lines are stripped off in the installation
# process. Please find the corresponding source file(s) in the repository
# "akinomyoga/ble.sh".
#
# Source: /lib/init-msys1.sh
function ble-edit/io:msys1/get-winpid.proc {
/usr/bin/ps | /usr/bin/gawk -v pid="$1" '
BEGIN {
cygpid_len = 9;
winpid_len = 36;
}
NR == 1 {
line = $0;
if (!match(line, /.*\yPID\y/)) next;
cygpid_end = RLENGTH;
if (!match(line, /.*\yWINPID\y/)) next;
winpid_end = RLENGTH;
next;
}
function get_last_number(line, limit, _, head, i) {
head = substr(line, 1, limit);
if (i = match(head, /[0-9]+$/))
return substr(head, i, RLENGTH);
return -1;
}
{
cygpid = get_last_number($0, cygpid_end);
if (cygpid != pid) next;
print get_last_number($0, winpid_end);
exit
}
'
}
function ble-edit/io:msys1/compile-helper {
local helper=$1
[[ -x $helper && -s $helper && $helper -nt $_ble_base/lib/init-msys1.sh ]] && return 0
gcc -O2 -s -o "$helper" -xc - << EOF || return 1
// For MSYS 1.0
#include <stdio.h>
#include <windows.h>
#include <sys/stat.h>
#include <signal.h>
BOOL is_process_alive(HANDLE handle) {
DWORD result;
return GetExitCodeProcess(handle, &result) && result == STILL_ACTIVE;
}
BOOL is_file(const char* filename) {
struct stat st;
return stat(filename, &st) == 0 && S_ISREG(st.st_mode);
}
int main(int argc, char** argv) {
const char* winpid = argv[1];
const char* fname_buff = argv[2];
const char* fname_read = argv[3];
signal(SIGINT, SIG_IGN);
//signal(SIGQUIT, SIG_IGN);
int ppid = atoi(winpid);
if (!ppid) {
fprintf(stderr, "ble.sh (msys1): invalid process ID '%s'\n", winpid);
return 1;
}
HANDLE parent_process = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, ppid);
if (parent_process == NULL) {
fprintf(stderr, "ble.sh (msys1): failed to open the parent process '%s'\n", winpid);
return 1;
}
int exit_code = 0;
BOOL terminate = FALSE;
while (!terminate) {
unlink(fname_read);
if (rename(fname_buff, fname_read) != 0) {
perror("ble.sh (msys1)");
fprintf(stderr, "ble.sh (msys1): failed to move the file '%s' -> '%s'\n", fname_buff, fname_read);
terminate = TRUE;
exit_code = 1;
break;
}
FILE* f = fopen(fname_read, "r");
if (!f) {
fprintf(stderr, "ble.sh (msys1): failed to open the file '%s'\n", fname_read);
terminate = TRUE;
exit_code = 1;
break;
}
for (;;) {
if (!is_process_alive(parent_process)) {
terminate = TRUE;
break;
}
if (is_file(fname_buff)) break;
int count = 0;
char buff[4096];
while (count = fread(&buff, 1, sizeof buff, f))
fwrite(buff, 1, count, stdout);
fflush(stdout);
Sleep(20);
}
fclose(f);
}
CloseHandle(parent_process);
return exit_code;
}
EOF
[[ -x $helper ]]
}
function ble-edit/io:msys1/start-background {
local basename=$_ble_edit_io_fname2
local fname_buff=$basename.buff
ble/base/is-msys1 || return 1
local helper=$_ble_base_cache/init-msys1-helper.exe
local helper2=$_ble_base_run/$$.init-msys1-helper.exe
ble-edit/io:msys1/compile-helper "$helper" &&
/usr/bin/cp "$helper" "$helper2" || return 1
local winpid
ble/util/assign winpid 'ble-edit/io:msys1/get-winpid.proc $$'
[[ $winpid ]] || return 1
>| "$fname_buff"
ble/fd#alloc _ble_edit_io_fd2 '> "$fname_buff"'
"$helper2" "$winpid" "$fname_buff" "${fname_buff%.buff}.read" | ble-edit/io/check-ignoreeof-loop & disown
} &>/dev/null

View file

@ -0,0 +1,253 @@
# Copyright 2015 Koichi Murase <myoga.murase@gmail.com>. All rights reserved.
# This script is a part of blesh (https://github.com/akinomyoga/ble.sh)
# provided under the BSD-3-Clause license. Do not edit this file because this
# is not the original source code: Various pre-processing has been applied.
# Also, the code comments and blank lines are stripped off in the installation
# process. Please find the corresponding source file(s) in the repository
# "akinomyoga/ble.sh".
#
# Source: /lib/init-term.sh
_ble_term_tput=
function ble/init:term/tput { return 1; }
if ble/bin#freeze-utility-path tput; then
ble/bin/tput cuu 1 &>/dev/null && _ble_term_tput=${_ble_term_tput}i
ble/bin/tput UP 1 &>/dev/null && _ble_term_tput=${_ble_term_tput}c
if [[ $_ble_term_tput ]]; then
function ble/init:term/tput {
local type=$_ble_term_tput
if [[ $1 == -c ]]; then # termcap 優先
shift
[[ $type == ic ]] && type=c
fi
if [[ $type != c ]]; then
ble/bin/tput "${1%%:*}" "${@:2}" 2>/dev/null
else
ble/bin/tput "${1#*:}" "${@:2}" 2>/dev/null
fi
}
fi
fi
function ble/init:term/register-varname {
local name=$1
varnames[${#varnames[@]}]=$name
}
function ble/init:term/define-cap {
local IFS=$_ble_term_IFS
local name=$1 def=$2
shift 2
ble/util/assign "$name" "ble/init:term/tput $* || ble/util/put \"\$def\""
ble/init:term/register-varname "$name"
}
function ble/init:term/define-cap.2 {
local IFS=$_ble_term_IFS
local name=$1 def=$2
shift 2
ble/util/assign "$name" "ble/util/put x; ble/init:term/tput $* || ble/util/put \"\$def\"; ble/util/put x"
builtin eval "$name=\${$name#x}; $name=\${$name%x}"
ble/init:term/register-varname "$name"
}
_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
if [[ $seq =~ $_ble_term_rex_sgr ]]; then
local rematch1=${BASH_REMATCH[1]}
builtin eval "$name=\$rematch1"
if [[ $ansi ]]; then
local rex='^[0-9]+$'
[[ $rematch1 =~ $rex ]] &&
[[ ! ${_ble_term_sgr_term2ansi[rematch1]} ]] &&
_ble_term_sgr_term2ansi[rematch1]=$ansi
fi
else
builtin eval "$name="
fi
if [[ $name =~ ^[_a-zA-Z][_a-zA-Z0-9]*$ ]]; then
ble/init:term/register-varname "$name"
fi
}
function ble/init:term/initialize {
local -a varnames=()
ble/init:term/register-varname _ble_term_sgr_term2ansi
_ble_term_xenl=1
[[ $_ble_term_tput ]] &&
! ble/init:term/tput xenl:xn &>/dev/null &&
_ble_term_xenl=
[[ $TERM == sun* ]] && _ble_term_xenl=
ble/init:term/register-varname _ble_term_xenl
_ble_term_bce=
[[ $_ble_term_tput ]] &&
ble/init:term/tput bce:ut &>/dev/null &&
_ble_term_bce=1
ble/init:term/register-varname _ble_term_bce
_ble_term_it=8
if [[ $_ble_term_tput ]]; then
ble/util/assign _ble_term_it 'ble/init:term/tput it:it'
_ble_term_it=${_ble_term_it:-8}
fi
ble/init:term/register-varname _ble_term_it
ble/init:term/define-cap.2 _ble_term_ind $'\n' ind:sf # $'\eD'
ble/init:term/define-cap _ble_term_ri '' ri:sr # $'\eM'
ble/init:term/define-cap _ble_term_cr $'\r' cr:cr
if [[ $OSTYPE == msys && ! $_ble_term_CR ]]; then # msys-1.0
[[ $_ble_term_cr ]] || _ble_term_cr=$'\e[G'
if [[ $TERM == cygwin ]]; then
[[ $_ble_term_ind == $'\eD' ]] && _ble_term_ind=$'\n'
_ble_term_xenl=
fi
fi
ble/init:term/define-cap _ble_term_cuu $'\e[%dA' cuu:UP 123
ble/init:term/define-cap _ble_term_cud $'\e[%dB' cud:DO 123
ble/init:term/define-cap _ble_term_cuf $'\e[%dC' cuf:RI 123
ble/init:term/define-cap _ble_term_cub $'\e[%dD' cub:LE 123
_ble_term_cuu=${_ble_term_cuu//123/%d}
_ble_term_cud=${_ble_term_cud//123/%d}
_ble_term_cuf=${_ble_term_cuf//123/%d}
_ble_term_cub=${_ble_term_cub//123/%d}
_ble_term_ri_or_cuu1=${_ble_term_ri:-${_ble_term_cuu//'%d'/1}}
ble/init:term/register-varname _ble_term_ri_or_cuu1
ble/init:term/define-cap _ble_term_cup $'\e[13;35H' cup:cm 12 34
_ble_term_cup=${_ble_term_cup//13/%l}
_ble_term_cup=${_ble_term_cup//35/%c}
_ble_term_cup=${_ble_term_cup//12/%y}
_ble_term_cup=${_ble_term_cup//34/%x}
ble/init:term/define-cap _ble_term_hpa "$_ble_term_cr${_ble_term_cuf//'%d'/123}" hpa:ch 123
_ble_term_hpa=${_ble_term_hpa//123/%x}
_ble_term_hpa=${_ble_term_hpa//124/%c}
ble/init:term/define-cap _ble_term_vpa "${_ble_term_cuu//'%d'/199}${_ble_term_cud//'%d'/123}" vpa:cv 123
_ble_term_vpa=${_ble_term_vpa//123/%y}
_ble_term_vpa=${_ble_term_vpa//124/%l}
ble/init:term/define-cap _ble_term_clear $'\e[H\e[2J' clear:cl
_ble_term_clear=${_ble_term_clear//$'\e[3J'}
ble/init:term/define-cap _ble_term_il $'\e[%dL' il:AL 123
ble/init:term/define-cap _ble_term_dl $'\e[%dM' -c dl:DL 123
_ble_term_il=${_ble_term_il//123/%d}
_ble_term_dl=${_ble_term_dl//123/%d}
[[ ${TERM%%-*} == eterm ]] && _ble_term_il=$'\r\e[%dL' _ble_term_dl=$'\r\e[%dM'
ble/init:term/define-cap _ble_term_el $'\e[K' el:ce
ble/init:term/define-cap _ble_term_el1 $'\e[1K' el1:cb
if [[ $_ble_term_el == $'\e[K' && $_ble_term_el1 == $'\e[1K' ]]; then
_ble_term_el2=$'\e[2K'
else
_ble_term_el2=$_ble_term_el1$_ble_term_el
fi
ble/init:term/register-varname _ble_term_el2
ble/init:term/define-cap _ble_term_ed $'\e[J' -c ed:cd
ble/init:term/define-cap _ble_term_ich '' ich:IC 123 # CSI @
ble/init:term/define-cap _ble_term_dch '' dch:DC 123 # CSI P
ble/init:term/define-cap _ble_term_ech '' ech:ec 123 # CSI X
_ble_term_ich=${_ble_term_ich//123/%d}
_ble_term_dch=${_ble_term_dch//123/%d}
_ble_term_ech=${_ble_term_ech//123/%d}
ble/init:term/define-cap _ble_term_sc $'\e7' sc:sc # \e[s
ble/init:term/define-cap _ble_term_rc $'\e8' rc:rc # \e[u
[[ $TERM == minix ]] && _ble_term_sc= _ble_term_rc=
ble/init:term/define-cap _ble_term_Ss '' Ss:Ss 123 # DECSCUSR
_ble_term_Ss=${_ble_term_Ss//123/@1}
ble/init:term/define-cap _ble_term_civis '' civis:vi
ble/init:term/define-cap _ble_term_cnorm '' cnorm:ve
ble/init:term/define-cap _ble_term_cvvis '' cvvis:vs
ble/init:term/register-varname _ble_term_rmcivis
if ble/string#match "$_ble_term_civis" $'^((\e\\[[<=>?]?[0-9;]+)[hl])+$'; then
local s=$_ble_term_civis
_ble_term_civis=
_ble_term_rmcivis=
while ble/string#match "$s" $'^(\e\\[[<=>?]?[0-9]+)[hl]'; do
s=${s:${#BASH_REMATCH}}
_ble_term_civis=$_ble_term_civis$BASH_REMATCH
if [[ $BASH_REMATCH == *l ]]; then
_ble_term_rmcivis=$_ble_term_rmcivis${BASH_REMATCH[1]}h
else
_ble_term_rmcivis=$_ble_term_rmcivis${BASH_REMATCH[1]}l
fi
done
elif [[ $_ble_term_civis == *$'\e[?25l'* || ! $_ble_term_civis && $TERM != minix ]]; then
_ble_term_rmcivis=$'\e[?25h'
_ble_term_civis=$'\e[?25l'
else
_ble_term_civis=
_ble_term_rmcivis=
fi
ble/init:term/define-cap _ble_term_smcup '' smcup:ti # \e[?1049h
ble/init:term/define-cap _ble_term_rmcup '' rmcup:te # \e[?1049l
ble/init:term/define-cap _ble_term_tsl '' tsl:ts
ble/init:term/define-cap _ble_term_fsl '' fsl:fs
ble/init:term/define-cap _ble_term_dsl '' dsl:ds
[[ ! $_ble_term_dsl && $_ble_term_fsl ]] &&
_ble_term_dsl=$_ble_term_tsl$_ble_term_fsl
ble/init:term/define-cap _ble_term_sgr0 $'\e[m' sgr0:me
ble/init:term/define-cap _ble_term_bold $'\e[1m' bold:md
ble/init:term/define-cap _ble_term_blink $'\e[5m' blink:mb
ble/init:term/define-cap _ble_term_rev $'\e[7m' rev:mr
ble/init:term/define-cap _ble_term_invis $'\e[8m' invis:mk
ble/init:term/define-sgr-param _ble_term_sgr_bold "$_ble_term_bold" 1
ble/init:term/define-sgr-param _ble_term_sgr_blink "$_ble_term_blink" 5
ble/init:term/define-sgr-param _ble_term_sgr_rev "$_ble_term_rev" 7
ble/init:term/define-sgr-param _ble_term_sgr_invis "$_ble_term_invis" 8
ble/init:term/define-cap _ble_term_sitm $'\e[3m' sitm:ZH
ble/init:term/define-cap _ble_term_ritm $'\e[23m' ritm:ZR
ble/init:term/define-cap _ble_term_smul $'\e[4m' smul:us
ble/init:term/define-cap _ble_term_rmul $'\e[24m' rmul:ue
ble/init:term/define-cap _ble_term_smso $'\e[7m' smso:so
ble/init:term/define-cap _ble_term_rmso $'\e[27m' rmso:se
ble/init:term/define-sgr-param _ble_term_sgr_sitm "$_ble_term_sitm" 3
ble/init:term/define-sgr-param _ble_term_sgr_ritm "$_ble_term_ritm" 23
ble/init:term/define-sgr-param _ble_term_sgr_smul "$_ble_term_smul" 4
ble/init:term/define-sgr-param _ble_term_sgr_rmul "$_ble_term_rmul" 24
ble/init:term/define-sgr-param _ble_term_sgr_smso "$_ble_term_smso" 7
ble/init:term/define-sgr-param _ble_term_sgr_rmso "$_ble_term_rmso" 27
ble/init:term/register-varname _ble_term_sgr_rev_reset
if [[ $_ble_term_sgr_smso && $_ble_term_sgr_smso == "$_ble_term_sgr_rev" ]]; then
_ble_term_sgr_rev_reset=$_ble_term_sgr_rmso
else
_ble_term_sgr_rev_reset=
fi
ble/init:term/define-cap _ble_term_colors 8 colors:Co
local i
_ble_term_setaf=()
_ble_term_setab=()
_ble_term_sgr_af=()
_ble_term_sgr_ab=()
for ((i=0;i<16;i++)); do
local i1=$((i%8)) af= ab=
if [[ $TERM == *-direct ]]; then
if ((i<8)); then
af=$'\e[3'$i'm'
ab=$'\e[4'$i'm'
else
af=$'\e[38;5;'$i'm'
ab=$'\e[48;5;'$i'm'
fi
else
if ((i<_ble_term_colors)); then
local j1
((j1=(i1==3?6:
(i1==6?3:
(i1==1?4:
(i1==4?1:i1))))))
local j=$((i-i1+j1))
ble/util/assign af 'ble/init:term/tput setaf:AF "$i" 2>/dev/null'
[[ $af ]] || ble/util/assign af 'ble/init:term/tput setf:Sf "$j" 2>/dev/null'
ble/util/assign ab 'ble/init:term/tput setab:AB "$i" 2>/dev/null'
[[ $ab ]] || ble/util/assign ab 'ble/init:term/tput setb:Sb "$j" 2>/dev/null'
fi
fi
[[ $af ]] || af=$'\e[3'$i1'm'
[[ $ab ]] || ab=$'\e[4'$i1'm'
_ble_term_setaf[i]=$af
_ble_term_setab[i]=$ab
local ansi_sgr_af=3$i1 ansi_sgr_ab=4$i1
((i>=8)) && ansi_sgr_af=9$i1 ansi_sgr_ab=10$i1
ble/init:term/define-sgr-param "_ble_term_sgr_af[i]" "$af" "$ansi_sgr_af"
ble/init:term/define-sgr-param "_ble_term_sgr_ab[i]" "$ab" "$ansi_sgr_ab"
done
ble/init:term/register-varname "_ble_term_setaf"
ble/init:term/register-varname "_ble_term_setab"
ble/init:term/register-varname "_ble_term_sgr_af"
ble/init:term/register-varname "_ble_term_sgr_ab"
ble/util/declare-print-definitions "${varnames[@]}" >| "$_ble_base_cache/term.$TERM"
}
ble/util/put "ble/term.sh: updating tput cache for TERM=$TERM... " >&2
ble/init:term/initialize
ble/util/print $'\r'"ble/term.sh: updating tput cache for TERM=$TERM... done" >&2
return 0

View file

@ -0,0 +1,223 @@
# Copyright 2015 Koichi Murase <myoga.murase@gmail.com>. All rights reserved.
# This script is a part of blesh (https://github.com/akinomyoga/ble.sh)
# provided under the BSD-3-Clause license. Do not edit this file because this
# is not the original source code: Various pre-processing has been applied.
# Also, the code comments and blank lines are stripped off in the installation
# process. Please find the corresponding source file(s) in the repository
# "akinomyoga/ble.sh".
#
# Source: /lib/keymap.emacs.sh
ble/is-function ble-edit/bind/load-editing-mode:emacs && return 0
function ble-edit/bind/load-editing-mode:emacs { return 0; }
ble/util/autoload "$_ble_base/lib/keymap.vi.sh" \
ble/widget/vi-rlfunc/{prev,end,next}-word \
ble/widget/vi-command/{forward,backward}-{v,u}word \
ble/widget/vi-command/forward-{v,u}word-end
bleopt/declare -v keymap_emacs_mode_string_multiline $'\e[1m-- MULTILINE --\e[m'
_ble_keymap_emacs_white_list=(
self-insert
batch-insert
nop
magic-space magic-slash
copy{,-forward,-backward}-{c,f,s,u}word
copy-region{,-or}
clear-screen
command-help
display-shell-version
redraw-line
)
function ble/keymap:emacs/is-command-white {
if [[ $1 == ble/widget/self-insert ]]; then
return 0
elif [[ $1 == ble/widget/* ]]; then
local IFS=$_ble_term_IFS
local cmd=${1#ble/widget/}; cmd=${cmd%%["$_ble_term_IFS"]*}
[[ $cmd == emacs/* || " ${_ble_keymap_emacs_white_list[*]} " == *" $cmd "* ]] && return 0
fi
return 1
}
function ble/widget/emacs/__before_widget__ {
if ! ble/keymap:emacs/is-command-white "$WIDGET"; then
ble-edit/undo/add
fi
}
function ble/widget/emacs/undo {
local arg; ble-edit/content/get-arg 1
ble-edit/undo/undo "$arg" || ble/widget/.bell 'no more older undo history'
}
function ble/widget/emacs/redo {
local arg; ble-edit/content/get-arg 1
ble-edit/undo/redo "$arg" || ble/widget/.bell 'no more recent undo history'
}
function ble/widget/emacs/revert {
local arg; ble-edit/content/clear-arg
ble-edit/undo/revert
}
function ble/keymap:emacs/.get-emacs-keymap {
ble/prompt/unit/add-hash '$_ble_decode_keymap,${_ble_decode_keymap_stack[*]}'
local i=${#_ble_decode_keymap_stack[@]}
keymap=$_ble_decode_keymap
while [[ $keymap != vi_?map && $keymap != emacs ]]; do
((i--)) || return 1
keymap=${_ble_decode_keymap_stack[i]}
done
[[ $keymap == emacs ]]
}
bleopt/declare -v prompt_emacs_mode_indicator '\q{keymap:emacs/mode-indicator}'
function bleopt/check:prompt_emacs_mode_indicator {
local bleopt_prompt_emacs_mode_indicator=$value
[[ $_ble_attached ]] && ble/keymap:emacs/update-mode-indicator
return 0
}
_ble_keymap_emacs_mode_indicator_data=()
function ble/prompt/unit:_ble_keymap_emacs_mode_indicator/update {
local trace_opts=truncate:relative:noscrc:ansi
local prompt_rows=1
local prompt_cols=${COLUMNS:-80}
((prompt_cols&&prompt_cols--))
local "${_ble_prompt_cache_vars[@]/%/=}" # WA #D1570 checked
ble/prompt/unit:{section}/update _ble_keymap_emacs_mode_indicator "$bleopt_prompt_emacs_mode_indicator" "$trace_opts"
}
function ble/keymap:emacs/update-mode-indicator {
local keymap
ble/keymap:emacs/.get-emacs-keymap || return 0
local opt_multiline=
[[ $_ble_edit_str == *$'\n'* ]] && opt_multiline=1
local footprint=$opt_multiline:$_ble_edit_arg:$_ble_edit_kbdmacro_record
[[ $footprint == "$_ble_keymap_emacs_modeline" ]] && return 0
_ble_keymap_emacs_modeline=$footprint
local version=$COLUMNS,$_ble_edit_lineno,$_ble_history_count,$_ble_edit_CMD
local prompt_hashref_base='$version'
ble/prompt/unit#update _ble_keymap_emacs_mode_indicator
local ret; ble/prompt/unit:{section}/get _ble_keymap_emacs_mode_indicator; local str=$ret
[[ $_ble_edit_arg ]] &&
str=${str:+"$str "}$'(arg: \e[1;34m'$_ble_edit_arg$'\e[m)'
[[ $_ble_edit_kbdmacro_record ]] &&
str=${str:+"$str "}$'\e[1;31mREC\e[m'
ble/edit/info/default ansi "$str"
}
blehook internal_PRECMD!=ble/keymap:emacs/update-mode-indicator
function ble/prompt/backslash:keymap:emacs/mode-indicator {
ble/prompt/unit/add-hash '$_ble_edit_str'
[[ $_ble_edit_str == *$'\n'* ]] || return 0
ble/prompt/unit/add-hash '$bleopt_keymap_emacs_mode_string_multiline'
local str=$bleopt_keymap_emacs_mode_string_multiline
ble/prompt/unit/add-hash '${_ble_edit_arg:+1}${_ble_edit_kbdmacro_record:+1}'
if [[ ! ${_ble_edit_arg:+1}${_ble_edit_kbdmacro_record:+1} ]]; then
local keybinding_C_m=${_ble_decode_emacs_kmap_[_ble_decode_Ctrl|0x6d]}
local keybinding_C_j=${_ble_decode_emacs_kmap_[_ble_decode_Ctrl|0x6a]}
[[ $keybinding_C_m == *:ble/widget/accept-single-line-or-newline ]] &&
[[ $keybinding_C_j == *:ble/widget/accept-line ]] &&
str=${str:+"$str "}$'(\e[35mRET\e[m or \e[35mC-m\e[m: insert a newline, \e[35mC-j\e[m: run)'
fi
[[ ! $str ]] || ble/prompt/print "$str"
}
function ble/widget/emacs/__after_widget__ {
ble/keymap:emacs/update-mode-indicator
}
function ble/widget/emacs/quoted-insert-char {
_ble_edit_mark_active=
_ble_decode_char__hook=ble/widget/emacs/quoted-insert-char.hook
return 147
}
function ble/widget/emacs/quoted-insert-char.hook {
ble/widget/quoted-insert-char.hook
ble/keymap:emacs/update-mode-indicator
}
function ble/widget/emacs/quoted-insert {
_ble_edit_mark_active=
_ble_decode_key__hook=ble/widget/emacs/quoted-insert.hook
return 147
}
function ble/widget/emacs/quoted-insert.hook {
ble/widget/quoted-insert.hook
ble/keymap:emacs/update-mode-indicator
}
function ble/widget/emacs/bracketed-paste {
ble/widget/bracketed-paste
_ble_edit_bracketed_paste_proc=ble/widget/emacs/bracketed-paste.proc
return 147
}
function ble/widget/emacs/bracketed-paste.proc {
ble/widget/bracketed-paste.proc "$@"
ble/keymap:emacs/update-mode-indicator
}
function ble/widget/emacs/execute-named-command/accept.hook {
ble/keymap:emacs/update-mode-indicator
ble/widget/execute-named-command/accept.hook "$1"
}
function ble/widget/emacs/execute-named-command {
ble/edit/async-read-mode 'ble/widget/emacs/execute-named-command/accept.hook'
_ble_edit_PS1='!'
_ble_edit_async_read_before_widget=ble/edit/async-read-mode/empty-cancel.hook
ble/history/set-prefix _ble_edit_rlfunc
return 147
}
function ble-decode/keymap:emacs/define {
local ble_bind_nometa=
ble-decode/keymap:safe/bind-common
ble-decode/keymap:safe/bind-history
ble-decode/keymap:safe/bind-complete
ble-decode/keymap:safe/bind-arg
ble-bind -f 'C-d' 'delete-region-or delete-forward-char-or-exit'
ble-bind -f 'M-^' history-expand-line
ble-bind -f 'SP' magic-space
ble-bind -f '/' magic-slash
ble-bind -f __attach__ safe/__attach__
ble-bind -f __before_widget__ emacs/__before_widget__
ble-bind -f __after_widget__ emacs/__after_widget__
ble-bind -f __line_limit__ __line_limit__
ble-bind -f 'C-c' discard-line
ble-bind -f 'C-j' accept-line
ble-bind -f 'C-RET' accept-line
ble-bind -f 'C-m' accept-single-line-or-newline
ble-bind -f 'RET' accept-single-line-or-newline
ble-bind -f 'C-o' accept-and-next
ble-bind -f 'C-x C-e' edit-and-execute-command
ble-bind -f 'M-#' insert-comment
ble-bind -f 'M-C-e' shell-expand-line
ble-bind -f 'M-&' tilde-expand
ble-bind -f 'C-g' bell
ble-bind -f 'C-x C-g' bell
ble-bind -f 'C-M-g' bell
ble-bind -f 'C-l' clear-screen
ble-bind -f 'C-M-l' redraw-line
ble-bind -f 'f1' command-help
ble-bind -f 'C-x C-v' display-shell-version
ble-bind -c 'C-z' fg
ble-bind -f 'M-z' zap-to-char
ble-bind -f 'C-\' bell
ble-bind -f 'C-^' bell
ble-bind -f 'C-_' emacs/undo
ble-bind -f 'C-DEL' emacs/undo
ble-bind -f 'C-BS' emacs/undo
ble-bind -f 'C-/' emacs/undo
ble-bind -f 'C-x u' emacs/undo
ble-bind -f 'C-x C-u' emacs/undo
ble-bind -f 'C-x U' emacs/redo
ble-bind -f 'C-x C-S-u' emacs/redo
ble-bind -f 'M-r' emacs/revert
ble-bind -f 'C-q' emacs/quoted-insert
ble-bind -f 'C-v' emacs/quoted-insert
ble-bind -f paste_begin emacs/bracketed-paste
ble-bind -f 'M-x' emacs/execute-named-command
}
function ble-decode/keymap:emacs/initialize {
local fname_keymap_cache=$_ble_base_cache/keymap.emacs
if [[ -s $fname_keymap_cache &&
$fname_keymap_cache -nt $_ble_base/lib/keymap.emacs.sh &&
$fname_keymap_cache -nt $_ble_base/lib/init-cmap.sh ]]; then
source "$fname_keymap_cache" && return 0
fi
ble/edit/info/immediate-show text "ble.sh: updating cache/keymap.emacs..."
{
ble/decode/keymap#load isearch dump
ble/decode/keymap#load nsearch dump
ble/decode/keymap#load emacs dump
} 3>| "$fname_keymap_cache"
ble/edit/info/immediate-show text "ble.sh: updating cache/keymap.emacs... done"
}
ble-decode/keymap:emacs/initialize
ble_bind_keymap=emacs blehook/invoke keymap_load
ble_bind_keymap=emacs blehook/invoke keymap_emacs_load
return 0

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,60 @@
# Copyright 2015 Koichi Murase <myoga.murase@gmail.com>. All rights reserved.
# This script is a part of blesh (https://github.com/akinomyoga/ble.sh)
# provided under the BSD-3-Clause license. Do not edit this file because this
# is not the original source code: Various pre-processing has been applied.
# Also, the code comments and blank lines are stripped off in the installation
# process. Please find the corresponding source file(s) in the repository
# "akinomyoga/ble.sh".
#
# Source: /lib/keymap.vi_digraph.sh
_ble_keymap_vi_digraph__hook=
function ble/widget/vi_digraph/.proc {
local code=$1
local hook=${_ble_keymap_vi_digraph__hook:-ble-decode-key}
_ble_keymap_vi_digraph__hook=
ble/decode/keymap/pop
builtin eval -- "$hook $code"
}
function ble/widget/vi_digraph/defchar {
ble/widget/vi_digraph/.proc "${KEYS[0]}"
}
function ble/widget/vi_digraph/default {
local key=${KEYS[0]}
local flag=$((key&_ble_decode_MaskFlag)) char=$((key&_ble_decode_MaskChar))
if ((flag==_ble_decode_Ctrl&&63<=char&&char<128&&(char&0x1F)!=0)); then
((char=char==63?127:char&0x1F))
ble/widget/vi_digraph/.proc "$char"
return 0
fi
ble/widget/.bell
return 0
}
function ble-decode/keymap:vi_digraph/define {
ble-bind -f __defchar__ vi_digraph/defchar
ble-bind -f __default__ vi_digraph/default
ble-bind -f __line_limit__ nop
local lines; ble/util/mapfile lines < "$_ble_base/lib/keymap.vi_digraph.txt"
local line field ch1 ch2 code
for line in "${lines[@]}"; do
[[ $line == ??' '* ]] || continue
[[ $OSTYPE == msys* ]] && line=${line%$'\r'}
ch1=${line::1}
ch2=${line:1:1}
code=${line:3}
ble-bind -f "$ch1 $ch2" "vi_digraph/.proc $code"
done
}
function ble-decode/keymap:vi_digraph/initialize {
local fname_keymap_cache=$_ble_base_cache/keymap.vi_digraph
if [[ -s $fname_keymap_cache &&
$fname_keymap_cache -nt $_ble_base/lib/keymap.vi_digraph.sh &&
$fname_keymap_cache -nt $_ble_base/lib/keymap.vi_digraph.txt ]]; then
source "$fname_keymap_cache"
return 0
fi
ble/edit/info/immediate-show text "ble.sh: updating cache/keymap.vi_digraph..."
>| "$fname_keymap_cache"
ble/decode/keymap#load vi_digraph dump 3>> "$fname_keymap_cache"
ble/edit/info/immediate-show text "ble.sh: updating cache/keymap.vi_digraph... done"
}
ble-decode/keymap:vi_digraph/initialize

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,326 @@
# Copyright 2015 Koichi Murase <myoga.murase@gmail.com>. All rights reserved.
# This script is a part of blesh (https://github.com/akinomyoga/ble.sh)
# provided under the BSD-3-Clause license. Do not edit this file because this
# is not the original source code: Various pre-processing has been applied.
# Also, the code comments and blank lines are stripped off in the installation
# process. Please find the corresponding source file(s) in the repository
# "akinomyoga/ble.sh".
#
# Source: /lib/test-bash.sh
ble-import lib/core-test
ble/test/start-section 'bash' 69
(
a='x y'
ble/test code:'ret=$a' ret="x y"
ble/test '[[ $a == "x y" ]]'
ble/test 'case $a in ("x y") true ;; (*) false ;; esac'
a='x y'
ble/test code:'ret=$a' ret="x y"
ble/test '[[ $a == "x y" ]]'
ble/test 'case $a in ("x y") true ;; (*) false ;; esac'
IFS=abc a='xabcy'
ble/test code:'ret=$a' ret="xabcy"
ble/test '[[ $a == "xabcy" ]]'
ble/test 'case $a in ("xabcy") true ;; (*) false ;; esac'
IFS=$' \t\n'
a='x y'
ble/test 'read -r ret <<< $a' ret="x y"
a='x y'
if ((_ble_bash<40400)); then
ble/test 'read -r ret <<< $a' ret="x y"
else
ble/test 'read -r ret <<< $a' ret="x y"
fi
IFS=abc a='xabcy'
if ((_ble_bash<40400)); then
ble/test 'read -r ret <<< $a' ret="x y"
else
ble/test 'read -r ret <<< $a' ret="xabcy"
fi
IFS=$' \t\n'
b='/*'
ble/test code:'ret=$b' ret="/*"
ble/test 'case $b in ("/*") true ;; (*) false ;; esac'
ble/test 'read -r ret <<< $b' ret="/*"
)
(
a=("")
function f1 { ret=$1; }
if ((30100<=_ble_bash&&_ble_bash<30200)); then
ble/test 'f1 "a${a[*]}b"' ret=$'a\177b'
ble/test code:'ret="a${a[*]}b"' ret=$'a\177b'
ble/test 'case "a${a[*]}b" in ($'\''a\177b'\'') true ;; (*) false ;; esac'
ble/test 'read -r ret <<< "a${a[*]}b"' ret=$'a\177b'
else
ble/test 'f1 "a${a[*]}b"' ret='ab'
ble/test code:'ret="a${a[*]}b"' ret='ab'
ble/test 'case "a${a[*]}b" in (ab) true ;; (*) false ;; esac'
ble/test 'read -r ret <<< "a${a[*]}b"' ret=ab
fi
var=X%dX%dX
if ((_ble_bash<30200)); then
ble/test code:'ret=${var//%d/.}' ret='X%dX%dX'
else
ble/test code:'ret=${var//%d/.}' ret='X.X.X'
fi
ble/test/chdir || exit
touch {a..c}.txt
function f1 { local GLOBIGNORE='*.txt'; }
if ((_ble_bash<30200)); then
ble/test 'f1; echo *' stdout='*'
else
ble/test 'f1; echo *' stdout='a.txt b.txt c.txt'
fi
function f1 { local POSIXLY_CORRECT=y; builtin unset -v POSIXLY_CORRECT; }
set +o posix
if ((_ble_bash<30200)); then
ble/test 'f1; [[ -o posix ]]'
else
ble/test 'f1; [[ ! -o posix ]]'
fi
builtin unset -v POSIXLY_CORRECT
ble/test '[[ ! -o posix ]]'
set +o posix
function f1 { local POSIXLY_CORRECT; builtin unset -v POSIXLY_CORRECT; [[ ! -o posix ]]; }
if ((_ble_bash<40400)); then
ble/test '! f1'
else
ble/test 'f1'
fi
set +o posix
function f1/sub { true; }
if ((_ble_bash<50300)); then
ble/test 'set -o posix; f1/sub; ret=$?; set +o posix' ret=0
else
ble/test 'set -o posix; f1/sub; ret=$?; set +o posix' ret=0
fi
if ((_ble_bash<30004)); then
ble/test code:'a=あ ret=${#a}' ret=3
else
ble/test code:'a=あ ret=${#a}' ret=1
fi
builtin unset -v v
v=$'a\nb'
if ((_ble_bash<30100)); then
ble/test code:'declare -p v' stdout=$'declare -- v="a\\\nb"'
elif ((_ble_bash<50200)); then
ble/test code:'declare -p v' stdout=$'declare -- v="a\nb"'
else
ble/test code:'declare -p v' stdout='declare -- v=$'\''a\nb'\'
fi
builtin unset -v scalar
if ((_ble_bash<30100)); then
ble/test code:'ret="[${scalar-$'\''hello'\''}]"' ret="['hello']" # disable=#D1774
else
ble/test code:'ret="[${scalar-$'\''hello'\''}]"' ret='[hello]' # disable=#D1774
fi
)
(
function f1 { local -a a; local -A a; }
if ((_ble_bash<40000)); then
ble/test f1 exit=2
elif ((_ble_bash<50000)); then
ble/test '(f1)' exit=139 # SIGSEGV
else
ble/test f1 exit=1
fi
c=(a b c)
IFS=x
if ((_ble_bash<50000)); then
ble/test 'case ${c[*]} in ("a b c") true ;; (*) false ;; esac'
ble/test 'read -r ret <<< ${c[*]}' ret="a b c"
else
ble/test 'case ${c[*]} in ("axbxc") true ;; (*) false ;; esac'
ble/test 'read -r ret <<< ${c[*]}' ret="axbxc"
fi
ble/test 'case "${c[*]}" in ("axbxc") true ;; (*) false ;; esac'
ble/test 'read -r ret <<< "${c[*]}"' ret="axbxc"
IFS=$' \t\n'
c=(a b c)
ble/test code:'ret=${c[*]}' ret="a b c"
ble/test 'case ${c[*]} in ("a b c") true ;; (*) false ;; esac'
ble/test 'read -r ret <<< ${c[*]}' ret="a b c"
IFS=x
if ((_ble_bash<40300)); then
ble/test code:'ret=${c[*]}' ret="a b c"
else
ble/test code:'ret=${c[*]}' ret="axbxc"
fi
ble/test code:'ret="${c[*]}"' ret="axbxc"
IFS=$' \t\n'
builtin unset -v arr1 arr2
local arr1
local -a arr2
if ((_ble_bash<40200)); then
ble/test code:'ret=${#arr1[@]}' ret=1
else
ble/test code:'ret=${#arr1[@]}' ret=0
fi
ble/test code:'ret=${#arr2[@]}' ret=0
a=($'\x7F' $'\x01')
if ((_ble_bash<40000)); then
ble/test 'declare -p a' stdout=$'declare -a a=\'([0]="\x01\x01\x01\x7F" [1]="\x01\x01\x01\x01")\'' # '
elif ((_ble_bash<40400)); then
ble/test 'declare -p a' stdout=$'declare -a a=\'([0]="\x01\x7F" [1]="\x01\x01")\'' # '
else
ble/test 'declare -p a' stdout='declare -a a=([0]=$'\''\177'\'' [1]=$'\''\001'\'')' # disable=#D0525
fi
function f1 { local -a arr=(b b b); ble/util/print "(${arr[*]})"; }
function f2 { local -a arr=(a a a); f1; }
if ((30100<=_ble_bash&&_ble_bash<30104)); then
ble/test f2 stdout='()'
else
ble/test f2 stdout='(b b b)'
fi
if ((30100<=_ble_bash&&_ble_bash<30104)); then
ble/test 'function f1 { local -a alpha=(); local -a beta=(); }'
else
ble/test 'function f1 { local -a alpha=() beta=(); }'
fi
if ((_ble_bash<30200)); then
ble/test code:'ret=あ ret=${#ret[0]}' ret=3 # disable=#D0182
else
ble/test code:'ret=あ ret=${#ret[0]}' ret=1 # disable=#D0182
fi
declare ret=(1 2 3) # disable=#D0184
if ((_ble_bash<30100)); then
ble/test ret='(1 2 3)'
else
ble/test ret='1'
fi
declare -a ret=("1 2") # disable=#D0525
if ((_ble_bash<30100)); then
ble/test ret='1'
else
ble/test ret='1 2'
fi
v="1 2 3"
declare -a ret=("$v") # disable=#D0525
if ((_ble_bash<30100)); then
ble/test ret='1'
else
ble/test ret='1 2 3'
fi
a=(1 2 3)
IFS=x
declare -a a1=("${a[@]}") # disable=#D0525
a2=("${a[@]}") # disable=#D0525
IFS=$' \t\n'
if ((_ble_bash<30100)); then
ble/test code:'ret=$a1' ret=1x2x3
ble/test code:'ret=$a2' ret=1
else
ble/test code:'ret=$a1' ret=1
ble/test code:'ret=$a2' ret=1
fi
IFS=x
v=1x2x3
declare -a a1=($v)
a2=($v)
if ((_ble_bash<30100)); then
ble/test code:'ret=$a1' ret=1x2x3
ble/test code:'ret=$a2' ret=1
else
ble/test code:'ret=$a1' ret=1
ble/test code:'ret=$a2' ret=1
fi
v='1 2 3'
declare -a a1=($v)
a2=($v)
if ((_ble_bash<30100)); then
ble/test code:'ret=$a1' ret=1
ble/test code:'ret=$a2' ret='1 2 3'
else
ble/test code:'ret=$a1' ret='1 2 3'
ble/test code:'ret=$a2' ret='1 2 3'
fi
IFS=$' \t\n'
builtin unset -v scalar
scalar=abcd
if ((_ble_bash<30100)); then
ble/test code:'ret=${scalar[@]//[bc]}' ret='' # disable=#D1570
elif ((40300<=_ble_bash&&_ble_bash<40400)); then
ble/test code:'ret=${scalar[@]//[bc]}' ret=$'\001a\001\001\001d' # disable=#D1570
else
ble/test code:'ret=${scalar[@]//[bc]}' ret='ad' # disable=#D1570
fi
)
(
q=\' line='$'$q'\'$q'!!'$q'\'$q
code='(builtin history -s histentry; builtin history -p "$line")'
if ((_ble_bash<30100)); then
ble/test "$code" stdout=
elif ((_ble_bash<40100)) || [[ $- != *[iH]* ]]; then
ble/test "$code" stdout="${line//!!/histentry}"
else
ble/test "$code" stdout="$line"
fi
if ((_ble_bash<40100)); then
ble/test '(set -H; builtin history -c; builtin history -p "$line")' stdout= exit=1
else
ble/test '(set -H; builtin history -c; builtin history -p "$line")' stdout="$line"
fi
if [[ -d /proc/$$/fd ]] && { ((1)) >/dev/tty; } 2>/dev/null; then
(
exec 7>/dev/null 77>/dev/null # disable=#D0857
exec 7>/dev/tty 77>/dev/tty # disable=#D0857
ble/util/getpid
if ((30100<=_ble_bash&&_ble_bash<40000)); then
ble/test '[[ -t 7 ]]'
ble/test '[[ ! -t 77 ]]'
else
ble/test '[[ -t 7 ]]'
ble/test '[[ -t 77 ]]'
fi
)
fi
if [[ -d /proc/$$/fd ]] && { ((1)) >/dev/tty; } 2>/dev/null; then
(
exec 7>/dev/null 77>/dev/null # disable=#D0857
exec 7>&- 77>&- # disable=#D2164
ble/util/getpid
if ((30100<=_ble_bash&&_ble_bash<30200)); then
ble/test '[[ ! -e /proc/$BASHPID/fd/7 ]]'
ble/test '[[ -e /proc/$BASHPID/fd/77 ]]'
else
ble/test '[[ ! -e /proc/$BASHPID/fd/7 ]]'
ble/test '[[ ! -e /proc/$BASHPID/fd/77 ]]'
fi
)
fi
function f1 { ble/util/print hello; } >&"$fd1"
function f2 { ble/util/print hello >&"$fd1"; }
function f3 { { ble/util/print hello; } >&"$fd1"; }
function test1 {
local fd1=
ble/fd#alloc fd1 '>&1'
"$1" >/dev/null & local pid=$!
wait "$pid"
ble/fd#close fd1
}
if ((_ble_bash<30100)); then
ble/test 'test1 f1' stdout=
else
ble/test 'test1 f1' stdout=hello
fi
ble/test 'test1 f2' stdout=hello
ble/test 'test1 f3' stdout=hello
)
(
shopt -s expand_aliases
alias e='ble/util/print hello'
ble/test 'eval "e"' stdout=hello
ble/test 'true && eval "e"' stdout=hello
ble/test 'eval "e" & wait' stdout=hello
if [[ $- == *i* ]]; then
ble/test '(eval "e") & wait' stdout=
ble/test '{ eval "e"; } & wait' stdout=
ble/test 'true && eval "e" & wait' stdout=
else
ble/test '(eval "e") & wait' stdout=hello
ble/test '{ eval "e"; } & wait' stdout=hello
ble/test 'true && eval "e" & wait' stdout=hello
fi
builtin unalias e
)
ble/test/end-section

View file

@ -0,0 +1,639 @@
# Copyright 2015 Koichi Murase <myoga.murase@gmail.com>. All rights reserved.
# This script is a part of blesh (https://github.com/akinomyoga/ble.sh)
# provided under the BSD-3-Clause license. Do not edit this file because this
# is not the original source code: Various pre-processing has been applied.
# Also, the code comments and blank lines are stripped off in the installation
# process. Please find the corresponding source file(s) in the repository
# "akinomyoga/ble.sh".
#
# Source: /lib/test-canvas.sh
ble-import lib/core-test
_ble_test_canvas_contra=
if [[ -x ext/contra ]]; then
_ble_test_canvas_contra=ext/contra
elif [[ $(printf 'hello world' | contra test 5 2 2>/dev/null) == $' worl\nd ' ]]; then
_ble_test_canvas_contra=contra
fi
function ble/test:canvas/trace.contra {
[[ $_ble_test_canvas_contra ]] || return 0 # skip
local w=${1%%:*} h=${1#*:} esc=$2 opts=$3 test_opts=$4
local expect=$(sed 's/\$$//')
local ret x=0 y=0 g=0 rex termw=$w termh=$h
rex=':x=([^:]+):'; [[ :$test_opts: =~ $rex ]] && ((x=BASH_REMATCH[1]))
rex=':y=([^:]+):'; [[ :$test_opts: =~ $rex ]] && ((y=BASH_REMATCH[1]))
rex=':termw=([^:]+):'; [[ :$test_opts: =~ $rex ]] && ((termw=BASH_REMATCH[1]))
rex=':termh=([^:]+):'; [[ :$test_opts: =~ $rex ]] && ((termh=BASH_REMATCH[1]))
local x0=$x y0=$y
LINES=$h COLUMNS=$w ble/canvas/trace "$esc" "$opts"
local out=$ret
ble/string#quote-word "$esc"; local q_esc=$ret
ble/string#quote-word "$opts"; local q_opts=$ret
ble/test --depth=1 --display-code="trace $q_esc $q_opts" \
'{ printf "\e['$((y0+1))';'$((x0+1))'H"; ble/util/put "$out";} | "$_ble_test_canvas_contra" test "$termw" "$termh"' \
stdout="$expect"
}
ble/test/start-section 'ble/canvas/trace (relative:confine:measure-bbox)' 17
ble/test:canvas/trace.contra 10:10 'hello world this is a flow world' relative x=3:y=3:termw=20 << EOF
$
$
$
hello w $
orld this $
is a flow $
world $
$
$
$
EOF
ble/test:canvas/trace.contra 20:1 '12345678901234567890hello' confine << EOF
12345678901234567890$
EOF
ble/test:canvas/trace.contra 10:1 $'hello\nworld' confine << EOF
helloworld$
EOF
ble/test:canvas/trace.contra 10:2 $'hello\nworld check' confine << EOF
hello $
world chec$
EOF
ble/test:canvas/trace.contra 10:6 $'hello\e[B\e[4D123' measure-bbox x=3:y=2 << EOF
$
$
hello $
123 $
$
$
EOF
[[ $_ble_test_canvas_contra ]] &&
ble/test 'echo "$x1-$x2:$y1-$y2"' stdout='3-8:2-4'
ble/test:canvas/trace.contra 10:2 日本語 measure-bbox << EOF
日本語 $
$
EOF
[[ $_ble_test_canvas_contra ]] &&
ble/test 'echo "$x1-$x2:$y1-$y2"' stdout='0-6:0-1'
ble/test:canvas/trace.contra 10:2 $'hello\eDworld' measure-bbox << EOF
hello $
world$
EOF
[[ $_ble_test_canvas_contra ]] &&
ble/test 'echo "$x1-$x2:$y1-$y2"' stdout='0-10:0-2'
ble/test:canvas/trace.contra 10:2 $'hello\eMworld' measure-bbox << EOF
world$
hello $
EOF
[[ $_ble_test_canvas_contra ]] &&
ble/test 'echo "$x1-$x2:$y1-$y2"' stdout='0-10:-1-1'
(
LINES=10 COLUMNS=10 _ble_term_xenl=1
ble/test 'x=0 y=0; ble/canvas/trace "HelloWorld"; ret=$x,$y' ret=10,0
ble/test 'x=0 y=0; ble/canvas/trace "HelloWorldH"; ret=$x,$y' ret=1,1
ble/test 'x=0 y=0; ble/canvas/trace "HelloWorldHello"; ret=$x,$y' ret=5,1
ble/test 'x=0 y=0; ble/canvas/trace "HelloWorldHelloWorldHello"; ret=$x,$y' ret=5,2
ble/test 'x=0 y=0; ble/canvas/trace "HelloWorldHelloWorldHelloWorldHello"; ret=$x,$y' ret=5,3
)
ble/test/start-section 'ble/canvas/trace (cfuncs)' 18
function ble/test:canvas/check-trace-1 {
local input=$1 ex=$2 ey=$3
ble/canvas/trace.draw "$input"
ble/test --depth=1 '((x==ex&&y==ey))'
}
function ble/test:canvas/check-trace {
local -a DRAW_BUFF=()
ble/canvas/put.draw "$_ble_term_clear"
local x=0 y=0
ble/test:canvas/check-trace-1 "abc" 3 0
ble/test:canvas/check-trace-1 $'\n\n\nn' 1 3
ble/test:canvas/check-trace-1 $'\e[3BB' 2 6
ble/test:canvas/check-trace-1 $'\e[2AA' 3 4
ble/test:canvas/check-trace-1 $'\e[20CC' 24 4
ble/test:canvas/check-trace-1 $'\e[8DD' 17 4
ble/test:canvas/check-trace-1 $'\e[9EE' 1 13
ble/test:canvas/check-trace-1 $'\e[6FF' 1 7
ble/test:canvas/check-trace-1 $'\e[28GG' 28 7
ble/test:canvas/check-trace-1 $'\e[II' 33 7
ble/test:canvas/check-trace-1 $'\e[3ZZ' 17 7
ble/test:canvas/check-trace-1 $'\eDD' 18 8
ble/test:canvas/check-trace-1 $'\eMM' 19 7
ble/test:canvas/check-trace-1 $'\e77\e[3;3Hexcur\e8\e[C8' 21 7
ble/test:canvas/check-trace-1 $'\eEE' 1 8
ble/test:canvas/check-trace-1 $'\e[10;24HH' 24 9
ble/test:canvas/check-trace-1 $'\e[1;94mb\e[m' 25 9
local expect=$(sed 's/\$$//' << EOF
abc $
$
excur $
n $
A D C $
$
B $
F Z M78 G I $
E D $
Hb $
$
$
$
E $
$
EOF
)
[[ $_ble_test_canvas_contra ]] &&
ble/test --depth=1 \
'ble/canvas/flush.draw | $_ble_test_canvas_contra test 40 15' \
stdout="$expect"
}
ble/test:canvas/check-trace
ble/test/start-section 'ble/canvas/trace (justify)' 30
ble/test:canvas/trace.contra 30:1 'a b c' justify << EOF
a b c$
EOF
ble/test:canvas/trace.contra 30:1 ' center ' justify << EOF
center $
EOF
ble/test:canvas/trace.contra 30:1 ' right-aligned' justify << EOF
right-aligned$
EOF
ble/test:canvas/trace.contra 30:1 'left-aligned' justify << EOF
left-aligned $
EOF
ble/test:canvas/trace.contra 30:1 ' 日本語' justify << EOF
日本語$
EOF
ble/test:canvas/trace.contra 30:1 'a b c d e f' justify << EOF
a b c d e f$
EOF
ble/test:canvas/trace.contra 30:2 $'hello center world\na b c d e f' justify << EOF
hello center world$
a b c d e f$
EOF
ble/test:canvas/trace.contra 30:3 'A brown fox jumped over the lazy dog. A brown fox jumped over the lazy dog.' justify << EOF
A brown fox jumped over the la$
zy dog. A brown fox jumped ove$
r the lazy dog.$
EOF
ble/test:canvas/trace.contra 30:2 $'hello blesh world\rHELLO WORLD\nhello world HELLO BLESH WORLD' justify=$' \r' << EOF
hello blesh worldHELLO WORLD$
hello world HELLO BLESH WORLD$
EOF
COLUMNS=10 LINES=10 x=3 y=2 ble/canvas/trace $'a b c\n' justify:measure-bbox
ble/test 'echo "$x1,$y1:$x2,$y2"' stdout:'0,2:10,4'
COLUMNS=10 LINES=10 x=3 y=2 ble/canvas/trace $' hello ' justify:measure-bbox
ble/test 'echo "$x1,$y1:$x2,$y2"' stdout:'2,2:7,3'
ble/test:canvas/trace.contra 30:1 $'\e[3Dhello\rblesh\rworld\e[1D' justify=$'\r' x=5 << EOF
hello blesh world$
EOF
ble/test:canvas/trace.contra \
30:5 $'hello world\nfoo bar buzz\nA quick brown fox\nLorem ipsum\n1 1 2 3 5 8 13 21 34 55 89 144' \
justify:clip=2,1+24,5 << EOF
o bar $
quick brown $
rem i $
1 2 3 5 8 13 21 34 55 89 $
$
EOF
ble/test:canvas/trace.contra 30:1 $'hello1 world long long word quick brown' justify:confine << EOF
hello1 world long long word qu$
EOF
ble/test:canvas/trace.contra 30:1 $'hello2 world long long word quick brown' justify:truncate << EOF
hello2 world long long word qu$
EOF
ble/test:canvas/trace.contra 60:2 $'-- INSERT --\r/home/murase\r2021-01-01 00:00:00' justify << EOF
-- INSERT 2021-01-01 00:00:00$
$
EOF
ble/test:canvas/trace.contra 30:3 $'hello\r\vquick check\v\rtest \e[2Afoo\r\vbar' justify:truncate << EOF
hello foo$
quick check bar$
test $
EOF
ble/test:canvas/trace.contra 30:3 $'hello\n2021-01-01\nA' right:measure-bbox:measure-gbox << EOF
hello$
2021-01-01$
A$
EOF
if [[ $_ble_test_canvas_contra ]]; then
ble/test 'echo "bbox:$x1,$y1-$x2,$y2"' stdout='bbox:0,0-30,3'
ble/test 'echo "gbox:$gx1,$gy1-$gx2,$gy2"' stdout='gbox:20,0-30,3'
fi
ble/test:canvas/trace.contra 30:3 $'hello\n2021-01-01\nA' center:measure-bbox:measure-gbox << EOF
hello $
2021-01-01 $
A $
EOF
if [[ $_ble_test_canvas_contra ]]; then
ble/test 'echo "bbox:$x1,$y1-$x2,$y2"' stdout='bbox:0,0-20,3'
ble/test 'echo "gbox:$gx1,$gy1-$gx2,$gy2"' stdout='gbox:10,0-20,3'
fi
ble/test:canvas/trace.contra 10:1 $'xyz\e[4Daxyz' relative:measure-bbox x=3 << EOF
axyz $
EOF
if [[ $_ble_test_canvas_contra ]]; then
ble/test 'echo "bbox:$x1,$y1-$x2,$y2"' stdout='bbox:2,0-6,1'
fi
ble/test:canvas/trace.contra 30:3 $'\n2022-11-28' right:measure-bbox:measure-gbox << EOF
$
2022-11-28$
$
EOF
if [[ $_ble_test_canvas_contra ]]; then
ble/test 'echo "bbox:$x1,$y1-$x2,$y2"' stdout='bbox:0,0-30,2'
ble/test 'echo "gbox:$gx1,$gy1-$gx2,$gy2"' stdout='gbox:20,1-30,2'
fi
ble/test:canvas/trace.contra 30:3 $'\n\n2022-11-28' right:measure-bbox:measure-gbox << EOF
$
$
2022-11-28$
EOF
if [[ $_ble_test_canvas_contra ]]; then
ble/test 'echo "bbox:$x1,$y1-$x2,$y2"' stdout='bbox:0,0-30,3'
ble/test 'echo "gbox:$gx1,$gy1-$gx2,$gy2"' stdout='gbox:20,2-30,3'
fi
ble/test/start-section 'ble/canvas/trace-text' 11
(
sgr0= sgr1=
lines=1 cols=10 _ble_term_xenl=1 x=0 y=0
ble/test 'ble/canvas/trace-text "Hello World";ret="$x,$y,$ret"' ret='10,0,Hello Worl'
lines=1 cols=10 _ble_term_xenl= x=0 y=0
ble/test 'ble/canvas/trace-text "Hello World";ret="$x,$y,$ret"' ret='9,0,Hello Wor'
lines=1 cols=10 _ble_term_xenl=1 x=3 y=0
ble/test 'ble/canvas/trace-text "Hello World";ret="$x,$y,$ret"' ret='10,0,Hello W'
lines=3 cols=10 _ble_term_xenl=1 x=3 y=0
ble/test 'ble/canvas/trace-text "Hello Bash World";ret="$x,$y,$ret"' ret='9,1,Hello Bash World'
lines=3 cols=10 _ble_term_xenl=1 x=3 y=0
ble/test 'ble/canvas/trace-text "これは日本語の文章";ret="$x,$y,$ret"' ret=$'2,2,これは\n日本語の文章'
lines=3 cols=10 _ble_term_xenl=1 x=3 y=0
ble/test 'ble/canvas/trace-text "これは日本語の文章" nonewline;ret="$x,$y,$ret"' ret='2,2,これは 日本語の文章'
lines=3 cols=10 _ble_term_xenl=1 x=0 y=0
ble/test 'ble/canvas/trace-text "これは日本";ret="$x,$y,$ret"' ret=$'0,1,これは日本\n'
lines=3 cols=10 _ble_term_xenl=0 x=0 y=0
ble/test 'ble/canvas/trace-text "これは日本";ret="$x,$y,$ret"' ret=$'0,1,これは日本'
lines=3 cols=10 _ble_term_xenl=1 x=0 y=0
ble/test 'ble/canvas/trace-text "これは日本" nonewline;ret="$x,$y,$ret"' ret=$'10,0,これは日本'
lines=3 cols=10 _ble_term_xenl=0 x=0 y=0
ble/test 'ble/canvas/trace-text "これは日本" nonewline;ret="$x,$y,$ret"' ret=$'0,1,これは日本'
lines=1 cols=12 _ble_term_xenl=1 x=0 y=0
ble/test $'ble/canvas/trace-text "あ\nい\nう" external-sgr;ret="$x,$y,$ret"' ret=$'10,0,あ^Jい^Jう'
)
ble/test/end-section
ble/test/start-section 'ble/canvas/textmap' 5
function ble/test:canvas/textmap {
local text=$1
x=0 y=0
_ble_textmap_length=
_ble_textmap_pos=()
_ble_textmap_glyph=()
_ble_textmap_ichg=()
_ble_textmap_dbeg=0
_ble_textmap_dend=${#text}
_ble_textmap_dend0=0
ble/textmap#update "$text"
[[ :$opts: == *:stderr:* ]] &&
declare -p _ble_textmap_pos >&2
}
(
ble/test:canvas/textmap $'hello\nworld\ncheck'
ble/test 'ble/textmap#getxy.out 5; ret=$x,$y' ret='5,0'
ble/test 'ble/textmap#getxy.out 6; ret=$x,$y' ret='0,1'
ble/test 'ble/textmap#getxy.out 11; ret=$x,$y' ret='5,1'
ble/test 'ble/textmap#getxy.out 12; ret=$x,$y' ret='0,2'
ble/test 'ble/textmap#getxy.out 17; ret=$x,$y' ret='5,2'
)
ble/test/start-section 'ble/canvas/GraphemeCluster/c2break' 77
if (LC_ALL=C.UTF-8 builtin eval "s=\$'\\U1F6D1'"; ((${#s}==2))) 2>/dev/null; then
function ble/test:canvas/GraphemeCluster/.locate-code-point {
local s=$1 k=$2 len=${#1} i=0 shift
while ((k-->=1&&i<len)); do
ble/unicode/GraphemeCluster/s2break-right "$s" "$i" shift
((i+=shift))
done
ret=$i
}
else
function ble/test:canvas/GraphemeCluster/.locate-code-point {
ret=$2
}
fi
(
bleopt grapheme_cluster=extended
_ble_unicode_GraphemeClusterBreak_custom=()
bleopt emoji_opts=ri:tpvs:epvs:zwj
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0x20))"' ret="$_ble_unicode_GraphemeClusterBreak_Other"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0x41))"' ret="$_ble_unicode_GraphemeClusterBreak_Other"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0x7E))"' ret="$_ble_unicode_GraphemeClusterBreak_Other"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0x00))"' ret="$_ble_unicode_GraphemeClusterBreak_Control"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0x0d))"' ret="$_ble_unicode_GraphemeClusterBreak_Control"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0x0a))"' ret="$_ble_unicode_GraphemeClusterBreak_Control"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0x1F))"' ret="$_ble_unicode_GraphemeClusterBreak_Control"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0x80))"' ret="$_ble_unicode_GraphemeClusterBreak_Control"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0x9F))"' ret="$_ble_unicode_GraphemeClusterBreak_Control"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0x0308))"' ret="$_ble_unicode_GraphemeClusterBreak_InCB_Extend"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0x200C))"' ret="$_ble_unicode_GraphemeClusterBreak_Extend" # ZWNJ
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0x200D))"' ret="$_ble_unicode_GraphemeClusterBreak_ZWJ" # ZWJ
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0x0600))"' ret="$_ble_unicode_GraphemeClusterBreak_Prepend"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0x0605))"' ret="$_ble_unicode_GraphemeClusterBreak_Prepend"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0x06DD))"' ret="$_ble_unicode_GraphemeClusterBreak_Prepend"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0x110BD))"' ret="$_ble_unicode_GraphemeClusterBreak_Prepend"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0xE33))"' ret="$_ble_unicode_GraphemeClusterBreak_SpacingMark" # THAI CHARACTER SARA AM
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0xEB3))"' ret="$_ble_unicode_GraphemeClusterBreak_SpacingMark" # LAO VOWEL SIGN AM
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0x1100))"' ret="$_ble_unicode_GraphemeClusterBreak_L"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0x115F))"' ret="$_ble_unicode_GraphemeClusterBreak_L"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0xA960))"' ret="$_ble_unicode_GraphemeClusterBreak_L"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0xA97C))"' ret="$_ble_unicode_GraphemeClusterBreak_L"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0x1160))"' ret="$_ble_unicode_GraphemeClusterBreak_V"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0x11A2))"' ret="$_ble_unicode_GraphemeClusterBreak_V"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0xD7B0))"' ret="$_ble_unicode_GraphemeClusterBreak_V"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0xD7C6))"' ret="$_ble_unicode_GraphemeClusterBreak_V"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0x11A8))"' ret="$_ble_unicode_GraphemeClusterBreak_T"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0x11F9))"' ret="$_ble_unicode_GraphemeClusterBreak_T"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0xD7CB))"' ret="$_ble_unicode_GraphemeClusterBreak_T"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0xD7FB))"' ret="$_ble_unicode_GraphemeClusterBreak_T"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0xAC00))"' ret="$_ble_unicode_GraphemeClusterBreak_LV"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0xAC1C))"' ret="$_ble_unicode_GraphemeClusterBreak_LV"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0xAC38))"' ret="$_ble_unicode_GraphemeClusterBreak_LV"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0xAC01))"' ret="$_ble_unicode_GraphemeClusterBreak_LVT"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0xAC04))"' ret="$_ble_unicode_GraphemeClusterBreak_LVT"
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0x1F1E6))"' ret="$_ble_unicode_GraphemeClusterBreak_Regional_Indicator" # RI A
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0x1F1FF))"' ret="$_ble_unicode_GraphemeClusterBreak_Regional_Indicator" # RI Z
ble/test 'ble/unicode/GraphemeCluster/c2break "$((0x1F32B))"' ret="$_ble_unicode_GraphemeClusterBreak_Pictographic"
if ((_ble_bash>=40200)); then
function ble/test:canvas/GraphemeClusterBreak/find-previous-boundary {
local str=$1 index=$2 ans=$3 ret=
ble/test:canvas/GraphemeCluster/.locate-code-point "$str." "$index"; index=$ret
ble/test:canvas/GraphemeCluster/.locate-code-point "$str" "$ans"; ans=$ret
ble/test "ble/unicode/GraphemeCluster/find-previous-boundary '$str' $index" ret="$ans"
}
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'\U1F1E6\U1F1FF\U1F1E6\U1F1FF' 1 0
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'\U1F1E6\U1F1FF\U1F1E6\U1F1FF' 2 0
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'\U1F1E6\U1F1FF\U1F1E6\U1F1FF' 3 2
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'\U1F1E6\U1F1FF\U1F1E6\U1F1FF' 4 2
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'\U1F1E6\U1F1FF\U1F1E6\U1F1FF' 5 4
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'A\U1F1E6\U1F1FF\U1F1E6\U1F1FF\U1F1E6' 2 1
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'B\U1F1E6\U1F1FF\U1F1E6\U1F1FF\U1F1E6' 3 1
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'C\U1F1E6\U1F1FF\U1F1E6\U1F1FF\U1F1E6' 4 3
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'D\U1F1E6\U1F1FF\U1F1E6\U1F1FF\U1F1E6' 5 3
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'E\U1F1E6\U1F1FF\U1F1E6\U1F1FF\U1F1E6' 6 5
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'F\U1F1E6\U1F1FF\U1F1E6\U1F1FF\U1F1E6' 7 6
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'G\U1F1E6\U1F1FF\U1F1E6\U1F1FF\U1F1E6Z' 7 6
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'H\u600\u600\u600\u600\U1F1E6\U1F1FF' 7 1
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'I\u600\u600\u600\u600\U1F1E6\U1F1FF' 6 1
bleopt_grapheme_cluster=legacy ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'J\u600\u600\u600\u600\U1F1E6\U1F1FF' 7 5
bleopt_grapheme_cluster=legacy ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'K\u600\u600\u600\u600\U1F1E6\U1F1FF' 6 5
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'\U1F636\U200D\U1F32B\UFE0F' 1 0
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'\U1F636\U200D\U1F32B\UFE0F' 2 0
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'\U1F636\U200D\U1F32B\UFE0F' 3 0
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'\U1F636\U200D\U1F32B\UFE0F' 4 0
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'\U1F636\U200D\U1F32B\UFE0F' 5 4
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'a\U1F636\U200D\U1F32B\UFE0F' 2 1
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'b\U1F636\U200D\U1F32B\UFE0F' 3 1
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'c\U1F636\U200D\U1F32B\UFE0F' 4 1
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'d\U1F636\U200D\U1F32B\UFE0F' 5 1
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'e\U1F636\U200D\U1F32B\UFE0F' 6 5
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'f\U200D\U1F32B\UFE0F' 2 0
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'g\U200D\U1F32B\UFE0F' 3 2
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'h\U200D\U1F32B\UFE0F' 4 2
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary $'i\U200D\U1F32B\UFE0F' 5 4
ble/test "ble/test:canvas/textmap \$'@@' stderr; ble/textmap#get-index-at -v ret 1 0" ret=1
ble/test "ble/test:canvas/textmap \$'@\u0308@' stderr; ble/textmap#get-index-at -v ret 1 0" ret=2
ble/test "ble/test:canvas/textmap \$'@\u0308\u0308@' stderr; ble/textmap#get-index-at -v ret 1 0" ret=3
ble/test "ble/test:canvas/textmap \$'@\u0308\u0308\u0308@' stderr; ble/textmap#get-index-at -v ret 1 0" ret=4
ble/test 'ble/util/is-unicode-output'
c1=$'\uFE0F'
ble/test code:'code=; ble/unicode/GraphemeCluster/s2break-right "$c1" 0 code; ret=$code' ret="$((0xFE0F))"
ble/test code:'code=; ble/unicode/GraphemeCluster/s2break-left "$c1" "${#c1}" code; ret=$code' ret="$((0xFE0F))"
c2=$'\U1F6D1'
ble/test code:'code=; ble/unicode/GraphemeCluster/s2break-right "$c2" 0 code; ret=$code' ret="$((0x1F6D1))"
ble/test code:'code=; ble/unicode/GraphemeCluster/s2break-left "$c2" "${#c2}" code; ret=$code' ret="$((0x1F6D1))"
fi
)
ble/test/start-section 'ble/canvas/GraphemeCluster/c2break (GraphemeBreakTest.txt)' 6244
(
bleopt grapheme_cluster=extended
_ble_unicode_c2w_version=17 # Test cases contain 15.1.0 features
_ble_unicode_GraphemeClusterBreak_custom=()
bleopt emoji_opts=ri:tpvs:epvs:zwj
tests_cases=(
0,1,2:'\U0020\U0020' 0,0,2,3:'\U0020\U0308\U0020' 0,1,2:'\U0020\U000D' 0,0,2,3:'\U0020\U0308\U000D' 0,1,2:'\U0020\U000A' 0,0,2,3:'\U0020\U0308\U000A'
0,1,2:'\U0020\U0001' 0,0,2,3:'\U0020\U0308\U0001' 0,0,2:'\U0020\U034F' 0,0,0,3:'\U0020\U0308\U034F' 0,1,2:'\U0020\U1F1E6' 0,0,2,3:'\U0020\U0308\U1F1E6'
0,1,2:'\U0020\U0600' 0,0,2,3:'\U0020\U0308\U0600' 0,0,2:'\U0020\U0A03' 0,0,0,3:'\U0020\U0308\U0A03' 0,1,2:'\U0020\U1100' 0,0,2,3:'\U0020\U0308\U1100'
0,1,2:'\U0020\U1160' 0,0,2,3:'\U0020\U0308\U1160' 0,1,2:'\U0020\U11A8' 0,0,2,3:'\U0020\U0308\U11A8' 0,1,2:'\U0020\UAC00' 0,0,2,3:'\U0020\U0308\UAC00'
0,1,2:'\U0020\UAC01' 0,0,2,3:'\U0020\U0308\UAC01' 0,0,2:'\U0020\U0900' 0,0,0,3:'\U0020\U0308\U0900' 0,0,2:'\U0020\U0903' 0,0,0,3:'\U0020\U0308\U0903'
0,1,2:'\U0020\U0904' 0,0,2,3:'\U0020\U0308\U0904' 0,1,2:'\U0020\U0D4E' 0,0,2,3:'\U0020\U0308\U0D4E' 0,1,2:'\U0020\U0915' 0,0,2,3:'\U0020\U0308\U0915'
0,1,2:'\U0020\U231A' 0,0,2,3:'\U0020\U0308\U231A' 0,0,2:'\U0020\U0300' 0,0,0,3:'\U0020\U0308\U0300' 0,0,2:'\U0020\U093C' 0,0,0,3:'\U0020\U0308\U093C'
0,0,2:'\U0020\U094D' 0,0,0,3:'\U0020\U0308\U094D' 0,0,2:'\U0020\U200D' 0,0,0,3:'\U0020\U0308\U200D' 0,1,2:'\U0020\U0378' 0,0,2,3:'\U0020\U0308\U0378'
0,1,2:'\U000D\U0020' 0,1,2,3:'\U000D\U0308\U0020' 0,1,2:'\U000D\U000D' 0,1,2,3:'\U000D\U0308\U000D' 0,1,2:'\U000D\U000A' 0,1,2,3:'\U000D\U0308\U000A'
0,1,2:'\U000D\U0001' 0,1,2,3:'\U000D\U0308\U0001' 0,1,2:'\U000D\U034F' 0,1,1,3:'\U000D\U0308\U034F' 0,1,2:'\U000D\U1F1E6' 0,1,2,3:'\U000D\U0308\U1F1E6'
0,1,2:'\U000D\U0600' 0,1,2,3:'\U000D\U0308\U0600' 0,1,2:'\U000D\U0A03' 0,1,1,3:'\U000D\U0308\U0A03' 0,1,2:'\U000D\U1100' 0,1,2,3:'\U000D\U0308\U1100'
0,1,2:'\U000D\U1160' 0,1,2,3:'\U000D\U0308\U1160' 0,1,2:'\U000D\U11A8' 0,1,2,3:'\U000D\U0308\U11A8' 0,1,2:'\U000D\UAC00' 0,1,2,3:'\U000D\U0308\UAC00'
0,1,2:'\U000D\UAC01' 0,1,2,3:'\U000D\U0308\UAC01' 0,1,2:'\U000D\U0900' 0,1,1,3:'\U000D\U0308\U0900' 0,1,2:'\U000D\U0903' 0,1,1,3:'\U000D\U0308\U0903'
0,1,2:'\U000D\U0904' 0,1,2,3:'\U000D\U0308\U0904' 0,1,2:'\U000D\U0D4E' 0,1,2,3:'\U000D\U0308\U0D4E' 0,1,2:'\U000D\U0915' 0,1,2,3:'\U000D\U0308\U0915'
0,1,2:'\U000D\U231A' 0,1,2,3:'\U000D\U0308\U231A' 0,1,2:'\U000D\U0300' 0,1,1,3:'\U000D\U0308\U0300' 0,1,2:'\U000D\U093C' 0,1,1,3:'\U000D\U0308\U093C'
0,1,2:'\U000D\U094D' 0,1,1,3:'\U000D\U0308\U094D' 0,1,2:'\U000D\U200D' 0,1,1,3:'\U000D\U0308\U200D' 0,1,2:'\U000D\U0378' 0,1,2,3:'\U000D\U0308\U0378'
0,1,2:'\U000A\U0020' 0,1,2,3:'\U000A\U0308\U0020' 0,1,2:'\U000A\U000D' 0,1,2,3:'\U000A\U0308\U000D' 0,1,2:'\U000A\U000A' 0,1,2,3:'\U000A\U0308\U000A'
0,1,2:'\U000A\U0001' 0,1,2,3:'\U000A\U0308\U0001' 0,1,2:'\U000A\U034F' 0,1,1,3:'\U000A\U0308\U034F' 0,1,2:'\U000A\U1F1E6' 0,1,2,3:'\U000A\U0308\U1F1E6'
0,1,2:'\U000A\U0600' 0,1,2,3:'\U000A\U0308\U0600' 0,1,2:'\U000A\U0A03' 0,1,1,3:'\U000A\U0308\U0A03' 0,1,2:'\U000A\U1100' 0,1,2,3:'\U000A\U0308\U1100'
0,1,2:'\U000A\U1160' 0,1,2,3:'\U000A\U0308\U1160' 0,1,2:'\U000A\U11A8' 0,1,2,3:'\U000A\U0308\U11A8' 0,1,2:'\U000A\UAC00' 0,1,2,3:'\U000A\U0308\UAC00'
0,1,2:'\U000A\UAC01' 0,1,2,3:'\U000A\U0308\UAC01' 0,1,2:'\U000A\U0900' 0,1,1,3:'\U000A\U0308\U0900' 0,1,2:'\U000A\U0903' 0,1,1,3:'\U000A\U0308\U0903'
0,1,2:'\U000A\U0904' 0,1,2,3:'\U000A\U0308\U0904' 0,1,2:'\U000A\U0D4E' 0,1,2,3:'\U000A\U0308\U0D4E' 0,1,2:'\U000A\U0915' 0,1,2,3:'\U000A\U0308\U0915'
0,1,2:'\U000A\U231A' 0,1,2,3:'\U000A\U0308\U231A' 0,1,2:'\U000A\U0300' 0,1,1,3:'\U000A\U0308\U0300' 0,1,2:'\U000A\U093C' 0,1,1,3:'\U000A\U0308\U093C'
0,1,2:'\U000A\U094D' 0,1,1,3:'\U000A\U0308\U094D' 0,1,2:'\U000A\U200D' 0,1,1,3:'\U000A\U0308\U200D' 0,1,2:'\U000A\U0378' 0,1,2,3:'\U000A\U0308\U0378'
0,1,2:'\U0001\U0020' 0,1,2,3:'\U0001\U0308\U0020' 0,1,2:'\U0001\U000D' 0,1,2,3:'\U0001\U0308\U000D' 0,1,2:'\U0001\U000A' 0,1,2,3:'\U0001\U0308\U000A'
0,1,2:'\U0001\U0001' 0,1,2,3:'\U0001\U0308\U0001' 0,1,2:'\U0001\U034F' 0,1,1,3:'\U0001\U0308\U034F' 0,1,2:'\U0001\U1F1E6' 0,1,2,3:'\U0001\U0308\U1F1E6'
0,1,2:'\U0001\U0600' 0,1,2,3:'\U0001\U0308\U0600' 0,1,2:'\U0001\U0A03' 0,1,1,3:'\U0001\U0308\U0A03' 0,1,2:'\U0001\U1100' 0,1,2,3:'\U0001\U0308\U1100'
0,1,2:'\U0001\U1160' 0,1,2,3:'\U0001\U0308\U1160' 0,1,2:'\U0001\U11A8' 0,1,2,3:'\U0001\U0308\U11A8' 0,1,2:'\U0001\UAC00' 0,1,2,3:'\U0001\U0308\UAC00'
0,1,2:'\U0001\UAC01' 0,1,2,3:'\U0001\U0308\UAC01' 0,1,2:'\U0001\U0900' 0,1,1,3:'\U0001\U0308\U0900' 0,1,2:'\U0001\U0903' 0,1,1,3:'\U0001\U0308\U0903'
0,1,2:'\U0001\U0904' 0,1,2,3:'\U0001\U0308\U0904' 0,1,2:'\U0001\U0D4E' 0,1,2,3:'\U0001\U0308\U0D4E' 0,1,2:'\U0001\U0915' 0,1,2,3:'\U0001\U0308\U0915'
0,1,2:'\U0001\U231A' 0,1,2,3:'\U0001\U0308\U231A' 0,1,2:'\U0001\U0300' 0,1,1,3:'\U0001\U0308\U0300' 0,1,2:'\U0001\U093C' 0,1,1,3:'\U0001\U0308\U093C'
0,1,2:'\U0001\U094D' 0,1,1,3:'\U0001\U0308\U094D' 0,1,2:'\U0001\U200D' 0,1,1,3:'\U0001\U0308\U200D' 0,1,2:'\U0001\U0378' 0,1,2,3:'\U0001\U0308\U0378'
0,1,2:'\U034F\U0020' 0,0,2,3:'\U034F\U0308\U0020' 0,1,2:'\U034F\U000D' 0,0,2,3:'\U034F\U0308\U000D' 0,1,2:'\U034F\U000A' 0,0,2,3:'\U034F\U0308\U000A'
0,1,2:'\U034F\U0001' 0,0,2,3:'\U034F\U0308\U0001' 0,0,2:'\U034F\U034F' 0,0,0,3:'\U034F\U0308\U034F' 0,1,2:'\U034F\U1F1E6' 0,0,2,3:'\U034F\U0308\U1F1E6'
0,1,2:'\U034F\U0600' 0,0,2,3:'\U034F\U0308\U0600' 0,0,2:'\U034F\U0A03' 0,0,0,3:'\U034F\U0308\U0A03' 0,1,2:'\U034F\U1100' 0,0,2,3:'\U034F\U0308\U1100'
0,1,2:'\U034F\U1160' 0,0,2,3:'\U034F\U0308\U1160' 0,1,2:'\U034F\U11A8' 0,0,2,3:'\U034F\U0308\U11A8' 0,1,2:'\U034F\UAC00' 0,0,2,3:'\U034F\U0308\UAC00'
0,1,2:'\U034F\UAC01' 0,0,2,3:'\U034F\U0308\UAC01' 0,0,2:'\U034F\U0900' 0,0,0,3:'\U034F\U0308\U0900' 0,0,2:'\U034F\U0903' 0,0,0,3:'\U034F\U0308\U0903'
0,1,2:'\U034F\U0904' 0,0,2,3:'\U034F\U0308\U0904' 0,1,2:'\U034F\U0D4E' 0,0,2,3:'\U034F\U0308\U0D4E' 0,1,2:'\U034F\U0915' 0,0,2,3:'\U034F\U0308\U0915'
0,1,2:'\U034F\U231A' 0,0,2,3:'\U034F\U0308\U231A' 0,0,2:'\U034F\U0300' 0,0,0,3:'\U034F\U0308\U0300' 0,0,2:'\U034F\U093C' 0,0,0,3:'\U034F\U0308\U093C'
0,0,2:'\U034F\U094D' 0,0,0,3:'\U034F\U0308\U094D' 0,0,2:'\U034F\U200D' 0,0,0,3:'\U034F\U0308\U200D' 0,1,2:'\U034F\U0378' 0,0,2,3:'\U034F\U0308\U0378'
0,1,2:'\U1F1E6\U0020' 0,0,2,3:'\U1F1E6\U0308\U0020' 0,1,2:'\U1F1E6\U000D' 0,0,2,3:'\U1F1E6\U0308\U000D' 0,1,2:'\U1F1E6\U000A' 0,0,2,3:'\U1F1E6\U0308\U000A'
0,1,2:'\U1F1E6\U0001' 0,0,2,3:'\U1F1E6\U0308\U0001' 0,0,2:'\U1F1E6\U034F' 0,0,0,3:'\U1F1E6\U0308\U034F' 0,0,2:'\U1F1E6\U1F1E6'
0,0,2,3:'\U1F1E6\U0308\U1F1E6' 0,1,2:'\U1F1E6\U0600' 0,0,2,3:'\U1F1E6\U0308\U0600' 0,0,2:'\U1F1E6\U0A03' 0,0,0,3:'\U1F1E6\U0308\U0A03'
0,1,2:'\U1F1E6\U1100' 0,0,2,3:'\U1F1E6\U0308\U1100' 0,1,2:'\U1F1E6\U1160' 0,0,2,3:'\U1F1E6\U0308\U1160' 0,1,2:'\U1F1E6\U11A8' 0,0,2,3:'\U1F1E6\U0308\U11A8'
0,1,2:'\U1F1E6\UAC00' 0,0,2,3:'\U1F1E6\U0308\UAC00' 0,1,2:'\U1F1E6\UAC01' 0,0,2,3:'\U1F1E6\U0308\UAC01' 0,0,2:'\U1F1E6\U0900' 0,0,0,3:'\U1F1E6\U0308\U0900'
0,0,2:'\U1F1E6\U0903' 0,0,0,3:'\U1F1E6\U0308\U0903' 0,1,2:'\U1F1E6\U0904' 0,0,2,3:'\U1F1E6\U0308\U0904' 0,1,2:'\U1F1E6\U0D4E' 0,0,2,3:'\U1F1E6\U0308\U0D4E'
0,1,2:'\U1F1E6\U0915' 0,0,2,3:'\U1F1E6\U0308\U0915' 0,1,2:'\U1F1E6\U231A' 0,0,2,3:'\U1F1E6\U0308\U231A' 0,0,2:'\U1F1E6\U0300' 0,0,0,3:'\U1F1E6\U0308\U0300'
0,0,2:'\U1F1E6\U093C' 0,0,0,3:'\U1F1E6\U0308\U093C' 0,0,2:'\U1F1E6\U094D' 0,0,0,3:'\U1F1E6\U0308\U094D' 0,0,2:'\U1F1E6\U200D' 0,0,0,3:'\U1F1E6\U0308\U200D'
0,1,2:'\U1F1E6\U0378' 0,0,2,3:'\U1F1E6\U0308\U0378' 0,0,2:'\U0600\U0020' 0,0,2,3:'\U0600\U0308\U0020' 0,1,2:'\U0600\U000D' 0,0,2,3:'\U0600\U0308\U000D'
0,1,2:'\U0600\U000A' 0,0,2,3:'\U0600\U0308\U000A' 0,1,2:'\U0600\U0001' 0,0,2,3:'\U0600\U0308\U0001' 0,0,2:'\U0600\U034F' 0,0,0,3:'\U0600\U0308\U034F'
0,0,2:'\U0600\U1F1E6' 0,0,2,3:'\U0600\U0308\U1F1E6' 0,0,2:'\U0600\U0600' 0,0,2,3:'\U0600\U0308\U0600' 0,0,2:'\U0600\U0A03' 0,0,0,3:'\U0600\U0308\U0A03'
0,0,2:'\U0600\U1100' 0,0,2,3:'\U0600\U0308\U1100' 0,0,2:'\U0600\U1160' 0,0,2,3:'\U0600\U0308\U1160' 0,0,2:'\U0600\U11A8' 0,0,2,3:'\U0600\U0308\U11A8'
0,0,2:'\U0600\UAC00' 0,0,2,3:'\U0600\U0308\UAC00' 0,0,2:'\U0600\UAC01' 0,0,2,3:'\U0600\U0308\UAC01' 0,0,2:'\U0600\U0900' 0,0,0,3:'\U0600\U0308\U0900'
0,0,2:'\U0600\U0903' 0,0,0,3:'\U0600\U0308\U0903' 0,0,2:'\U0600\U0904' 0,0,2,3:'\U0600\U0308\U0904' 0,0,2:'\U0600\U0D4E' 0,0,2,3:'\U0600\U0308\U0D4E'
0,0,2:'\U0600\U0915' 0,0,2,3:'\U0600\U0308\U0915' 0,0,2:'\U0600\U231A' 0,0,2,3:'\U0600\U0308\U231A' 0,0,2:'\U0600\U0300' 0,0,0,3:'\U0600\U0308\U0300'
0,0,2:'\U0600\U093C' 0,0,0,3:'\U0600\U0308\U093C' 0,0,2:'\U0600\U094D' 0,0,0,3:'\U0600\U0308\U094D' 0,0,2:'\U0600\U200D' 0,0,0,3:'\U0600\U0308\U200D'
0,0,2:'\U0600\U0378' 0,0,2,3:'\U0600\U0308\U0378' 0,1,2:'\U0A03\U0020' 0,0,2,3:'\U0A03\U0308\U0020' 0,1,2:'\U0A03\U000D' 0,0,2,3:'\U0A03\U0308\U000D'
0,1,2:'\U0A03\U000A' 0,0,2,3:'\U0A03\U0308\U000A' 0,1,2:'\U0A03\U0001' 0,0,2,3:'\U0A03\U0308\U0001' 0,0,2:'\U0A03\U034F' 0,0,0,3:'\U0A03\U0308\U034F'
0,1,2:'\U0A03\U1F1E6' 0,0,2,3:'\U0A03\U0308\U1F1E6' 0,1,2:'\U0A03\U0600' 0,0,2,3:'\U0A03\U0308\U0600' 0,0,2:'\U0A03\U0A03' 0,0,0,3:'\U0A03\U0308\U0A03'
0,1,2:'\U0A03\U1100' 0,0,2,3:'\U0A03\U0308\U1100' 0,1,2:'\U0A03\U1160' 0,0,2,3:'\U0A03\U0308\U1160' 0,1,2:'\U0A03\U11A8' 0,0,2,3:'\U0A03\U0308\U11A8'
0,1,2:'\U0A03\UAC00' 0,0,2,3:'\U0A03\U0308\UAC00' 0,1,2:'\U0A03\UAC01' 0,0,2,3:'\U0A03\U0308\UAC01' 0,0,2:'\U0A03\U0900' 0,0,0,3:'\U0A03\U0308\U0900'
0,0,2:'\U0A03\U0903' 0,0,0,3:'\U0A03\U0308\U0903' 0,1,2:'\U0A03\U0904' 0,0,2,3:'\U0A03\U0308\U0904' 0,1,2:'\U0A03\U0D4E' 0,0,2,3:'\U0A03\U0308\U0D4E'
0,1,2:'\U0A03\U0915' 0,0,2,3:'\U0A03\U0308\U0915' 0,1,2:'\U0A03\U231A' 0,0,2,3:'\U0A03\U0308\U231A' 0,0,2:'\U0A03\U0300' 0,0,0,3:'\U0A03\U0308\U0300'
0,0,2:'\U0A03\U093C' 0,0,0,3:'\U0A03\U0308\U093C' 0,0,2:'\U0A03\U094D' 0,0,0,3:'\U0A03\U0308\U094D' 0,0,2:'\U0A03\U200D' 0,0,0,3:'\U0A03\U0308\U200D'
0,1,2:'\U0A03\U0378' 0,0,2,3:'\U0A03\U0308\U0378' 0,1,2:'\U1100\U0020' 0,0,2,3:'\U1100\U0308\U0020' 0,1,2:'\U1100\U000D' 0,0,2,3:'\U1100\U0308\U000D'
0,1,2:'\U1100\U000A' 0,0,2,3:'\U1100\U0308\U000A' 0,1,2:'\U1100\U0001' 0,0,2,3:'\U1100\U0308\U0001' 0,0,2:'\U1100\U034F' 0,0,0,3:'\U1100\U0308\U034F'
0,1,2:'\U1100\U1F1E6' 0,0,2,3:'\U1100\U0308\U1F1E6' 0,1,2:'\U1100\U0600' 0,0,2,3:'\U1100\U0308\U0600' 0,0,2:'\U1100\U0A03' 0,0,0,3:'\U1100\U0308\U0A03'
0,0,2:'\U1100\U1100' 0,0,2,3:'\U1100\U0308\U1100' 0,0,2:'\U1100\U1160' 0,0,2,3:'\U1100\U0308\U1160' 0,1,2:'\U1100\U11A8' 0,0,2,3:'\U1100\U0308\U11A8'
0,0,2:'\U1100\UAC00' 0,0,2,3:'\U1100\U0308\UAC00' 0,0,2:'\U1100\UAC01' 0,0,2,3:'\U1100\U0308\UAC01' 0,0,2:'\U1100\U0900' 0,0,0,3:'\U1100\U0308\U0900'
0,0,2:'\U1100\U0903' 0,0,0,3:'\U1100\U0308\U0903' 0,1,2:'\U1100\U0904' 0,0,2,3:'\U1100\U0308\U0904' 0,1,2:'\U1100\U0D4E' 0,0,2,3:'\U1100\U0308\U0D4E'
0,1,2:'\U1100\U0915' 0,0,2,3:'\U1100\U0308\U0915' 0,1,2:'\U1100\U231A' 0,0,2,3:'\U1100\U0308\U231A' 0,0,2:'\U1100\U0300' 0,0,0,3:'\U1100\U0308\U0300'
0,0,2:'\U1100\U093C' 0,0,0,3:'\U1100\U0308\U093C' 0,0,2:'\U1100\U094D' 0,0,0,3:'\U1100\U0308\U094D' 0,0,2:'\U1100\U200D' 0,0,0,3:'\U1100\U0308\U200D'
0,1,2:'\U1100\U0378' 0,0,2,3:'\U1100\U0308\U0378' 0,1,2:'\U1160\U0020' 0,0,2,3:'\U1160\U0308\U0020' 0,1,2:'\U1160\U000D' 0,0,2,3:'\U1160\U0308\U000D'
0,1,2:'\U1160\U000A' 0,0,2,3:'\U1160\U0308\U000A' 0,1,2:'\U1160\U0001' 0,0,2,3:'\U1160\U0308\U0001' 0,0,2:'\U1160\U034F' 0,0,0,3:'\U1160\U0308\U034F'
0,1,2:'\U1160\U1F1E6' 0,0,2,3:'\U1160\U0308\U1F1E6' 0,1,2:'\U1160\U0600' 0,0,2,3:'\U1160\U0308\U0600' 0,0,2:'\U1160\U0A03' 0,0,0,3:'\U1160\U0308\U0A03'
0,1,2:'\U1160\U1100' 0,0,2,3:'\U1160\U0308\U1100' 0,0,2:'\U1160\U1160' 0,0,2,3:'\U1160\U0308\U1160' 0,0,2:'\U1160\U11A8' 0,0,2,3:'\U1160\U0308\U11A8'
0,1,2:'\U1160\UAC00' 0,0,2,3:'\U1160\U0308\UAC00' 0,1,2:'\U1160\UAC01' 0,0,2,3:'\U1160\U0308\UAC01' 0,0,2:'\U1160\U0900' 0,0,0,3:'\U1160\U0308\U0900'
0,0,2:'\U1160\U0903' 0,0,0,3:'\U1160\U0308\U0903' 0,1,2:'\U1160\U0904' 0,0,2,3:'\U1160\U0308\U0904' 0,1,2:'\U1160\U0D4E' 0,0,2,3:'\U1160\U0308\U0D4E'
0,1,2:'\U1160\U0915' 0,0,2,3:'\U1160\U0308\U0915' 0,1,2:'\U1160\U231A' 0,0,2,3:'\U1160\U0308\U231A' 0,0,2:'\U1160\U0300' 0,0,0,3:'\U1160\U0308\U0300'
0,0,2:'\U1160\U093C' 0,0,0,3:'\U1160\U0308\U093C' 0,0,2:'\U1160\U094D' 0,0,0,3:'\U1160\U0308\U094D' 0,0,2:'\U1160\U200D' 0,0,0,3:'\U1160\U0308\U200D'
0,1,2:'\U1160\U0378' 0,0,2,3:'\U1160\U0308\U0378' 0,1,2:'\U11A8\U0020' 0,0,2,3:'\U11A8\U0308\U0020' 0,1,2:'\U11A8\U000D' 0,0,2,3:'\U11A8\U0308\U000D'
0,1,2:'\U11A8\U000A' 0,0,2,3:'\U11A8\U0308\U000A' 0,1,2:'\U11A8\U0001' 0,0,2,3:'\U11A8\U0308\U0001' 0,0,2:'\U11A8\U034F' 0,0,0,3:'\U11A8\U0308\U034F'
0,1,2:'\U11A8\U1F1E6' 0,0,2,3:'\U11A8\U0308\U1F1E6' 0,1,2:'\U11A8\U0600' 0,0,2,3:'\U11A8\U0308\U0600' 0,0,2:'\U11A8\U0A03' 0,0,0,3:'\U11A8\U0308\U0A03'
0,1,2:'\U11A8\U1100' 0,0,2,3:'\U11A8\U0308\U1100' 0,1,2:'\U11A8\U1160' 0,0,2,3:'\U11A8\U0308\U1160' 0,0,2:'\U11A8\U11A8' 0,0,2,3:'\U11A8\U0308\U11A8'
0,1,2:'\U11A8\UAC00' 0,0,2,3:'\U11A8\U0308\UAC00' 0,1,2:'\U11A8\UAC01' 0,0,2,3:'\U11A8\U0308\UAC01' 0,0,2:'\U11A8\U0900' 0,0,0,3:'\U11A8\U0308\U0900'
0,0,2:'\U11A8\U0903' 0,0,0,3:'\U11A8\U0308\U0903' 0,1,2:'\U11A8\U0904' 0,0,2,3:'\U11A8\U0308\U0904' 0,1,2:'\U11A8\U0D4E' 0,0,2,3:'\U11A8\U0308\U0D4E'
0,1,2:'\U11A8\U0915' 0,0,2,3:'\U11A8\U0308\U0915' 0,1,2:'\U11A8\U231A' 0,0,2,3:'\U11A8\U0308\U231A' 0,0,2:'\U11A8\U0300' 0,0,0,3:'\U11A8\U0308\U0300'
0,0,2:'\U11A8\U093C' 0,0,0,3:'\U11A8\U0308\U093C' 0,0,2:'\U11A8\U094D' 0,0,0,3:'\U11A8\U0308\U094D' 0,0,2:'\U11A8\U200D' 0,0,0,3:'\U11A8\U0308\U200D'
0,1,2:'\U11A8\U0378' 0,0,2,3:'\U11A8\U0308\U0378' 0,1,2:'\UAC00\U0020' 0,0,2,3:'\UAC00\U0308\U0020' 0,1,2:'\UAC00\U000D' 0,0,2,3:'\UAC00\U0308\U000D'
0,1,2:'\UAC00\U000A' 0,0,2,3:'\UAC00\U0308\U000A' 0,1,2:'\UAC00\U0001' 0,0,2,3:'\UAC00\U0308\U0001' 0,0,2:'\UAC00\U034F' 0,0,0,3:'\UAC00\U0308\U034F'
0,1,2:'\UAC00\U1F1E6' 0,0,2,3:'\UAC00\U0308\U1F1E6' 0,1,2:'\UAC00\U0600' 0,0,2,3:'\UAC00\U0308\U0600' 0,0,2:'\UAC00\U0A03' 0,0,0,3:'\UAC00\U0308\U0A03'
0,1,2:'\UAC00\U1100' 0,0,2,3:'\UAC00\U0308\U1100' 0,0,2:'\UAC00\U1160' 0,0,2,3:'\UAC00\U0308\U1160' 0,0,2:'\UAC00\U11A8' 0,0,2,3:'\UAC00\U0308\U11A8'
0,1,2:'\UAC00\UAC00' 0,0,2,3:'\UAC00\U0308\UAC00' 0,1,2:'\UAC00\UAC01' 0,0,2,3:'\UAC00\U0308\UAC01' 0,0,2:'\UAC00\U0900' 0,0,0,3:'\UAC00\U0308\U0900'
0,0,2:'\UAC00\U0903' 0,0,0,3:'\UAC00\U0308\U0903' 0,1,2:'\UAC00\U0904' 0,0,2,3:'\UAC00\U0308\U0904' 0,1,2:'\UAC00\U0D4E' 0,0,2,3:'\UAC00\U0308\U0D4E'
0,1,2:'\UAC00\U0915' 0,0,2,3:'\UAC00\U0308\U0915' 0,1,2:'\UAC00\U231A' 0,0,2,3:'\UAC00\U0308\U231A' 0,0,2:'\UAC00\U0300' 0,0,0,3:'\UAC00\U0308\U0300'
0,0,2:'\UAC00\U093C' 0,0,0,3:'\UAC00\U0308\U093C' 0,0,2:'\UAC00\U094D' 0,0,0,3:'\UAC00\U0308\U094D' 0,0,2:'\UAC00\U200D' 0,0,0,3:'\UAC00\U0308\U200D'
0,1,2:'\UAC00\U0378' 0,0,2,3:'\UAC00\U0308\U0378' 0,1,2:'\UAC01\U0020' 0,0,2,3:'\UAC01\U0308\U0020' 0,1,2:'\UAC01\U000D' 0,0,2,3:'\UAC01\U0308\U000D'
0,1,2:'\UAC01\U000A' 0,0,2,3:'\UAC01\U0308\U000A' 0,1,2:'\UAC01\U0001' 0,0,2,3:'\UAC01\U0308\U0001' 0,0,2:'\UAC01\U034F' 0,0,0,3:'\UAC01\U0308\U034F'
0,1,2:'\UAC01\U1F1E6' 0,0,2,3:'\UAC01\U0308\U1F1E6' 0,1,2:'\UAC01\U0600' 0,0,2,3:'\UAC01\U0308\U0600' 0,0,2:'\UAC01\U0A03' 0,0,0,3:'\UAC01\U0308\U0A03'
0,1,2:'\UAC01\U1100' 0,0,2,3:'\UAC01\U0308\U1100' 0,1,2:'\UAC01\U1160' 0,0,2,3:'\UAC01\U0308\U1160' 0,0,2:'\UAC01\U11A8' 0,0,2,3:'\UAC01\U0308\U11A8'
0,1,2:'\UAC01\UAC00' 0,0,2,3:'\UAC01\U0308\UAC00' 0,1,2:'\UAC01\UAC01' 0,0,2,3:'\UAC01\U0308\UAC01' 0,0,2:'\UAC01\U0900' 0,0,0,3:'\UAC01\U0308\U0900'
0,0,2:'\UAC01\U0903' 0,0,0,3:'\UAC01\U0308\U0903' 0,1,2:'\UAC01\U0904' 0,0,2,3:'\UAC01\U0308\U0904' 0,1,2:'\UAC01\U0D4E' 0,0,2,3:'\UAC01\U0308\U0D4E'
0,1,2:'\UAC01\U0915' 0,0,2,3:'\UAC01\U0308\U0915' 0,1,2:'\UAC01\U231A' 0,0,2,3:'\UAC01\U0308\U231A' 0,0,2:'\UAC01\U0300' 0,0,0,3:'\UAC01\U0308\U0300'
0,0,2:'\UAC01\U093C' 0,0,0,3:'\UAC01\U0308\U093C' 0,0,2:'\UAC01\U094D' 0,0,0,3:'\UAC01\U0308\U094D' 0,0,2:'\UAC01\U200D' 0,0,0,3:'\UAC01\U0308\U200D'
0,1,2:'\UAC01\U0378' 0,0,2,3:'\UAC01\U0308\U0378' 0,1,2:'\U0900\U0020' 0,0,2,3:'\U0900\U0308\U0020' 0,1,2:'\U0900\U000D' 0,0,2,3:'\U0900\U0308\U000D'
0,1,2:'\U0900\U000A' 0,0,2,3:'\U0900\U0308\U000A' 0,1,2:'\U0900\U0001' 0,0,2,3:'\U0900\U0308\U0001' 0,0,2:'\U0900\U034F' 0,0,0,3:'\U0900\U0308\U034F'
0,1,2:'\U0900\U1F1E6' 0,0,2,3:'\U0900\U0308\U1F1E6' 0,1,2:'\U0900\U0600' 0,0,2,3:'\U0900\U0308\U0600' 0,0,2:'\U0900\U0A03' 0,0,0,3:'\U0900\U0308\U0A03'
0,1,2:'\U0900\U1100' 0,0,2,3:'\U0900\U0308\U1100' 0,1,2:'\U0900\U1160' 0,0,2,3:'\U0900\U0308\U1160' 0,1,2:'\U0900\U11A8' 0,0,2,3:'\U0900\U0308\U11A8'
0,1,2:'\U0900\UAC00' 0,0,2,3:'\U0900\U0308\UAC00' 0,1,2:'\U0900\UAC01' 0,0,2,3:'\U0900\U0308\UAC01' 0,0,2:'\U0900\U0900' 0,0,0,3:'\U0900\U0308\U0900'
0,0,2:'\U0900\U0903' 0,0,0,3:'\U0900\U0308\U0903' 0,1,2:'\U0900\U0904' 0,0,2,3:'\U0900\U0308\U0904' 0,1,2:'\U0900\U0D4E' 0,0,2,3:'\U0900\U0308\U0D4E'
0,1,2:'\U0900\U0915' 0,0,2,3:'\U0900\U0308\U0915' 0,1,2:'\U0900\U231A' 0,0,2,3:'\U0900\U0308\U231A' 0,0,2:'\U0900\U0300' 0,0,0,3:'\U0900\U0308\U0300'
0,0,2:'\U0900\U093C' 0,0,0,3:'\U0900\U0308\U093C' 0,0,2:'\U0900\U094D' 0,0,0,3:'\U0900\U0308\U094D' 0,0,2:'\U0900\U200D' 0,0,0,3:'\U0900\U0308\U200D'
0,1,2:'\U0900\U0378' 0,0,2,3:'\U0900\U0308\U0378' 0,1,2:'\U0903\U0020' 0,0,2,3:'\U0903\U0308\U0020' 0,1,2:'\U0903\U000D' 0,0,2,3:'\U0903\U0308\U000D'
0,1,2:'\U0903\U000A' 0,0,2,3:'\U0903\U0308\U000A' 0,1,2:'\U0903\U0001' 0,0,2,3:'\U0903\U0308\U0001' 0,0,2:'\U0903\U034F' 0,0,0,3:'\U0903\U0308\U034F'
0,1,2:'\U0903\U1F1E6' 0,0,2,3:'\U0903\U0308\U1F1E6' 0,1,2:'\U0903\U0600' 0,0,2,3:'\U0903\U0308\U0600' 0,0,2:'\U0903\U0A03' 0,0,0,3:'\U0903\U0308\U0A03'
0,1,2:'\U0903\U1100' 0,0,2,3:'\U0903\U0308\U1100' 0,1,2:'\U0903\U1160' 0,0,2,3:'\U0903\U0308\U1160' 0,1,2:'\U0903\U11A8' 0,0,2,3:'\U0903\U0308\U11A8'
0,1,2:'\U0903\UAC00' 0,0,2,3:'\U0903\U0308\UAC00' 0,1,2:'\U0903\UAC01' 0,0,2,3:'\U0903\U0308\UAC01' 0,0,2:'\U0903\U0900' 0,0,0,3:'\U0903\U0308\U0900'
0,0,2:'\U0903\U0903' 0,0,0,3:'\U0903\U0308\U0903' 0,1,2:'\U0903\U0904' 0,0,2,3:'\U0903\U0308\U0904' 0,1,2:'\U0903\U0D4E' 0,0,2,3:'\U0903\U0308\U0D4E'
0,1,2:'\U0903\U0915' 0,0,2,3:'\U0903\U0308\U0915' 0,1,2:'\U0903\U231A' 0,0,2,3:'\U0903\U0308\U231A' 0,0,2:'\U0903\U0300' 0,0,0,3:'\U0903\U0308\U0300'
0,0,2:'\U0903\U093C' 0,0,0,3:'\U0903\U0308\U093C' 0,0,2:'\U0903\U094D' 0,0,0,3:'\U0903\U0308\U094D' 0,0,2:'\U0903\U200D' 0,0,0,3:'\U0903\U0308\U200D'
0,1,2:'\U0903\U0378' 0,0,2,3:'\U0903\U0308\U0378' 0,1,2:'\U0904\U0020' 0,0,2,3:'\U0904\U0308\U0020' 0,1,2:'\U0904\U000D' 0,0,2,3:'\U0904\U0308\U000D'
0,1,2:'\U0904\U000A' 0,0,2,3:'\U0904\U0308\U000A' 0,1,2:'\U0904\U0001' 0,0,2,3:'\U0904\U0308\U0001' 0,0,2:'\U0904\U034F' 0,0,0,3:'\U0904\U0308\U034F'
0,1,2:'\U0904\U1F1E6' 0,0,2,3:'\U0904\U0308\U1F1E6' 0,1,2:'\U0904\U0600' 0,0,2,3:'\U0904\U0308\U0600' 0,0,2:'\U0904\U0A03' 0,0,0,3:'\U0904\U0308\U0A03'
0,1,2:'\U0904\U1100' 0,0,2,3:'\U0904\U0308\U1100' 0,1,2:'\U0904\U1160' 0,0,2,3:'\U0904\U0308\U1160' 0,1,2:'\U0904\U11A8' 0,0,2,3:'\U0904\U0308\U11A8'
0,1,2:'\U0904\UAC00' 0,0,2,3:'\U0904\U0308\UAC00' 0,1,2:'\U0904\UAC01' 0,0,2,3:'\U0904\U0308\UAC01' 0,0,2:'\U0904\U0900' 0,0,0,3:'\U0904\U0308\U0900'
0,0,2:'\U0904\U0903' 0,0,0,3:'\U0904\U0308\U0903' 0,1,2:'\U0904\U0904' 0,0,2,3:'\U0904\U0308\U0904' 0,1,2:'\U0904\U0D4E' 0,0,2,3:'\U0904\U0308\U0D4E'
0,1,2:'\U0904\U0915' 0,0,2,3:'\U0904\U0308\U0915' 0,1,2:'\U0904\U231A' 0,0,2,3:'\U0904\U0308\U231A' 0,0,2:'\U0904\U0300' 0,0,0,3:'\U0904\U0308\U0300'
0,0,2:'\U0904\U093C' 0,0,0,3:'\U0904\U0308\U093C' 0,0,2:'\U0904\U094D' 0,0,0,3:'\U0904\U0308\U094D' 0,0,2:'\U0904\U200D' 0,0,0,3:'\U0904\U0308\U200D'
0,1,2:'\U0904\U0378' 0,0,2,3:'\U0904\U0308\U0378' 0,0,2:'\U0D4E\U0020' 0,0,2,3:'\U0D4E\U0308\U0020' 0,1,2:'\U0D4E\U000D' 0,0,2,3:'\U0D4E\U0308\U000D'
0,1,2:'\U0D4E\U000A' 0,0,2,3:'\U0D4E\U0308\U000A' 0,1,2:'\U0D4E\U0001' 0,0,2,3:'\U0D4E\U0308\U0001' 0,0,2:'\U0D4E\U034F' 0,0,0,3:'\U0D4E\U0308\U034F'
0,0,2:'\U0D4E\U1F1E6' 0,0,2,3:'\U0D4E\U0308\U1F1E6' 0,0,2:'\U0D4E\U0600' 0,0,2,3:'\U0D4E\U0308\U0600' 0,0,2:'\U0D4E\U0A03' 0,0,0,3:'\U0D4E\U0308\U0A03'
0,0,2:'\U0D4E\U1100' 0,0,2,3:'\U0D4E\U0308\U1100' 0,0,2:'\U0D4E\U1160' 0,0,2,3:'\U0D4E\U0308\U1160' 0,0,2:'\U0D4E\U11A8' 0,0,2,3:'\U0D4E\U0308\U11A8'
0,0,2:'\U0D4E\UAC00' 0,0,2,3:'\U0D4E\U0308\UAC00' 0,0,2:'\U0D4E\UAC01' 0,0,2,3:'\U0D4E\U0308\UAC01' 0,0,2:'\U0D4E\U0900' 0,0,0,3:'\U0D4E\U0308\U0900'
0,0,2:'\U0D4E\U0903' 0,0,0,3:'\U0D4E\U0308\U0903' 0,0,2:'\U0D4E\U0904' 0,0,2,3:'\U0D4E\U0308\U0904' 0,0,2:'\U0D4E\U0D4E' 0,0,2,3:'\U0D4E\U0308\U0D4E'
0,0,2:'\U0D4E\U0915' 0,0,2,3:'\U0D4E\U0308\U0915' 0,0,2:'\U0D4E\U231A' 0,0,2,3:'\U0D4E\U0308\U231A' 0,0,2:'\U0D4E\U0300' 0,0,0,3:'\U0D4E\U0308\U0300'
0,0,2:'\U0D4E\U093C' 0,0,0,3:'\U0D4E\U0308\U093C' 0,0,2:'\U0D4E\U094D' 0,0,0,3:'\U0D4E\U0308\U094D' 0,0,2:'\U0D4E\U200D' 0,0,0,3:'\U0D4E\U0308\U200D'
0,0,2:'\U0D4E\U0378' 0,0,2,3:'\U0D4E\U0308\U0378' 0,1,2:'\U0915\U0020' 0,0,2,3:'\U0915\U0308\U0020' 0,1,2:'\U0915\U000D' 0,0,2,3:'\U0915\U0308\U000D'
0,1,2:'\U0915\U000A' 0,0,2,3:'\U0915\U0308\U000A' 0,1,2:'\U0915\U0001' 0,0,2,3:'\U0915\U0308\U0001' 0,0,2:'\U0915\U034F' 0,0,0,3:'\U0915\U0308\U034F'
0,1,2:'\U0915\U1F1E6' 0,0,2,3:'\U0915\U0308\U1F1E6' 0,1,2:'\U0915\U0600' 0,0,2,3:'\U0915\U0308\U0600' 0,0,2:'\U0915\U0A03' 0,0,0,3:'\U0915\U0308\U0A03'
0,1,2:'\U0915\U1100' 0,0,2,3:'\U0915\U0308\U1100' 0,1,2:'\U0915\U1160' 0,0,2,3:'\U0915\U0308\U1160' 0,1,2:'\U0915\U11A8' 0,0,2,3:'\U0915\U0308\U11A8'
0,1,2:'\U0915\UAC00' 0,0,2,3:'\U0915\U0308\UAC00' 0,1,2:'\U0915\UAC01' 0,0,2,3:'\U0915\U0308\UAC01' 0,0,2:'\U0915\U0900' 0,0,0,3:'\U0915\U0308\U0900'
0,0,2:'\U0915\U0903' 0,0,0,3:'\U0915\U0308\U0903' 0,1,2:'\U0915\U0904' 0,0,2,3:'\U0915\U0308\U0904' 0,1,2:'\U0915\U0D4E' 0,0,2,3:'\U0915\U0308\U0D4E'
0,1,2:'\U0915\U0915' 0,0,2,3:'\U0915\U0308\U0915' 0,1,2:'\U0915\U231A' 0,0,2,3:'\U0915\U0308\U231A' 0,0,2:'\U0915\U0300' 0,0,0,3:'\U0915\U0308\U0300'
0,0,2:'\U0915\U093C' 0,0,0,3:'\U0915\U0308\U093C' 0,0,2:'\U0915\U094D' 0,0,0,3:'\U0915\U0308\U094D' 0,0,2:'\U0915\U200D' 0,0,0,3:'\U0915\U0308\U200D'
0,1,2:'\U0915\U0378' 0,0,2,3:'\U0915\U0308\U0378' 0,1,2:'\U231A\U0020' 0,0,2,3:'\U231A\U0308\U0020' 0,1,2:'\U231A\U000D' 0,0,2,3:'\U231A\U0308\U000D'
0,1,2:'\U231A\U000A' 0,0,2,3:'\U231A\U0308\U000A' 0,1,2:'\U231A\U0001' 0,0,2,3:'\U231A\U0308\U0001' 0,0,2:'\U231A\U034F' 0,0,0,3:'\U231A\U0308\U034F'
0,1,2:'\U231A\U1F1E6' 0,0,2,3:'\U231A\U0308\U1F1E6' 0,1,2:'\U231A\U0600' 0,0,2,3:'\U231A\U0308\U0600' 0,0,2:'\U231A\U0A03' 0,0,0,3:'\U231A\U0308\U0A03'
0,1,2:'\U231A\U1100' 0,0,2,3:'\U231A\U0308\U1100' 0,1,2:'\U231A\U1160' 0,0,2,3:'\U231A\U0308\U1160' 0,1,2:'\U231A\U11A8' 0,0,2,3:'\U231A\U0308\U11A8'
0,1,2:'\U231A\UAC00' 0,0,2,3:'\U231A\U0308\UAC00' 0,1,2:'\U231A\UAC01' 0,0,2,3:'\U231A\U0308\UAC01' 0,0,2:'\U231A\U0900' 0,0,0,3:'\U231A\U0308\U0900'
0,0,2:'\U231A\U0903' 0,0,0,3:'\U231A\U0308\U0903' 0,1,2:'\U231A\U0904' 0,0,2,3:'\U231A\U0308\U0904' 0,1,2:'\U231A\U0D4E' 0,0,2,3:'\U231A\U0308\U0D4E'
0,1,2:'\U231A\U0915' 0,0,2,3:'\U231A\U0308\U0915' 0,1,2:'\U231A\U231A' 0,0,2,3:'\U231A\U0308\U231A' 0,0,2:'\U231A\U0300' 0,0,0,3:'\U231A\U0308\U0300'
0,0,2:'\U231A\U093C' 0,0,0,3:'\U231A\U0308\U093C' 0,0,2:'\U231A\U094D' 0,0,0,3:'\U231A\U0308\U094D' 0,0,2:'\U231A\U200D' 0,0,0,3:'\U231A\U0308\U200D'
0,1,2:'\U231A\U0378' 0,0,2,3:'\U231A\U0308\U0378' 0,1,2:'\U0300\U0020' 0,0,2,3:'\U0300\U0308\U0020' 0,1,2:'\U0300\U000D' 0,0,2,3:'\U0300\U0308\U000D'
0,1,2:'\U0300\U000A' 0,0,2,3:'\U0300\U0308\U000A' 0,1,2:'\U0300\U0001' 0,0,2,3:'\U0300\U0308\U0001' 0,0,2:'\U0300\U034F' 0,0,0,3:'\U0300\U0308\U034F'
0,1,2:'\U0300\U1F1E6' 0,0,2,3:'\U0300\U0308\U1F1E6' 0,1,2:'\U0300\U0600' 0,0,2,3:'\U0300\U0308\U0600' 0,0,2:'\U0300\U0A03' 0,0,0,3:'\U0300\U0308\U0A03'
0,1,2:'\U0300\U1100' 0,0,2,3:'\U0300\U0308\U1100' 0,1,2:'\U0300\U1160' 0,0,2,3:'\U0300\U0308\U1160' 0,1,2:'\U0300\U11A8' 0,0,2,3:'\U0300\U0308\U11A8'
0,1,2:'\U0300\UAC00' 0,0,2,3:'\U0300\U0308\UAC00' 0,1,2:'\U0300\UAC01' 0,0,2,3:'\U0300\U0308\UAC01' 0,0,2:'\U0300\U0900' 0,0,0,3:'\U0300\U0308\U0900'
0,0,2:'\U0300\U0903' 0,0,0,3:'\U0300\U0308\U0903' 0,1,2:'\U0300\U0904' 0,0,2,3:'\U0300\U0308\U0904' 0,1,2:'\U0300\U0D4E' 0,0,2,3:'\U0300\U0308\U0D4E'
0,1,2:'\U0300\U0915' 0,0,2,3:'\U0300\U0308\U0915' 0,1,2:'\U0300\U231A' 0,0,2,3:'\U0300\U0308\U231A' 0,0,2:'\U0300\U0300' 0,0,0,3:'\U0300\U0308\U0300'
0,0,2:'\U0300\U093C' 0,0,0,3:'\U0300\U0308\U093C' 0,0,2:'\U0300\U094D' 0,0,0,3:'\U0300\U0308\U094D' 0,0,2:'\U0300\U200D' 0,0,0,3:'\U0300\U0308\U200D'
0,1,2:'\U0300\U0378' 0,0,2,3:'\U0300\U0308\U0378' 0,1,2:'\U093C\U0020' 0,0,2,3:'\U093C\U0308\U0020' 0,1,2:'\U093C\U000D' 0,0,2,3:'\U093C\U0308\U000D'
0,1,2:'\U093C\U000A' 0,0,2,3:'\U093C\U0308\U000A' 0,1,2:'\U093C\U0001' 0,0,2,3:'\U093C\U0308\U0001' 0,0,2:'\U093C\U034F' 0,0,0,3:'\U093C\U0308\U034F'
0,1,2:'\U093C\U1F1E6' 0,0,2,3:'\U093C\U0308\U1F1E6' 0,1,2:'\U093C\U0600' 0,0,2,3:'\U093C\U0308\U0600' 0,0,2:'\U093C\U0A03' 0,0,0,3:'\U093C\U0308\U0A03'
0,1,2:'\U093C\U1100' 0,0,2,3:'\U093C\U0308\U1100' 0,1,2:'\U093C\U1160' 0,0,2,3:'\U093C\U0308\U1160' 0,1,2:'\U093C\U11A8' 0,0,2,3:'\U093C\U0308\U11A8'
0,1,2:'\U093C\UAC00' 0,0,2,3:'\U093C\U0308\UAC00' 0,1,2:'\U093C\UAC01' 0,0,2,3:'\U093C\U0308\UAC01' 0,0,2:'\U093C\U0900' 0,0,0,3:'\U093C\U0308\U0900'
0,0,2:'\U093C\U0903' 0,0,0,3:'\U093C\U0308\U0903' 0,1,2:'\U093C\U0904' 0,0,2,3:'\U093C\U0308\U0904' 0,1,2:'\U093C\U0D4E' 0,0,2,3:'\U093C\U0308\U0D4E'
0,1,2:'\U093C\U0915' 0,0,2,3:'\U093C\U0308\U0915' 0,1,2:'\U093C\U231A' 0,0,2,3:'\U093C\U0308\U231A' 0,0,2:'\U093C\U0300' 0,0,0,3:'\U093C\U0308\U0300'
0,0,2:'\U093C\U093C' 0,0,0,3:'\U093C\U0308\U093C' 0,0,2:'\U093C\U094D' 0,0,0,3:'\U093C\U0308\U094D' 0,0,2:'\U093C\U200D' 0,0,0,3:'\U093C\U0308\U200D'
0,1,2:'\U093C\U0378' 0,0,2,3:'\U093C\U0308\U0378' 0,1,2:'\U094D\U0020' 0,0,2,3:'\U094D\U0308\U0020' 0,1,2:'\U094D\U000D' 0,0,2,3:'\U094D\U0308\U000D'
0,1,2:'\U094D\U000A' 0,0,2,3:'\U094D\U0308\U000A' 0,1,2:'\U094D\U0001' 0,0,2,3:'\U094D\U0308\U0001' 0,0,2:'\U094D\U034F' 0,0,0,3:'\U094D\U0308\U034F'
0,1,2:'\U094D\U1F1E6' 0,0,2,3:'\U094D\U0308\U1F1E6' 0,1,2:'\U094D\U0600' 0,0,2,3:'\U094D\U0308\U0600' 0,0,2:'\U094D\U0A03' 0,0,0,3:'\U094D\U0308\U0A03'
0,1,2:'\U094D\U1100' 0,0,2,3:'\U094D\U0308\U1100' 0,1,2:'\U094D\U1160' 0,0,2,3:'\U094D\U0308\U1160' 0,1,2:'\U094D\U11A8' 0,0,2,3:'\U094D\U0308\U11A8'
0,1,2:'\U094D\UAC00' 0,0,2,3:'\U094D\U0308\UAC00' 0,1,2:'\U094D\UAC01' 0,0,2,3:'\U094D\U0308\UAC01' 0,0,2:'\U094D\U0900' 0,0,0,3:'\U094D\U0308\U0900'
0,0,2:'\U094D\U0903' 0,0,0,3:'\U094D\U0308\U0903' 0,1,2:'\U094D\U0904' 0,0,2,3:'\U094D\U0308\U0904' 0,1,2:'\U094D\U0D4E' 0,0,2,3:'\U094D\U0308\U0D4E'
0,1,2:'\U094D\U0915' 0,0,2,3:'\U094D\U0308\U0915' 0,1,2:'\U094D\U231A' 0,0,2,3:'\U094D\U0308\U231A' 0,0,2:'\U094D\U0300' 0,0,0,3:'\U094D\U0308\U0300'
0,0,2:'\U094D\U093C' 0,0,0,3:'\U094D\U0308\U093C' 0,0,2:'\U094D\U094D' 0,0,0,3:'\U094D\U0308\U094D' 0,0,2:'\U094D\U200D' 0,0,0,3:'\U094D\U0308\U200D'
0,1,2:'\U094D\U0378' 0,0,2,3:'\U094D\U0308\U0378' 0,1,2:'\U200D\U0020' 0,0,2,3:'\U200D\U0308\U0020' 0,1,2:'\U200D\U000D' 0,0,2,3:'\U200D\U0308\U000D'
0,1,2:'\U200D\U000A' 0,0,2,3:'\U200D\U0308\U000A' 0,1,2:'\U200D\U0001' 0,0,2,3:'\U200D\U0308\U0001' 0,0,2:'\U200D\U034F' 0,0,0,3:'\U200D\U0308\U034F'
0,1,2:'\U200D\U1F1E6' 0,0,2,3:'\U200D\U0308\U1F1E6' 0,1,2:'\U200D\U0600' 0,0,2,3:'\U200D\U0308\U0600' 0,0,2:'\U200D\U0A03' 0,0,0,3:'\U200D\U0308\U0A03'
0,1,2:'\U200D\U1100' 0,0,2,3:'\U200D\U0308\U1100' 0,1,2:'\U200D\U1160' 0,0,2,3:'\U200D\U0308\U1160' 0,1,2:'\U200D\U11A8' 0,0,2,3:'\U200D\U0308\U11A8'
0,1,2:'\U200D\UAC00' 0,0,2,3:'\U200D\U0308\UAC00' 0,1,2:'\U200D\UAC01' 0,0,2,3:'\U200D\U0308\UAC01' 0,0,2:'\U200D\U0900' 0,0,0,3:'\U200D\U0308\U0900'
0,0,2:'\U200D\U0903' 0,0,0,3:'\U200D\U0308\U0903' 0,1,2:'\U200D\U0904' 0,0,2,3:'\U200D\U0308\U0904' 0,1,2:'\U200D\U0D4E' 0,0,2,3:'\U200D\U0308\U0D4E'
0,1,2:'\U200D\U0915' 0,0,2,3:'\U200D\U0308\U0915' 0,1,2:'\U200D\U231A' 0,0,2,3:'\U200D\U0308\U231A' 0,0,2:'\U200D\U0300' 0,0,0,3:'\U200D\U0308\U0300'
0,0,2:'\U200D\U093C' 0,0,0,3:'\U200D\U0308\U093C' 0,0,2:'\U200D\U094D' 0,0,0,3:'\U200D\U0308\U094D' 0,0,2:'\U200D\U200D' 0,0,0,3:'\U200D\U0308\U200D'
0,1,2:'\U200D\U0378' 0,0,2,3:'\U200D\U0308\U0378' 0,1,2:'\U0378\U0020' 0,0,2,3:'\U0378\U0308\U0020' 0,1,2:'\U0378\U000D' 0,0,2,3:'\U0378\U0308\U000D'
0,1,2:'\U0378\U000A' 0,0,2,3:'\U0378\U0308\U000A' 0,1,2:'\U0378\U0001' 0,0,2,3:'\U0378\U0308\U0001' 0,0,2:'\U0378\U034F' 0,0,0,3:'\U0378\U0308\U034F'
0,1,2:'\U0378\U1F1E6' 0,0,2,3:'\U0378\U0308\U1F1E6' 0,1,2:'\U0378\U0600' 0,0,2,3:'\U0378\U0308\U0600' 0,0,2:'\U0378\U0A03' 0,0,0,3:'\U0378\U0308\U0A03'
0,1,2:'\U0378\U1100' 0,0,2,3:'\U0378\U0308\U1100' 0,1,2:'\U0378\U1160' 0,0,2,3:'\U0378\U0308\U1160' 0,1,2:'\U0378\U11A8' 0,0,2,3:'\U0378\U0308\U11A8'
0,1,2:'\U0378\UAC00' 0,0,2,3:'\U0378\U0308\UAC00' 0,1,2:'\U0378\UAC01' 0,0,2,3:'\U0378\U0308\UAC01' 0,0,2:'\U0378\U0900' 0,0,0,3:'\U0378\U0308\U0900'
0,0,2:'\U0378\U0903' 0,0,0,3:'\U0378\U0308\U0903' 0,1,2:'\U0378\U0904' 0,0,2,3:'\U0378\U0308\U0904' 0,1,2:'\U0378\U0D4E' 0,0,2,3:'\U0378\U0308\U0D4E'
0,1,2:'\U0378\U0915' 0,0,2,3:'\U0378\U0308\U0915' 0,1,2:'\U0378\U231A' 0,0,2,3:'\U0378\U0308\U231A' 0,0,2:'\U0378\U0300' 0,0,0,3:'\U0378\U0308\U0300'
0,0,2:'\U0378\U093C' 0,0,0,3:'\U0378\U0308\U093C' 0,0,2:'\U0378\U094D' 0,0,0,3:'\U0378\U0308\U094D' 0,0,2:'\U0378\U200D' 0,0,0,3:'\U0378\U0308\U200D'
0,1,2:'\U0378\U0378' 0,0,2,3:'\U0378\U0308\U0378' 0,1,2,3,4,5:'\U000D\U000A\U0061\U000A\U0308' 0,0,2:'\U0061\U0308' 0,0,2,3:'\U0020\U200D\U0646'
0,0,2,3:'\U0646\U200D\U0020' 0,0,2:'\U1100\U1100' 0,0,2,3:'\UAC00\U11A8\U1100' 0,0,2,3:'\UAC01\U11A8\U1100' 0,0,2,3,4:'\U1F1E6\U1F1E7\U1F1E8\U0062'
0,1,1,3,4,5:'\U0061\U1F1E6\U1F1E7\U1F1E8\U0062' 0,1,1,1,4,5,6:'\U0061\U1F1E6\U1F1E7\U200D\U1F1E8\U0062'
0,1,1,3,3,5,6:'\U0061\U1F1E6\U200D\U1F1E7\U1F1E8\U0062' 0,1,1,3,3,5,6:'\U0061\U1F1E6\U1F1E7\U1F1E8\U1F1E9\U0062' 0,0,2:'\U0061\U200D'
0,0,2,3:'\U0061\U0308\U0062' 0,0,2,3:'\U0061\U0903\U0062' 0,1,1,3:'\U0061\U0600\U0062' 0,0,2,3:'\U1F476\U1F3FF\U1F476' 0,0,2,3:'\U0061\U1F3FF\U1F476'
0,0,2,2,2,5:'\U0061\U1F3FF\U1F476\U200D\U1F6D1' 0,0,0,0,0,0,6:'\U1F476\U1F3FF\U0308\U200D\U1F476\U1F3FF' 0,0,0,3:'\U1F6D1\U200D\U1F6D1'
0,0,2,3:'\U0061\U200D\U1F6D1' 0,0,0,3:'\U2701\U200D\U2701' 0,0,2,3:'\U0061\U200D\U2701' 0,1,2:'\U0915\U0924' 0,0,0,3:'\U0915\U094D\U0924'
0,0,0,0,4:'\U0915\U094D\U094D\U0924' 0,0,0,0,4:'\U0915\U094D\U200D\U0924' 0,0,0,0,0,5:'\U0915\U093C\U200D\U094D\U0924'
0,0,0,0,0,5:'\U0915\U093C\U094D\U200D\U0924' 0,0,0,0,0,5:'\U0915\U094D\U0924\U094D\U092F' 0,0,2,3:'\U0915\U094D\U0061' 0,0,2,3:'\U0061\U094D\U0924'
0,0,2,3:'\U003F\U094D\U0924' 0,0,0,0,4:'\U0915\U094D\U094D\U0924'
)
function ble/test:canvas/GraphemeClusterBreak/find-previous-boundary {
local ans=${1%%:*} str=${1#*:}
builtin eval "local s=\$'$str'"
ble/string#split ans , "$ans"
local k=0 b=0
for k in "${!ans[@]}"; do
ble/test:canvas/GraphemeCluster/.locate-code-point "$s." "$((k+1))"; local i=$ret
ble/test:canvas/GraphemeCluster/.locate-code-point "$s" "${ans[k]}"; local a=$ret
ble/test "ble/unicode/GraphemeCluster/find-previous-boundary \$'$str' $i" ret="$a"
if ((a>b)); then
local ret= c= w= cs= extend=
ble/test "ble/unicode/GraphemeCluster/match \$'$str' $b && ((ret=b+1+extend))" ret="$a"
((b=a))
fi
done
}
if ((_ble_bash>=40200)); then
for spec in "${tests_cases[@]}"; do
ble/test:canvas/GraphemeClusterBreak/find-previous-boundary "$spec"
done
fi
)
ble/test/end-section

View file

@ -0,0 +1,36 @@
# Copyright 2015 Koichi Murase <myoga.murase@gmail.com>. All rights reserved.
# This script is a part of blesh (https://github.com/akinomyoga/ble.sh)
# provided under the BSD-3-Clause license. Do not edit this file because this
# is not the original source code: Various pre-processing has been applied.
# Also, the code comments and blank lines are stripped off in the installation
# process. Please find the corresponding source file(s) in the repository
# "akinomyoga/ble.sh".
#
# Source: /lib/test-complete.sh
ble-import lib/core-complete
ble-import lib/core-test
ble/test/start-section 'ble/complete' 7
(
function _collect {
local text=${args[1]} p0=0 i out=
for ((i=0;i<${#ret[@]};i++)); do
((p=ret[i]))
if ((i%2==0)); then
out=$out${text:p0:p-p0}'['
else
out=$out${text:p0:p-p0}']'
fi
p0=$p
done
((p0<${#text})) && out=$out${text:p0}
ret=$out
}
ble/test 'args=(akf Makefile 0); ble/complete/candidates/filter:hsubseq/match "${args[@]}"; _collect' ret='M[ak]e[f]ile'
ble/test 'args=(akf Makefile 1); ble/complete/candidates/filter:hsubseq/match "${args[@]}"; _collect' ret='Makefile'
ble/test 'args=(Mkf Makefile 1); ble/complete/candidates/filter:hsubseq/match "${args[@]}"; _collect' ret='[M]a[k]e[f]ile'
ble/test 'args=(Maf Makefile 1); ble/complete/candidates/filter:hsubseq/match "${args[@]}"; _collect' ret='[Ma]ke[f]ile'
ble/test 'args=(Mak Makefile 1); ble/complete/candidates/filter:hsubseq/match "${args[@]}"; _collect' ret='[Mak]efile'
ble/test 'args=(ake Makefile 0); ble/complete/candidates/filter:hsubseq/match "${args[@]}"; _collect' ret='M[ake]file'
ble/test 'args=(afe Makefile 0); ble/complete/candidates/filter:hsubseq/match "${args[@]}"; _collect' ret='M[a]ke[f]il[e]'
)
ble/test/end-section

View file

@ -0,0 +1,47 @@
# Copyright 2015 Koichi Murase <myoga.murase@gmail.com>. All rights reserved.
# This script is a part of blesh (https://github.com/akinomyoga/ble.sh)
# provided under the BSD-3-Clause license. Do not edit this file because this
# is not the original source code: Various pre-processing has been applied.
# Also, the code comments and blank lines are stripped off in the installation
# process. Please find the corresponding source file(s) in the repository
# "akinomyoga/ble.sh".
#
# Source: /lib/test-decode.sh
ble-import lib/core-test
ble/test/start-section 'ble/decode' 33
(
ble/test 'ble/builtin/bind/.parse-keyname tab ; ret=${chars[0]}' ret=9
ble/test 'ble/builtin/bind/.parse-keyname TAB ; ret=${chars[0]}' ret=9
ble/test 'ble/builtin/bind/.parse-keyname newline; ret=${chars[0]}' ret=10
ble/test 'ble/builtin/bind/.parse-keyname LFD ; ret=${chars[0]}' ret=10
ble/test 'ble/builtin/bind/.parse-keyname Return ; ret=${chars[0]}' ret=13
ble/test 'ble/builtin/bind/.parse-keyname RET ; ret=${chars[0]}' ret=13
ble/test 'ble/builtin/bind/.parse-keyname Space ; ret=${chars[0]}' ret=32
ble/test 'ble/builtin/bind/.parse-keyname SPC ; ret=${chars[0]}' ret=32
ble/test 'ble/builtin/bind/.parse-keyname Rubout ; ret=${chars[0]}' ret=127
ble/test 'ble/builtin/bind/.parse-keyname DEL ; ret=${chars[0]}' ret=127
ble/test 'ble/builtin/bind/.parse-keyname Escape ; ret=${chars[0]}' ret=27
ble/test 'ble/builtin/bind/.parse-keyname ESC ; ret=${chars[0]}' ret=27
ble/test 'ble/builtin/bind/.parse-keyname C-Space; ret=${chars[0]}' ret=0
ble/test 'ble/builtin/bind/.parse-keyname s ; ret=${chars[0]}' ret=115
ble/test 'ble/builtin/bind/.parse-keyname S ; ret=${chars[0]}' ret=83
ble/test "ble/builtin/bind/.parse-keyname '\C-x\C-y' ; ret=\${chars[0]}" ret=25 # C-y
ble/test "ble/builtin/bind/.parse-keyname 'xyz' ; ret=\${chars[0]}" ret=120 # x
ble/test "ble/builtin/bind/.parse-keyname '\a' ; ret=\${chars[0]}" ret=92 # \ (backslash)
ble/test "ble/builtin/bind/.parse-keyname '\C-nop' ; ret=\${chars[0]}" ret=14 # C-n
ble/test "ble/builtin/bind/.parse-keyname '\C-xC-y' ; ret=\${chars[0]}" ret=25 # C-y
ble/test "ble/builtin/bind/.parse-keyname '\C-axC-b' ; ret=\${chars[0]}" ret=2 # C-b
ble/test "ble/builtin/bind/.parse-keyname 'helloC-b' ; ret=\${chars[0]}" ret=2 # C-b
ble/test "ble/builtin/bind/.parse-keyname 'helloC-x,TAB' ; ret=\${chars[0]}" ret=24 # C-x
ble/test "ble/builtin/bind/.parse-keyname 'C-xTAB' ; ret=\${chars[0]}" ret=24 # C-x
ble/test "ble/builtin/bind/.parse-keyname 'TABC-x' ; ret=\${chars[0]}" ret=24 # C-x
ble/test "ble/builtin/bind/.parse-keyname 'BC-' ; ret=\${chars[0]}" ret=0 # C-@
ble/test "ble/builtin/bind/.parse-keyname 'C-M-a' ; ret=\${chars[0]}" ret=129 # C-M-a
ble/test "ble/builtin/bind/.parse-keyname 'M-C-a' ; ret=\${chars[0]}" ret=129 # C-M-a
ble/test "ble/builtin/bind/.parse-keyname 'C-aalpha-beta'; ret=\${chars[0]}" ret=2 # C-b
ble/test "ble/builtin/bind/.parse-keyname '\C-a\M-c' ; ret=\${chars[0]}" ret=131 # C-M-c
ble/test "ble/builtin/bind/.parse-keyname 'panic-trim-c' ; ret=\${chars[0]}" ret=131 # C-M-c
ble/test "ble/builtin/bind/.parse-keyname 'C--' ; ret=\${chars[0]}" ret=0 # C-@
ble/test "ble/builtin/bind/.parse-keyname 'C--x' ; ret=\${chars[0]}" ret=24 # C-x
)
ble/test/end-section

View file

@ -0,0 +1,16 @@
# Copyright 2015 Koichi Murase <myoga.murase@gmail.com>. All rights reserved.
# This script is a part of blesh (https://github.com/akinomyoga/ble.sh)
# provided under the BSD-3-Clause license. Do not edit this file because this
# is not the original source code: Various pre-processing has been applied.
# Also, the code comments and blank lines are stripped off in the installation
# process. Please find the corresponding source file(s) in the repository
# "akinomyoga/ble.sh".
#
# Source: /lib/test-edit.sh
ble-import lib/core-test
ble/test/start-section 'ble/edit' 2
(
ble/test "_ble_edit_str=$'echo\nhello\nworld' ble-edit/content/find-logical-eol 13 -1" exit=0 ret=10
ble/test "_ble_edit_str=$'echo\nhello\nworld' ble-edit/content/find-logical-bol 13 -1" exit=0 ret=5
)
ble/test/end-section

View file

@ -0,0 +1,594 @@
# Copyright 2015 Koichi Murase <myoga.murase@gmail.com>. All rights reserved.
# This script is a part of blesh (https://github.com/akinomyoga/ble.sh)
# provided under the BSD-3-Clause license. Do not edit this file because this
# is not the original source code: Various pre-processing has been applied.
# Also, the code comments and blank lines are stripped off in the installation
# process. Please find the corresponding source file(s) in the repository
# "akinomyoga/ble.sh".
#
# Source: /lib/test-keymap.vi.sh
ble-import lib/core-test
ble-import lib/keymap.vi
ble-import lib/vim-surround
function ble/keymap:vi_test/decompose-state {
local spec=$1
ind=${spec%%:*} str=${spec#*:}
if ((${#ind}==1)) && [[ $ind == [!a-zA-Z0-9] ]]; then
ind=${str%%"$ind"*} ind=${#ind} str=${str::ind}${str:ind+1}
mark=
elif ((${#ind}==2)) && [[ ${ind::1} == [!a-zA-Z0-9] && ${ind:1:1} == [!a-zA-Z0-9] ]]; then
local ind1=${ind::1} ind2=${ind:1:1} text
text=${str//"$ind2"} text=${text%%"$ind1"*} ind=${#text}
text=${str//"$ind1"} text=${text%%"$ind2"*} mark=${#text}
str=${str//["$ind"]*}
fi
}
function ble/keymap:vi_test/start-section {
ble/test/start-section "ble/keymap.vi/$1" "$2"
}
function ble/keymap:vi_test/check {
local id=$1 initial=$2 kspecs=$3 final=$4
local str ind mark
ble/keymap:vi_test/decompose-state "$initial"; local i=$ind in=$str ima=$mark
ble/keymap:vi_test/decompose-state "$final"; local f=$ind fin=$str fma=$mark
local nl=$'\n' nl_rep=$'\e[7m^J\e[27m'
ble-edit/content/reset "$in" edit
_ble_edit_ind=$i
[[ $ima ]] && _ble_edit_mark=$ima
local ret
ble-decode-kbd "$kspecs"
ble/string#split-words ret "$ret"
local ble_decode=${_ble_keymap_vi_test_ble_decode:-ble-decode-key}
"$ble_decode" "${ret[@]}" &>/dev/null
local esc_in=${in//$nl/"$nl_rep"}
local section=${_ble_test_section_title#'ble/keymap.vi/'}
local title="$section/$id i=$i${ima:+ m=$ima} str=$esc_in keys=($kspecs)"
local ind_expect=ind=$f
local ind_result=ind=$_ble_edit_ind
if [[ $fma ]]; then
ind_expect=$ind_expect,mark=$fma
ind_result=$ind_result,mark=$_ble_edit_mark
fi
local str_expect=$fin
local str_result=$_ble_edit_str
ble/test --depth=1 --display-code="$title" ret="$ind_expect" stdout="$str_expect[EOF]" \
code:'ret=$ind_result; ble/util/put "$str_result[EOF]"'
local ext=$?
case $_ble_decode_keymap in
(vi_[ixo]map)
ble-decode-key "$((_ble_decode_Ctrl|99))" &>/dev/null ;; # C-c
esac
return "$ext"
}
function ble/keymap:vi_test/section:space {
ble/test/start-section "ble/keymap.vi/space" 2
local str=$' 1234\n567890ab\n'
ble/keymap:vi_test/check 1 "4:$str" '4 SP' "9:$str"
ble/keymap:vi_test/check 2 "4:$str" 'd 4 SP' $'3: \n567890ab\n'
ble/test/end-section
}
function ble/keymap:vi_test/section:cw {
ble/test/start-section "ble/keymap.vi/cw" 30
ble/keymap:vi_test/check A1 '@:cp ./foo.txt @ /tmp/' 'c w' '@:cp ./foo.txt @/tmp/'
ble/keymap:vi_test/check A2 '@:cp ./foo.tx@t /tmp/' 'c w' '@:cp ./foo.tx@ /tmp/'
ble/keymap:vi_test/check A3 '@:cp ./fo@o.txt /tmp/' 'c w' '@:cp ./fo@.txt /tmp/'
ble/keymap:vi_test/check A4 '@:cp ./foo.t@xt /tmp/' 'c w' '@:cp ./foo.t@ /tmp/'
ble/keymap:vi_test/check A5 '@:cp ./fo@o.txt /tmp/' 'c W' '@:cp ./fo@ /tmp/'
ble/keymap:vi_test/check B1a '@:123@ 456 789' 'c w' '@:123@456 789'
ble/keymap:vi_test/check B1b '@:123@ 456 789' '1 c w' '@:123@456 789'
ble/keymap:vi_test/check B1c '@:123@ 456 789' '2 c w' '@:123@789'
ble/keymap:vi_test/check B2a '@:12@3 456 789' 'c w' '@:12@ 456 789'
ble/keymap:vi_test/check B2b '@:12@3 456 789' '1 c w' '@:12@ 456 789'
ble/keymap:vi_test/check B2c '@:12@3 456 789' '2 c w' '@:12@ 789'
ble/keymap:vi_test/check B3a '@:@123 456 789' 'c w' '@:@ 456 789'
ble/keymap:vi_test/check B3b '@:@123 456 789' '1 c w' '@:@ 456 789'
ble/keymap:vi_test/check B3c '@:@123 456 789' '2 c w' '@:@ 789'
ble/keymap:vi_test/check B4a '@:ab@c///漢字' 'c w' '@:ab@///漢字'
ble/keymap:vi_test/check B4b '@:ab@c///漢字' '1 c w' '@:ab@///漢字'
ble/keymap:vi_test/check B4c '@:ab@c///漢字' '2 c w' '@:ab@漢字'
ble/keymap:vi_test/check B5a '@:@abc///漢字' 'c w' '@:@///漢字'
ble/keymap:vi_test/check B5b '@:@abc///漢字' '1 c w' '@:@///漢字'
ble/keymap:vi_test/check B5c '@:@abc///漢字' '2 c w' '@:@漢字'
ble/keymap:vi_test/check C1 $'@:123 456 @ \n\n789' 'c w' $'@:123 456 @\n\n789'
ble/keymap:vi_test/check C2 $'@:123 456 \n@\n789' 'c w' $'@:123 456 \n@\n789'
ble/keymap:vi_test/check C3 $'@:123 45@6 \n\n789' 'c w' $'@:123 45@ \n\n789'
ble/keymap:vi_test/check C4 $'@:123 456@ \n\n789\nabc' '2 c w' $'@:123 456@\n789\nabc'
ble/keymap:vi_test/check C5 $'@:123 45@6 \n\n789\nabc' '2 c w' $'@:123 45@\nabc'
ble/keymap:vi_test/check C6 $'@:123 4@56 \n\n789\nabc' '2 c w' $'@:123 4@\nabc'
ble/keymap:vi_test/check C7 $'@:123 456@ \n\n\n789\nabc' '2 c w' $'@:123 456@\n\n789\nabc'
ble/keymap:vi_test/check C8 $'@:123 45@6 \n\n\n789\nabc' '2 c w' $'@:123 45@\nabc'
ble/keymap:vi_test/check C9 $'@:123 4@56 \n\n\n789\nabc' '2 c w' $'@:123 4@\nabc'
ble/keymap:vi_test/check C9 $'@:123 456 \n\n@' '2 c w' $'@:123 456 \n\n@'
ble/test/end-section
}
function ble/keymap:vi_test/section:search {
local -a _ble_util_buffer=()
ble/test/start-section "ble/keymap.vi/search" 10
ble/keymap:vi_test/check A1a '@:ech@o abc abc abc' '/ a b c RET' '@:echo @abc abc abc'
ble/keymap:vi_test/check A1b '@:ech@o abc abc abc' '/ a b c RET n' '@:echo abc @abc abc'
ble/keymap:vi_test/check A1c '@:ech@o abc abc abc' '/ a b c RET 2 n' '@:echo abc abc @abc'
ble/keymap:vi_test/check A1d '@:ech@o abc abc abc' '/ a b c RET 2 n N' '@:echo abc @abc abc'
ble/keymap:vi_test/check A2a '@:echo@ abc abc abc' '/ a b c RET' '@:echo @abc abc abc'
ble/keymap:vi_test/check A2b '@:echo @abc abc abc' '/ a b c RET' '@:echo abc @abc abc'
ble/keymap:vi_test/check A2c '@:echo a@bc abc abc' '/ a b c RET' '@:echo abc @abc abc'
ble/keymap:vi_test/check A3a '@:echo abc@ abc abc' '? a b c RET' '@:echo @abc abc abc'
ble/keymap:vi_test/check A3b '@:echo abc @abc abc' '? a b c RET' '@:echo @abc abc abc'
ble/keymap:vi_test/check A3c '@:echo abc a@bc abc' '? a b c RET' '@:echo abc @abc abc'
ble/test/end-section
ble/textarea#invalidate
}
function ble/keymap:vi_test/section:increment {
ble/test/start-section "ble/keymap.vi/increment" 19
ble/keymap:vi_test/check A1a '@:@123' 'C-a' '@:12@4'
ble/keymap:vi_test/check A1b '@:@123' 'C-x' '@:12@2'
ble/keymap:vi_test/check A1c '@:@-123' 'C-a' '@:-12@2'
ble/keymap:vi_test/check A1d '@:@-123' 'C-x' '@:-12@4'
ble/keymap:vi_test/check A2a '@:@ -123 0' 'C-a' '@: -12@2 0'
ble/keymap:vi_test/check A2b '@: @-123 0' 'C-a' '@: -12@2 0'
ble/keymap:vi_test/check A2c '@: -@123 0' 'C-a' '@: -12@2 0'
ble/keymap:vi_test/check A2d '@: -1@23 0' 'C-a' '@: -12@2 0'
ble/keymap:vi_test/check A2e '@: -12@3 0' 'C-a' '@: -12@2 0'
ble/keymap:vi_test/check A2f '@: -123@ 0' 'C-a' '@: -123 @1'
ble/keymap:vi_test/check A3a '@:@000' 'C-a' '@:00@1'
ble/keymap:vi_test/check A3b '@:@000' '1 0 C-a' '@:01@0'
ble/keymap:vi_test/check A3c '@:@000' '1 0 0 C-a' '@:10@0'
ble/keymap:vi_test/check A3d '@:@000' 'C-x' '@:-00@1'
ble/keymap:vi_test/check A3e '@:@000' '1 0 C-x' '@:-01@0'
ble/keymap:vi_test/check A3f '@:@000' '1 0 0 C-x' '@:-10@0'
ble/keymap:vi_test/check A3g '@:@099' '1 0 0 C-x' '@:-00@1'
ble/keymap:vi_test/check A3h '@:@099' '9 9 C-x' '@:00@0'
ble/keymap:vi_test/check A4a '@:-@0' 'C-a' '@:@1'
ble/test/end-section
}
function ble/keymap:vi_test/section:macro {
local _ble_decode_keylog_depth=0
local _ble_keymap_vi_test_ble_decode=ble-decode-char
local ble_decode_char_sync=1
ble/function#push ble/util/is-stdin-ready '((0))'
ble/test/start-section "ble/keymap.vi/macro" 1
ble/keymap:vi_test/check A1 '@:@123' 'q a A SP h e l l o @ESC q @ a' '@:123 hello hell@o'
ble/test/end-section
ble/function#pop ble/util/is-stdin-ready
}
function ble/keymap:vi_test/section:surround {
ble/test/start-section "ble/keymap.vi/surround" 7
ble/keymap:vi_test/check A1a '@:abcd @fghi jklm nopq' 'y s e a' '@:abcd @<fghi> jklm nopq'
ble/keymap:vi_test/check A1b '@:abcd @fghi jklm nopq' 'y s w a' '@:abcd @<fghi> jklm nopq'
ble/keymap:vi_test/check A1c '@:abcd @fghi jklm nopq' 'y s a w a' '@:abcd @<fghi> jklm nopq'
ble/keymap:vi_test/check A1d '@:abcd @ jklm nopq' 'y s 3 l a' '@:abcd @<> jklm nopq'
ble/keymap:vi_test/check A2a '@:abcd @fghi jklm nopq' 'v 3 l S a' '@:abcd @<fghi> jklm nopq'
ble/keymap:vi_test/check A2b '@:abcd @fghi jklm nopq' 'v 4 l S a' '@:abcd @<fghi >jklm nopq'
ble/keymap:vi_test/check A2c '@:abcd @fghi jklm nopq' 'h v 5 l S a' '@:abcd@< fghi >jklm nopq'
ble/test/end-section
}
function ble/keymap:vi_test/section:txtobj_quote_xmap {
ble/test/start-section "ble/keymap.vi/txtobj_quote_xmap" 45
ble/keymap:vi_test/check A1a '@:ab@cd " fghi " jklm " nopq " rstu " vwxyz' 'v i " S a' '@:abcd "@< fghi >" jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check A1b '@:abcd @" fghi " jklm " nopq " rstu " vwxyz' 'v i " S a' '@:abcd "@< fghi >" jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check A1c '@:abcd " fghi@ " jklm " nopq " rstu " vwxyz' 'v i " S a' '@:abcd "@< fghi >" jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check A1d '@:abcd " fghi @" jklm " nopq " rstu " vwxyz' 'v i " S a' '@:abcd "@< fghi >" jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check A2a '@:ab@cd " fghi " jklm " nopq " rstu " vwxyz' 'v 2 i " S a' '@:abcd @<" fghi "> jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check A2b '@:ab@cd " fghi " jklm " nopq " rstu " vwxyz' 'v a " S a' '@:abcd @<" fghi " >jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check A2c '@:ab@cd " fghi " jklm " nopq " rstu " vwxyz' 'v 2 a " S a' '@:abcd @<" fghi " >jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check A3a '@:ab@cd "" jklm " nopq " rstu " vwxyz' 'v i " S a' '@:abcd @<""> jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check A3b '@:ab@cd "" jklm " nopq " rstu " vwxyz' 'v 2 i " S a' '@:abcd @<""> jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check B1a '@:abcd@ " fghi " jklm " nopq " rstu " vwxyz' 'v l i " S a' '@:abcd@< " fghi " jklm >" nopq " rstu " vwxyz'
ble/keymap:vi_test/check B1b '@:abcd " fghi " jklm " nopq@ " rstu " vwxyz' 'v l i " S a' '@:abcd " fghi " jklm " nopq@< " rstu >" vwxyz'
ble/keymap:vi_test/check B1c '@:abc@d " fghi " jklm " nopq " rstu " vwxyz' 'v l i " S a' '@:abcd "@< fghi >" jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check B1d '@:abcd " fgh@i " jklm " nopq " rstu " vwxyz' 'v l i " S a' '@:abcd "@< fghi >" jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check B1e '@:abcd " fghi " @jklm " nopq " rstu " vwxyz' 'v l i " S a' '@:abcd " fghi " jklm "@< nopq >" rstu " vwxyz'
ble/keymap:vi_test/check B1f '@:abcd " fghi "@ jklm " nopq " rstu " vwxyz' 'v l i " S a' '@:abcd " fghi "@< jklm " nopq >" rstu " vwxyz'
ble/keymap:vi_test/check B2a '@:abcd@ " fghi " jklm " nopq " rstu " vwxyz' 'v l 2 i " S a' '@:abcd@< " fghi " jklm "> nopq " rstu " vwxyz'
ble/keymap:vi_test/check B2b '@:abcd " fghi " jklm " nopq@ " rstu " vwxyz' 'v l 2 i " S a' '@:abcd " fghi " jklm " nopq@< " rstu "> vwxyz'
ble/keymap:vi_test/check B2c '@:abc@d " fghi " jklm " nopq " rstu " vwxyz' 'v l 2 i " S a' '@:abcd @<" fghi "> jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check B2d '@:abcd " fgh@i " jklm " nopq " rstu " vwxyz' 'v l 2 i " S a' '@:abcd @<" fghi "> jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check B2e '@:abcd " fghi " @jklm " nopq " rstu " vwxyz' 'v l 2 i " S a' '@:abcd " fghi " jklm @<" nopq "> rstu " vwxyz'
ble/keymap:vi_test/check B2f '@:abcd " fghi "@ jklm " nopq " rstu " vwxyz' 'v l 2 i " S a' '@:abcd " fghi "@< jklm " nopq "> rstu " vwxyz'
ble/keymap:vi_test/check B3a '@:abcd@ " fghi " jklm " nopq " rstu " vwxyz' 'v l a " S a' '@:abcd@< " fghi " jklm " >nopq " rstu " vwxyz'
ble/keymap:vi_test/check B3b '@:abcd " fghi " jklm " nopq@ " rstu " vwxyz' 'v l a " S a' '@:abcd " fghi " jklm " nopq@< " rstu " >vwxyz'
ble/keymap:vi_test/check B3c '@:abc@d " fghi " jklm " nopq " rstu " vwxyz' 'v l a " S a' '@:abcd @<" fghi " >jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check B3d '@:abcd " fgh@i " jklm " nopq " rstu " vwxyz' 'v l a " S a' '@:abcd @<" fghi " >jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check B3e '@:abcd " fghi " @jklm " nopq " rstu " vwxyz' 'v l a " S a' '@:abcd " fghi " jklm @<" nopq " >rstu " vwxyz'
ble/keymap:vi_test/check B3f '@:abcd " fghi "@ jklm " nopq " rstu " vwxyz' 'v l a " S a' '@:abcd " fghi "@< jklm " nopq " >rstu " vwxyz'
ble/keymap:vi_test/check C1a '@:abc@d " fghi " jklm " nopq " rstu " vwxyz' 'v h i " S a' '@:ab@<cd> " fghi " jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check C1b '@:abcd " @fghi " jklm " nopq " rstu " vwxyz' 'v h i " S a' '@:abcd "@< fghi >" jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check C1c '@:abcd " fghi@ " jklm " nopq " rstu " vwxyz' 'v h i " S a' '@:abcd "@< fghi >" jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check C1d '@:abcd " fghi @" jklm " nopq " rstu " vwxyz' 'v h i " S a' '@:abcd "@< fghi "> jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check C1e '@:abcd " fghi " jkl@m " nopq " rstu " vwxyz' 'v h i " S a' '@:abcd "@< fghi >" jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check C1f '@:abcd " fghi " jkl@m " nopq " rstu " vwxyz' 'v 5 h i " S a' '@:abcd "@< fghi " jklm> " nopq " rstu " vwxyz'
ble/keymap:vi_test/check C2a '@:abc@d " fghi " jklm " nopq " rstu " vwxyz' 'v h 2 i " S a' '@:ab@<cd> " fghi " jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check C2b '@:abcd " @fghi " jklm " nopq " rstu " vwxyz' 'v h 2 i " S a' '@:abcd @<" fghi "> jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check C2c '@:abcd " fghi@ " jklm " nopq " rstu " vwxyz' 'v h 2 i " S a' '@:abcd @<" fghi >" jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check C2d '@:abcd " fghi @" jklm " nopq " rstu " vwxyz' 'v h 2 i " S a' '@:abcd @<" fghi "> jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check C2e '@:abcd " fghi " jkl@m " nopq " rstu " vwxyz' 'v h 2 i " S a' '@:abcd @<" fghi "> jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check C2f '@:abcd " fghi " jkl@m " nopq " rstu " vwxyz' 'v 5 h 2 i " S a' '@:abcd @<" fghi " jklm> " nopq " rstu " vwxyz'
ble/keymap:vi_test/check C3a '@:abc@d " fghi " jklm " nopq " rstu " vwxyz' 'v h a " S a' '@:ab@<cd> " fghi " jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check C3b '@:abcd " @fghi " jklm " nopq " rstu " vwxyz' 'v h a " S a' '@:abcd @<" fghi " >jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check C3c '@:abcd " fghi@ " jklm " nopq " rstu " vwxyz' 'v h a " S a' '@:abcd @<" fghi >" jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check C3d '@:abcd " fghi @" jklm " nopq " rstu " vwxyz' 'v h a " S a' '@:abcd @<" fghi "> jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check C3e '@:abcd " fghi " jkl@m " nopq " rstu " vwxyz' 'v h a " S a' '@:abcd @<" fghi " >jklm " nopq " rstu " vwxyz'
ble/keymap:vi_test/check C3f '@:abcd " fghi " jkl@m " nopq " rstu " vwxyz' 'v 5 h a " S a' '@:abcd @<" fghi " jklm> " nopq " rstu " vwxyz'
ble/test/end-section
}
function ble/keymap:vi_test/section:txtobj_block_omap {
ble/test/start-section "ble/keymap.vi/txtobj_block_omap" 41
ble/keymap:vi_test/check A1a '@:echo @foo ( bar ) baz (hello) world (vim) xxxx' 'd i b' '@:echo foo (@) baz (hello) world (vim) xxxx'
ble/keymap:vi_test/check A1b '@:echo foo@ ( bar ) baz (hello) world (vim) xxxx' 'd i b' '@:echo foo (@) baz (hello) world (vim) xxxx'
ble/keymap:vi_test/check A1c '@:echo foo @( bar ) baz (hello) world (vim) xxxx' 'd i b' '@:echo foo (@) baz (hello) world (vim) xxxx'
ble/keymap:vi_test/check A1d '@:echo foo (@ bar ) baz (hello) world (vim) xxxx' 'd i b' '@:echo foo (@) baz (hello) world (vim) xxxx'
ble/keymap:vi_test/check A1e '@:echo foo ( @bar ) baz (hello) world (vim) xxxx' 'd i b' '@:echo foo (@) baz (hello) world (vim) xxxx'
ble/keymap:vi_test/check A1f '@:echo foo ( bar@ ) baz (hello) world (vim) xxxx' 'd i b' '@:echo foo (@) baz (hello) world (vim) xxxx'
ble/keymap:vi_test/check A1g '@:echo foo ( bar @) baz (hello) world (vim) xxxx' 'd i b' '@:echo foo (@) baz (hello) world (vim) xxxx'
ble/keymap:vi_test/check A1h '@:echo foo ( bar )@ baz (hello) world (vim) xxxx' 'd i b' '@:echo foo ( bar ) baz (@) world (vim) xxxx'
ble/keymap:vi_test/check A1i '@:echo foo ( bar ) @baz (hello) world (vim) xxxx' 'd i b' '@:echo foo ( bar ) baz (@) world (vim) xxxx'
ble/keymap:vi_test/check A1i '@:echo foo ( bar ) baz (hello) world (vim@) xxxx' 'd i b' '@:echo foo ( bar ) baz (hello) world (@) xxxx'
ble/keymap:vi_test/check A1i '@:echo foo ( bar ) baz (hello) world (vim)@ xxxx' 'd i b' '@:echo foo ( bar ) baz (hello) world (vim)@ xxxx'
ble/keymap:vi_test/check A1i '@:echo foo ( bar ) baz (hello) world (vim) @xxxx' 'd i b' '@:echo foo ( bar ) baz (hello) world (vim) @xxxx'
ble/keymap:vi_test/check B1a '@:echo ( @foo ( bar ) baz (hello) world (vim) ) xxxx' 'd i b' '@:echo (@) xxxx'
ble/keymap:vi_test/check B1b '@:echo ( foo @( bar ) baz (hello) world (vim) ) xxxx' 'd i b' '@:echo ( foo (@) baz (hello) world (vim) ) xxxx'
ble/keymap:vi_test/check B1c '@:echo ( foo ( @bar ) baz (hello) world (vim) ) xxxx' 'd i b' '@:echo ( foo (@) baz (hello) world (vim) ) xxxx'
ble/keymap:vi_test/check B1d '@:echo ( foo ( bar @) baz (hello) world (vim) ) xxxx' 'd i b' '@:echo ( foo (@) baz (hello) world (vim) ) xxxx'
ble/keymap:vi_test/check B1e '@:echo ( foo ( bar )@ baz (hello) world (vim) ) xxxx' 'd i b' '@:echo (@) xxxx'
ble/keymap:vi_test/check B1f '@:echo ( foo ( bar ) baz@ (hello) world (vim) ) xxxx' 'd i b' '@:echo (@) xxxx'
ble/keymap:vi_test/check B1g '@:echo ( foo ( bar ) baz @(hello) world (vim) ) xxxx' 'd i b' '@:echo ( foo ( bar ) baz (@) world (vim) ) xxxx'
ble/keymap:vi_test/check B2a '@:echo ( @foo ( bar ) baz (hello) world (vim) ) xxxx' 'd 2 i b' '@:echo ( @foo ( bar ) baz (hello) world (vim) ) xxxx'
ble/keymap:vi_test/check B2b '@:echo ( foo @( bar ) baz (hello) world (vim) ) xxxx' 'd 2 i b' '@:echo (@) xxxx'
ble/keymap:vi_test/check B2c '@:echo ( foo ( @bar ) baz (hello) world (vim) ) xxxx' 'd 2 i b' '@:echo (@) xxxx'
ble/keymap:vi_test/check B2d '@:echo ( foo ( bar @) baz (hello) world (vim) ) xxxx' 'd 2 i b' '@:echo (@) xxxx'
ble/keymap:vi_test/check B2e '@:echo ( foo ( bar )@ baz (hello) world (vim) ) xxxx' 'd 2 i b' '@:echo ( foo ( bar )@ baz (hello) world (vim) ) xxxx'
ble/keymap:vi_test/check B2f '@:echo ( foo ( bar ) baz@ (hello) world (vim) ) xxxx' 'd 2 i b' '@:echo ( foo ( bar ) baz@ (hello) world (vim) ) xxxx'
ble/keymap:vi_test/check B2g '@:echo ( foo ( bar ) baz @(hello) world (vim) ) xxxx' 'd 2 i b' '@:echo (@) xxxx'
ble/keymap:vi_test/check C1a '@:echo ( @foo ( bar ) baz (hello) world (vim) xxxx' 'd i b' '@:echo ( @foo ( bar ) baz (hello) world (vim) xxxx'
ble/keymap:vi_test/check C1b '@:echo ( foo (@ bar ) baz (hello) world (vim) xxxx' 'd i b' '@:echo ( foo (@) baz (hello) world (vim) xxxx'
ble/keymap:vi_test/check C2a '@:echo @foo ( bar ) baz (hello) world (vim) ) xxxx' 'd i b' '@:echo foo (@) baz (hello) world (vim) ) xxxx'
ble/keymap:vi_test/check C2b '@:echo foo (@ bar ) baz (hello) world (vim) ) xxxx' 'd i b' '@:echo foo (@) baz (hello) world (vim) ) xxxx'
ble/keymap:vi_test/check D1a '@:echo @vim) test ( quick ) world ( foo )' 'd i b' '@:echo @vim) test ( quick ) world ( foo )'
ble/keymap:vi_test/check D1a '@:echo vi@m) test ( quick ) world ( foo )' 'd i b' '@:echo vi@m) test ( quick ) world ( foo )'
ble/keymap:vi_test/check D1a '@:echo vim@) test ( quick ) world ( foo )' 'd i b' '@:echo vim) test (@) world ( foo )'
ble/keymap:vi_test/check D1a '@:echo vim) @test ( quick ) world ( foo )' 'd i b' '@:echo vim) test (@) world ( foo )'
ble/keymap:vi_test/check D1a '@:echo vim) test @( quick ) world ( foo )' 'd i b' '@:echo vim) test (@) world ( foo )'
ble/keymap:vi_test/check E1a '@:echo @foo () bar' 'd i b' '@:echo foo (@) bar'
ble/keymap:vi_test/check E1b '@:echo foo @() bar' 'd i b' '@:echo foo (@) bar'
ble/keymap:vi_test/check E1c '@:echo foo (@) bar' 'd i b' '@:echo foo (@) bar'
ble/keymap:vi_test/check E1d '@:echo @foo () bar' 'd a b' '@:echo foo @ bar'
ble/keymap:vi_test/check E1e '@:echo foo @() bar' 'd a b' '@:echo foo @ bar'
ble/keymap:vi_test/check E1f '@:echo foo (@) bar' 'd a b' '@:echo foo @ bar'
ble/test/end-section
}
function ble/keymap:vi_test/section:txtobj_block_xmap {
ble/test/start-section "ble/keymap.vi/txtobj_block_xmap" 145
ble/keymap:vi_test/check A1a '@:echo @( foo ) bar ( baz ) hello ( vim ) world' 'v i b S a' '@:echo (@< foo >) bar ( baz ) hello ( vim ) world'
ble/keymap:vi_test/check A1b '@:echo ( @foo ) bar ( baz ) hello ( vim ) world' 'v i b S a' '@:echo (@< foo >) bar ( baz ) hello ( vim ) world'
ble/keymap:vi_test/check A1c '@:echo ( foo @) bar ( baz ) hello ( vim ) world' 'v i b S a' '@:echo (@< foo >) bar ( baz ) hello ( vim ) world'
ble/keymap:vi_test/check A1d '@:echo ( foo ) @bar ( baz ) hello ( vim ) world' 'v i b S a' '@:echo ( foo ) bar (@< baz >) hello ( vim ) world'
ble/keymap:vi_test/check A1e '@:echo ( foo ) bar ( baz ) hello ( vim ) @world' 'v i b S a' '@:echo ( foo ) bar ( baz ) hello ( vim ) @<w>orld'
ble/keymap:vi_test/check B1a '@:echo ( @( foo ) bar ( baz ) hello ) ( vim ) world' 'v i b S a' '@:echo ( (@< foo >) bar ( baz ) hello ) ( vim ) world'
ble/keymap:vi_test/check B1b '@:echo ( @( foo ) bar ( baz ) hello ) ( vim ) world' 'v 1 i b S a' '@:echo ( (@< foo >) bar ( baz ) hello ) ( vim ) world'
ble/keymap:vi_test/check B1c '@:echo ( @( foo ) bar ( baz ) hello ) ( vim ) world' 'v 2 i b S a' '@:echo (@< ( foo ) bar ( baz ) hello >) ( vim ) world'
ble/keymap:vi_test/check B1d '@:echo ( @( foo ) bar ( baz ) hello ) ( vim ) world' 'v 3 i b S a' '@:echo ( @<(> foo ) bar ( baz ) hello ) ( vim ) world'
ble/keymap:vi_test/check B2a '@:echo ( ( @foo ) bar ( baz ) hello ) ( vim ) world' 'v i b S a' '@:echo ( (@< foo >) bar ( baz ) hello ) ( vim ) world'
ble/keymap:vi_test/check B2b '@:echo ( ( @foo ) bar ( baz ) hello ) ( vim ) world' 'v 1 i b S a' '@:echo ( (@< foo >) bar ( baz ) hello ) ( vim ) world'
ble/keymap:vi_test/check B2c '@:echo ( ( @foo ) bar ( baz ) hello ) ( vim ) world' 'v 2 i b S a' '@:echo (@< ( foo ) bar ( baz ) hello >) ( vim ) world'
ble/keymap:vi_test/check B2d '@:echo ( ( @foo ) bar ( baz ) hello ) ( vim ) world' 'v 3 i b S a' '@:echo ( ( @<f>oo ) bar ( baz ) hello ) ( vim ) world'
ble/keymap:vi_test/check B3a '@:echo ( ( foo @) bar ( baz ) hello ) ( vim ) world' 'v i b S a' '@:echo ( (@< foo >) bar ( baz ) hello ) ( vim ) world'
ble/keymap:vi_test/check B3b '@:echo ( ( foo @) bar ( baz ) hello ) ( vim ) world' 'v 1 i b S a' '@:echo ( (@< foo >) bar ( baz ) hello ) ( vim ) world'
ble/keymap:vi_test/check B3c '@:echo ( ( foo @) bar ( baz ) hello ) ( vim ) world' 'v 2 i b S a' '@:echo (@< ( foo ) bar ( baz ) hello >) ( vim ) world'
ble/keymap:vi_test/check B3d '@:echo ( ( foo @) bar ( baz ) hello ) ( vim ) world' 'v 3 i b S a' '@:echo ( ( foo @<)> bar ( baz ) hello ) ( vim ) world'
ble/keymap:vi_test/check B4a '@:echo ( ( foo ) @bar ( baz ) hello ) ( vim ) world' 'v i b S a' '@:echo (@< ( foo ) bar ( baz ) hello >) ( vim ) world'
ble/keymap:vi_test/check B4b '@:echo ( ( foo ) @bar ( baz ) hello ) ( vim ) world' 'v 1 i b S a' '@:echo (@< ( foo ) bar ( baz ) hello >) ( vim ) world'
ble/keymap:vi_test/check B4c '@:echo ( ( foo ) @bar ( baz ) hello ) ( vim ) world' 'v 2 i b S a' '@:echo ( ( foo ) @<b>ar ( baz ) hello ) ( vim ) world'
ble/keymap:vi_test/check C1a '@:echo ( ( @foo ) bar ( baz ) hello' 'v i b S a' '@:echo ( (@< foo >) bar ( baz ) hello'
ble/keymap:vi_test/check C1b '@:echo ( ( foo ) @bar ( baz ) hello' 'v i b S a' '@:echo ( ( foo ) @<b>ar ( baz ) hello'
ble/keymap:vi_test/check D1a '@:echo ( @foo bar' 'v i b S a' '@:echo ( @<f>oo bar'
ble/keymap:vi_test/check E1a '@:echo (vim) test ( quick ) world ( @foo bar' 'v i b S a' '@:echo (vim) test ( quick ) world ( @<f>oo bar'
ble/keymap:vi_test/check E1b '@:echo (vim) test ( quick ) @world ( foo bar' 'v i b S a' '@:echo (vim) test ( quick ) @<w>orld ( foo bar'
ble/keymap:vi_test/check E1c '@:echo (vim) test ( @quick ) world ( foo bar' 'v i b S a' '@:echo (vim) test (@< quick >) world ( foo bar'
ble/keymap:vi_test/check E1d '@:echo (vim) @test ( quick ) world ( foo bar' 'v i b S a' '@:echo (vim) test (@< quick >) world ( foo bar'
ble/keymap:vi_test/check E1e '@:echo (@vim) test ( quick ) world ( foo bar' 'v i b S a' '@:echo (@<vim>) test ( quick ) world ( foo bar'
ble/keymap:vi_test/check F1a '@:echo @vim) test ( quick ) world ( foo )' 'v i b S a' '@:echo @<v>im) test ( quick ) world ( foo )'
ble/keymap:vi_test/check F1b '@:echo vim@) test ( quick ) world ( foo )' 'v i b S a' '@:echo vim) test (@< quick >) world ( foo )'
ble/keymap:vi_test/check F1c '@:echo vim) @test ( quick ) world ( foo )' 'v i b S a' '@:echo vim) test (@< quick >) world ( foo )'
ble/keymap:vi_test/check F1d '@:echo vim) test @( quick ) world ( foo )' 'v i b S a' '@:echo vim) test (@< quick >) world ( foo )'
ble/keymap:vi_test/check F1e '@:echo vim) test ( quick ) @world ( foo )' 'v i b S a' '@:echo vim) test ( quick ) world (@< foo >)'
ble/keymap:vi_test/check G1a '@:echo @foo () (bar)' 'v i b S a' '@:echo foo @<()> (bar)'
ble/keymap:vi_test/check G1b '@:echo foo @() (bar)' 'v i b S a' '@:echo foo @<(>) (bar)'
ble/keymap:vi_test/check G1c '@:echo foo (@) (bar)' 'v i b S a' '@:echo foo (@<)> (bar)'
ble/keymap:vi_test/check G2a '@:echo @foo () (bar)' 'v a b S a' '@:echo foo @<()> (bar)'
ble/keymap:vi_test/check G2b '@:echo foo @() (bar)' 'v a b S a' '@:echo foo @<(>) (bar)'
ble/keymap:vi_test/check G2c '@:echo foo (@) (bar)' 'v a b S a' '@:echo foo (@<)> (bar)'
ble/keymap:vi_test/check G3a '@:echo @foo () (bar)' 'v i b h S a' '@:echo foo@< ()> (bar)'
ble/keymap:vi_test/check G3b '@:echo @foo () (bar)' 'v a b l S a' '@:echo foo @<() >(bar)'
ble/keymap:vi_test/check H1a $'@:echo (\nhello @world\n)' 'v i b S a' $'@:echo (\n@<hello world\n>)'
ble/keymap:vi_test/check H2a $'@:echo (\nhello @world\n\n)' 'v i b S a' $'@:echo (\n@<hello world\n\n>)'
ble/keymap:vi_test/check I1a '@:echo @foo ( bar ) baz (hello) vim (world) this' 'v 1 l i b S a' '@:echo foo (@< bar >) baz (hello) vim (world) this'
ble/keymap:vi_test/check I1b '@:echo @foo ( bar ) baz (hello) vim (world) this' 'v 4 l i b S a' '@:echo foo (@< bar >) baz (hello) vim (world) this'
ble/keymap:vi_test/check I1c '@:echo @foo ( bar ) baz (hello) vim (world) this' 'v 6 l i b S a' '@:echo foo (@< bar >) baz (hello) vim (world) this'
ble/keymap:vi_test/check I1d '@:echo @foo ( bar ) baz (hello) vim (world) this' 'v 9 l i b S a' '@:echo @<foo ( bar >) baz (hello) vim (world) this'
ble/keymap:vi_test/check I1e '@:echo @foo ( bar ) baz (hello) vim (world) this' 'v 1 0 l i b S a' '@:echo @<foo ( bar )> baz (hello) vim (world) this'
ble/keymap:vi_test/check I1f '@:echo @foo ( bar ) baz (hello) vim (world) this' 'v 1 2 l i b S a' '@:echo @<foo ( bar ) b>az (hello) vim (world) this'
ble/keymap:vi_test/check I1g '@:echo @foo ( bar ) baz (hello) vim (world) this' 'v 1 6 l i b S a' '@:echo @<foo ( bar ) baz (>hello) vim (world) this'
ble/keymap:vi_test/check I1h '@:echo @foo ( bar ) baz (hello) vim (world) this' 'v 1 8 l i b S a' '@:echo @<foo ( bar ) baz (he>llo) vim (world) this'
ble/keymap:vi_test/check I2a '@:echo foo @( bar ) baz (hello) vim (world) this' 'v 1 l i b S a' '@:echo foo @<( >bar ) baz (hello) vim (world) this'
ble/keymap:vi_test/check I2b '@:echo foo @( bar ) baz (hello) vim (world) this' 'v 2 l i b S a' '@:echo foo @<( b>ar ) baz (hello) vim (world) this'
ble/keymap:vi_test/check I2c '@:echo foo @( bar ) baz (hello) vim (world) this' 'v 6 l i b S a' '@:echo foo @<( bar )> baz (hello) vim (world) this'
ble/keymap:vi_test/check I2d '@:echo foo @( bar ) baz (hello) vim (world) this' 'v 8 l i b S a' '@:echo foo @<( bar ) b>az (hello) vim (world) this'
ble/keymap:vi_test/check I2e '@:echo foo @( bar ) baz (hello) vim (world) this' 'v 1 2 l i b S a' '@:echo foo @<( bar ) baz (>hello) vim (world) this'
ble/keymap:vi_test/check I2f '@:echo foo @( bar ) baz (hello) vim (world) this' 'v 1 4 l i b S a' '@:echo foo @<( bar ) baz (he>llo) vim (world) this'
ble/keymap:vi_test/check I2g '@:echo foo @( bar ) baz (hello) vim (world) this' 'v 2 0 l i b S a' '@:echo foo @<( bar ) baz (hello) v>im (world) this'
ble/keymap:vi_test/check I3a '@:echo foo (@ bar ) baz (hello) vim (world) this' 'v 1 l i b S a' '@:echo foo (@< bar >) baz (hello) vim (world) this'
ble/keymap:vi_test/check I3b '@:echo foo (@ bar ) baz (hello) vim (world) this' 'v 4 l i b S a' '@:echo foo (@< bar >) baz (hello) vim (world) this'
ble/keymap:vi_test/check I3c '@:echo foo (@ bar ) baz (hello) vim (world) this' 'v 6 l i b S a' '@:echo foo (@< bar >) baz (hello) vim (world) this'
ble/keymap:vi_test/check I3d '@:echo foo (@ bar ) baz (hello) vim (world) this' 'v 1 0 l i b S a' '@:echo foo (@< bar >) baz (hello) vim (world) this'
ble/keymap:vi_test/check I3e '@:echo foo (@ bar ) baz (hello) vim (world) this' 'v 1 2 l i b S a' '@:echo foo (@< bar >) baz (hello) vim (world) this'
ble/keymap:vi_test/check I3f '@:echo foo (@ bar ) baz (hello) vim (world) this' 'v 1 6 l i b S a' '@:echo foo (@< bar >) baz (hello) vim (world) this'
ble/keymap:vi_test/check I3g '@:echo foo (@ bar ) baz (hello) vim (world) this' 'v 1 8 l i b S a' '@:echo foo (@< bar >) baz (hello) vim (world) this'
ble/keymap:vi_test/check I4a '@:echo foo ( @bar ) baz (hello) vim (world) this' 'v 1 l i b S a' '@:echo foo (@< bar >) baz (hello) vim (world) this'
ble/keymap:vi_test/check I4b '@:echo foo ( @bar ) baz (hello) vim (world) this' 'v 4 l i b S a' '@:echo foo (@< bar >) baz (hello) vim (world) this'
ble/keymap:vi_test/check I4c '@:echo foo ( @bar ) baz (hello) vim (world) this' 'v 6 l i b S a' '@:echo foo (@< bar >) baz (hello) vim (world) this'
ble/keymap:vi_test/check I4d '@:echo foo ( @bar ) baz (hello) vim (world) this' 'v 1 0 l i b S a' '@:echo foo (@< bar >) baz (hello) vim (world) this'
ble/keymap:vi_test/check I4e '@:echo foo ( @bar ) baz (hello) vim (world) this' 'v 1 2 l i b S a' '@:echo foo (@< bar >) baz (hello) vim (world) this'
ble/keymap:vi_test/check I4f '@:echo foo ( @bar ) baz (hello) vim (world) this' 'v 1 6 l i b S a' '@:echo foo (@< bar >) baz (hello) vim (world) this'
ble/keymap:vi_test/check I4g '@:echo foo ( @bar ) baz (hello) vim (world) this' 'v 1 8 l i b S a' '@:echo foo (@< bar >) baz (hello) vim (world) this'
ble/keymap:vi_test/check I5a '@:echo @foo ( bar ) baz (hello) vim (world) this' 'v 1 l a b S a' '@:echo foo @<( bar )> baz (hello) vim (world) this'
ble/keymap:vi_test/check I5b '@:echo @foo ( bar ) baz (hello) vim (world) this' 'v 4 l a b S a' '@:echo foo @<( bar )> baz (hello) vim (world) this'
ble/keymap:vi_test/check I5c '@:echo @foo ( bar ) baz (hello) vim (world) this' 'v 6 l a b S a' '@:echo foo @<( bar )> baz (hello) vim (world) this'
ble/keymap:vi_test/check I5d '@:echo @foo ( bar ) baz (hello) vim (world) this' 'v 9 l a b S a' '@:echo foo @<( bar )> baz (hello) vim (world) this'
ble/keymap:vi_test/check I5e '@:echo @foo ( bar ) baz (hello) vim (world) this' 'v 1 0 l a b S a' '@:echo foo @<( bar )> baz (hello) vim (world) this'
ble/keymap:vi_test/check I5f '@:echo @foo ( bar ) baz (hello) vim (world) this' 'v 1 2 l a b S a' '@:echo foo @<( bar )> baz (hello) vim (world) this'
ble/keymap:vi_test/check I5g '@:echo @foo ( bar ) baz (hello) vim (world) this' 'v 1 6 l a b S a' '@:echo foo @<( bar )> baz (hello) vim (world) this'
ble/keymap:vi_test/check I5h '@:echo @foo ( bar ) baz (hello) vim (world) this' 'v 1 8 l a b S a' '@:echo foo @<( bar )> baz (hello) vim (world) this'
ble/keymap:vi_test/check J1a '@:echo ( @foo ( bar ) baz (hello) vim (world) this )' 'v 1 l i b S a' '@:echo (@< foo ( bar ) baz (hello) vim (world) this >)'
ble/keymap:vi_test/check J1b '@:echo ( @foo ( bar ) baz (hello) vim (world) this )' 'v 2 l i b S a' '@:echo (@< foo ( bar ) baz (hello) vim (world) this >)'
ble/keymap:vi_test/check J1c '@:echo ( @foo ( bar ) baz (hello) vim (world) this )' 'v 4 l i b S a' '@:echo (@< foo ( bar ) baz (hello) vim (world) this >)'
ble/keymap:vi_test/check J1d '@:echo ( @foo ( bar ) baz (hello) vim (world) this )' 'v 6 l i b S a' '@:echo (@< foo ( bar ) baz (hello) vim (world) this >)'
ble/keymap:vi_test/check J1e '@:echo ( @foo ( bar ) baz (hello) vim (world) this )' 'v 1 0 l i b S a' '@:echo (@< foo ( bar ) baz (hello) vim (world) this >)'
ble/keymap:vi_test/check J1f '@:echo ( @foo ( bar ) baz (hello) vim (world) this )' 'v 1 2 l i b S a' '@:echo (@< foo ( bar ) baz (hello) vim (world) this >)'
ble/keymap:vi_test/check J1g '@:echo ( @foo ( bar ) baz (hello) vim (world) this )' 'v 1 6 l i b S a' '@:echo (@< foo ( bar ) baz (hello) vim (world) this >)'
ble/keymap:vi_test/check J2a '@:echo ( foo @( bar ) baz (hello) vim (world) this )' 'v 1 l i b S a' '@:echo (@< foo ( bar ) baz (hello) vim (world) this >)'
ble/keymap:vi_test/check J2b '@:echo ( foo @( bar ) baz (hello) vim (world) this )' 'v 2 l i b S a' '@:echo (@< foo ( bar ) baz (hello) vim (world) this >)'
ble/keymap:vi_test/check J2c '@:echo ( foo @( bar ) baz (hello) vim (world) this )' 'v 4 l i b S a' '@:echo (@< foo ( bar ) baz (hello) vim (world) this >)'
ble/keymap:vi_test/check J2d '@:echo ( foo @( bar ) baz (hello) vim (world) this )' 'v 6 l i b S a' '@:echo (@< foo ( bar ) baz (hello) vim (world) this >)'
ble/keymap:vi_test/check J2e '@:echo ( foo @( bar ) baz (hello) vim (world) this )' 'v 1 0 l i b S a' '@:echo (@< foo ( bar ) baz (hello) vim (world) this >)'
ble/keymap:vi_test/check J2f '@:echo ( foo @( bar ) baz (hello) vim (world) this )' 'v 1 2 l i b S a' '@:echo (@< foo ( bar ) baz (hello) vim (world) this >)'
ble/keymap:vi_test/check J2g '@:echo ( foo @( bar ) baz (hello) vim (world) this )' 'v 1 6 l i b S a' '@:echo (@< foo ( bar ) baz (hello) vim (world) this >)'
ble/keymap:vi_test/check J3a '@:echo ( foo ( @bar ) baz (hello) vim (world) this )' 'v 1 l i b S a' '@:echo ( foo (@< bar >) baz (hello) vim (world) this )'
ble/keymap:vi_test/check J3b '@:echo ( foo ( @bar ) baz (hello) vim (world) this )' 'v 2 l i b S a' '@:echo ( foo (@< bar >) baz (hello) vim (world) this )'
ble/keymap:vi_test/check J3c '@:echo ( foo ( @bar ) baz (hello) vim (world) this )' 'v 4 l i b S a' '@:echo ( foo (@< bar >) baz (hello) vim (world) this )'
ble/keymap:vi_test/check J3d '@:echo ( foo ( @bar ) baz (hello) vim (world) this )' 'v 6 l i b S a' '@:echo ( foo (@< bar >) baz (hello) vim (world) this )'
ble/keymap:vi_test/check J3e '@:echo ( foo ( @bar ) baz (hello) vim (world) this )' 'v 1 0 l i b S a' '@:echo ( foo (@< bar >) baz (hello) vim (world) this )'
ble/keymap:vi_test/check J3f '@:echo ( foo ( @bar ) baz (hello) vim (world) this )' 'v 1 2 l i b S a' '@:echo ( foo (@< bar >) baz (hello) vim (world) this )'
ble/keymap:vi_test/check J3g '@:echo ( foo ( @bar ) baz (hello) vim (world) this )' 'v 1 6 l i b S a' '@:echo ( foo (@< bar >) baz (hello) vim (world) this )'
ble/keymap:vi_test/check J3h '@:echo ( foo ( @bar ) baz (hello) vim (world) this )' 'v 1 8 l i b S a' '@:echo ( foo (@< bar >) baz (hello) vim (world) this )'
ble/keymap:vi_test/check K1a '@:echo foo @(bar (check) ) world' 'v 1 l i b S a' '@:echo foo (bar (@<check>) ) world'
ble/keymap:vi_test/check K1b '@:echo foo @(bar (check) ) world' 'v 4 l i b S a' '@:echo foo (bar (@<check>) ) world'
ble/keymap:vi_test/check K1c '@:echo foo @(bar (check) ) world' 'v 5 l i b S a' '@:echo foo (bar (@<check>) ) world'
ble/keymap:vi_test/check K1d '@:echo foo @(bar (check) ) world' 'v 7 l i b S a' '@:echo foo (bar (@<check>) ) world'
ble/keymap:vi_test/check K1e '@:echo foo @(bar (check) ) world' 'v 9 l i b S a' '@:echo foo (bar (@<check>) ) world'
ble/keymap:vi_test/check K1f '@:echo foo @(bar (check) ) world' 'v 1 0 l i b S a' '@:echo foo @<(bar (check>) ) world'
ble/keymap:vi_test/check K1g '@:echo foo @(bar (check) ) world' 'v 1 1 l i b S a' '@:echo foo @<(bar (check)> ) world'
ble/keymap:vi_test/check K1h '@:echo foo @(bar (check) ) world' 'v 1 2 l i b S a' '@:echo foo @<(bar (check) >) world'
ble/keymap:vi_test/check K1i '@:echo foo @(bar (check) ) world' 'v 1 3 l i b S a' '@:echo foo @<(bar (check) )> world'
ble/keymap:vi_test/check L1a '@:echo foo @(bar () ) world' 'v 1 l i b S a' '@:echo foo (bar @<()> ) world'
ble/keymap:vi_test/check L1b '@:echo foo @(bar () ) world' 'v 1 l i b h S a' '@:echo foo (bar@< ()> ) world'
ble/keymap:vi_test/check L1c '@:echo foo @(bar () ) world' 'v 1 l a b S a' '@:echo foo (bar @<()> ) world'
ble/keymap:vi_test/check L1d '@:echo foo @(bar () ) world' 'v 1 l a b l S a' '@:echo foo (bar @<() >) world'
ble/keymap:vi_test/check L2a '@:echo foo (bar @() ) world' 'v 1 l i b S a' '@:echo foo (@<bar () >) world'
ble/keymap:vi_test/check L2b '@:echo foo (bar @() ) world' 'v 2 l i b S a' '@:echo foo (@<bar () >) world'
ble/keymap:vi_test/check L2c '@:echo foo (bar @() ) world' 'v 3 l i b S a' '@:echo foo (@<bar () >) world'
ble/keymap:vi_test/check L2d '@:echo foo (bar @() ) world' 'v 4 l i b S a' '@:echo foo (@<bar () >) world'
ble/keymap:vi_test/check L3a '@:echo foo (bar (@) ) world' 'v 1 l i b S a' '@:echo foo (@<bar () >) world'
ble/keymap:vi_test/check L3b '@:echo foo (bar (@) ) world' 'v 2 l i b S a' '@:echo foo (@<bar () >) world'
ble/keymap:vi_test/check L3c '@:echo foo (bar (@) ) world' 'v 3 l i b S a' '@:echo foo (@<bar () >) world'
ble/keymap:vi_test/check L3d '@:echo foo (bar (@) ) world' 'v 4 l i b S a' '@:echo foo (@<bar () >) world'
ble/keymap:vi_test/check M1a '@:echo (foo @(bar (check) ) world) xxxx' 'v 1 l i b S a' '@:echo (@<foo (bar (check) ) world>) xxxx'
ble/keymap:vi_test/check M1b '@:echo (foo @(bar (check) ) world) xxxx' 'v 5 l i b S a' '@:echo (@<foo (bar (check) ) world>) xxxx'
ble/keymap:vi_test/check M1c '@:echo (foo @(bar (check) ) world) xxxx' 'v 7 l i b S a' '@:echo (@<foo (bar (check) ) world>) xxxx'
ble/keymap:vi_test/check M1d '@:echo (foo @(bar (check) ) world) xxxx' 'v 1 1 l i b S a' '@:echo (@<foo (bar (check) ) world>) xxxx'
ble/keymap:vi_test/check M1e '@:echo (foo @(bar (check) ) world) xxxx' 'v 1 2 l i b S a' '@:echo (@<foo (bar (check) ) world>) xxxx'
ble/keymap:vi_test/check M1f '@:echo (foo @(bar (check) ) world) xxxx' 'v 1 3 l i b S a' '@:echo (@<foo (bar (check) ) world>) xxxx'
ble/keymap:vi_test/check M1g '@:echo (foo @(bar (check) ) world) xxxx' 'v 1 4 l i b S a' '@:echo (@<foo (bar (check) ) world>) xxxx'
ble/keymap:vi_test/check M1h '@:echo (foo @(bar (check) ) world) xxxx' 'v 2 0 l i b S a' '@:echo (@<foo (bar (check) ) world>) xxxx'
ble/keymap:vi_test/check M1i '@:echo (foo @(bar (check) ) world) xxxx' 'v 2 4 l i b S a' '@:echo (@<foo (bar (check) ) world>) xxxx'
ble/keymap:vi_test/check M2a '@:echo (foo (@bar (check) ) world) xxxx' 'v 1 l i b S a' '@:echo (foo (@<bar (check) >) world) xxxx'
ble/keymap:vi_test/check M2b '@:echo (foo (@bar (check) ) world) xxxx' 'v 4 l i b S a' '@:echo (foo (@<bar (check) >) world) xxxx'
ble/keymap:vi_test/check M2c '@:echo (foo (@bar (check) ) world) xxxx' 'v 6 l i b S a' '@:echo (foo (@<bar (check) >) world) xxxx'
ble/keymap:vi_test/check M2d '@:echo (foo (@bar (check) ) world) xxxx' 'v 1 0 l i b S a' '@:echo (foo (@<bar (check) >) world) xxxx'
ble/keymap:vi_test/check M2e '@:echo (foo (@bar (check) ) world) xxxx' 'v 1 1 l i b S a' '@:echo (@<foo (bar (check) ) world>) xxxx'
ble/keymap:vi_test/check M2f '@:echo (foo (@bar (check) ) world) xxxx' 'v 1 2 l i b S a' '@:echo (@<foo (bar (check) ) world>) xxxx'
ble/keymap:vi_test/check M2g '@:echo (foo (@bar (check) ) world) xxxx' 'v 1 3 l i b S a' '@:echo (@<foo (bar (check) ) world>) xxxx'
ble/keymap:vi_test/check M2h '@:echo (foo (@bar (check) ) world) xxxx' 'v 1 9 l i b S a' '@:echo (@<foo (bar (check) ) world>) xxxx'
ble/keymap:vi_test/check M2i '@:echo (foo (@bar (check) ) world) xxxx' 'v 2 3 l i b S a' '@:echo (@<foo (bar (check) ) world>) xxxx'
ble/keymap:vi_test/check M3a '@:echo (foo (@bar (check) ) world xxxx' 'v 1 4 l i b S a' '@:echo (foo (@<bar (check) ) w>orld xxxx'
ble/keymap:vi_test/check M3b '@:echo foo (@bar (check) ) world) xxxx' 'v 1 4 l i b S a' '@:echo foo (@<bar (check) ) w>orld) xxxx'
ble/keymap:vi_test/check N1a $'@:echo ( foo (\n@hello world\n) bar )' 'v $ i b S a' $'@:echo (@< foo (\nhello world\n) bar >)'
ble/keymap:vi_test/check N1b $'@:echo ( foo (\n@hello world\n) bar )' 'v f d i b S a' $'@:echo (@< foo (\nhello world\n) bar >)'
ble/test/end-section
}
function ble/keymap:vi_test/section:txtobj_word {
ble/test/start-section "ble/keymap.vi/txtobj_word_omap" 79
ble/keymap:vi_test/check A1/iw '@:echo he@llo world "hello" "world"' 'd i w' '@:echo @ world "hello" "world"'
ble/keymap:vi_test/check A1/aw '@:echo he@llo world "hello" "world"' 'd a w' '@:echo @world "hello" "world"'
ble/keymap:vi_test/check A2/iw '@:echo hello@ world "hello" "world"' 'd i w' '@:echo hello@world "hello" "world"'
ble/keymap:vi_test/check A2/aw '@:echo hello@ world "hello" "world"' 'd a w' '@:echo hello@ "hello" "world"'
ble/keymap:vi_test/check A3/iw '@:echo hello world "he@llo" "world"' 'd i w' '@:echo hello world "@" "world"'
ble/keymap:vi_test/check A3/aw '@:echo hello world "he@llo" "world"' 'd a w' '@:echo hello world "@" "world"'
ble/keymap:vi_test/check A4/iw '@:echo hello world @"hello" "world"' 'd i w' '@:echo hello world @hello" "world"'
ble/keymap:vi_test/check A4/aw '@:echo hello world @"hello" "world"' 'd a w' '@:echo hello world@hello" "world"'
ble/keymap:vi_test/check A5/iw '@:echo hello world "hello@" "world"' 'd i w' '@:echo hello world "hello@ "world"'
ble/keymap:vi_test/check A5/aw '@:echo hello world "hello@" "world"' 'd a w' '@:echo hello world "hello@"world"'
ble/keymap:vi_test/check A1/2iw '@:echo he@llo world "hello" "world"' 'd 2 i w' '@:echo @world "hello" "world"'
ble/keymap:vi_test/check A1/2aw '@:echo he@llo world "hello" "world"' 'd 2 a w' '@:echo @"hello" "world"'
ble/keymap:vi_test/check A2/2iw '@:echo hello@ world "hello" "world"' 'd 2 i w' '@:echo hello@ "hello" "world"'
ble/keymap:vi_test/check A2/2aw '@:echo hello@ world "hello" "world"' 'd 2 a w' '@:echo hello@hello" "world"'
ble/keymap:vi_test/check A3/2iw '@:echo hello world "he@llo" "world"' 'd 2 i w' '@:echo hello world "@ "world"'
ble/keymap:vi_test/check A3/2aw '@:echo hello world "he@llo" "world"' 'd 2 a w' '@:echo hello world "@"world"'
ble/keymap:vi_test/check A4/2iw '@:echo hello world @"hello" "world"' 'd 2 i w' '@:echo hello world @" "world"'
ble/keymap:vi_test/check A4/2aw '@:echo hello world @"hello" "world"' 'd 2 a w' '@:echo hello world@" "world"'
ble/keymap:vi_test/check A5/2iw '@:echo hello world "hello@" "world"' 'd 2 i w' '@:echo hello world "hello@"world"'
ble/keymap:vi_test/check A5/2aw '@:echo hello world "hello@" "world"' 'd 2 a w' '@:echo hello world "hello@world"'
ble/keymap:vi_test/check A6/iw $'@:echo@ \n hello world' 'd i w' $'@:ech@o\n hello world'
ble/keymap:vi_test/check A6/aw $'@:echo@ \n hello world' 'd a w' $'@:echo@ world'
ble/keymap:vi_test/check A7.2/iw $'@:echo\n@\nhello\n\nworld\nZ' 'd i w' $'@:echo\n@\nhello\n\nworld\nZ'
ble/keymap:vi_test/check A7.2/aw $'@:echo\n@\nhello\n\nworld\nZ' 'd a w' $'@:echo\n@\nworld\nZ'
ble/keymap:vi_test/check A7.2/2iw $'@:echo\n@\nhello\n\nworld\nZ' 'd 2 i w' $'@:echo\n@\nworld\nZ'
ble/keymap:vi_test/check A7.2/2aw $'@:echo\n@\nhello\n\nworld\nZ' 'd 2 a w' $'@:echo\n@Z'
ble/keymap:vi_test/check A7.1/1diw $'@:echo\n@\nhello\nworld\nZ' 'd 1 i w' $'@:echo\n@\nhello\nworld\nZ'
ble/keymap:vi_test/check A7.1/2diw $'@:echo\n@\nhello\nworld\nZ' 'd 2 i w' $'@:echo\n@world\nZ'
ble/keymap:vi_test/check A7.1/3diw $'@:echo\n@\nhello\nworld\nZ' 'd 3 i w' $'@:echo\n@Z'
ble/keymap:vi_test/check A7.2/1diw $'@:echo\n@\nhello\n\nworld\nZ' 'd 1 i w' $'@:echo\n@\nhello\n\nworld\nZ'
ble/keymap:vi_test/check A7.2/2diw $'@:echo\n@\nhello\n\nworld\nZ' 'd 2 i w' $'@:echo\n@\nworld\nZ'
ble/keymap:vi_test/check A7.2/3diw $'@:echo\n@\nhello\n\nworld\nZ' 'd 3 i w' $'@:echo\n@world\nZ'
ble/keymap:vi_test/check A7.2/4diw $'@:echo\n@\nhello\n\nworld\nZ' 'd 4 i w' $'@:echo\n@Z'
ble/keymap:vi_test/check A7.3/1diw $'@:echo\n@\nhello\n\n\nworld\nZ' 'd 1 i w' $'@:echo\n@\nhello\n\n\nworld\nZ'
ble/keymap:vi_test/check A7.3/2diw $'@:echo\n@\nhello\n\n\nworld\nZ' 'd 2 i w' $'@:echo\n@\n\nworld\nZ'
ble/keymap:vi_test/check A7.3/3diw $'@:echo\n@\nhello\n\n\nworld\nZ' 'd 3 i w' $'@:echo\n@\nworld\nZ'
ble/keymap:vi_test/check A7.3/4diw $'@:echo\n@\nhello\n\n\nworld\nZ' 'd 4 i w' $'@:echo\n@Z'
ble/keymap:vi_test/check A7.4/1diw $'@:echo\n@\nhello\n\n\n\nworld\nZ' 'd 1 i w' $'@:echo\n@\nhello\n\n\n\nworld\nZ'
ble/keymap:vi_test/check A7.4/2diw $'@:echo\n@\nhello\n\n\n\nworld\nZ' 'd 2 i w' $'@:echo\n@\n\n\nworld\nZ'
ble/keymap:vi_test/check A7.4/3diw $'@:echo\n@\nhello\n\n\n\nworld\nZ' 'd 3 i w' $'@:echo\n@\n\nworld\nZ'
ble/keymap:vi_test/check A7.4/4diw $'@:echo\n@\nhello\n\n\n\nworld\nZ' 'd 4 i w' $'@:echo\n@world\nZ'
ble/keymap:vi_test/check A7.4/5diw $'@:echo\n@\nhello\n\n\n\nworld\nZ' 'd 5 i w' $'@:echo\n@Z'
ble/keymap:vi_test/check A7.5/1diw $'@:echo\n@\nhello\n\n\n\n\nworld\nZ' 'd 1 i w' $'@:echo\n@\nhello\n\n\n\n\nworld\nZ'
ble/keymap:vi_test/check A7.5/2diw $'@:echo\n@\nhello\n\n\n\n\nworld\nZ' 'd 2 i w' $'@:echo\n@\n\n\n\nworld\nZ'
ble/keymap:vi_test/check A7.5/3diw $'@:echo\n@\nhello\n\n\n\n\nworld\nZ' 'd 3 i w' $'@:echo\n@\n\n\nworld\nZ'
ble/keymap:vi_test/check A7.5/4diw $'@:echo\n@\nhello\n\n\n\n\nworld\nZ' 'd 4 i w' $'@:echo\n@\nworld\nZ'
ble/keymap:vi_test/check A7.5/5diw $'@:echo\n@\nhello\n\n\n\n\nworld\nZ' 'd 5 i w' $'@:echo\n@Z'
local A7_a=$'@:echo\n@\nhello\n\n\n\n\n\n\n\n\n\nworld\nZ'
ble/keymap:vi_test/check A7.a/1ciw "$A7_a" 'c 1 i w' $'@:echo\n@\nhello\n\n\n\n\n\n\n\n\n\nworld\nZ'
ble/keymap:vi_test/check A7.a/2ciw "$A7_a" 'c 2 i w' $'@:echo\n@\n\n\n\n\n\n\n\n\n\nworld\nZ'
ble/keymap:vi_test/check A7.a/3ciw "$A7_a" 'c 3 i w' $'@:echo\n@\n\n\n\n\n\n\n\n\nworld\nZ'
ble/keymap:vi_test/check A7.a/4ciw "$A7_a" 'c 4 i w' $'@:echo\n@\n\n\n\n\n\n\nworld\nZ'
ble/keymap:vi_test/check A7.a/5ciw "$A7_a" 'c 5 i w' $'@:echo\n@\n\n\n\n\nworld\nZ'
ble/keymap:vi_test/check A7.a/6ciw "$A7_a" 'c 6 i w' $'@:echo\n@\n\n\nworld\nZ'
ble/keymap:vi_test/check A7.a/7ciw "$A7_a" 'c 7 i w' $'@:echo\n@\nworld\nZ'
ble/keymap:vi_test/check A7.a/8ciw "$A7_a" 'c 8 i w' $'@:echo\n@\nZ'
ble/keymap:vi_test/check A7.a/1diw "$A7_a" 'd 1 i w' $'@:echo\n@\nhello\n\n\n\n\n\n\n\n\n\nworld\nZ'
ble/keymap:vi_test/check A7.a/2diw "$A7_a" 'd 2 i w' $'@:echo\n@\n\n\n\n\n\n\n\n\nworld\nZ'
ble/keymap:vi_test/check A7.a/3diw "$A7_a" 'd 3 i w' $'@:echo\n@\n\n\n\n\n\n\n\nworld\nZ'
ble/keymap:vi_test/check A7.a/4diw "$A7_a" 'd 4 i w' $'@:echo\n@\n\n\n\n\n\nworld\nZ'
ble/keymap:vi_test/check A7.a/5diw "$A7_a" 'd 5 i w' $'@:echo\n@\n\n\n\nworld\nZ'
ble/keymap:vi_test/check A7.a/6diw "$A7_a" 'd 6 i w' $'@:echo\n@\n\nworld\nZ'
ble/keymap:vi_test/check A7.a/7diw "$A7_a" 'd 7 i w' $'@:echo\n@world\nZ'
ble/keymap:vi_test/check A7.a/8diw "$A7_a" 'd 8 i w' $'@:echo\n@Z'
ble/keymap:vi_test/check A7.a/1caw "$A7_a" 'c 1 a w' $'@:echo\n@\n\n\n\n\n\n\n\n\n\nworld\nZ'
ble/keymap:vi_test/check A7.a/2caw "$A7_a" 'c 2 a w' $'@:echo\n@\n\n\n\n\n\n\n\nworld\nZ'
ble/keymap:vi_test/check A7.a/3caw "$A7_a" 'c 3 a w' $'@:echo\n@\n\n\n\n\n\nworld\nZ'
ble/keymap:vi_test/check A7.a/4caw "$A7_a" 'c 4 a w' $'@:echo\n@\n\n\n\nworld\nZ'
ble/keymap:vi_test/check A7.a/5caw "$A7_a" 'c 5 a w' $'@:echo\n@\n\nworld\nZ'
ble/keymap:vi_test/check A7.a/6caw "$A7_a" 'c 6 a w' $'@:echo\n@\nZ'
ble/keymap:vi_test/check A7.a/1daw "$A7_a" 'd 1 a w' $'@:echo\n@\n\n\n\n\n\n\n\n\nworld\nZ'
ble/keymap:vi_test/check A7.a/2daw "$A7_a" 'd 2 a w' $'@:echo\n@\n\n\n\n\n\n\nworld\nZ'
ble/keymap:vi_test/check A7.a/3daw "$A7_a" 'd 3 a w' $'@:echo\n@\n\n\n\n\nworld\nZ'
ble/keymap:vi_test/check A7.a/4daw "$A7_a" 'd 4 a w' $'@:echo\n@\n\n\nworld\nZ'
ble/keymap:vi_test/check A7.a/5daw "$A7_a" 'd 5 a w' $'@:echo\n@\nworld\nZ'
ble/keymap:vi_test/check A7.a/6daw "$A7_a" 'd 6 a w' $'@:echo\n@Z'
ble/keymap:vi_test/check A8.0/2aw $'@:echo\n@\nhello\n\nworld\n' 'd 2 a w' $'@:@echo'
ble/keymap:vi_test/check A8.2/2aw $'@: echo\n@\nhello\n\nworld\n' 'd 2 a w' $'@: @echo'
ble/keymap:vi_test/check A9.1/ciw $'@:@ \necho' 'c i w' $'@:@\necho'
ble/keymap:vi_test/check A9.2/ciw $'@:@\n echo' 'c i w' $'@:@\n echo'
ble/test/start-section "ble/keymap.vi/txtobj_word_xmap" 34
ble/keymap:vi_test/check B1/viw.1 '@:echo he@llo world "hello" "world"' 'v i w S a' '@:echo @<hello> world "hello" "world"'
ble/keymap:vi_test/check B1/vaw.1 '@:echo he@llo world "hello" "world"' 'v a w S a' '@:echo @<hello >world "hello" "world"'
ble/keymap:vi_test/check B2/viw.2 '@:echo hello@ world "hello" "world"' 'v i w S a' '@:echo hello@< >world "hello" "world"'
ble/keymap:vi_test/check B2/vaw.2 '@:echo hello@ world "hello" "world"' 'v a w S a' '@:echo hello@< world> "hello" "world"'
ble/keymap:vi_test/check B3/viw.3 '@:echo hello world "he@llo" "world"' 'v i w S a' '@:echo hello world "@<hello>" "world"'
ble/keymap:vi_test/check B3/vaw.3 '@:echo hello world "he@llo" "world"' 'v a w S a' '@:echo hello world "@<hello>" "world"'
ble/keymap:vi_test/check B4/viw.4 '@:echo hello world @"hello" "world"' 'v i w S a' '@:echo hello world @<">hello" "world"'
ble/keymap:vi_test/check B4/vaw.4 '@:echo hello world @"hello" "world"' 'v a w S a' '@:echo hello world@< ">hello" "world"'
ble/keymap:vi_test/check B5/viw.5 '@:echo hello world "hello@" "world"' 'v i w S a' '@:echo hello world "hello@<"> "world"'
ble/keymap:vi_test/check B5/vaw.5 '@:echo hello world "hello@" "world"' 'v a w S a' '@:echo hello world "hello@<" >"world"'
ble/keymap:vi_test/check B1/v2iw.1 '@:echo he@llo world "hello" "world"' 'v 2 i w S a' '@:echo @<hello >world "hello" "world"'
ble/keymap:vi_test/check B1/v2aw.1 '@:echo he@llo world "hello" "world"' 'v 2 a w S a' '@:echo @<hello world >"hello" "world"'
ble/keymap:vi_test/check B2/v2iw.2 '@:echo hello@ world "hello" "world"' 'v 2 i w S a' '@:echo hello@< world> "hello" "world"'
ble/keymap:vi_test/check B2/v2aw.2 '@:echo hello@ world "hello" "world"' 'v 2 a w S a' '@:echo hello@< world ">hello" "world"'
ble/keymap:vi_test/check B3/v2iw.3 '@:echo hello world "he@llo" "world"' 'v 2 i w S a' '@:echo hello world "@<hello"> "world"'
ble/keymap:vi_test/check B3/v2aw.3 '@:echo hello world "he@llo" "world"' 'v 2 a w S a' '@:echo hello world "@<hello" >"world"'
ble/keymap:vi_test/check B4/v2iw.4 '@:echo hello world @"hello" "world"' 'v 2 i w S a' '@:echo hello world @<"hello>" "world"'
ble/keymap:vi_test/check B4/v2aw.4 '@:echo hello world @"hello" "world"' 'v 2 a w S a' '@:echo hello world@< "hello>" "world"'
ble/keymap:vi_test/check B5/v2iw.5 '@:echo hello world "hello@" "world"' 'v 2 i w S a' '@:echo hello world "hello@<" >"world"'
ble/keymap:vi_test/check B5/v2aw.5 '@:echo hello world "hello@" "world"' 'v 2 a w S a' '@:echo hello world "hello@<" ">world"'
ble/keymap:vi_test/check B2/v1hiw '@:echo hello wo@rld' 'v 1 h i w S a' '@:echo hello @<wor>ld'
ble/keymap:vi_test/check B2/v2hiw '@:echo hello wo@rld' 'v 2 h i w S a' '@:echo hello@< wor>ld'
ble/keymap:vi_test/check B2/v3hiw '@:echo hello wo@rld' 'v 3 h i w S a' '@:echo hello@< wor>ld'
ble/keymap:vi_test/check B2/v4hiw '@:echo hello wo@rld' 'v 4 h i w S a' '@:echo @<hello wor>ld'
ble/keymap:vi_test/check B2/v1haw '@:echo hello wo@rld' 'v 1 h a w S a' '@:echo hello@< wor>ld'
ble/keymap:vi_test/check B2/v2haw '@:echo hello wo@rld' 'v 2 h a w S a' '@:echo @<hello wor>ld'
ble/keymap:vi_test/check B2/v3haw '@:echo hello wo@rld' 'v 3 h a w S a' '@:echo @<hello wor>ld'
ble/keymap:vi_test/check B2/v4haw '@:echo hello wo@rld' 'v 4 h a w S a' '@:echo@< hello wor>ld'
ble/keymap:vi_test/check B1/v1haw '@:echo he@llo' 'v 1 h a w S a' '@:echo@< hel>lo'
ble/keymap:vi_test/check B1/v2haw '@:echo he@llo' 'v 2 h a w S a' '@:@<echo hel>lo'
ble/keymap:vi_test/check B1/v3haw '@:echo he@llo' 'v 3 h a w S a' '@:e@<cho hel>lo'
ble/keymap:vi_test/check B1/v4haw '@:echo he@llo' 'v 4 h a w S a' '@:e@<cho hel>lo'
ble/keymap:vi_test/check Bn/viw $'@:@echo hello\necho world' 'v $ o $ i w c' $'@:echo hell@echo world'
ble/keymap:vi_test/check Bn/viw $'@:@echo hello \necho world' 'v $ o $ i w c' $'@:echo hello@\necho world'
ble/test/end-section
}
function ble/keymap:vi_test/section:op.2018-02-22 {
ble/test/start-section "ble/keymap.vi/op.2018-02-22" 4
ble/keymap:vi_test/check A0 $'@:12@345\n67890\n' 'y y p' $'@:12345\n@12345\n67890\n'
ble/keymap:vi_test/check B1 $'@:12@345\n67890\n' 'Y' $'@:12@345\n67890\n'
ble/keymap:vi_test/check B2 $'@:12@345\n67890\n' 'y y' $'@:12@345\n67890\n'
ble/keymap:vi_test/check C $'@:\n12@34567\n1あ2345\n12い345\n123う45\n1234え5\n' 'C-v 4 j l d' $'@:\n12@567\n1 345\n12345\n12 45\n12え5\n'
ble/test/end-section
}
function ble/keymap:vi_test/run-tests {
ble/keymap:vi_test/section:space
ble/keymap:vi_test/section:cw
ble/keymap:vi_test/section:search
ble/keymap:vi_test/section:increment
ble/keymap:vi_test/section:macro
ble/keymap:vi_test/section:surround
ble/keymap:vi_test/section:txtobj_quote_xmap
ble/keymap:vi_test/section:txtobj_block_omap
ble/keymap:vi_test/section:txtobj_block_xmap
ble/keymap:vi_test/section:txtobj_word
ble/keymap:vi_test/section:op.2018-02-22
}
if [[ $1 == bind ]]; then
function ble/widget/vi-command/check-vi-mode {
local original_str=$_ble_edit_str
local original_ind=$_ble_edit_ind
local original_mark=$_ble_edit_mark
local original_mark_active=$_ble_edit_mark_active
_ble_edit_line_disabled=1 ble/edit/.relocate-textarea # #D1800 pair=leave-command-layout
ble/util/buffer.flush
ble/keymap:vi_test/run-tests
ble-edit/content/reset "$original_str" edit
_ble_edit_ind=$original_ind
_ble_edit_mark=$original_mark
_ble_edit_mark_active=$original_mark_active
ble/edit/leave-command-layout # #D1800 pair=ble/edit/.relocate-textarea
return 0
}
function ble/widget/vi_imap/check-vi-mode {
ble/widget/vi_imap/normal-mode
ble/widget/vi-command/check-vi-mode
return 0
}
ble-bind -m vi_imap -f 'C-\ C-\' vi_imap/check-vi-mode
ble-bind -m vi_nmap -f 'C-\ C-\' vi-command:check-vi-mode
fi
function ble/keymap:vi_test/main {
_ble_decode_initialize_inputrc=none
ble/decode/initialize
[[ ${_ble_decode_keymap-} ]] ||
ble/decode/reset-default-keymap
ble/decode/keymap/push vi_imap
ble/widget/vi_imap/normal-mode
local original_str=$_ble_edit_str
local original_ind=$_ble_edit_ind
local original_mark=$_ble_edit_mark
local original_mark_active=$_ble_edit_mark_active
ble/util/buffer.flush
ble/keymap:vi_test/run-tests
ble-edit/content/reset "$original_str" edit
_ble_edit_ind=$original_ind
_ble_edit_mark=$original_mark
_ble_edit_mark_active=$original_mark_active
while [[ $_ble_decode_keymap != vi_imap ]]; do
ble/decode/keymap/pop
done
ble/decode/keymap/pop
return 0
}
ble/keymap:vi_test/main

View file

@ -0,0 +1,119 @@
# Copyright 2015 Koichi Murase <myoga.murase@gmail.com>. All rights reserved.
# This script is a part of blesh (https://github.com/akinomyoga/ble.sh)
# provided under the BSD-3-Clause license. Do not edit this file because this
# is not the original source code: Various pre-processing has been applied.
# Also, the code comments and blank lines are stripped off in the installation
# process. Please find the corresponding source file(s) in the repository
# "akinomyoga/ble.sh".
#
# Source: /lib/test-main.sh
ble-import lib/core-test
ble/test/start-section 'ble/main' 29
(
function f1 {
builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust"
ble/util/setexit 123
builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_return"
}
function f2 {
builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust"
[[ ! -o posix ]]
builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_return"
}
set +o posix
ble/test 'f1' exit=123
ble/test 'f2'
ble/test 'f1; [[ ! -o posix ]]'
ble/test 'f2; [[ ! -o posix ]]'
ble/test 'set -o posix; f1; ret=$?; set +o posix' ret=123
ble/test 'set -o posix; f2; ret=$?; set +o posix' ret=0
ble/test 'set -o posix; f1; [[ -o posix ]]; ret=$?; set +o posix' ret=0
ble/test 'set -o posix; f2; [[ -o posix ]]; ret=$?; set +o posix' ret=0
)
(
ble/test ble/util/put a stdout=a
ble/test ble/util/print a stdout=a
ble/test 'ble/util/put "a b"' stdout='a b'
ble/test 'ble/util/print "a b"' stdout='a b'
ble/test 'ble/util/put "a b"; ble/util/put "c d"' \
stdout='a bc d'
ble/test 'ble/util/print "a b"; ble/util/print "c d"' \
stdout='a b' \
stdout='c d'
)
(
function ble/test/dummy-1 { true; }
function ble/test/dummy-2 { true; }
function ble/test/dummy-3 { true; }
ble/test ble/bin#has ble/test/dummy-1
ble/test ble/bin#has ble/test/dummy-{1..3}
ble/test ble/bin#has ble/test/dummy-0 exit=1
ble/test ble/bin#has ble/test/dummy-{0..2} exit=1
alias ble_test_dummy_4=echo
shopt -u expand_aliases
ble/test '! ble/bin#has ble_test_dummy_4'
shopt -s expand_aliases
ble/test 'ble/bin#has ble_test_dummy_4'
)
(
if [[ $OSTYPE == msys* ]]; then
export MSYS=${MSYS:+$MSYS }winsymlinks
fi
ble/bin#freeze-utility-path readlink ls
function ble/test:readlink.impl1 {
ret=$1
ble/util/readlink/.resolve-loop
}
function ble/test:readlink.impl2 {
ret=$1
ble/function#push ble/bin/readlink
ble/util/readlink/.resolve-loop
ble/function#pop ble/bin/readlink
}
ble/test/chdir || exit
cd -P .
command mkdir -p ab/cd/ef
command touch ab/cd/ef/file.txt
command ln -s ef/file.txt ab/cd/link1
command ln -s ab link.d
command ln -s link.d/cd/link1 f.txt
ble/test '
ble/util/readlink f.txt
[[ $ret != /* ]] && ret=${PWD%/}/$ret' \
ret="${PWD%/}/ab/cd/ef/file.txt"
command touch loop1.sh
command ln -s loop1.sh loop0.sh
command ln -s loop1.sh loop3.sh
command rm loop1.sh
command ln -s loop3.sh loop2.sh
command ln -s loop2.sh loop1.sh
for impl in impl1 impl2; do
ble/test "ble/test:readlink.$impl loop0.sh" ret='loop1.sh'
done
mkdir -p phys.dir
touch phys.dir/1.txt
ln -s ../../../phys.dir ab/cd/ef/phys.link
ln -s ab/cd/ef/phys.link phys.link
local pwd=$PWD xpath=
ble/test code:'
path=phys.link/1.txt
ble/util/readlink/.resolve-physical-directory
declare -p path PWD >&2
[[ $path == */phys.dir/1.txt && $PWD == "$pwd" ]]'
ble/test/rmdir
)
(
ble/test '[[ -d $_ble_base ]]'
ble/test '[[ -d $_ble_base_run ]]'
ble/test '[[ -d $_ble_base_cache ]]'
)
(
qnl="\$'\n'"
value=$'\nxxx is a function\nhello\nyyy is a function\n'
pattern=$'\n+([][{}:[:alnum:]]) is a function\n'
shopt -s extglob
ble/test '[[ ${value//$pattern/'"$qnl"'} == '"$qnl"'hello'"$qnl"' ]]'
shopt -u extglob
ble/test '[[ ${value//$pattern/'"$qnl"'} != '"$qnl"'hello'"$qnl"' ]]'
)
ble/test/end-section

View file

@ -0,0 +1,47 @@
# Copyright 2015 Koichi Murase <myoga.murase@gmail.com>. All rights reserved.
# This script is a part of blesh (https://github.com/akinomyoga/ble.sh)
# provided under the BSD-3-Clause license. Do not edit this file because this
# is not the original source code: Various pre-processing has been applied.
# Also, the code comments and blank lines are stripped off in the installation
# process. Please find the corresponding source file(s) in the repository
# "akinomyoga/ble.sh".
#
# Source: /lib/test-syntax.sh
ble-import lib/core-syntax
ble-import lib/core-test
ble/test/start-section 'ble/syntax' 22
(
func=ble/syntax:bash/simple-word/evaluate-last-brace-expansion
collect='ret=$simple_ibrace/$ret'
ble/test "$func 'a{b,c}x' ; $collect" ret='6:2/acx'
ble/test "$func 'a{b,{c,d}x' ; $collect" ret='9:2/adx'
ble/test "$func 'a{b,{c,d}}x'; $collect" ret='10:2/adx'
ble/test "$func 'a{{c,dx' ; $collect" ret='5:1/adx'
ble/test "$func 'a{b{c,dx' ; $collect" ret='6:2/abdx'
ble/test "$func 'a{b,c}{d}x' ; $collect" ret='7:2/acd}x'
)
(
func=ble/syntax:bash/simple-word/reconstruct-incomplete-word
collect='ret=$?:$simple_flags:[$simple_ibrace]:$ret'
ble/test "$func 'hello-word' ; $collect" ret='0::[0:0]:hello-word'
ble/test "$func 'hello word' ; $collect" ret='1::[0:0]:hello'
ble/test "$func 'hello-word\"a' ; $collect" ret='0:D:[0:0]:hello-word"a"'
ble/test "$func 'a{b,c}x' ; $collect" ret='0::[6:2]:acx'
ble/test "$func 'a{b,{c,d}x' ; $collect" ret='0::[9:2]:adx'
ble/test "$func 'a{b,{c,d}}x' ; $collect" ret='0::[10:2]:adx'
ble/test "$func 'a{{c,dx' ; $collect" ret='0::[5:1]:adx'
ble/test "$func 'a{b{c,dx' ; $collect" ret='0::[6:2]:abdx'
ble/test "$func 'a{b,c}{d}x' ; $collect" ret='0::[7:2]:acd}x'
ble/test "$func 'a{b,c}x\"hello, world'; $collect" ret='0:D:[6:2]:acx"hello, world"'
ble/test "$func 'a{b,{c,d}x'\''a' ; $collect" ret='0:S:[9:2]:adx'\''a'\'
ble/test "$func 'a{b,{c,d}}x\$'\''\e[m'; $collect" ret='0:E:[10:2]:adx$'\''\e[m'\'
ble/test "$func 'a{{c,dx\$\"aa' ; $collect" ret='0:I:[5:1]:adx$"aa"'
)
(
func=ble/syntax:bash/simple-word/evaluate-path-spec
collect='ret="${spec[*]} >>> ${path[*]}"'
ble/test "$func '~/a/b/c' ; $collect" ret="~ ~/a ~/a/b ~/a/b/c >>> $HOME $HOME/a $HOME/a/b $HOME/a/b/c"
ble/test "$func '~/a/b/c' / after-sep; $collect" ret="~/ ~/a/ ~/a/b/ ~/a/b/c >>> $HOME/ $HOME/a/ $HOME/a/b/ $HOME/a/b/c"
ble/test "$func '/x/y/z' / after-sep ; $collect" ret="/ /x/ /x/y/ /x/y/z >>> / /x/ /x/y/ /x/y/z"
)
ble/test/end-section

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,214 @@
# Copyright 2015 Koichi Murase <myoga.murase@gmail.com>. All rights reserved.
# This script is a part of blesh (https://github.com/akinomyoga/ble.sh)
# provided under the BSD-3-Clause license. Do not edit this file because this
# is not the original source code: Various pre-processing has been applied.
# Also, the code comments and blank lines are stripped off in the installation
# process. Please find the corresponding source file(s) in the repository
# "akinomyoga/ble.sh".
#
# Source: /lib/util.bgproc.sh
function ble/util/bgproc#open {
if ! ble/string#match "$1" '^[_a-zA-Z][_a-zA-Z0-9]*$'; then
ble/util/print "$FUNCNAME: $1: invalid prefix value." >&2
return 2
fi
ble/util/bgproc#close "$1"
local -a bgproc=()
bgproc[0]=
bgproc[1]=
bgproc[2]=$2
bgproc[3]=${3-}
local -a bgproc_fname=()
bgproc_fname[0]=$_ble_base_run/$$.util.bgproc.$1.response.pipe
bgproc_fname[1]=$_ble_base_run/$$.util.bgproc.$1.request.pipe
bgproc_fname[2]=$_ble_base_run/$$.util.bgproc.$1.pid
ble/util/save-vars "${1}_" bgproc bgproc_fname
[[ :${bgproc[3]}: == *:deferred:* ]] || ble/util/bgproc#start "$1"; local ext=$?
if ((ext!=0)); then
builtin eval -- "${1}_bgproc=() ${1}_bgproc_fname=()"
fi
return "$ext"
}
function ble/util/bgproc#opened {
local bgpid_ref=${1}_bgproc[0]
[[ ${!bgpid_ref+set} ]] || return 2
}
function ble/util/bgproc/.alive {
[[ ${bgproc[4]-} ]] && kill -0 "${bgproc[4]}" 2>/dev/null
}
function ble/util/bgproc/.exec {
builtin eval -- "${bgproc[2]}" <&"${bgproc[1]}" >&"${bgproc[0]}"
}
function ble/util/bgproc/.mkfifo {
local -a pipe_remove=() pipe_create=()
local i
for i in 0 1; do
[[ -p ${bgproc_fname[i]} ]] && continue
ble/array#push pipe_create "${bgproc_fname[i]}"
if [[ -e ${bgproc_fname[i]} || -h ${bgproc_fname[i]} ]]; then
ble/array#push pipe_remove "${bgproc_fname[i]}"
fi
done
((${#pipe_remove[@]}==0)) || ble/bin/rm -f "${pipe_remove[@]}" 2>/dev/null
((${#pipe_create[@]}==0)) || ble/bin/mkfifo "${pipe_create[@]}" 2>/dev/null
}
function ble/util/bgproc#start {
local bgproc bgproc_fname
ble/util/restore-vars "${1}_" bgproc bgproc_fname
if ((!${#bgproc[@]})); then
ble/util/print "$FUNCNAME: $1: not an existing bgproc name." >&2
return 2
fi
if ble/util/bgproc/.alive; then
return 0
fi
[[ ! ${bgproc[0]-} ]] || ble/fd#close 'bgproc[0]'
[[ ! ${bgproc[1]-} ]] || ble/fd#close 'bgproc[1]'
local _ble_local_ext=0 _ble_local_bgproc0= _ble_local_bgproc1=
if ble/util/bgproc/.mkfifo &&
ble/fd#alloc _ble_local_bgproc0 '<> "${bgproc_fname[0]}"' &&
ble/fd#alloc _ble_local_bgproc1 '<> "${bgproc_fname[1]}"'
then
bgproc[0]=$_ble_local_bgproc0
bgproc[1]=$_ble_local_bgproc1
ble/util/assign 'bgproc[4]' '(set -m; ble/util/joblist/__suppress__; ble/util/bgproc/.exec >/dev/null & bgpid=$!; ble/util/print "$bgpid")'
if ble/util/bgproc/.alive; then
[[ :${bgproc[3]}: == *:no-close-on-unload:* ]] ||
ble/util/print "-${bgproc[4]}" >| "${bgproc_fname[2]}"
[[ :${bgproc[3]}: == *:no-close-on-unload:* || :${bgproc[3]}: == *:owner-close-on-unload:* ]] ||
blehook unload!="ble/util/bgproc#close $1"
ble/util/bgproc#keepalive "$1"
else
builtin unset -v 'bgproc[4]'
_ble_local_ext=1
fi
else
_ble_local_ext=3
fi
if ((_ble_local_ext!=0)); then
[[ ! ${bgproc[0]-} ]] || ble/fd#close 'bgproc[0]'
[[ ! ${bgproc[1]-} ]] || ble/fd#close 'bgproc[1]'
bgproc[0]=
bgproc[1]=
builtin unset -v 'bgproc[4]'
fi
ble/util/save-vars "${1}_" bgproc bgproc_fname
if ((_ble_local_ext==0)); then
ble/function#try ble/util/bgproc/onstart:"$1"
fi
return "$_ble_local_ext"
}
function ble/util/bgproc#stop/.kill {
local pid=$1 opts=$2 ret
local timeout=10000
if ble/opts#extract-last-optarg "$opts" kill-timeout; then
timeout=$ret
fi
ble/util/conditional-sync '' '((1))' 1000 progressive-weight:pid="$pid":no-wait-pid:timeout="$timeout"
kill -0 "$pid" || return 0
local timeout=10000
if ble/opts#extract-last-optarg "$opts" kill9-timeout; then
timeout=$ret
fi
ble/util/conditional-sync '' '((1))' 1000 progressive-weight:pid="$pid":no-wait-pid:timeout="$timeout":SIGKILL
}
function ble/util/bgproc#stop {
local prefix=$1
ble/util/bgproc#keepalive/.cancel-timeout "$prefix"
local bgproc bgproc_fname
ble/util/restore-vars "${prefix}_" bgproc bgproc_fname
if ((!${#bgproc[@]})); then
ble/util/print "$FUNCNAME: $prefix: not an existing bgproc name." >&2
return 2
fi
[[ ${bgproc[4]-} ]] || return 1
if ble/is-function ble/util/bgproc/onstop:"$prefix" && ble/util/bgproc/.alive; then
ble/util/bgproc/onstop:"$prefix"
fi
ble/fd#close 'bgproc[0]'
ble/fd#close 'bgproc[1]'
>| "${bgproc_fname[2]}"
if ble/util/bgproc/.alive; then
(ble/util/nohup 'ble/util/bgproc#stop/.kill "-${bgproc[4]}" "${bgproc[3]}"')
fi
builtin eval -- "${prefix}_bgproc[0]="
builtin eval -- "${prefix}_bgproc[1]="
builtin unset -v "${prefix}_bgproc[4]"
return 0
}
function ble/util/bgproc#alive {
local prefix=$1 bgproc
ble/util/restore-vars "${prefix}_" bgproc
((${#bgproc[@]})) || return 2
[[ ${bgproc[4]-} ]] || return 1
kill -0 "${bgproc[4]}" 2>/dev/null || return 3
return 0
}
function ble/util/bgproc#keepalive/.timeout {
local prefix=$1
if ble/is-function ble/util/bgproc/ontimeout:"$prefix"; then
if ! ble/util/bgproc/ontimeout:"$prefix"; then
ble/util/bgproc#keepalive "$prefix"
return 0
fi
fi
ble/util/bgproc#stop "$prefix"
}
function ble/util/bgproc#keepalive/.cancel-timeout {
local prefix=$1
ble/function#try ble/util/idle.cancel "ble/util/bgproc#keepalive/.timeout $prefix"
}
function ble/util/bgproc#keepalive {
local prefix=$1 bgproc
ble/util/restore-vars "${prefix}_" bgproc
((${#bgproc[@]})) || return 2
ble/util/bgproc/.alive || return 1
ble/util/bgproc#keepalive/.cancel-timeout "$prefix"
local ret
ble/opts#extract-last-optarg "${bgproc[3]}" timeout || return 0; local bgproc_timeout=$ret
if ((bgproc_timeout>0)); then
local timeout_proc="ble/util/bgproc#keepalive/.timeout $1"
ble/function#try ble/util/idle.push --sleep="$bgproc_timeout" "$timeout_proc"
fi
return 0
}
_ble_util_bgproc_onclose_processing=
function ble/util/bgproc#close {
ble/util/bgproc#opened "$1" || return 2
local prefix=${1}
blehook unload-="ble/util/bgproc#close $prefix"
ble/util/bgproc#keepalive/.cancel-timeout "$prefix"
if ble/is-function ble/util/bgproc/onclose:"$prefix"; then
if [[ :${_ble_util_bgproc_onclose_processing-}: != *:"$prefix":* ]]; then
local _ble_util_bgproc_onclose_processing=${_ble_util_bgproc_onclose_processing-}:$prefix
ble/util/bgproc/onclose:"$prefix"
fi
fi
ble/util/bgproc#stop "$prefix"
builtin eval -- "${prefix}_bgproc=() ${prefix}_bgproc_fname=()"
}
function ble/util/bgproc#use {
local bgproc
ble/util/restore-vars "${1}_" bgproc
if ((!${#bgproc[@]})); then
ble/util/print "$FUNCNAME: $1: not an existing bgproc name." >&2
return 2
fi
if [[ ! ${bgproc[4]-} ]]; then
ble/util/bgproc#start "$1" || return "$?"
elif ! kill -0 "${bgproc[4]-}"; then
if [[ :${bgproc[3]-}: == *:restart:* ]]; then
ble/util/bgproc#start "$1" || return "$?"
else
return 1
fi
else
ble/util/bgproc#keepalive "$1"
return 0
fi
}
function ble/util/bgproc#post {
ble/util/bgproc#use "$1" || return "$?"
local fd1_ref=${1}_bgproc[1]
ble/util/print "$2" >&"${!fd1_ref}"
}

View file

@ -0,0 +1,339 @@
# Copyright 2015 Koichi Murase <myoga.murase@gmail.com>. All rights reserved.
# This script is a part of blesh (https://github.com/akinomyoga/ble.sh)
# provided under the BSD-3-Clause license. Do not edit this file because this
# is not the original source code: Various pre-processing has been applied.
# Also, the code comments and blank lines are stripped off in the installation
# process. Please find the corresponding source file(s) in the repository
# "akinomyoga/ble.sh".
#
# Source: /lib/vim-airline.sh
ble-import keymap.vi
ble-import prompt-git
bleopt/declare -n vim_airline_theme dark
function bleopt/check:vim_airline_theme {
local init=ble/lib/vim-airline/theme:"$value"/initialize
if ! ble/is-function "$init"; then
local ret
if ! ble/util/import/search "airline/$value"; then
ble/util/print "ble/lib/vim-airline: theme '$value' not found." >&2
return 1
fi
ble/util/import "$ret"
ble/is-function "$init" || return 1
fi
"$init"
return 0
}
bleopt/declare -v vim_airline_section_a '\e[1m\q{lib/vim-airline/mode}'
bleopt/declare -v vim_airline_section_b '\q{lib/vim-airline/gitstatus}'
bleopt/declare -v vim_airline_section_c '\w'
bleopt/declare -v vim_airline_section_x 'bash'
bleopt/declare -v vim_airline_section_y '$_ble_util_locale_encoding[unix]'
bleopt/declare -v vim_airline_section_z ' \q{history-percentile} \e[1m!\q{history-index}/\!\e[22m \q{position}'
bleopt/declare -v vim_airline_left_sep $'\uE0B0'
bleopt/declare -v vim_airline_left_alt_sep $'\uE0B1'
bleopt/declare -v vim_airline_right_sep $'\uE0B2'
bleopt/declare -v vim_airline_right_alt_sep $'\uE0B3'
bleopt/declare -v vim_airline_symbol_branch $'\uE0A0'
bleopt/declare -v vim_airline_symbol_dirty $'\u26A1'
function bleopt/check:vim_airline_left_sep { ble/prompt/unit#clear _ble_prompt_status; }
function bleopt/check:vim_airline_left_alt_sep { ble/prompt/unit#clear _ble_prompt_status; }
function bleopt/check:vim_airline_right_sep { ble/prompt/unit#clear _ble_prompt_status; }
function bleopt/check:vim_airline_right_alt_sep { ble/prompt/unit#clear _ble_prompt_status; }
builtin eval -- "${_ble_util_gdict_declare//NAME/_ble_lib_vim_airline_mode_map_default}"
ble/gdict#set _ble_lib_vim_airline_mode_map_default 'i' 'INSERT'
ble/gdict#set _ble_lib_vim_airline_mode_map_default 'n' 'NORMAL'
ble/gdict#set _ble_lib_vim_airline_mode_map_default 'in' '(INSERT)'
ble/gdict#set _ble_lib_vim_airline_mode_map_default 'o' 'OP PENDING'
ble/gdict#set _ble_lib_vim_airline_mode_map_default 'R' 'REPLACE'
ble/gdict#set _ble_lib_vim_airline_mode_map_default '' 'V REPLACE'
ble/gdict#set _ble_lib_vim_airline_mode_map_default 'v' 'VISUAL'
ble/gdict#set _ble_lib_vim_airline_mode_map_default 'V' 'V-LINE'
ble/gdict#set _ble_lib_vim_airline_mode_map_default '' 'V-BLOCK'
ble/gdict#set _ble_lib_vim_airline_mode_map_default 's' 'SELECT'
ble/gdict#set _ble_lib_vim_airline_mode_map_default 'S' 'S-LINE'
ble/gdict#set _ble_lib_vim_airline_mode_map_default '' 'S-BLOCK'
ble/gdict#set _ble_lib_vim_airline_mode_map_default '?' '------'
ble/gdict#set _ble_lib_vim_airline_mode_map_default 'c' 'COMMAND'
builtin eval -- "${_ble_util_gdict_declare//NAME/_ble_lib_vim_airline_mode_map_atomic}"
ble/gdict#set _ble_lib_vim_airline_mode_map_atomic 'i' 'I'
ble/gdict#set _ble_lib_vim_airline_mode_map_atomic 'n' 'N'
ble/gdict#set _ble_lib_vim_airline_mode_map_atomic 'R' 'R'
ble/gdict#set _ble_lib_vim_airline_mode_map_atomic 'v' 'V'
ble/gdict#set _ble_lib_vim_airline_mode_map_atomic 'V' 'V-L'
ble/gdict#set _ble_lib_vim_airline_mode_map_atomic '' 'V-B'
ble/gdict#set _ble_lib_vim_airline_mode_map_atomic 's' 'S'
ble/gdict#set _ble_lib_vim_airline_mode_map_atomic 'S' 'S-L'
ble/gdict#set _ble_lib_vim_airline_mode_map_atomic '' 'S-B'
ble/gdict#set _ble_lib_vim_airline_mode_map_atomic '?' '--'
ble/gdict#set _ble_lib_vim_airline_mode_map_atomic 'c' 'C'
builtin eval -- "${_ble_util_gdict_declare//NAME/_ble_lib_vim_airline_mode_map}"
ble/gdict#cp _ble_lib_vim_airline_mode_map_default _ble_lib_vim_airline_mode_map
function ble/lib/vim-airline/initialize-faces {
ble/color/defface vim_airline_a fg=17,bg=45
ble/color/defface vim_airline_b fg=231,bg=27
ble/color/defface vim_airline_c fg=231,bg=18
ble/color/defface vim_airline_error fg=16,bg=88 # fg=#000000,bg=#990000
ble/color/defface vim_airline_term fg=158,bg=234 # fg=#9cffd3,bg=#202020
ble/color/defface vim_airline_warning fg=16,bg=166 # fg=#000000,bg=#df5f00
local section map
for section in a b c error term warning; do
for map in _normal _insert _visual _commandline _inactive; do
ble/color/defface "vim_airline_$section$map" ref:"vim_airline_$section"
done
ble/color/defface "vim_airline_${section}_replace" ref:"vim_airline_${section}_insert"
done
local map
for map in '' _normal _insert _replace _visual _commandline _inactive; do
ble/color/defface "vim_airline_x$map" ref:"vim_airline_c$map"
ble/color/defface "vim_airline_y$map" ref:"vim_airline_b$map"
ble/color/defface "vim_airline_z$map" ref:"vim_airline_a$map"
done
local name
for name in {a,b,c,x,y,z,error,term,warning}{,_normal,_insert,_replace,_visual,_commandline,_inactive}; do
ble/color/defface "vim_airline_${name}_modified" ref:"vim_airline_$name"
done
}
ble/lib/vim-airline/initialize-faces
function ble/lib/vim-airline/convert-theme/.to-color256 {
local R=$((16#${1:1:2}))
local G=$((16#${1:3:2}))
local B=$((16#${1:5:2}))
ble/color/convert-rgb24-to-color256 "$R" "$G" "$B"
}
function ble/lib/vim-airline/convert-theme/.setface {
local gspec=
local ret
ble/lib/vim-airline/convert-theme/.to-color256 "$2"; local fg=$ret
ble/lib/vim-airline/convert-theme/.to-color256 "$3"; local bg=$ret
printf 'ble/color/setface vim_airline_%-13s %-13s # %s\n' "$1" "fg=$fg,bg=$bg" "fg=$2,bg=$3"
}
function ble/lib/vim-airline/convert-theme {
local file=$1
sed -n 's/let s:airline_\([_a-zA-Z0-9]\{1,\}\)[^[:alnum:]]\{1,\}\(\#[0-9a-fA-F]\{6\}\)[^[:alnum:]]\{1,\}\(\#[0-9a-fA-F]\{6\}\).*/\1 \2 \3/p' "$file" |
while ble/bash/read face fg bg; do
ble/lib/vim-airline/convert-theme/.setface "$face" "$fg" "$bg"
done
}
ble/color/setface vim_airline_a_normal fg=17,bg=190 # fg=#00005f,bg=#dfff00
ble/color/setface vim_airline_b_normal fg=231,bg=238 # fg=#ffffff,bg=#444444
ble/color/setface vim_airline_c_normal fg=158,bg=234 # fg=#9cffd3,bg=#202020
ble/color/setface vim_airline_a_insert fg=17,bg=45 # fg=#00005f,bg=#00dfff
ble/color/setface vim_airline_b_insert fg=231,bg=27 # fg=#ffffff,bg=#005fff
ble/color/setface vim_airline_c_insert fg=231,bg=18 # fg=#ffffff,bg=#000080
ble/color/setface vim_airline_a_visual fg=16,bg=214 # fg=#000000,bg=#ffaf00
ble/color/setface vim_airline_b_visual fg=16,bg=202 # fg=#000000,bg=#ff5f00
ble/color/setface vim_airline_c_visual fg=231,bg=52 # fg=#ffffff,bg=#5f0000
ble/color/setface vim_airline_a_inactive fg=239,bg=234 # fg=#4e4e4e,bg=#1c1c1c
ble/color/setface vim_airline_b_inactive fg=239,bg=235 # fg=#4e4e4e,bg=#262626
ble/color/setface vim_airline_c_inactive fg=239,bg=236 # fg=#4e4e4e,bg=#303030
ble/color/setface vim_airline_a_commandline fg=17,bg=40 # fg=#00005f,bg=#00d700
ble/color/setface vim_airline_b_commandline fg=231,bg=238 # fg=#ffffff,bg=#444444
ble/color/setface vim_airline_c_commandline fg=158,bg=234 # fg=#9cffd3,bg=#202020
_ble_lib_vim_airline_mode_data=()
_ble_lib_vim_airline_keymap=
_ble_lib_vim_airline_mode=
_ble_lib_vim_airline_rawmode=
function ble/prompt/unit:_ble_lib_vim_airline_mode/update {
local keymap mode m
ble/keymap:vi/script/get-vi-keymap
ble/keymap:vi/script/get-mode
case $mode in
(i*) m='insert' ;;
([R]*) m='replace' ;;
(*[vVsS]) m='visual' ;;
(*c) m='commandline' ;;
(*n) m='normal' ;;
(*) m='inactive' ;;
esac
ble/prompt/unit/add-hash '$_ble_edit_str'
ble/prompt/unit/add-hash '$_ble_history_INDEX'
local entry
ble/history/get-entry "$_ble_history_INDEX"
[[ $_ble_edit_str != "$entry" ]] && m=${m}_modified
ble/prompt/unit/assign _ble_lib_vim_airline_keymap "$keymap"
ble/prompt/unit/assign _ble_lib_vim_airline_mode "$m"
ble/prompt/unit/assign _ble_lib_vim_airline_rawmode "$mode"
[[ $prompt_unit_changed ]]
}
_ble_lib_vim_airline_sep_width_data=()
function ble/prompt/unit:_ble_lib_vim_airline_sep_width/update {
ble/prompt/unit/add-hash '$bleopt_char_width_version,$bleopt_char_width_mode'
ble/prompt/unit/add-hash '$bleopt_emoji_version,$bleopt_emoji_width,$bleopt_emoji_opts'
local w ret x y g
((x=0,y=0,g=0))
LINES=1 COLUMNS=$cols ble/canvas/trace "$bleopt_vim_airline_left_sep" confine
((w=x,x=0,y=0,g=0))
LINES=1 COLUMNS=$cols ble/canvas/trace "$bleopt_vim_airline_left_alt_sep" confine
((w=x>w?x:w))
ble/prompt/unit/add-hash '$bleopt_vim_airline_left_sep'
ble/prompt/unit/add-hash '$bleopt_vim_airline_left_alt_sep'
ble/prompt/unit/assign '_ble_lib_vim_airline_sep_width_data[3]' "$w"
((x=0,y=0,g=0))
LINES=1 COLUMNS=$cols ble/canvas/trace "$bleopt_vim_airline_right_sep" confine
((w=x,x=0,y=0,g=0))
LINES=1 COLUMNS=$cols ble/canvas/trace "$bleopt_vim_airline_right_alt_sep" confine
((w=x>w?x:w))
ble/prompt/unit/add-hash '$bleopt_vim_airline_right_sep'
ble/prompt/unit/add-hash '$bleopt_vim_airline_right_alt_sep'
ble/prompt/unit/assign '_ble_lib_vim_airline_sep_width_data[4]' "$w"
[[ $prompt_unit_changed ]]
}
function ble/prompt/backslash:lib/vim-airline/mode/.resolve {
local raw=$1
if ble/gdict#has _ble_lib_vim_airline_mode_map "$raw"; then
ble/gdict#get _ble_lib_vim_airline_mode_map "$raw"
else
case $raw in
(o) ble/prompt/backslash:lib/vim-airline/mode/.resolve "$_ble_lib_vim_airline_rawmode" ;;
([iR]?*) ble/prompt/backslash:lib/vim-airline/mode/.resolve "${raw::1}" ;;
(*?[ncvVsS]) ble/prompt/backslash:lib/vim-airline/mode/.resolve "${raw:${#raw}-1}" ;;
() ble/prompt/backslash:lib/vim-airline/mode/.resolve R ;;
(R) ble/prompt/backslash:lib/vim-airline/mode/.resolve i ;;
([S]) ble/prompt/backslash:lib/vim-airline/mode/.resolve s ;;
([Vs]) ble/prompt/backslash:lib/vim-airline/mode/.resolve v ;;
([ivnc])
ret=
case $_ble_lib_vim_airline_rawmode in
(i*) ret=$bleopt_keymap_vi_mode_name_insert ;;
(R*) ret=$bleopt_keymap_vi_mode_name_replace ;;
(*) ret=$bleopt_keymap_vi_mode_name_vreplace ;;
esac
[[ $_ble_lib_vim_airline_rawmode == [iR]?* ]] &&
ble/string#tolower "($insert) "
case $_ble_lib_vim_airline_rawmode in
(*n)
if [[ ! $ret ]]; then
local rex='[[:alnum:]](.*[[:alnum:]])?'
[[ $bleopt_keymap_vi_mode_string_nmap =~ $rex ]]
ret=${BASH_REMATCH[0]:-NORMAL}
fi ;;
(*v) ret="${ret}${ret:+ }$bleopt_keymap_vi_mode_name_visual" ;;
(*V) ret="${ret}${ret:+ }$bleopt_keymap_vi_mode_name_visual $bleopt_keymap_vi_mode_name_line" ;;
(*) ret="${ret}${ret:+ }$bleopt_keymap_vi_mode_name_visual $bleopt_keymap_vi_mode_name_block" ;;
(*s) ret="${ret}${ret:+ }$bleopt_keymap_vi_mode_name_select" ;;
(*S) ret="${ret}${ret:+ }$bleopt_keymap_vi_mode_name_select $bleopt_keymap_vi_mode_name_line" ;;
(*) ret="${ret}${ret:+ }$bleopt_keymap_vi_mode_name_select $bleopt_keymap_vi_mode_name_block" ;;
(*c) ret="${ret}${ret:+ }COMMAND" ;;
esac
[[ $ret ]] ||
ble/prompt/backslash:lib/vim-airline/mode/.resolve '?' ;;
(*) ret='?__' ;;
esac
fi
}
function ble/prompt/backslash:lib/vim-airline/mode {
local ret
if [[ $_ble_lib_vim_airline_keymap == vi_omap ]]; then
ble/prompt/backslash:lib/vim-airline/mode/.resolve o
else
ble/prompt/backslash:lib/vim-airline/mode/.resolve "$_ble_lib_vim_airline_rawmode"
fi
[[ $ret ]] && ble/prompt/print "$ret"
}
function ble/prompt/backslash:lib/vim-airline/gitstatus {
local "${_ble_contrib_prompt_git_vars[@]/%/=}" # WA #D1570 checked
if ble/contrib/prompt-git/initialize; then
ble/contrib/prompt-git/update-head-information
if [[ $branch ]]; then
ble/prompt/print "$bleopt_vim_airline_symbol_branch$branch"
elif [[ $hash ]]; then
ble/prompt/print "$bleopt_vim_airline_symbol_branch${hash::7}"
else
ble/prompt/print '$bleopt_vim_airline_symbol_branch???????'
fi
ble/contrib/prompt-git/is-dirty &&
ble/prompt/print "$bleopt_vim_airline_symbol_dirty"
fi
}
function ble/prompt/unit:{vim-airline-section}/update {
local section=$1
local ref_ps=bleopt_vim_airline_section_$section
local face=vim_airline_${section}_$_ble_lib_vim_airline_mode
local prefix=_ble_lib_vim_airline_section_$section
ble/prompt/unit/add-hash '$_ble_lib_vim_airline_mode_data'
ble/prompt/unit/add-hash "\$$ref_ps"
local trace_opts=confine:relative:noscrc:face0="$face":ansi:measure-bbox:measure-gbox
local prompt_rows=1 prompt_cols=$cols # Note: cols は \q{lib/vim-airline} で設定される
ble/prompt/unit:{section}/update "$prefix" "${!ref_ps}" "$trace_opts"
}
function ble/prompt/unit:_ble_lib_vim_airline_section_a/update { ble/prompt/unit:{vim-airline-section}/update a; }
function ble/prompt/unit:_ble_lib_vim_airline_section_b/update { ble/prompt/unit:{vim-airline-section}/update b; }
function ble/prompt/unit:_ble_lib_vim_airline_section_c/update { ble/prompt/unit:{vim-airline-section}/update c; }
function ble/prompt/unit:_ble_lib_vim_airline_section_x/update { ble/prompt/unit:{vim-airline-section}/update x; }
function ble/prompt/unit:_ble_lib_vim_airline_section_y/update { ble/prompt/unit:{vim-airline-section}/update y; }
function ble/prompt/unit:_ble_lib_vim_airline_section_z/update { ble/prompt/unit:{vim-airline-section}/update z; }
function ble/lib/vim-airline/.print-section {
local section=$1
local ret g0 bg
ble/color/face2g "vim_airline_${section}_$_ble_lib_vim_airline_mode"; g0=$ret
ble/color/g#compute-bg "$g0"; bg=$ret
if [[ $prev_g0 ]]; then
local sep=bleopt_vim_airline gsep
if [[ $prev_section == [ab] ]]; then
sep=${sep}_left
else
sep=${sep}_right
fi
if [[ $prev_bg == $bg ]]; then
sep=${sep}_alt_sep
if [[ $prev_section == [ab] ]]; then
gsep=$prev_g0
else
gsep=$g0
fi
((gsep&=~_ble_color_gflags_DecorationMask|_ble_color_gflags_Revert|_ble_color_gflags_Invisible))
else
sep=${sep}_sep gsep=0
if [[ $sep == *_right_sep ]]; then
ble/color/g#setfg gsep "$bg"
ble/color/g#setbg gsep "$prev_bg"
else
ble/color/g#setfg gsep "$prev_bg"
ble/color/g#setbg gsep "$bg"
fi
fi
ble/color/g2sgr-ansi "$gsep"
ble/prompt/print "$ret${!sep}"
fi
local ref_show=_ble_lib_vim_airline_section_${section}_show
if [[ ${!ref_show} ]]; then
ble/prompt/unit:{section}/get "_ble_lib_vim_airline_section_$section"; local esc=$ret
ble/color/g2sgr-ansi "$g0"
ble/prompt/print "$ret $esc$ret "
fi
[[ $section == c ]] && ble/prompt/print $'\r'
prev_g0=$g0
prev_bg=$bg
prev_section=$section
}
function ble/prompt/backslash:lib/vim-airline {
local "${_ble_contrib_prompt_git_vars[@]/%/=}" # WA #D1570 checked
ble/prompt/unit#update _ble_lib_vim_airline_mode
ble/prompt/unit#update _ble_lib_vim_airline_sep_width
local lwsep=${_ble_lib_vim_airline_sep_width_data[3]:-1}
local rwsep=${_ble_lib_vim_airline_sep_width_data[4]:-1}
local ret bg=0
ble/color/face2g "vim_airline_c_$_ble_lib_vim_airline_mode"
ble/color/g#getbg "$ret"
ble/color/g#setbg bg "$ret"
ble/color/setface prompt_status_line "g:$bg"
local cols=$COLUMNS; ((_ble_term_xenl||cols--))
local unit rest_cols=$((cols-2*lwsep-3*rwsep))
for unit in _ble_lib_vim_airline_section_{a,c,z,b,y,x}; do
ble/prompt/unit#update "$unit"
local gx1=${unit}_gbox[0]; gx1=${!gx1}
local x2=${unit}_bbox[2]; x2=${!x2}
local show=
[[ $gx1 ]] && ((x2+2<=rest_cols)) && ((show=1,rest_cols-=x2+2))
builtin eval -- "${unit}_show=\$show"
done
local section prev_section= prev_g0= prev_bg=
for section in a b c x y z; do
ble/lib/vim-airline/.print-section "$section"
done
}
bleopt -I vim_airline_@
bleopt keymap_vi_mode_show=
bleopt prompt_status_line='\q{lib/vim-airline}'
bleopt prompt_status_align=$'justify=\r'

View file

@ -0,0 +1,56 @@
# Copyright 2015 Koichi Murase <myoga.murase@gmail.com>. All rights reserved.
# This script is a part of blesh (https://github.com/akinomyoga/ble.sh)
# provided under the BSD-3-Clause license. Do not edit this file because this
# is not the original source code: Various pre-processing has been applied.
# Also, the code comments and blank lines are stripped off in the installation
# process. Please find the corresponding source file(s) in the repository
# "akinomyoga/ble.sh".
#
# Source: /lib/vim-arpeggio.sh
ble-import keymap.vi
bleopt/declare -v vim_arpeggio_timeoutlen 40
function ble/lib/vim-arpeggio.sh/bind/.usage {
ble/util/print "usage: ble/lib/vim-arpeggio.sh/bind [-m KEYMAP] -[fxcs@] KEYS COMMAND"
ble/util/print " KEYS has the form of {mods}{X}{Y}. {mods} are modifiers of the form"
ble/util/print " /([CSMAsH]-)*/ and {X} and {Y} are alphabets which specify simultaneous"
ble/util/print " keys."
}
function ble/lib/vim-arpeggio.sh/bind {
local -a opts=()
if [[ $1 == -m ]]; then
if [[ ! $2 ]]; then
ble/util/print "vim-arpeggio.sh: invalid option argument for \`-m'." >&2
ble/lib/vim-arpeggio.sh/bind/.usage >&2
return 1
fi
ble/array#push opts -m "$2"
shift 2
fi
local type=$1 keys=$2 cmd=$3
if [[ $type == --help ]]; then
ble/lib/vim-arpeggio.sh/bind/.usage
return 0
elif [[ $type != -[fxcs@] ]]; then
ble/util/print "vim-arpeggio.sh: invalid bind type." >&2
ble/lib/vim-arpeggio.sh/bind/.usage >&2
return 1
fi
local mods=
if local rex='^(([CSMAsH]-)+)..'; [[ $keys =~ $rex ]]; then
mods=${BASH_REMATCH[1]}
keys=${keys:${#mods}}
fi
local timeout=$((bleopt_vim_arpeggio_timeoutlen))
((timeout<0)) && timeout=
if ((${#keys}==2)); then
local k1=$mods${keys::1} k2=$mods${keys:1:1}
ble-bind "${opts[@]}" "$type" "$k1 $k2" "$cmd"
ble-bind "${opts[@]}" "$type" "$k2 $k1" "$cmd"
ble-bind "${opts[@]}" -T "$k1" "$timeout"
ble-bind "${opts[@]}" -T "$k2" "$timeout"
else
ble/util/print "vim-arpeggio.sh: sorry only 2-key bindings are supported now." >&2
ble/lib/vim-arpeggio.sh/bind/.usage >&2
return 1
fi
}

View file

@ -0,0 +1,559 @@
# Copyright 2015 Koichi Murase <myoga.murase@gmail.com>. All rights reserved.
# This script is a part of blesh (https://github.com/akinomyoga/ble.sh)
# provided under the BSD-3-Clause license. Do not edit this file because this
# is not the original source code: Various pre-processing has been applied.
# Also, the code comments and blank lines are stripped off in the installation
# process. Please find the corresponding source file(s) in the repository
# "akinomyoga/ble.sh".
#
# Source: /lib/vim-surround.sh
ble-import keymap.vi
bleopt/declare -n vim_surround_45 $'$(\r)' # ysiw-
bleopt/declare -n vim_surround_61 $'$((\r))' # ysiw=
bleopt/declare -n vim_surround_q \" # ysiwQ
bleopt/declare -n vim_surround_Q \' # ysiwq
bleopt/declare -v vim_surround_omap_bind 1
function ble/lib/vim-surround.sh/get-char-from-key {
local key=$1
if ! ble-decode-key/ischar "$key"; then
local flag=$((key&_ble_decode_MaskFlag)) code=$((key&_ble_decode_MaskChar))
if ((flag==_ble_decode_Ctrl&&63<=code&&code<128&&(code&0x1F)!=0)); then
((key=code==63?127:code&0x1F))
else
return 1
fi
fi
ble/util/c2s "$key"
return 0
}
function ble/lib/vim-surround.sh/async-inputtarget.hook {
local mode=$1 hook=${@:2:$#-2} key=${@:$#} ret
if ! ble/lib/vim-surround.sh/get-char-from-key "$key"; then
ble/widget/vi-command/bell
return 1
fi
local c=$ret
if [[ :$mode: == *:digit:* && $c == [0-9] ]]; then
_ble_edit_arg=$_ble_edit_arg$c
_ble_decode_key__hook="ble/lib/vim-surround.sh/async-inputtarget.hook digit $hook"
return 147
elif [[ :$mode: == *:init:* && $c == ' ' ]]; then
_ble_decode_key__hook="ble/lib/vim-surround.sh/async-inputtarget.hook space $hook"
return 147
fi
if [[ $c == [$'\e\003'] ]]; then # C-[, C-c
ble/widget/vi-command/bell
return 1
else
[[ $c == \' ]] && c="'\''"
[[ $mode == space ]] && c=' '$c
builtin eval -- "$hook '$c'"
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 147
}
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 147
}
_ble_lib_vim_surround_previous_tag=html
function ble/lib/vim-surround.sh/load-template {
local ins=$1
if [[ ${ins//[0-9]} && ! ${ins//[_a-zA-Z0-9]} ]]; then
local optname=bleopt_vim_surround_$ins
template=${!optname}
[[ $template ]] && return 0
fi
local ret; ble/util/s2c "$ins"
local optname=bleopt_vim_surround_$ret
template=${!optname}
[[ $template ]] && return 0
case $ins in
(['<tT']*)
local tag=${ins:1}; tag=${tag//$'\r'/' '}
if [[ ! $tag ]]; then
tag=$_ble_lib_vim_surround_previous_tag
else
tag=${tag%'>'}
_ble_lib_vim_surround_previous_tag=$tag
fi
local end_tag=${tag%%["$_ble_term_IFS"]*}
template="<$tag>"$'\r'"</$end_tag>" ;;
('(') template=$'( \r )' ;;
('[') template=$'[ \r ]' ;;
('{') template=$'{ \r }' ;;
(['b)']) template=$'(\r)' ;;
(['r]']) template=$'[\r]' ;;
(['B}']) template=$'{\r}' ;;
(['a>']) template=$'<\r>' ;;
([a-zA-Z]) return 1 ;;
(*) template=$ins ;;
esac
} &>/dev/null
function ble/lib/vim-surround.sh/surround {
local text=$1 ins=$2 opts=$3
local instype=
[[ $ins == $'\x1D' ]] && ins='}' instype=indent # C-], C-}
local has_space=
[[ $ins == ' '?* ]] && ins=${ins:1} has_space=1
local template=
ble/lib/vim-surround.sh/load-template "$ins" || return 1
local prefix= suffix=
if [[ $template == *$'\r'* ]]; then
prefix=${template%%$'\r'*}
suffix=${template#*$'\r'}
else
prefix=$template
suffix=$template
fi
if [[ $prefix == *' ' && $suffix == ' '* ]]; then
prefix=${prefix::${#prefix}-1}
suffix=${suffix:1}
has_space=1
fi
if [[ $instype == indent || :$opts: == *:linewise:* ]]; then
ble-edit/content/find-logical-bol "$beg"; local bol=$ret
ble-edit/content/find-non-space "$bol"; local nol=$ret
local indent=
if [[ $instype == indent ]] || ((bol<nol)); then
indent=${_ble_edit_str:bol:nol-bol}
elif [[ $has_space ]]; then
indent=' '
fi
text=$indent$text
if [[ $instype == indent || :$opts: == *:indent:* ]]; then
ble/keymap:vi/string#increase-indent "$text" "$bleopt_indent_offset"; text=$ret
fi
text=$'\n'$text$'\n'$indent
elif [[ $has_space ]]; then
text=' '$text' '
fi
ret=$prefix$text$suffix
}
function ble/lib/vim-surround.sh/async-read-tagname {
ble/keymap:vi/async-commandline-mode "$1"
_ble_edit_PS1='<'
_ble_keymap_vi_cmap_before_widget=ble/lib/vim-surround.sh/async-read-tagname/.before-command.hook
return 147
}
function ble/lib/vim-surround.sh/async-read-tagname/.before-command.hook {
if [[ ${KEYS[0]} == 62 ]]; then # '>'
ble/widget/self-insert
ble/widget/vi_cmap/accept
ble/decode/widget/suppress-widget
fi
}
_ble_lib_vim_surround_ys_type= # ys | yS | vS | vgS
_ble_lib_vim_surround_ys_args=()
_ble_lib_vim_surround_ys_ranges=()
function ble/highlight/layer:region/mark:vi_surround/get-selection {
local type=$_ble_lib_vim_surround_ys_type
local context=${_ble_lib_vim_surround_ys_args[2]}
if [[ $context == block ]]; then
local -a sub_ranges
sub_ranges=("${_ble_lib_vim_surround_ys_ranges[@]}")
selection=()
local sub
for sub in "${sub_ranges[@]}"; do
ble/string#split sub : "$sub"
((sub[0]<sub[1])) || continue
ble/array#push selection "${sub[0]}" "${sub[1]}"
done
else
selection=("${_ble_lib_vim_surround_ys_args[@]::2}")
if [[ $context == char && ( $type == yS || $type == ySS || $type == vgS ) ]]; then
local ret
ble-edit/content/find-logical-bol "${selection[0]}"; selection[0]=$ret
ble-edit/content/find-logical-eol "${selection[1]}"; selection[1]=$ret
fi
fi
}
function ble/highlight/layer:region/mark:vi_surround/get-face {
face=region_target
}
function ble/lib/vim-surround.sh/operator.impl {
_ble_lib_vim_surround_ys_type=$1; shift
_ble_lib_vim_surround_ys_args=("$@")
[[ $3 == block ]] && _ble_lib_vim_surround_ys_ranges=("${sub_ranges[@]}")
_ble_edit_mark_active=vi_surround
ble/lib/vim-surround.sh/async-inputtarget-noarg ble/widget/vim-surround.sh/ysurround.hook1
ble/lib/vim-surround.sh/ysurround.repeat/entry
return 147
}
function ble/keymap:vi/operator:yS { ble/lib/vim-surround.sh/operator.impl yS "$@"; }
function ble/keymap:vi/operator:ys { ble/lib/vim-surround.sh/operator.impl ys "$@"; }
function ble/keymap:vi/operator:ySS { ble/lib/vim-surround.sh/operator.impl ySS "$@"; }
function ble/keymap:vi/operator:yss { ble/lib/vim-surround.sh/operator.impl yss "$@"; }
function ble/keymap:vi/operator:vS { ble/lib/vim-surround.sh/operator.impl vS "$@"; }
function ble/keymap:vi/operator:vgS { ble/lib/vim-surround.sh/operator.impl vgS "$@"; }
function ble/widget/vim-surround.sh/ysurround.hook1 {
local ins=$1
if local rex='^ ?[<tT]$'; [[ $ins =~ $rex ]]; then
ble/lib/vim-surround.sh/async-read-tagname "ble/widget/vim-surround.sh/ysurround.hook2 '$ins'"
else
ble/widget/vim-surround.sh/ysurround.core "$ins"
fi
}
function ble/widget/vim-surround.sh/ysurround.hook2 {
local ins=$1 tagName=$2
ble/widget/vim-surround.sh/ysurround.core "$ins$tagName"
}
function ble/widget/vim-surround.sh/ysurround.core {
local ins=$1
_ble_edit_mark_active= # mark:vi_surround を解除
local ret
local type=$_ble_lib_vim_surround_ys_type
local beg=${_ble_lib_vim_surround_ys_args[0]}
local end=${_ble_lib_vim_surround_ys_args[1]}
local context=${_ble_lib_vim_surround_ys_args[2]}
local sub_ranges; sub_ranges=("${_ble_lib_vim_surround_ys_ranges[@]}")
_ble_lib_vim_surround_ys_type=
_ble_lib_vim_surround_ys_args=()
_ble_lib_vim_surround_ys_ranges=()
if [[ $context == block ]]; then
local isub=${#sub_ranges[@]} sub
local smin= smax= slpad= srpad=
while ((isub--)); do
local sub=${sub_ranges[isub]}
local stext=${sub#*:*:*:*:*:}
ble/string#split sub : "${sub::${#sub}-${#stext}}"
smin=${sub[0]} smax=${sub[1]}
slpad=${sub[2]} srpad=${sub[3]}
if ! ble/lib/vim-surround.sh/surround "$stext" "$ins"; then
ble/widget/vi-command/bell
return 1
fi
stext=$ret
((slpad)) && { ble/string#repeat ' ' "$slpad"; stext=$ret$stext; }
((srpad)) && { ble/string#repeat ' ' "$srpad"; stext=$stext$ret; }
ble/widget/.replace-range "$smin" "$smax" "$stext"
done
else
local text=${_ble_edit_str:beg:end-beg}
if [[ $type == ys ]]; then
if local rex=$'[ \t\n]+$'; [[ $text =~ $rex ]]; then
((end-=${#BASH_REMATCH}))
text=${_ble_edit_str:beg:end-beg}
fi
fi
local opts=
if [[ $type == yS || $type == ySS || $context == char && $type == vgS ]]; then
opts=linewise:indent
elif [[ $context == line ]]; then
opts=linewise
fi
if ! ble/lib/vim-surround.sh/surround "$text" "$ins" "$opts"; then
ble/widget/vi-command/bell
return 1
fi
local text=$ret
ble/widget/.replace-range "$beg" "$end" "$text"
fi
_ble_edit_ind=$beg
if [[ $context == line ]]; then
ble/widget/vi-command/first-non-space
else
ble/keymap:vi/adjust-command-mode
fi
ble/keymap:vi/mark/end-edit-area
ble/lib/vim-surround.sh/ysurround.repeat/record "$type" "$ins"
return 0
}
function ble/widget/vim-surround.sh/ysurround-current-line {
ble/widget/vi_nmap/linewise-operator yss
}
function ble/widget/vim-surround.sh/ySurround-current-line {
ble/widget/vi_nmap/linewise-operator ySS
}
function ble/widget/vim-surround.sh/vsurround { # vS
ble/widget/vi-command/operator vS
}
function ble/widget/vim-surround.sh/vgsurround { # vgS
[[ $_ble_decode_keymap == vi_xmap ]] &&
ble/keymap:vi/xmap/add-eol-extension # 末尾拡張
ble/widget/vi-command/operator vgS
}
_ble_lib_vim_surround_ys_repeat=()
function ble/lib/vim-surround.sh/ysurround.repeat/entry {
local -a _ble_keymap_vi_repeat _ble_keymap_vi_repeat_irepeat
ble/keymap:vi/repeat/record-normal
_ble_lib_vim_surround_ys_repeat=("${_ble_keymap_vi_repeat[@]}")
}
function ble/lib/vim-surround.sh/ysurround.repeat/record {
ble/keymap:vi/repeat/record-special && return 0
local type=$1 ins=$2
_ble_keymap_vi_repeat=("${_ble_lib_vim_surround_ys_repeat[@]}")
_ble_keymap_vi_repeat_irepeat=()
_ble_keymap_vi_repeat[10]=$type
_ble_keymap_vi_repeat[11]=$ins
case $type in
(vS|vgS)
_ble_keymap_vi_repeat[2]='ble/widget/vi-command/operator ysurround.repeat'
_ble_keymap_vi_repeat[4]= ;;
(yss|ySS)
_ble_keymap_vi_repeat[2]='ble/widget/vi_nmap/linewise-operator ysurround.repeat'
_ble_keymap_vi_repeat[4]= ;;
(*)
_ble_keymap_vi_repeat[4]=ysurround.repeat
esac
}
function ble/keymap:vi/operator:ysurround.repeat {
_ble_lib_vim_surround_ys_type=${_ble_keymap_vi_repeat[10]}
_ble_lib_vim_surround_ys_args=("$@")
[[ $3 == block ]] && _ble_lib_vim_surround_ys_ranges=("${sub_ranges[@]}")
local ins=${_ble_keymap_vi_repeat[11]}
ble/widget/vim-surround.sh/ysurround.core "$ins"
}
function ble/keymap:vi/operator:surround.record { return 0; }
function ble/keymap:vi/operator:surround {
local beg=$1 end=$2 context=$3
local content=$surround_content ins=$surround_ins trims=$surround_trim
local ret
if [[ $trims ]]; then
ble/string#trim "$content"; content=$ret
fi
local opts=; [[ $surround_type == cS ]] && opts=linewise
if ! ble/lib/vim-surround.sh/surround "$content" "$ins" "$opts"; then
ble/widget/vi-command/bell
return 0
fi
content=$ret
ble/widget/.replace-range "$beg" "$end" "$content"
return 0
}
function ble/keymap:vi/operator:surround-extract-region {
surround_beg=$beg surround_end=$end
return 147 # 強制中断する為
}
_ble_lib_vim_surround_cs=()
function ble/widget/vim-surround.sh/nmap/csurround.initialize {
_ble_lib_vim_surround_cs=("${@:1:3}")
return 0
}
function ble/widget/vim-surround.sh/nmap/csurround.set-delimiter {
local type=${_ble_lib_vim_surround_cs[0]}
local arg=${_ble_lib_vim_surround_cs[1]}
local reg=${_ble_lib_vim_surround_cs[2]}
_ble_lib_vim_surround_cs[3]=$1
local trim=
[[ $del == ' '?* ]] && trim=1 del=${del:1}
if [[ $del == a ]]; then
del='>'
elif [[ $del == r ]]; then
del=']'
elif [[ $del == T ]]; then
del='t' trim=1
fi
local obj1= obj2=
case $del in
([wWps]) obj1=i$del obj2=i$del ;;
([\'\"\`]) obj1=i$del obj2=a$del arg=1 ;;
(['bB)}>]t']) obj1=i$del obj2=a$del ;;
(['({<[']) obj1=i$del obj2=a$del trim=1 ;;
([a-zA-Z]) obj1=i$del obj2=a$del ;;
esac
local beg end
if [[ $obj1 && $obj2 ]]; then
local surround_beg=$_ble_edit_ind surround_end=$_ble_edit_ind
ble/keymap:vi/text-object.impl "$arg" surround-extract-region '' "$obj2"
beg=$surround_beg end=$surround_end
elif [[ $del == / ]]; then
local rex='(/\*([^/]|/[^*])*/?){1,'$arg'}$'
[[ ${_ble_edit_str::_ble_edit_ind+2} =~ $rex ]] || return 1
beg=$((_ble_edit_ind+2-${#BASH_REMATCH}))
ble/string#index-of "${_ble_edit_str:beg+2}" '*/' || return 1
end=$((beg+ret+4))
elif [[ $del ]]; then
local ret
ble-edit/content/find-logical-bol; local bol=$ret
ble-edit/content/find-logical-eol; local eol=$ret
local line=${_ble_edit_str:bol:eol-bol}
local ind=$((_ble_edit_ind-bol))
if ble/string#last-index-of "${line::ind}" "$del"; then
beg=$ret
elif local base=$((ind-(2*${#del}-1))); ((base>=0||(base=0)))
ble/string#index-of "${line:base:ind+${#del}-base}" "$del"; then
beg=$((base+ret))
else
return 1
fi
ble/string#index-of "${line:beg+${#del}}" "$del" || return 1
end=$((beg+2*${#del}+ret))
((beg+=bol,end+=bol))
fi
_ble_lib_vim_surround_cs[11]=$del
_ble_lib_vim_surround_cs[12]=$obj1
_ble_lib_vim_surround_cs[13]=$obj2
_ble_lib_vim_surround_cs[14]=$beg
_ble_lib_vim_surround_cs[15]=$end
_ble_lib_vim_surround_cs[16]=$arg
_ble_lib_vim_surround_cs[17]=$trim
}
function ble/widget/vim-surround.sh/nmap/csurround.replace {
local ins=$1
local type=${_ble_lib_vim_surround_cs[0]}
local arg=${_ble_lib_vim_surround_cs[1]}
local reg=${_ble_lib_vim_surround_cs[2]}
local del=${_ble_lib_vim_surround_cs[3]}
local del2=${_ble_lib_vim_surround_cs[11]}
local obj1=${_ble_lib_vim_surround_cs[12]}
local obj2=${_ble_lib_vim_surround_cs[13]}
local beg=${_ble_lib_vim_surround_cs[14]}
local end=${_ble_lib_vim_surround_cs[15]}
local arg2=${_ble_lib_vim_surround_cs[16]}
local surround_ins=$ins
local surround_type=$type
local surround_trim=${_ble_lib_vim_surround_cs[17]}
if [[ $obj1 && $obj2 ]]; then
local ind=$_ble_edit_ind
local _ble_edit_kill_ring _ble_edit_kill_type
ble/keymap:vi/text-object.impl "$arg2" y '' "$obj1"; local ext=$?
_ble_edit_ind=$ind
((ext!=0)) && return 1
local surround_content=$_ble_edit_kill_ring
ble/keymap:vi/text-object.impl "$arg2" surround '' "$obj2" || return 1
elif [[ $del2 == / ]]; then
local surround_content=${_ble_edit_str:beg+2:end-beg-4}
ble/keymap:vi/call-operator surround "$beg" "$end" char '' ''
_ble_edit_ind=$beg
elif [[ $del2 ]]; then
local surround_content=${_ble_edit_str:beg+${#del2}:end-beg-2*${#del2}}
ble/keymap:vi/call-operator surround "$beg" "$end" char '' ''
_ble_edit_ind=$beg
else
ble/widget/vi-command/bell
return 1
fi
ble/widget/vim-surround.sh/nmap/csurround.record "$type" "$arg" "$reg" "$del" "$ins"
ble/keymap:vi/adjust-command-mode
return 0
}
function ble/widget/vim-surround.sh/nmap/csurround.record {
[[ $_ble_keymap_vi_mark_suppress_edit ]] && return 0
local type=$1 arg=$2 reg=$3 del=$4 ins=$5
local WIDGET=ble/widget/vim-surround.sh/nmap/csurround.repeat ARG=$arg FLAG= REG=$reg
ble/keymap:vi/repeat/record
if [[ $_ble_decode_keymap == vi_imap ]]; then
_ble_keymap_vi_repeat_insert[10]=$type
_ble_keymap_vi_repeat_insert[11]=$del
_ble_keymap_vi_repeat_insert[12]=$ins
else
_ble_keymap_vi_repeat[10]=$type
_ble_keymap_vi_repeat[11]=$del
_ble_keymap_vi_repeat[12]=$ins
fi
}
function ble/widget/vim-surround.sh/nmap/csurround.repeat {
local ARG FLAG REG; ble/keymap:vi/get-arg 1
local type=${_ble_keymap_vi_repeat[10]}
local del=${_ble_keymap_vi_repeat[11]}
local ins=${_ble_keymap_vi_repeat[12]}
ble/widget/vim-surround.sh/nmap/csurround.initialize "$type" "$ARG" "$REG" &&
ble/widget/vim-surround.sh/nmap/csurround.set-delimiter "$del" &&
ble/widget/vim-surround.sh/nmap/csurround.replace "$ins" && return 0
ble/widget/vi-command/bell
return 1
}
function ble/widget/vim-surround.sh/nmap/dsurround {
local ARG FLAG REG; ble/keymap:vi/get-arg 1
ble/widget/vim-surround.sh/nmap/csurround.initialize ds "$ARG" "$REG"
ble/lib/vim-surround.sh/async-inputtarget ble/widget/vim-surround.sh/nmap/dsurround.hook
}
function ble/widget/vim-surround.sh/nmap/dsurround.hook {
local del=$1
ble/widget/vim-surround.sh/nmap/csurround.set-delimiter "$del" &&
ble/widget/vim-surround.sh/nmap/csurround.replace '' && return 0
ble/widget/vi-command/bell
return 1
}
function ble/highlight/layer:region/mark:vi_csurround/get-selection {
local beg=${_ble_lib_vim_surround_cs[14]}
local end=${_ble_lib_vim_surround_cs[15]}
selection=("$beg" "$end")
}
function ble/highlight/layer:region/mark:vi_csurround/get-face {
face=region_target
}
function ble/widget/vim-surround.sh/nmap/csurround {
ble/widget/vim-surround.sh/nmap/csurround.impl cs
}
function ble/widget/vim-surround.sh/nmap/cSurround {
ble/widget/vim-surround.sh/nmap/csurround.impl cS
}
function ble/widget/vim-surround.sh/nmap/csurround.impl {
local ARG FLAG REG; ble/keymap:vi/get-arg 1
local type=$1
ble/widget/vim-surround.sh/nmap/csurround.initialize "$type" "$ARG" "$REG"
ble/lib/vim-surround.sh/async-inputtarget ble/widget/vim-surround.sh/nmap/csurround.hook1
}
function ble/widget/vim-surround.sh/nmap/csurround.hook1 {
local del=$1
if [[ $del ]] && ble/widget/vim-surround.sh/nmap/csurround.set-delimiter "$del"; then
_ble_edit_mark_active=vi_csurround
ble/lib/vim-surround.sh/async-inputtarget-noarg ble/widget/vim-surround.sh/nmap/csurround.hook2
return "$?"
fi
_ble_lib_vim_surround_cs=()
ble/widget/vi-command/bell
return 1
}
function ble/widget/vim-surround.sh/nmap/csurround.hook2 {
local ins=$1
if local rex='^ ?[<tT]$'; [[ $ins =~ $rex ]]; then
ble/lib/vim-surround.sh/async-read-tagname "ble/widget/vim-surround.sh/nmap/csurround.hook3 '$ins'"
else
ble/widget/vim-surround.sh/nmap/csurround.hook3 "$ins"
fi
}
function ble/widget/vim-surround.sh/nmap/csurround.hook3 {
local ins=$1 tagName=$2
_ble_edit_mark_active= # clear mark:vi_csurround
ble/widget/vim-surround.sh/nmap/csurround.replace "$ins$tagName" && return 0
ble/widget/vi-command/bell
return 1
}
function ble/widget/vim-surround.sh/omap {
local ret n=${#KEYS[@]}
if ! ble/keymap:vi/k2c "${KEYS[n?n-1:0]}"; then
ble/widget/.bell
return 1
fi
ble/util/c2s "$ret"; local s=$ret
local opfunc=${_ble_keymap_vi_opfunc%%:*}$s
local opflags=${_ble_keymap_vi_opfunc#*:}
case $opfunc in
(y[sS])
local ARG FLAG REG; ble/keymap:vi/get-arg 1
_ble_edit_arg=$ARG
_ble_keymap_vi_reg=$REG
ble/decode/keymap/pop
ble/widget/vi-command/operator "$opfunc:$opflags" ;;
(yss)
ble/widget/vi_nmap/linewise-operator "yss:$opflags" ;;
(yS[sS])
ble/widget/vi_nmap/linewise-operator "ySS:$opflags" ;;
(ds) ble/widget/vim-surround.sh/nmap/dsurround ;;
(cs) ble/widget/vim-surround.sh/nmap/csurround ;;
(cS) ble/widget/vim-surround.sh/nmap/cSurround ;;
(*) ble/widget/.bell ;;
esac
}
ble-bind -m vi_xmap -f 'S' vim-surround.sh/vsurround
ble-bind -m vi_xmap -f 'g S' vim-surround.sh/vgsurround
if [[ $bleopt_vim_surround_omap_bind ]]; then
ble-bind -m vi_omap -f s 'vim-surround.sh/omap'
ble-bind -m vi_omap -f S 'vim-surround.sh/omap'
else
ble-bind -m vi_nmap -f 'y s' 'vi-command/operator ys'
ble-bind -m vi_nmap -f 'y s s' 'vim-surround.sh/ysurround-current-line'
ble-bind -m vi_nmap -f 'y S' 'vi-command/operator yS'
ble-bind -m vi_nmap -f 'y S s' 'vim-surround.sh/ySurround-current-line'
ble-bind -m vi_nmap -f 'y S S' 'vim-surround.sh/ySurround-current-line'
ble-bind -m vi_nmap -f 'd s' 'vim-surround.sh/nmap/dsurround'
ble-bind -m vi_nmap -f 'c s' 'vim-surround.sh/nmap/csurround'
ble-bind -m vi_nmap -f 'c S' 'vim-surround.sh/nmap/cSurround'
fi