Files
buzz/mobile/lib/features
Matt Toohey 1996069693 fix(mobile): offer the mention chooser while editing a message
The edit sheet was a plain text field: typing ` cc @bo` opened nothing,
and the only way to mention someone from an edit was to type the name
exactly (scenario 08). The sheet now mounts the composer's `@` chooser
with the same rules, as buzz-app's edit box does (recommendation 9):
the same trigger, ranking, folded matching, directory search, Space and
closing-punctuation selection, suffix boundary, chip binding and focus
handling. A pick inserts the same bound `@Label` chip, and the message's
existing mentions open as chips, each bound to the person its tags name
(`@Name` or `@Name (<key>)` for exactly one tagged person; a name two
tagged people share stays text).

An edit replaces prose only, following buzz-app's edit rule: the saved
edit event carries the tags the edit path wrote before (`h`, `e` and the
custom-emoji tags) and never a `p` tag for a pick, so nobody is notified
from an edit. Save, Cancel and the sheet layout are otherwise unchanged;
the body scrolls so the field, the chooser and the keyboard fit together
on a small phone. A hardware Enter keeps inserting a newline while no
chooser row is shown.

The chooser's state moves out of the composer widget into a shared
`_useMentionChooser` hook in `mention_chooser.dart` (query, opening,
shown rows, chip insertion and the per-edit tracking that also performs
terminator selection); the composer and the new `message_edit_sheet.dart`
part both use it, so no rule is copied. The hook exposes the live query
for hardware keys that arrive before the next frame. The hardware-key
helper takes an optional `send`, which the edit sheet leaves out.

Tests: a new edit sheet journey opens a message with an existing Alice
mention and sees her chip, types `@bo` and taps Bob into a chip, sees the
chooser leave and return with the field's focus, selects `@alice,` with a
comma, picks Quinn from a directory search, and saves content with the
picks and no `p` tag; an unchanged or emptied edit saves nothing; and the
sheet fits a small phone with the keyboard and the chooser open. The
journey fails when the sheet stops tracking the query or stops seeding
chips. `dart format`, `flutter analyze`, `just file-size-check` and the
full mobile `flutter test` suite pass.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
2026-11-19 15:07:17 +11:00
..