aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-10-02 01:40:40 -0700
committerBruce Hill <bruce@bruce-hill.com>2019-10-02 01:40:40 -0700
commitc7e08b884ab876c8ce06000a8789045b50d40c20 (patch)
tree2926457f083304b17abef20105486ba97bf8bb4b
parent7f402ee32afa7ed065c26d83fbe4537cfeae98f8 (diff)
Fix for some messed up behavior for Escape key and for passing vararg
commands to bb
-rw-r--r--bb.h14
-rw-r--r--bindings.bb2
2 files changed, 8 insertions, 8 deletions
diff --git a/bb.h b/bb.h
index bdbc0c1..9e18345 100644
--- a/bb.h
+++ b/bb.h
@@ -225,13 +225,13 @@ static const char *bbcmdfn = "bb() {\n"
" if test $# -eq 0; then cat >> $BBCMD; return; fi\n"
" for arg; do\n"
" shift;\n"
-" if echo \"$arg\" | grep \"^+[^:]*:$\" >/dev/null 2>/dev/null; then\n"
-" if test $# -gt 0; then printf \"%s\\0\" \"$arg\" \"$@\" >> $BBCMD\n"
-" else sed \"s/\\([^\\x00]\\+\\)/$arg\\1/g\" >> $BBCMD; fi\n"
-" return\n"
-" fi\n"
-" printf \"%s\\0\" \"$arg\" >> $BBCMD\n"
-" done\n"
+" if expr \"$arg\" : \"^+[^:]*:$\" >/dev/null; then\n"
+" if test $# -gt 0; then printf \"$arg%s\\0\" \"$@\" >> $BBCMD;\n"
+" else sed \"s/\\([^\\x00]\\+\\)/$arg\\1/g\" >> $BBCMD; fi;\n"
+" return;\n"
+" fi;\n"
+" printf \"%s\\0\" \"$arg\" >> $BBCMD;\n"
+" done;\n"
"}\n"
"ask() {\n"
#ifdef ASK
diff --git a/bindings.bb b/bindings.bb
index a5fd9f0..8b46793 100644
--- a/bindings.bb
+++ b/bindings.bb
@@ -61,7 +61,7 @@ Section: File Selection
v,V,Space: # Toggle selection at cursor
bb +toggle
Escape: # Clear selection
- bb +deselect: "$@"
+ [ $# -gt 0 ] && bb +deselect: "$@"
Ctrl-s: # Save the selection
[ $# -gt 0 ] && ask savename "Save selection as: " && printf '%s\0' "$@" > ~/.config/bb/"$savename"
Ctrl-o: # Open a saved selection