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