fix(ui): allow c and n in create-order form text fields#72
Conversation
Global n (cancel) and c (copy) shortcuts ran before form Char(_) handling, so payment method and other fields could not type those letters. Route them through handle_char_input when a text field is focused (not Order Type). Also refresh AI docs for relay reconcile, CantDo hydration, timeline UX, and the form key guard pattern. Co-authored-by: Cursor <cursoragent@cursor.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughAdds a guard helper and conditional key routing so ChangesOrder Creation Form Input Key Guard and System Documentation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
docs/CODING_STANDARDS.md (1)
76-76: ⚡ Quick winBreak the compound sentence into shorter sentences for clarity.
The example on line 76 is valuable but compresses multiple concepts into a single 85+ word sentence, which reduces readability. Consider breaking it into separate sentences to improve comprehension.
For instance:
- First sentence: general split examples (handle_navigation_keys, handle_form_input)
- Second sentence: location of form typing logic
- Third sentence: the specific pattern (guarded arms before generic Char(_) handler)
Additionally, the term "guarded arms" may benefit from a brief clarification (e.g., "match arms with conditional guards") for readers less familiar with Rust pattern-matching terminology.
📝 Proposed refactor for improved readability
-**Example**: If `handle_key_event` grows too large, split it into `handle_navigation_keys`, `handle_form_input`, etc. Form typing lives in **`src/ui/key_handler/form_input.rs`**; global keys like **`n`** (cancel) and **`c`** (copy) must not swallow characters when **`is_creating_order_text_input`** is true — add guarded arms in `mod.rs` before the generic `Char(_)` handler. +**Example**: If `handle_key_event` grows too large, split it into `handle_navigation_keys`, `handle_form_input`, etc. Form typing lives in **`src/ui/key_handler/form_input.rs`**. Global keys like **`n`** (cancel) and **`c`** (copy) must not swallow characters when **`is_creating_order_text_input`** is true. To prevent this, add guarded match arms (with conditional guards) in `mod.rs` before the generic `Char(_)` handler.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/CODING_STANDARDS.md` at line 76, Rewrite the long example sentence into three clear sentences: 1) describe breaking up large handlers (e.g., handle_key_event → handle_navigation_keys, handle_form_input), 2) state where form typing logic lives (src/ui/key_handler/form_input.rs), and 3) explain the specific pattern to implement in mod.rs (add match arms with conditional guards before the generic Char(_) handler so global keys like `n` and `c` do not swallow input when `is_creating_order_text_input` is true); also replace "guarded arms" with the clearer phrase "match arms with conditional guards (guarded match arms)".
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/buy` order flow.md:
- Line 110: The sentence claiming "Status::Success does not pick step 6 alone"
conflicts with the updated mapping that maps Status::Success -> StepRate (6);
update the wording so it reflects that a Success status now resolves to StepRate
(6) via listing_step_from_status, and clarify that Action::Rate / RateReceived
still may run before status evaluation so a combined rate+success presentation
can highlight the rate; reference Status::Success, StepRate (6),
listing_step_from_status, Action::Rate, RateReceived,
buy_listing_flow_step_from_action and sell_listing_flow_step_from_action when
making the edit.
---
Nitpick comments:
In `@docs/CODING_STANDARDS.md`:
- Line 76: Rewrite the long example sentence into three clear sentences: 1)
describe breaking up large handlers (e.g., handle_key_event →
handle_navigation_keys, handle_form_input), 2) state where form typing logic
lives (src/ui/key_handler/form_input.rs), and 3) explain the specific pattern to
implement in mod.rs (add match arms with conditional guards before the generic
Char(_) handler so global keys like `n` and `c` do not swallow input when
`is_creating_order_text_input` is true); also replace "guarded arms" with the
clearer phrase "match arms with conditional guards (guarded match arms)".
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 948157bc-7368-4006-b205-1d5ca3934087
📒 Files selected for processing (11)
docs/CODING_STANDARDS.mddocs/DATABASE.mddocs/DM_LISTENER_FLOW.mddocs/MESSAGE_FLOW_AND_PROTOCOL.mddocs/README.mddocs/STARTUP_AND_CONFIG.mddocs/TUI_INTERFACE.mddocs/buy order flow.mddocs/sell order flow.mdsrc/ui/key_handler/form_input.rssrc/ui/key_handler/mod.rs
There was a problem hiding this comment.
Reviewed strictly.
This looks good to me.
I checked the key-routing change with the current handler ordering in mind, and the fix is appropriately scoped:
n/care now treated as normal character input when a text-editable create-order field is focused- the
OrderTypetoggle is still excluded, so the fix does not blur the buy/sell selector semantics - outside that text-input context, the existing global behaviors remain intact
I do not see a blocker in the current version, and the added helper/test make the intent clear enough for future maintenance.
Summary
Fixes #71
In the Create New Order form, global
n(cancel) andc(copy invoice) shortcuts ran before generic character input, socandncould not be typed in Payment Method and other text fields (e.g. SEPA, Bizum, cash).is_creating_order_text_input()inform_input.rsc/nthroughhandle_char_inputwhen a text field is focused (Order Type toggle unchanged)Summary by CodeRabbit
New Features
Documentation