Extract the wrapping text-entry popup and put quick-create and link-PR on it - #169
Merged
Merged
Conversation
Three modal arms drew a single typed buffer into a bordered popup, but only Mode::Prompt sized the box from the wrapped line count. LinkPr and QuickCreate asked for a fixed three rows, two of them borders, so a long intent or a pasted PR URL vanished past the first wrapped row — the cursor with it, leaving the operator typing blind. Extract the prompt's measure/clamp/scroll block into draw_text_entry_popup beside popup_area and put all three arms on it, each passing its whole title because the submit suffixes differ. The width, the 3..=20 row clamp and the tail scroll are the prompt's, unchanged. Verified with two new tests mirroring the prompt pair over Mode::QuickCreate — they fail against the old three-row arm — and by driving the TUI: a long intent in the n modal wraps and grows to the clamp, then scrolls to keep the tail and the cursor on screen, and a long URL in the link-PR prompt wraps the same way. The refine popup is untouched. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ABF2CHfKV8sp2gSzJLsQ4T
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.
Three modal arms in crates/voro/src/ui.rs drew a single typed buffer into a
bordered popup, but only
Mode::Promptsized the box from the wrapped linecount.
Mode::LinkPrandMode::QuickCreateaskedpopup_areafor a fixedthree rows, two of them borders, so everything past the first wrapped row — the
▏ cursor included — was clipped: the operator typing a long intent into
n, orpasting a long PR URL, was typing blind.
What changed
The prompt's body is now
draw_text_entry_popup(frame, title, buffer), sittingbeside
popup_areaas part of the same popup toolbox. It splits the buffer on'\n', appends the cursor to the last line, builds a wrapping
Paragraph,measures it with
line_countat the popup's inner width, sizes the boxrendered_rows.clamp(3, 20)and past the clamp scrolls to the tail. Width 72,the clamp and the tail scroll are the prompt's numbers unchanged, now named as
WIDTH/MIN_ROWS/MAX_ROWSconstants. Both explanatory comments — the'\n'-vs-wrapped-count note and the RejectWork multi-line one — moved across
with the code they describe.
All three arms call it and are one line each plus their title, which each
passes whole because the suffixes genuinely differ ("⏎ to submit" for the
prompt and link-PR, "⏎ to propose" for quick create).
Mode::QuickCreatestillresolves the project name from
app.projectsexactly as before,unwrap_or("the project")and all. No copy of the measure/clamp/scroll blocksurvives. The helper takes no
hitsand pushes nothing, so the arms stillregister no click target.
Key handling is untouched —
App::key_quick_createandkey_link_prare notin the diff.
Mode::AddProjectand the viewer form are deliberately leftalone: two-field forms with focus styling are a different shape, and bending
the helper to fit them was out of scope. Nothing in DESIGN.md needed changing;
this was a rendering defect, not a change to documented modal semantics.
Verification
Two new tests mirror the existing prompt pair over
Mode::QuickCreate:quick_create_popup_grows_with_wrapped_textandquick_create_popup_scrolls_to_the_tail_when_it_overflows.render_promptwasgeneralised into
render_modal(store, mode)with thinrender_prompt/render_quick_createwrappers, the quick-create one seedingstore.create_project("voro", "/tmp/voro")beforeApp::newso the titleresolves. I confirmed both new tests are load-bearing by temporarily restoring
the old three-row arm — both fail against it, then pass again with the helper.
prompt_popup_grows_with_wrapped_textandprompt_popup_scrolls_to_the_tail_when_it_overflowspass unchanged.cargo test --workspace(470 + 389 + 1, 0 failed),cargo clippy --workspace --all-targets -- -D warningsandcargo fmt --allare all clean.Manually driven through the
verifyskill against a scratch db in tmux at110x30. Pressing
nwith one project goes straight to quick create; typing~130 columns wrapped to two rows with
TAILMARK▏visible, and typing on pastthe clamp pinned the tail and cursor on the last row while the head scrolled
out of the 20-row box.
gon a non-review task opened the link-PR prompt,where a 116-character URL wrapped across two rows with the cursor visible —
both previously clipped. The refine popup still renders exactly as before.