mirror of
https://github.com/dylanaraps/shfm.git
synced 2026-12-04 21:48:24 +00:00
prompts
This commit is contained in:
2 files changed
+26
-1
No files matched your search
@@ -39,6 +39,7 @@ h - go up level
|
|||||||
g - go to top
|
g - go to top
|
||||||
G - go to bottom
|
G - go to bottom
|
||||||
q - quit
|
q - quit
|
||||||
|
: - cd to <input>
|
||||||
|
|
||||||
|
|
||||||
opener
|
opener
|
||||||
|
|||||||
@@ -74,6 +74,21 @@ status_line() {
|
|||||||
"$LINES" "$COLUMNS" "$1"
|
"$LINES" "$COLUMNS" "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prompt() {
|
||||||
|
printf '\0337\033[%sH%s' "$LINES" "$1"
|
||||||
|
|
||||||
|
case $2 in
|
||||||
|
r)
|
||||||
|
stty icanon echo
|
||||||
|
read -r ans ||:
|
||||||
|
stty -icanon -echo
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
printf '\0338'
|
||||||
|
status_line "$PWD ($y/$#)"
|
||||||
|
}
|
||||||
|
|
||||||
print_line() {
|
print_line() {
|
||||||
offset=$1
|
offset=$1
|
||||||
|
|
||||||
@@ -172,13 +187,22 @@ main() {
|
|||||||
redraw "$@"
|
redraw "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
# broken
|
|
||||||
G?)
|
G?)
|
||||||
y=$#
|
y=$#
|
||||||
y2=$(($# < bottom ? $# : bottom))
|
y2=$(($# < bottom ? $# : bottom))
|
||||||
redraw "$@"
|
redraw "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
:?)
|
||||||
|
prompt "cd: " r
|
||||||
|
|
||||||
|
cd "${ans:="$0"}" >/dev/null 2>&1|| continue
|
||||||
|
|
||||||
|
set -- *
|
||||||
|
y=1 y2=1
|
||||||
|
redraw "$@"
|
||||||
|
;;
|
||||||
|
|
||||||
q?)
|
q?)
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
|||||||
Reference in new issue
Block a user