mirror of
https://github.com/dylanaraps/shfm.git
synced 2026-10-21 11:29:32 +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 bottom
|
||||
q - quit
|
||||
: - cd to <input>
|
||||
|
||||
|
||||
opener
|
||||
|
||||
@@ -74,6 +74,21 @@ status_line() {
|
||||
"$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() {
|
||||
offset=$1
|
||||
|
||||
@@ -172,13 +187,22 @@ main() {
|
||||
redraw "$@"
|
||||
;;
|
||||
|
||||
# broken
|
||||
G?)
|
||||
y=$#
|
||||
y2=$(($# < bottom ? $# : bottom))
|
||||
redraw "$@"
|
||||
;;
|
||||
|
||||
:?)
|
||||
prompt "cd: " r
|
||||
|
||||
cd "${ans:="$0"}" >/dev/null 2>&1|| continue
|
||||
|
||||
set -- *
|
||||
y=1 y2=1
|
||||
redraw "$@"
|
||||
;;
|
||||
|
||||
q?)
|
||||
exit 0
|
||||
;;
|
||||
|
||||
Reference in new issue
Block a user