@@ -1137,35 +1137,6 @@ function ble/keymap:vi/register#play {
11371137 ble/widget/.MACRO " ${ret[@]} "
11381138 return 0
11391139}
1140- # # @fn ble/keymap:vi/register#dump/escape text
1141- # # @var[out] ret
1142- function ble/keymap:vi/register#dump/escape {
1143- local text=$1
1144- local out= i=0 iN=${# text}
1145- while (( i< iN)) ; do
1146- local tail=${text: i}
1147- if ble/util/isprint+ " $tail " ; then
1148- out=$out$BASH_REMATCH
1149- (( i+= ${# BASH_REMATCH} ))
1150- else
1151- ble/util/s2c " $tail "
1152- local code=$ret
1153- if (( code< 32 )) ; then
1154- ble/util/c2s " $(( code+ 64 )) "
1155- out=$out$_ble_term_rev ^$ret$_ble_term_sgr0
1156- elif (( code== 127 )) ; then
1157- out=$out$_ble_term_rev ^? $_ble_term_sgr0
1158- elif (( 128 <= code&& code< 160 )) ; then
1159- ble/util/c2s " $(( code- 64 )) "
1160- out=$out ${_ble_term_rev} M-^$ret$_ble_term_sgr0
1161- else
1162- out=$out ${tail:: 1}
1163- fi
1164- (( i++ ))
1165- fi
1166- done
1167- ret=$out
1168- }
11691140function ble/keymap:vi/register#dump {
11701141 local k ret out=
11711142 local value type content
@@ -1184,19 +1155,13 @@ function ble/keymap:vi/register#dump {
11841155 (B:* ) type=block ;;
11851156 (* ) type=char ;;
11861157 esac
1187- ble/keymap:vi/register#dump/escape " $content " ; content=$ret
11881158
1189- out=$out ' "' $k ' (' $type ' ) ' $content $' \n '
1159+ ble/string#escape-for-display " $content " sgr1=" $_ble_term_rev " :sgr0=" $_ble_term_sgr0 "
1160+ out=$out ' "' $k ' (' $type ' ) ' $ret $' \n '
11901161 done
11911162 ble/edit/info/show ansi " $out "
11921163 return 0
11931164}
1194- function ble/widget/vi-command:reg { ble/keymap:vi/register#dump; }
1195- function ble/widget/vi-command:regi { ble/keymap:vi/register#dump; }
1196- function ble/widget/vi-command:regis { ble/keymap:vi/register#dump; }
1197- function ble/widget/vi-command:regist { ble/keymap:vi/register#dump; }
1198- function ble/widget/vi-command:registe { ble/keymap:vi/register#dump; }
1199- function ble/widget/vi-command:register { ble/keymap:vi/register#dump; }
12001165function ble/widget/vi-command:registers { ble/keymap:vi/register#dump; }
12011166
12021167function ble/widget/vi-command/append-arg {
@@ -2710,7 +2675,7 @@ function ble/keymap:vi/mark/get-mark.impl {
27102675 ret=$index
27112676 return 0
27122677}
2713- # # @fn ble/keymap:vi/mark/get-mark.impl c
2678+ # # @fn ble/keymap:vi/mark/get-local- mark
27142679# # @param[in] c
27152680# # mark の番号 (文字コード) を指定します。
27162681# # @var[out] ret
@@ -2855,6 +2820,55 @@ function ble/widget/vi-command/goto-mark.hook {
28552820 return 1
28562821}
28572822
2823+ function ble/widget/vi-command:marks {
2824+ ble/keymap:vi/mark/update-mark-history
2825+
2826+ local -a entries=() # <char>:<hindex>:<bol>:<col>
2827+ local c
2828+ for c in " ${! _ble_keymap_vi_mark_local[@]} " ; do
2829+ local value=${_ble_keymap_vi_mark_local[c]}
2830+ [[ $value ]] && ble/array#push entries " $c ::$value "
2831+ done
2832+ for c in " ${! _ble_keymap_vi_mark_global[@]} " ; do
2833+ local value=${_ble_keymap_vi_mark_global[c]}
2834+ [[ $value ]] && ble/array#push entries " $c :$value "
2835+ done
2836+
2837+ local -a fields=()
2838+ local data ret
2839+ for data in " ${entries[@]} " ; do
2840+ ble/string#split data : " $data "
2841+
2842+ ble/util/c2s-edit " ${data[0]} " sgr1=$' \e [9807m' :sgr0=$' \e [9807m' ; local s=$ret
2843+
2844+ # determine the line number and history position
2845+ local line hlabel=
2846+ if [[ ${data[1]} ]]; then
2847+ local entry
2848+ ble/history/get-edited-entry " $index "
2849+ line=$entry
2850+ hlabel=' !' ${data[1]}
2851+ else
2852+ line=$_ble_edit_str
2853+ fi
2854+ ble/string#count-char " ${line:: data[2]} " $' \n '
2855+ (( line= 1 + ret))
2856+
2857+ ble/keymap:vi/mark/get-mark.impl " $line " " ${data[3]} " ; local ind=$ret
2858+
2859+ ble/array#push fields " ${data[0]} " " $s " " $line " " ${data[3]} " " $ind " " $hlabel "
2860+ done
2861+
2862+ if (( ${# fields[@]} )) ; then
2863+ local content
2864+ ble/util/sprintf content ' %7d %s\t(%3d, %3d) %5d%s\n' " ${fields[@]} "
2865+ content=${content% $' \n ' }
2866+ local mydbg=1
2867+ ble/edit/info/show ansi " $content "
2868+ fi
2869+ return 0
2870+ }
2871+
28582872# ------------------------------------------------------------------------------
28592873# repeat (nmap .)
28602874
@@ -5503,6 +5517,8 @@ function ble/widget/vi-command/commandline.hook {
55035517 local cmd=ble/widget/vi-command:" ${command[0]} "
55045518 if ble/is-function " $cmd " ; then
55055519 " $cmd " " ${command[@]: 1} " ; local ext=$?
5520+ elif ble/util/compgen cmd -A function -- " ble/widget/vi-command:${command[@]} " && (( ${# cmd[@]} == 1 )) ; then
5521+ " $cmd " " ${command[@]: 1} " ; local ext=$?
55065522 else
55075523 ble/widget/vi-command/bell " unknown command $1 " ; local ext=1
55085524 fi
0 commit comments