aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-11-08 15:46:00 +0100
committerBruce Hill <bruce@bruce-hill.com>2019-11-08 15:46:00 +0100
commite60e5472b46b50734c5d2fd64e4c07a370f2d944 (patch)
treeeca688a23af86c613ac4818216ebba752b62a2a6
parentb9e2bc280befaf259bb5a61d1b6e41de3b8ed3c7 (diff)
Added better doc for unscroll
-rw-r--r--bb.h3
-rw-r--r--bindings.bb8
2 files changed, 6 insertions, 5 deletions
diff --git a/bb.h b/bb.h
index ec1440f..ff245a2 100644
--- a/bb.h
+++ b/bb.h
@@ -264,7 +264,8 @@ static const char *bbcmdfn = "bb() {\n"
" printf \"%s\\0\" \"$arg\" >> $BBCMD;\n"
" done;\n"
"}\n"
-"butt() {\n"
+// This shell function overwrites the lines above the cursor instead of scrolling the screen
+"unscroll() {\n"
" input=\"$(cat)\"\n"
" printf \"\\033[$(echo \"$input\" | wc -l)A\\033[J\" >/dev/tty\n"
" echo \"$input\"\n"
diff --git a/bindings.bb b/bindings.bb
index 5088a4e..e87c7b2 100644
--- a/bindings.bb
+++ b/bindings.bb
@@ -108,17 +108,17 @@ d,Delete: # Delete a file
printf "\033[1mDeleting \033[33m$BBCURSOR\033[0;1m...\033[0m " && confirm &&
rm -rf "$BBCURSOR" && bb +deselect:"$BBCURSOR" +refresh
D: # Delete all selected files
- [ $# -gt 0 ] && printf "\033[1mDeleting the following:\n\033[33m$(printf ' %s\n' "$@")\033[0m" | butt | more &&
+ [ $# -gt 0 ] && printf "\033[1mDeleting the following:\n\033[33m$(printf ' %s\n' "$@")\033[0m" | unscroll | more &&
confirm && rm -rf "$@" && bb +deselect +refresh
Ctrl-v: # Move files here
- printf "\033[1mMoving the following to here:\n\033[33m$(printf ' %s\n' "$@")\033[0m" | butt | more &&
+ printf "\033[1mMoving the following to here:\n\033[33m$(printf ' %s\n' "$@")\033[0m" | unscroll | more &&
confirm && printf "\033[1G\033[KMoving..." && mv -i "$@" . && printf "done." &&
bb +deselect +refresh && for f; do bb +sel:"$(basename "$f")"; done
c: # Copy a file
printf "\033[1mCreating copy of \033[33m$BBCURSOR\033[0;1m...\033[0m " &&
confirm && cp -ri "$BBCURSOR" "$BBCURSOR.copy" && bb +refresh
C: # Copy all selected files here
- [ $# -gt 0 ] && printf "\033[1mCopying the following to here:\n\033[33m$(printf ' %s\n' "$@")\033[0m" | butt | more &&
+ [ $# -gt 0 ] && printf "\033[1mCopying the following to here:\n\033[33m$(printf ' %s\n' "$@")\033[0m" | unscroll | more &&
confirm && printf "\033[1G\033[KCopying..." &&
for f; do if [ "./$(basename "$f")" -ef "$f" ]; then
cp -ri "$f" "$f.copy" || break;
@@ -163,7 +163,7 @@ Ctrl-r: # Regex rename files
command -v rename >/dev/null ||
{ printf '\033[31;1mThe `rename` command is not installed. Please install it to use this key binding.\033[0m\n'; pause; exit; };
ask patt "Replace pattern: " && ask rep "Replacement: " &&
- printf "\033[1mRenaming:\n\033[33m$(if [ $# -gt 0 ]; then rename -nv "$patt" "$rep" "$@"; else rename -nv "$patt" "$rep" *; fi)\033[0m" | butt | more &&
+ printf "\033[1mRenaming:\n\033[33m$(if [ $# -gt 0 ]; then rename -nv "$patt" "$rep" "$@"; else rename -nv "$patt" "$rep" *; fi)\033[0m" | unscroll | more &&
confirm || exit 1
if [ $# -gt 0 ]; then rename -i "$patt" "$rep" "$@"; else rename -i "$patt" "$rep" *; fi
bb +deselect +refresh