Skip to content

Match standard finger status sentences on the whole line, not as a prefix #28

@jonathandeamer

Description

@jonathandeamer

Follow-up to #6 / #19 (which added the standard finger status labels).

render/fields.go highlights label prefixes via a deliberate allowlist. Some of those entries aren't Label: value fields, though — they're standalone status sentences a finger daemon prints on their own line:

  • No mail.
  • No Plan.
  • Never logged in.

The matcher uses strings.HasPrefix, so a free-form .plan/.project line that merely starts with one of these has the words colored as if they were a field label — e.g.

No mail. Back from leave on Monday.

highlights "No mail.". That's the allowlist asserting structure that isn't there, which cuts against the repo's "UI copy is honest" rule.

Task

Treat these colon-less, sentence-style markers as whole-line matches: highlight them only when the trimmed line equals the marker exactly, not when it's a prefix. Genuine status lines (which are the whole line) still highlight; prose that happens to start with the same words no longer does. The Label:-style and trailing-value markers (Login:, Last login, Mail last read, …) keep their prefix behavior — only the standalone sentences change.

Acceptance criteria

  • The three sentence markers match on the full (trimmed) line, not as a prefix.
  • A golden test proving: a genuine standalone No mail. line highlights, and a prose line that starts with the marker (No mail. (on leave)) does not.
  • make check green.

Supersedes this issue's original boundary-test framing: the negative test lands here as part of the fix, rather than documenting the current prefix behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions