2.1 KiB
2.1 KiB
send-rs src/tui/state.rs — focus model and draft retention
Metadata
| Field | Value |
|---|---|
| Institute | Molodetz Institute — Research & Retrieval Division |
| Subject | tui-framework-design |
| Document type | Source Dossier |
| Tier | 1 |
| Source title | send-rs src/tui/state.rs — focus state (WhatsApp+Telegram ratatui client) |
| Source URL | https://raw.githubusercontent.com/pedromarquetti/send-rs/master/src/tui/state.rs |
| Source publisher / author | pedromarquetti (send-rs / Sender project) |
| Source type | repository |
| Source date (published) | Unknown — not stated |
| Date researched | 2026-10-11 |
| Researched by | tai (agent), model: Muse Spark, on behalf of retoor |
| Research method | direct page fetch |
| Confidence | Medium |
| Status | Active |
Summary
A four-variant focus enum (ChatList / Chat / Write / Popup) with a cycle_focus routine that saves per-chat TextArea drafts when focus moves away. Focus is explicit application state, not derived from widget identity.
Key findings
- Focus is an explicit enum with four variants:
ChatList,Chat,Write,Popup. cycle_focussaves the current per-chatTextAreadraft before moving focus, so partially typed messages survive pane switches and chat switches.
Pros / strengths
- Explicit focus enum makes per-focus status hints, keymaps, and border accents all keyed off one value — simple to port.
- Draft retention on focus move is the correct behavior for a chat input and is handled at the focus layer rather than per widget.
Cons / limitations / caveats
- A fixed four-variant enum is less general than tai's traversal-ordered focus chain; porting the idea means mapping variants onto tai's focusable panels, not copying the enum.
Relevance to tai
- Contributes the explicit-focus-state plus per-chat draft-retention pattern to the messaging-layout conclusion; tai's chat scene needs the same draft behavior on its
TextBox-based input.
Changelog
| Date | Change |
|---|---|
| 2026-10-11 | Initial dossier created from 2026-10-11 research-pass evidence (body opened via web_fetch by researching agent). |