feat(tui): Generate screen — prompt editor & parameter fields #59

Merged
charles merged 1 commit from tui/generate-prompt-20 into main 2026-04-11 20:42:21 +00:00
Owner

Summary

Twelfth PR. Replaces the Generate stub with a real screen holding a loom_core::GenerationParams and providing inline editors for every parameter. Stacks on #58. Closes charles/loom#20.

What's in

  • screens/generate.rsGenerateScreen, GenerateFocus (11 fields), handle_prompt_key / handle_param_key
  • Prompt + negative multi-line editors with paste-on-typing, Backspace, Ctrl+U clear, Ctrl+W delete word, Enter newline
  • Parameter editors:
    • Model / Sampler — string edit
    • Steps / Width / Height — u32, digit entry + Backspace, clamped to [1,500] / [64,2048]
    • CFG — f64, digit+dot + Up/Down for ±0.5 step, clamped [0,50]
    • Seed — i64; R-1 (random), L → last seed if present
    • Batch size / count — shared u32 editor
  • Tab / Shift+Tab cycles focus across the whole field list
  • F5 runs validate() (non-empty prompt, w/h ≥ 64, steps ≥ 1, batch ≥ 1) and submits — for now a success emits an info notification; a failure emits a warn. Real generation wiring comes later in Phase 3 once PluginBridge is threaded through AppCtx
  • screens promoted to a directory

Tests (6 new, 65 total)

  • Default validation fails on empty prompt
  • Typing chars + backspace roundtrip in prompt
  • GenerateFocus::next round-trips back to Prompt
  • Seed R/L in the Seed field
  • Steps clamp low
  • Validation flips to None once a prompt is set

Out of scope

  • LoRA panel (#21), mode tabs (#22), inpaint canvas (#23), queue overlay (#24), preview pane (#25), AI enhance/tag (#26)
  • Model / Sampler combo pickers — today they're free-text; combo popups that draw from PluginBridge::list_models() / list_samplers() come when the bridge is wired through AppCtx
## Summary Twelfth PR. Replaces the Generate stub with a real screen holding a `loom_core::GenerationParams` and providing inline editors for every parameter. Stacks on #58. Closes charles/loom#20. ## What's in - **`screens/generate.rs`** — `GenerateScreen`, `GenerateFocus` (11 fields), `handle_prompt_key` / `handle_param_key` - Prompt + negative multi-line editors with paste-on-typing, Backspace, `Ctrl+U` clear, `Ctrl+W` delete word, `Enter` newline - Parameter editors: - Model / Sampler — string edit - Steps / Width / Height — `u32`, digit entry + Backspace, clamped to `[1,500]` / `[64,2048]` - CFG — `f64`, digit+dot + `Up`/`Down` for ±0.5 step, clamped `[0,50]` - Seed — `i64`; `R` → `-1` (random), `L` → last seed if present - Batch size / count — shared `u32` editor - `Tab` / `Shift+Tab` cycles focus across the whole field list - `F5` runs `validate()` (non-empty prompt, w/h ≥ 64, steps ≥ 1, batch ≥ 1) and submits — for now a success emits an info notification; a failure emits a warn. Real generation wiring comes later in Phase 3 once `PluginBridge` is threaded through `AppCtx` - `screens` promoted to a directory ## Tests (6 new, 65 total) - Default validation fails on empty prompt - Typing chars + backspace roundtrip in prompt - `GenerateFocus::next` round-trips back to `Prompt` - Seed `R`/`L` in the Seed field - Steps clamp low - Validation flips to `None` once a prompt is set ## Out of scope - LoRA panel (#21), mode tabs (#22), inpaint canvas (#23), queue overlay (#24), preview pane (#25), AI enhance/tag (#26) - Model / Sampler combo pickers — today they're free-text; combo popups that draw from `PluginBridge::list_models()` / `list_samplers()` come when the bridge is wired through `AppCtx`
First cut of the Generate screen. A GenerateScreen holds a
loom_core::GenerationParams instance and a GenerateFocus enum tracking
which field is focused. Tab/Shift-Tab cycles between prompt, negative,
model, sampler, steps, cfg, width, height, seed, batch size, and
batch count. Each parameter slot has its own inline editor:

- Strings (model, sampler) take printable chars + Backspace + Ctrl+U
- u32 fields (steps, width, height) parse digits and clamp to range
- f64 (cfg) supports digit/dot input + Up/Down for ±0.5 step
- Seed is i64 with `R` → -1 (random) and `L` → last used seed
- Batch slots use the same u32 editor

F5 runs validation (non-empty prompt, width/height ≥ 64, steps ≥ 1,
batch ≥ 1) and submits — for now submission just fires an info
notification. Real generation wiring waits for PluginBridge to be
threaded through AppCtx (later Phase 3 ticket).

screens is promoted to a directory (screens/mod.rs + screens/generate.rs).

Closes charles/loom#20

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
charles changed target branch from tui/detect-15 to main 2026-04-11 20:42:12 +00:00
charles deleted branch tui/generate-prompt-20 2026-04-11 20:42:21 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
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
charles/loom!59
No description provided.