bin: drop non-ASCII-only candidates from tmux-grab
A bare prompt glyph or box-drawing character (e.g. an isolated ❯ or
───) surfaced as its own candidate whenever it landed on its own line,
even though it is never useful to copy. Filtering for at least one
byte in the printable ASCII range keeps mixed candidates (a token with
both text and a glyph) while dropping symbol-only ones.
Assisted-by: Claude Sonnet 5 via Claude Code
diff --git a/bin/,tmux-grab b/bin/,tmux-grab
index cba92444..0220f2a5 100755
--- a/bin/,tmux-grab
+++ b/bin/,tmux-grab
@@ -59,9 +59,12 @@ main() {
# stripped (so "(utils.rb:42)" yields "utils.rb:42", and a parenthetical
# phrase survives as one candidate instead of shattering at its inner
# spaces); then punctuation-split sub-tokens (so "foo", "bar", "baz" are
- # too). A final filter drops any candidate carrying a raw control byte --
- # stray escape-sequence remnants, bells, and the like -- so only real
- # text reaches fzf.
+ # too). A final pair of filters drops any candidate carrying a raw
+ # control byte -- stray escape-sequence remnants, bells, and the like --
+ # and any candidate with no ASCII in it at all, like a bare prompt glyph
+ # or box-drawing character, since those are never what you meant to
+ # copy. LC_ALL=C makes the ASCII-range check byte-exact regardless of
+ # the caller's locale.
local tokens
tokens=$(
{
@@ -74,7 +77,7 @@ main() {
}
}'
printf '%s\n' "$pane_text_reversed" | grep --only-matching --extended-regexp '[[:alnum:]_]+' || true
- } | awk '!seen[$0]++' | grep -Ev '[[:cntrl:]]' || true
+ } | awk '!seen[$0]++' | grep -Ev '[[:cntrl:]]' | LC_ALL=C grep -E '[ -~]' || true
)
[[ -n "$tokens" ]] || exit 0