Restore TUI command entry and suspend, clean up tech debt#35
Merged
ScottMorris merged 6 commits intomainfrom Mar 18, 2026
Merged
Restore TUI command entry and suspend, clean up tech debt#35ScottMorris merged 6 commits intomainfrom
ScottMorris merged 6 commits intomainfrom
Conversation
fcc1ba4 to
538ec09
Compare
**What changed** - close the command palette once a full slash command is recognised and argument entry begins, so typed commands submit normally again - add parser and intent coverage for selected-item slash commands such as `/resume`, `/park`, and `/archive` - handle `Ctrl+Z` by restoring the terminal before suspend and re-entering the TUI cleanly on resume - update help text and docs so the documented TUI behaviour matches the shipped fixes **Why** - manually typed slash commands in `v0.0.3` could stay trapped in palette mode and block submission - suspend was being swallowed by the raw-mode event loop, which made `flo` behave unlike a normal terminal app - the parser, selected-item handlers, and docs had drifted apart, which increased the risk of more command UX regressions
Flow Tests95 tests +10 95 ✅ +10 0s ⏱️ ±0s Results for commit 52c70b0. ± Comparison against base commit 9c6967b. This pull request removes 3 and adds 13 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
CI check summary
|
Replace the ~75-line if-chain in parse_slash_command with a static COMMAND_TABLE lookup. Add Copy to the Intent enum (all unit variants) to support use in the const table. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tech debt: - Remove redundant should_show_command_palette wrapper; call should_keep_command_palette_open directly - Make command_palette_query private (only used within state.rs) - Unify duplicate Backspace/Char key arms in both palette-open and normal insert mode branches - Extract apply_input_result helper to replace repeated match blocks in Normal mode keybinding handlers (r, p, d, A) and Enter/submit - Add From<Result<String>> impl on InputResult to unify error handling Bug fix: - Close the command palette when trailing text follows an unrecognised command token (e.g. "/bran meow") — previously trapped the user in a "No matching commands" dead-end - Forward Delete, Left, Right, Home, End keys to the textarea while the palette is open instead of swallowing them Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The palette now reopens when cursor movement and editing change the command token back to an unrecognised prefix (e.g. /branch meow → backspace → /branc meow shows palette filtered to matching commands). - Keep palette open for unknown prefixes even with trailing text, to support the command-correction workflow (/now → /no → select /note) - Refresh palette state on all insert-mode keys (including cursor movement and Delete), not just Char/Backspace Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1b7d6c7f4c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ase matching - Add accepts_trailing column to COMMAND_TABLE so /where only matches its exact form, preventing silent argument loss - Make slash_command_by_name use exact case matching to stay consistent with the core parser (which only recognises lowercase commands) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rebased onto main after PR #40 was merged. This PR takes the best from both branches (#40's command palette UX, #35's extensible structs), then applies a comprehensive tech debt cleanup across the TUI and core crates.
User-facing changes
Slash command entry: Manually typed slash commands now leave the command palette once the command is recognised and argument entry begins, so(shipped in Restore TUI command submission and suspend handling #40)Entersubmits the command normally again.Terminal suspend:(shipped in Restore TUI command submission and suspend handling #40)Ctrl+Znow suspendsflo, restores the terminal cleanly, and allows the TUI to resume properly afterfg./resume,/park, and/archiveas first-class intents with full slash-command handlers, so they work consistently whether typed or selected from the palette./now,/branch,/note) keep the palette open until the argument is started; commands without arguments (like/done,/where,/resume) close the palette immediately./branch meow→ backspace →/branc meowshows filtered matches), supporting inline command correction.Code quality — tech debt cleanup
if-chain inparse_slash_commandwith a staticCOMMAND_TABLElookup. AddedCopyto theIntentenum (all unit variants) to support use in the const table.SlashCommandstruct: Replaces the(&str, &str)tuple array with a struct that carriessyntax,description, andrequires_argument. This makes palette behaviour data-driven instead of string-matching.should_show_command_palette(delegated directly toshould_keep_command_palette_open) and madecommand_palette_queryprivate (only used withinstate.rs).Backspace/Char(_)match arms in both the palette-open and normal insert mode branches. All insert-mode keys now trigger palette state refresh.apply_input_resulthelper: Extracted repeatedmatch result { Reply/Error/None }blocks from the Normal mode keybinding handlers (r,p,d,A) and the Enter/submit handler.From<Result<String>>forInputResult: Unifies error handling between functions returningInputResultand those returningResult<String>.should_follow_active_after_submit: Replaced hand-rolled string matching withparsed_intent()+matches!onIntentvariants.suspend_terminal(): Replaced by the extractedenter_tui_terminal()/restore_tui_terminal()helpers that are also used byrun()and the panic hook.Documentation
README.md, andSPEC.mdso the documented command and suspend behaviour match the implementation.Test plan
cargo fmt --all -- --checkcargo clippy --workspace --all-targets -- -D warningscargo test --workspace— 93 tests passCtrl+Zsuspend andfgresumeCloses #32, Closes #33
🤖 Generated with Claude Code