@kecan0406/ttheme 1.0.44 → 1.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -18
- package/bin/ttheme.js +167 -165
- package/bin/ttheme.js.map +1 -1
- package/dist/manifest.json +1 -1
- package/package.json +1 -1
- package/shell/adapters/_bg.zsh +6 -6
- package/shell/adapters/ghostty.zsh +2 -2
- package/shell/adapters/iterm2.zsh +1 -1
- package/shell/ttheme.zsh +78 -69
package/dist/manifest.json
CHANGED
package/package.json
CHANGED
package/shell/adapters/_bg.zsh
CHANGED
|
@@ -6,7 +6,7 @@ __tt_ghostty_shown() {
|
|
|
6
6
|
[[ -r $f ]] || return 1
|
|
7
7
|
REPLY=${${"$(<$f)"}##*\?}
|
|
8
8
|
REPLY=${REPLY%.conf}
|
|
9
|
-
REPLY=${REPLY/--/@}
|
|
9
|
+
REPLY=${${REPLY/--/@}/--//}
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
__tt_put() {
|
|
@@ -92,7 +92,7 @@ __tt_bg_path() {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
__tt_bg_load() {
|
|
95
|
-
local name=$1 file=${1/@/--} dir=${TTHEME_CONFIG:h}/backgrounds img="" fit=contain op=1 pos=center f line stem="" size=100 REPLY
|
|
95
|
+
local name=$1 file=${${1/@/--}/\//--} dir=${TTHEME_CONFIG:h}/backgrounds img="" fit=contain op=1 pos=center f line stem="" size=100 REPLY
|
|
96
96
|
local -i at=5
|
|
97
97
|
local -a fills lines
|
|
98
98
|
(( ${+bgsrc[$name]} )) && return 0
|
|
@@ -189,7 +189,7 @@ __tt_bg_bake() {
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
__tt_bg_include() {
|
|
192
|
-
local file=${1/@/--}
|
|
192
|
+
local file=${${1/@/--}/\//--}
|
|
193
193
|
local conf=${TTHEME_CONFIG:h}/backgrounds/$file.conf line
|
|
194
194
|
local -a lines=() add=()
|
|
195
195
|
[[ -r $conf ]] && lines=("${(@f)$(<$conf)}")
|
|
@@ -205,7 +205,7 @@ __tt_bg_write() {
|
|
|
205
205
|
local pos=${TTHEME_BG_POSITIONS[${bgpos[$1]}]}
|
|
206
206
|
local -i W=$(( (pw + 2 * bgmx) * bgcw )) H=$(( (ph + 2 * bgmy) * bgch ))
|
|
207
207
|
local -a wh fr
|
|
208
|
-
[[ -r $dir/${name/@/--}.conf ]] || return 0
|
|
208
|
+
[[ -r $dir/${${name/@/--}/\//--}.conf ]] || return 0
|
|
209
209
|
__tt_bg_include $name || return 1
|
|
210
210
|
if [[ "$size ${bgpos[$1]} ${bgop[$1]}" == "${bgdef[$1]}" ]]; then
|
|
211
211
|
rm -f -- $dir/${bgtunef[$1]}
|
|
@@ -449,7 +449,7 @@ __tt_pv_bg_image() {
|
|
|
449
449
|
__tt_bg_load $name
|
|
450
450
|
bgload[$name]="" bgedit[$name]=1
|
|
451
451
|
msg=${err:-"background · $name"} msgt=$(( rc ? 300 : 200 ))
|
|
452
|
-
[[ -r ${TTHEME_CONFIG:h}/backgrounds/${name/@/--}.conf ]] || return 0
|
|
452
|
+
[[ -r ${TTHEME_CONFIG:h}/backgrounds/${${name/@/--}/\//--}.conf ]] || return 0
|
|
453
453
|
tune=$name tf=1 tsnap="${bgsize[$name]} ${bgpos[$name]} ${bgop[$name]} ${bgoff[$name]}"
|
|
454
454
|
}
|
|
455
455
|
|
|
@@ -527,7 +527,7 @@ __tt_pv_bg_save() {
|
|
|
527
527
|
continue
|
|
528
528
|
fi
|
|
529
529
|
saved+=($name)
|
|
530
|
-
if [[ ! -r ${TTHEME_CONFIG:h}/backgrounds/${name/@/--}.conf ]]; then
|
|
530
|
+
if [[ ! -r ${TTHEME_CONFIG:h}/backgrounds/${${name/@/--}/\//--}.conf ]]; then
|
|
531
531
|
msg="background · $name none"
|
|
532
532
|
elif (( bgoff[$name] )); then
|
|
533
533
|
msg="background · $name off"
|
|
@@ -22,9 +22,9 @@ __tt_shown() {
|
|
|
22
22
|
__tt_bg_shown
|
|
23
23
|
was=$REPLY
|
|
24
24
|
[[ $was == $1 ]] && return 1
|
|
25
|
-
[[ -r $dir/${1/@/--}.conf || ( -n $was && -r $dir/${was/@/--}.conf ) ]] || return 1
|
|
25
|
+
[[ -r $dir/${${1/@/--}/\//--}.conf || ( -n $was && -r $dir/${${was/@/--}/\//--}.conf ) ]] || return 1
|
|
26
26
|
[[ -d $dir ]] || mkdir -p $dir || return 1
|
|
27
|
-
__tt_put $dir/shown.conf "config-file = ?${1/@/--}.conf"
|
|
27
|
+
__tt_put $dir/shown.conf "config-file = ?${${1/@/--}/\//--}.conf"
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
__tt_bg_cells() {
|
|
@@ -20,7 +20,7 @@ __tt_shown() {
|
|
|
20
20
|
__tt_bg_shown
|
|
21
21
|
was=$REPLY
|
|
22
22
|
[[ $2 != force && $was == $1 ]] && return 1
|
|
23
|
-
[[ -r $dir/${1/@/--}.conf || ( -n $was && -r $dir/${was/@/--}.conf ) ]] || (( TTHEME_MUXED )) || return 1
|
|
23
|
+
[[ -r $dir/${${1/@/--}/\//--}.conf || ( -n $was && -r $dir/${${was/@/--}/\//--}.conf ) ]] || (( TTHEME_MUXED )) || return 1
|
|
24
24
|
(( ${TTHEME_ORDER[(Ie)$1]} )) || return 1
|
|
25
25
|
__tt_out $'\e]1337;SetProfile=ttheme · '$1$'\a'
|
|
26
26
|
TTHEME_ITERM_SHOWN=$1
|
package/shell/ttheme.zsh
CHANGED
|
@@ -169,15 +169,22 @@ __tt_name_of() { REPLY=${${(k)TTHEME_PALETTE[(re)$1]}:-custom} }
|
|
|
169
169
|
__tt_color() { [[ -t 1 && -z $NO_COLOR && $TERM != dumb ]] }
|
|
170
170
|
|
|
171
171
|
__tt_palette_line() {
|
|
172
|
-
local name=$1
|
|
173
|
-
local -a p=(${=TTHEME_PALETTE[$name]})
|
|
172
|
+
local name=$1 width=$2 on=$3 hex cell="" bar=""
|
|
173
|
+
local -a p=(${=TTHEME_PALETTE[$name]}) sw=(${=TTHEME_SWATCH[$name]})
|
|
174
174
|
(( ${#p} >= 20 )) || return 1
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
175
|
+
for hex in $sw; do
|
|
176
|
+
hex=${hex#\#}
|
|
177
|
+
cell+=$'\e[38;2;'$((16#${hex:0:2}))';'$((16#${hex:2:2}))';'$((16#${hex:4:2}))'m■ '
|
|
178
|
+
done
|
|
179
|
+
if [[ -n $on ]]; then
|
|
180
|
+
local cur=${p[3]#\#} sel=${p[4]#\#} fg=${p[2]#\#} ac
|
|
181
|
+
printf -v ac '\e[38;2;%d;%d;%dm' $((16#${cur:0:2})) $((16#${cur:2:2})) $((16#${cur:4:2}))
|
|
182
|
+
printf -v bar '\e[48;2;%d;%d;%d;38;2;%d;%d;%dm' \
|
|
183
|
+
$((16#${sel:0:2})) $((16#${sel:2:2})) $((16#${sel:4:2})) $((16#${fg:0:2})) $((16#${fg:2:2})) $((16#${fg:4:2}))
|
|
184
|
+
printf '%s▌\e[39m %s %s■\e[39m \e[1m%-*s\e[22m %s\e[0m\n' "$ac" "$bar" "$ac" "$width" "$name" "$cell"
|
|
185
|
+
else
|
|
186
|
+
printf ' %-*s %s\e[0m\n' "$width" "$name" "$cell"
|
|
187
|
+
fi
|
|
181
188
|
}
|
|
182
189
|
|
|
183
190
|
__tt_announce() {
|
|
@@ -384,8 +391,9 @@ __tt_order() {
|
|
|
384
391
|
}
|
|
385
392
|
|
|
386
393
|
__tt_menu() {
|
|
387
|
-
local k cur=""
|
|
394
|
+
local k cur="" grp last_grp="" REPLY
|
|
388
395
|
local -a reply
|
|
396
|
+
local -i width=0
|
|
389
397
|
__tt_order
|
|
390
398
|
if ! __tt_color; then
|
|
391
399
|
for k in $reply; do
|
|
@@ -394,26 +402,21 @@ __tt_menu() {
|
|
|
394
402
|
return 0
|
|
395
403
|
fi
|
|
396
404
|
[[ -n $TTHEME_SPEC ]] && __tt_name_of "$TTHEME_SPEC" && cur=$REPLY
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
local ch=${cp[3]#\#}
|
|
401
|
-
printf -v gutter '\033[38;2;%d;%d;%dm◆\033[0m ' \
|
|
402
|
-
$((16#${ch:0:2})) $((16#${ch:2:2})) $((16#${ch:4:2}))
|
|
403
|
-
fi
|
|
405
|
+
for k in $reply; do
|
|
406
|
+
(( ${#k} > width )) && width=${#k}
|
|
407
|
+
done
|
|
404
408
|
for k in $reply; do
|
|
405
409
|
grp=${TTHEME_GROUP[$k]:-Other}
|
|
406
410
|
if [[ $grp != $last_grp ]]; then
|
|
407
|
-
printf '\033[
|
|
411
|
+
[[ $grp == *@* && $last_grp != *@* && -n $last_grp ]] && printf ' \033[2m── markets ──────────\033[0m\n'
|
|
412
|
+
printf ' \033[1m%s\033[0m' "$grp"
|
|
408
413
|
[[ -n ${TTHEME_NATIVE[$k]} ]] && printf ' \033[2m%s\033[0m' "${TTHEME_NATIVE[$k]}"
|
|
409
414
|
printf '\n'
|
|
410
415
|
last_grp=$grp
|
|
411
416
|
fi
|
|
412
|
-
|
|
413
|
-
[[ $k == $cur ]] && mark=$gutter
|
|
414
|
-
__tt_palette_line "$k" "$mark"
|
|
417
|
+
__tt_palette_line "$k" $width ${${(M)k:#$cur}:+1}
|
|
415
418
|
done
|
|
416
|
-
printf '\n\033[2mttheme use <palette> paints this tab · ttheme preview · ttheme help\033[0m\n'
|
|
419
|
+
printf '\n \033[2mttheme use <palette> paints this tab · ttheme preview · ttheme help\033[0m\n'
|
|
417
420
|
}
|
|
418
421
|
|
|
419
422
|
__tt_help() {
|
|
@@ -589,7 +592,7 @@ __tt_rotate() {
|
|
|
589
592
|
|
|
590
593
|
__tt_pv_rows() {
|
|
591
594
|
rtype=() rval=() rcnt=()
|
|
592
|
-
local g t gm
|
|
595
|
+
local g t gm ruled=""
|
|
593
596
|
local -a ts
|
|
594
597
|
for g in $groups; do
|
|
595
598
|
ts=()
|
|
@@ -599,6 +602,10 @@ __tt_pv_rows() {
|
|
|
599
602
|
[[ -z $flt || -n $gm || $t == *$flt* ]] && ts+=($t)
|
|
600
603
|
done
|
|
601
604
|
[[ -n $flt ]] && (( ! ${#ts} )) && continue
|
|
605
|
+
if [[ $g == *@* && -z $ruled ]]; then
|
|
606
|
+
ruled=1
|
|
607
|
+
(( ${#rtype} )) && { rtype+=(rule); rval+=(''); rcnt+=(0) }
|
|
608
|
+
fi
|
|
602
609
|
rtype+=(hdr); rval+=($g); rcnt+=(${#ts})
|
|
603
610
|
if [[ -n $flt || -n ${exp[$g]} ]]; then
|
|
604
611
|
for t in $ts; do rtype+=(thm); rval+=($t); rcnt+=(0); done
|
|
@@ -729,14 +736,22 @@ __tt_pv_hl() {
|
|
|
729
736
|
}
|
|
730
737
|
|
|
731
738
|
__tt_pv_row() {
|
|
732
|
-
local t=${rval[$1]} b=$'\e[1m' d=$'\e[2m' r=$'\e[22;24;39m' z=$'\e[0m' on="" base="" lead=$'\e[2m' mark=" " name arrow=▸
|
|
739
|
+
local t=${rval[$1]} b=$'\e[1m' d=$'\e[2m' r=$'\e[22;24;39m' z=$'\e[0m' on="" gut=" " base="" lead=$'\e[2m' mark=" " name arrow=▸
|
|
733
740
|
local -i w
|
|
734
741
|
(( color )) || b= d= r= z= lead=
|
|
735
|
-
(( $1 == cur
|
|
742
|
+
if (( $1 == cur )); then
|
|
743
|
+
gut=$ac"▌"$r" "
|
|
744
|
+
(( color )) && on=$sb
|
|
745
|
+
fi
|
|
746
|
+
if [[ ${rtype[$1]} == rule ]]; then
|
|
747
|
+
name='── markets '
|
|
748
|
+
REPLY=" "$d$name${(l:lw - 4 - ${#name}::─:)}$z
|
|
749
|
+
return 0
|
|
750
|
+
fi
|
|
736
751
|
if [[ ${rtype[$1]} == hdr ]]; then
|
|
737
752
|
[[ -n $flt || -n ${exp[$t]} ]] && arrow=▾
|
|
738
753
|
name=$t
|
|
739
|
-
(( ${(m)#name} > lw -
|
|
754
|
+
(( ${(m)#name} > lw - 10 )) && name="${name[1,lw-11]}…"
|
|
740
755
|
base=$b
|
|
741
756
|
if (( color )) && [[ $t == "$ag" ]]; then
|
|
742
757
|
base+=$ac lead=$ac
|
|
@@ -744,24 +759,24 @@ __tt_pv_row() {
|
|
|
744
759
|
lead=""
|
|
745
760
|
fi
|
|
746
761
|
__tt_pv_hl "$name" "$base"
|
|
747
|
-
w=$(( lw -
|
|
762
|
+
w=$(( lw - 6 - ${(m)#name} - ${#rcnt[$1]} ))
|
|
748
763
|
(( w < 1 )) && w=1
|
|
749
|
-
REPLY=$on$lead$arrow$r" "$base$REPLY$r${(l:w:: :)}$d${rcnt[$1]}$z
|
|
764
|
+
REPLY=$gut$on" "$lead$arrow$r" "$base$REPLY$r${(l:w:: :)}$d${rcnt[$1]}$r" "$z
|
|
750
765
|
return 0
|
|
751
766
|
fi
|
|
752
767
|
if (( $1 == cur )); then
|
|
753
|
-
mark=$
|
|
768
|
+
mark=$ac"■"$r base=$b
|
|
754
769
|
elif [[ -n $cdot && $t == "$cn" ]]; then
|
|
755
770
|
mark=$cdot
|
|
756
771
|
fi
|
|
757
772
|
__tt_pv_hl "$t" "$base"
|
|
758
773
|
if (( color )); then
|
|
759
774
|
[[ -n ${tstrip[$t]} ]] || __tt_pv_strip $t
|
|
760
|
-
w=$(( lw -
|
|
775
|
+
w=$(( lw - 19 - ${#t} ))
|
|
761
776
|
(( w < 1 )) && w=1
|
|
762
|
-
REPLY
|
|
777
|
+
REPLY=$gut$on" $mark $base$REPLY$r${(l:w:: :)}${tstrip[$t]} "$z
|
|
763
778
|
else
|
|
764
|
-
REPLY="
|
|
779
|
+
REPLY="$gut $mark $REPLY"
|
|
765
780
|
fi
|
|
766
781
|
}
|
|
767
782
|
|
|
@@ -1141,8 +1156,8 @@ __tt_pv_flush() {
|
|
|
1141
1156
|
}
|
|
1142
1157
|
|
|
1143
1158
|
__tt_pv_draw() {
|
|
1144
|
-
local out line cnt ex ag="" ac="" sb=""
|
|
1145
|
-
local -i lw sw split sc se=$(( pw - 2 )) h k i N=${#rval}
|
|
1159
|
+
local out line cnt ex ag="" ac="" sb="" dd="" zz="" state=on src="" REPLY
|
|
1160
|
+
local -i lw sw split sc se=$(( pw - 2 )) h k i N=${#rval} mt=${#TTHEME_ORDER} wiped=0
|
|
1146
1161
|
__tt_pv_lw
|
|
1147
1162
|
lw=$reply[1] sw=$reply[2]
|
|
1148
1163
|
split=$(( sw > 0 )) sc=$(( pw - 1 - sw ))
|
|
@@ -1154,21 +1169,14 @@ __tt_pv_draw() {
|
|
|
1154
1169
|
(( cur >= top + h )) && top=$(( cur - h + 1 ))
|
|
1155
1170
|
(( top < 1 )) && top=1
|
|
1156
1171
|
(( N > h && top > N - h + 1 )) && top=$(( N - h + 1 ))
|
|
1157
|
-
if (( N > h )); then
|
|
1158
|
-
rail=1
|
|
1159
|
-
rl=$(( h * h / N ))
|
|
1160
|
-
(( rl < 1 )) && rl=1
|
|
1161
|
-
rs=$(( 1 + (top - 1) * (h - rl) / (N - h) ))
|
|
1162
|
-
fi
|
|
1163
1172
|
if (( color )); then
|
|
1164
|
-
dd=$'\e[2m' zz=$'\e[0m'
|
|
1173
|
+
dd=$'\e[2m' zz=$'\e[0m'
|
|
1165
1174
|
if [[ -n $applied ]]; then
|
|
1166
1175
|
local -a ap=(${=applied})
|
|
1167
1176
|
local acx=${ap[3]#\#} sbx=${ap[4]#\#}
|
|
1168
1177
|
printf -v ac '\e[38;2;%d;%d;%dm' $((16#${acx:0:2})) $((16#${acx:2:2})) $((16#${acx:4:2}))
|
|
1169
1178
|
printf -v sb '\e[48;2;%d;%d;%dm' $((16#${sbx:0:2})) $((16#${sbx:2:2})) $((16#${sbx:4:2}))
|
|
1170
1179
|
fi
|
|
1171
|
-
rthumb=$ac"█"$zz cmark=$ac"▶"$'\e[39m'
|
|
1172
1180
|
[[ ${rtype[cur]} == thm ]] && ag=${TTHEME_GROUP[${rval[cur]}]:-Other}
|
|
1173
1181
|
fi
|
|
1174
1182
|
if [[ -n $flt ]]; then
|
|
@@ -1194,13 +1202,13 @@ __tt_pv_draw() {
|
|
|
1194
1202
|
fi
|
|
1195
1203
|
if [[ -n $flt ]]; then
|
|
1196
1204
|
if (( color )); then
|
|
1197
|
-
line="
|
|
1205
|
+
line=" "$'\e[1m'$flt$zz$ac$'\e[7m \e[0m'
|
|
1198
1206
|
else
|
|
1199
|
-
line="
|
|
1207
|
+
line=" ${flt}_"
|
|
1200
1208
|
fi
|
|
1201
1209
|
else
|
|
1202
1210
|
ex="$expal | $exgrp"
|
|
1203
|
-
(( ${#ex} > lw -
|
|
1211
|
+
(( ${#ex} > lw - 19 - ${#cnt} )) && ex="${ex[1,lw-20-${#cnt}]}…"
|
|
1204
1212
|
if (( gstep > 0 )); then
|
|
1205
1213
|
local gkeep=$(( ${#ex} * (8 - gstep) / 8 ))
|
|
1206
1214
|
if [[ $TTHEME_FX == (decode|glitch) ]]; then
|
|
@@ -1218,39 +1226,34 @@ __tt_pv_draw() {
|
|
|
1218
1226
|
ex="${ex[1,gkeep]}▏"
|
|
1219
1227
|
fi
|
|
1220
1228
|
fi
|
|
1221
|
-
line="
|
|
1229
|
+
line=" "$dd"search… e.g. $ex"$zz
|
|
1222
1230
|
fi
|
|
1223
|
-
out+=$line$'\e[K\e['$(( lw - ${#cnt}
|
|
1231
|
+
out+=$line$'\e[K\e['$(( lw - ${#cnt} ))'G'
|
|
1224
1232
|
if [[ -n $flt ]]; then
|
|
1225
|
-
out+=$cnt
|
|
1233
|
+
out+=$cnt
|
|
1226
1234
|
else
|
|
1227
|
-
out+=$dd$cnt$zz
|
|
1235
|
+
out+=$dd$cnt$zz
|
|
1228
1236
|
fi
|
|
1229
|
-
out+=$
|
|
1237
|
+
out+=$'\n\e[K\n'
|
|
1238
|
+
(( N > h && top > 1 )) && out+=" "$dd"…"$zz
|
|
1239
|
+
out+=$'\e[K\n'
|
|
1230
1240
|
for (( k = 0; k < ph - 4; k++ )); do
|
|
1231
1241
|
i=$(( top + k ))
|
|
1232
1242
|
line=""
|
|
1233
1243
|
if (( k < h )); then
|
|
1234
1244
|
if (( ! N )); then
|
|
1235
|
-
(( k == 0 )) && line="
|
|
1245
|
+
(( k == 0 )) && line=" ${dd}no palettes match '$flt'$zz"
|
|
1236
1246
|
elif (( i <= N )); then
|
|
1237
1247
|
__tt_pv_row $i
|
|
1238
1248
|
line=$REPLY
|
|
1239
1249
|
fi
|
|
1250
|
+
elif (( k == h && N > h && top + h <= N )); then
|
|
1251
|
+
line=" "$dd"…"$zz
|
|
1240
1252
|
fi
|
|
1241
|
-
out+=$line$'\e[K'
|
|
1242
|
-
if (( rail && k < h )); then
|
|
1243
|
-
if (( k + 1 >= rs && k + 1 < rs + rl )); then
|
|
1244
|
-
out+=$'\e['$(( lw + 2 ))'G'$rthumb
|
|
1245
|
-
else
|
|
1246
|
-
out+=$'\e['$(( lw + 2 ))'G'$rtrack
|
|
1247
|
-
fi
|
|
1248
|
-
fi
|
|
1249
|
-
out+=$'\n'
|
|
1253
|
+
out+=$line$'\e[K\n'
|
|
1250
1254
|
done
|
|
1251
1255
|
__tt_pv_foot $(( split ? se : pw ))
|
|
1252
1256
|
if (( split )); then
|
|
1253
|
-
out+=$'\e[2;'$sc'H'$dd${(l:$(( se - sc + 1 ))::─:)}$zz
|
|
1254
1257
|
if (( help && sw >= 48 )); then
|
|
1255
1258
|
__tt_pv_head 1 $sc $se keys
|
|
1256
1259
|
__tt_pv_help
|
|
@@ -1313,15 +1316,19 @@ __tt_pv_canpick() {
|
|
|
1313
1316
|
}
|
|
1314
1317
|
|
|
1315
1318
|
__tt_pv_strip() {
|
|
1316
|
-
local
|
|
1317
|
-
local -a
|
|
1319
|
+
local hex cell=""
|
|
1320
|
+
local -a sw=(${=TTHEME_SWATCH[$1]})
|
|
1318
1321
|
local -i j
|
|
1319
|
-
for (( j =
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
+
for (( j = 1; j <= 6; j++ )); do
|
|
1323
|
+
hex=${sw[j]#\#}
|
|
1324
|
+
(( j > 1 )) && cell+=" "
|
|
1325
|
+
if [[ -n $hex ]]; then
|
|
1326
|
+
cell+=$'\e[38;2;'$((16#${hex:0:2}))';'$((16#${hex:2:2}))';'$((16#${hex:4:2}))'m■'
|
|
1327
|
+
else
|
|
1328
|
+
cell+=" "
|
|
1329
|
+
fi
|
|
1322
1330
|
done
|
|
1323
|
-
|
|
1324
|
-
tstrip[$1]=$cell$'\e[0m'
|
|
1331
|
+
tstrip[$1]=$cell$'\e[39m'
|
|
1325
1332
|
}
|
|
1326
1333
|
|
|
1327
1334
|
__tt_pv_init() {
|
|
@@ -1479,8 +1486,8 @@ __tt_pv_handle() {
|
|
|
1479
1486
|
__tt_pv_toggle
|
|
1480
1487
|
fi
|
|
1481
1488
|
;;
|
|
1482
|
-
up) (( cur > 1 )) && cur=$(( cur - 1 )) ;;
|
|
1483
|
-
down) (( cur < ${#rval} )) && cur=$(( cur + 1 )) ;;
|
|
1489
|
+
up) (( cur > 1 )) && cur=$(( cur - 1 )); [[ ${rtype[cur]} == rule ]] && cur=$(( cur - 1 )) ;;
|
|
1490
|
+
down) (( cur < ${#rval} )) && cur=$(( cur + 1 )); [[ ${rtype[cur]} == rule ]] && cur=$(( cur + 1 )) ;;
|
|
1484
1491
|
right) [[ ${rtype[cur]} == hdr && -z ${exp[${rval[cur]}]} ]] && __tt_pv_toggle ;;
|
|
1485
1492
|
left) __tt_pv_left ;;
|
|
1486
1493
|
home) cur=1 ;;
|
|
@@ -1488,11 +1495,13 @@ __tt_pv_handle() {
|
|
|
1488
1495
|
pgup)
|
|
1489
1496
|
cur=$(( cur - ph + 5 ))
|
|
1490
1497
|
(( cur < 1 )) && cur=1
|
|
1498
|
+
[[ ${rtype[cur]} == rule ]] && cur=$(( cur - 1 ))
|
|
1491
1499
|
;;
|
|
1492
1500
|
pgdn)
|
|
1493
1501
|
cur=$(( cur + ph - 5 ))
|
|
1494
1502
|
(( cur > ${#rval} )) && cur=${#rval}
|
|
1495
1503
|
(( cur < 1 )) && cur=1
|
|
1504
|
+
[[ ${rtype[cur]} == rule ]] && cur=$(( cur + 1 ))
|
|
1496
1505
|
;;
|
|
1497
1506
|
' ') [[ ${rtype[cur]} == hdr ]] && __tt_pv_toggle ;;
|
|
1498
1507
|
$'\t')
|