Add --min-len to drop trivially short matches #10

Open
opened 2026-09-19 16:33:42 +09:00 by natsukium · 0 comments
Owner

Summary

Add --min-len N: drop matches shorter than N display columns.

Why

A loose pattern is the intended dialect for presets ("permissive and best-effort … the goal is to
surface candidates a human then picks from", src/preset.rs), and the cost of that choice is the
occasional screenful of two-character matches which are never what you wanted — --preset sha on
a hex dump, --preset path on a log full of a/b.

kitty's hints guards this way (docs/research.md: "non-empty + min-len 3") and it is the cheapest
knob that makes a wide pattern usable without making the pattern itself stricter.

Notes

  • Filter after matching, before label assignment, so labels stay dense over the matches that
    remain.
  • Length in display columns (the cells the match covers), not bytes, since everything else in
    spoor is column-based.
  • Distinct from the zero-width guard in matcher::find_in_logical_row, which is mandatory and
    already there; this is a user knob on top.
## Summary Add `--min-len N`: drop matches shorter than `N` display columns. ## Why A loose pattern is the intended dialect for presets ("permissive and best-effort … the goal is to surface candidates a human then picks from", `src/preset.rs`), and the cost of that choice is the occasional screenful of two-character matches which are never what you wanted — `--preset sha` on a hex dump, `--preset path` on a log full of `a/b`. kitty's hints guards this way (`docs/research.md`: "non-empty + min-len 3") and it is the cheapest knob that makes a wide pattern usable without making the pattern itself stricter. ## Notes - Filter after matching, before label assignment, so labels stay dense over the matches that remain. - Length in display columns (the cells the match covers), not bytes, since everything else in `spoor` is column-based. - Distinct from the zero-width guard in `matcher::find_in_logical_row`, which is mandatory and already there; this is a user knob on top.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
natsukium/spoor#10
No description provided.