mirror of https://github.com/dylanaraps/shfm.git
one formatting function
This commit is contained in:
parent
5249bda2b4
commit
8c31129813
30
shfm
30
shfm
|
@ -58,9 +58,9 @@ term_scroll_down() {
|
||||||
y=$((y + 1))
|
y=$((y + 1))
|
||||||
y2=$((y2 + 1 < bottom ? y2 + 1 : bottom))
|
y2=$((y2 + 1 < bottom ? y2 + 1 : bottom))
|
||||||
|
|
||||||
print_line "$((y - 1))" "$@"
|
line_print "$((y - 1))" "$@"
|
||||||
printf '\n'
|
printf '\n'
|
||||||
print_line "$y" "$@"
|
line_print "$y" "$@"
|
||||||
status_line "($y/$#) $PWD"
|
status_line "($y/$#) $PWD"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -73,14 +73,14 @@ term_scroll_up() {
|
||||||
*)
|
*)
|
||||||
y=$((y - 1))
|
y=$((y - 1))
|
||||||
|
|
||||||
print_line "$((y + 1))" "$@"
|
line_print "$((y + 1))" "$@"
|
||||||
|
|
||||||
case $y2 in
|
case $y2 in
|
||||||
1) esc IL ;;
|
1) esc IL ;;
|
||||||
*) esc CUU; y2=$((y2 > 1 ? y2 - 1 : 1))
|
*) esc CUU; y2=$((y2 > 1 ? y2 - 1 : 1))
|
||||||
esac
|
esac
|
||||||
|
|
||||||
print_line "$y" "$@"
|
line_print "$y" "$@"
|
||||||
status_line "($y/$#) $PWD"
|
status_line "($y/$#) $PWD"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -147,18 +147,14 @@ list_print() {
|
||||||
esac
|
esac
|
||||||
|
|
||||||
for file do
|
for file do
|
||||||
file_escape "$file"
|
|
||||||
|
|
||||||
case $i in
|
case $i in
|
||||||
"$y2") esc SGR 34 7
|
"$y2") esc SGR 34 7
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case $((i - end)) in
|
case $((i - end)) in
|
||||||
-*)
|
-*)
|
||||||
printf %s "$safe"
|
line_format "$file"
|
||||||
esc SGR
|
|
||||||
esc CUD
|
esc CUD
|
||||||
printf '\r'
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -202,7 +198,7 @@ prompt() {
|
||||||
status_line "($y/$#) $PWD"
|
status_line "($y/$#) $PWD"
|
||||||
}
|
}
|
||||||
|
|
||||||
print_line() {
|
line_print() {
|
||||||
offset=$1
|
offset=$1
|
||||||
|
|
||||||
case $offset in
|
case $offset in
|
||||||
|
@ -210,18 +206,22 @@ print_line() {
|
||||||
esac
|
esac
|
||||||
|
|
||||||
shift "$offset"
|
shift "$offset"
|
||||||
file_escape "$1"
|
|
||||||
|
|
||||||
esc EL0
|
line_format "$1"
|
||||||
printf %s "$safe"
|
|
||||||
esc SGR
|
|
||||||
printf '\r'
|
|
||||||
|
|
||||||
case $offset in
|
case $offset in
|
||||||
"$y") cur=$1
|
"$y") cur=$1
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
line_format() {
|
||||||
|
file_escape "$1"
|
||||||
|
esc EL0
|
||||||
|
printf %s "$safe"
|
||||||
|
esc SGR
|
||||||
|
printf '\r'
|
||||||
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue