Repository navigation
[CTX-1386] fix(ui): start new panels at row zero - #2313
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 10 minutes. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
2822e72 to
c72b501
Compare
Review verdict: APPROVEReviewed head Root cause and fix
Regression and mutation
Windows portability
Gates (head
|
c72b501 to
c7c8d7a
Compare
Size a fresh pane's shell to the decorated content frame it is presented in instead of the raw slot allocation. The first present used to shrink grid and PTY immediately after spawn, delivering a SIGWINCH that repaints the prompt and can leave a blank first row above it. Regression: new_leaf_spawns_at_its_presented_content_frame (fails before: 40x24 vs 37x22; passes after). Refs #2145.
c7c8d7a to
92a1ece
Compare
Priority: P2 | Area: ui | Labels: fix,P2,area:ui | Milestone: 0.0.25 | RFC: - | Task: CTX-1386
Closes #2145
Root cause
TerminalApp::commit_new_leafsized a fresh pane's shell fromlayout_allocations()— the raw slot after gaps, before the border/content inset. The very first present then shrank the pane grid and PTY to the decorated content frame immediately after the shell started. That post-spawnSIGWINCHmakes the shell repaint its prompt; a prompt hook that draws its repaint on a fresh line leaves a stray blank first row above the prompt. Runningclearhappened to repaint without that extra row, which is why it looked like a one-off grid offset.The path affected only the keymap split/new-panel actions (
NewSplit,NewPanel, including the empty-base materialization).workspace_newand session restore already spawn from the present frame.Evidence
NewSplitpane was spawned at40x24while its presented content frame was37x22; the firsttick()then resized both grid and PTY, delivering the spuriousSIGWINCH.80x24vs frame77x22before the first present.workspace_newalready spawned at77x22with no follow-up resize.Change
commit_new_leafnow resolves the size frompresent_frames()first and falls back tolayout_allocations()only for a degenerate container. The shell is born at its final content size, and the first geometry sync is a no-op.The move-panel path already sizes the pane from the target's decorated content frame; a resize there only happens when the target geometry genuinely differs and it preserves the top content rows.
Regression
new_leaf_spawns_at_its_presented_content_frameruns bothNewSplitandNewPanel, asserts the PTY and grid are born at the presented content frame, and asserts the first present does not resize either.Before the fix it failed with:
After the fix it passes.
Verification
just fmt-checkcargo clippy -p bitty-terminal --all-targets --locked -- -D warningscargo nextest run -p bitty-terminal --locked: 1247 passed, 1 skippedcargo nextest run -p bitty-terminal --locked -E 'test(chrome_keys)': 130 passedcargo check --target x86_64-pc-windows-gnu --workspace --all-targets --lockedjust check: green (workspace nextest 7572 passed / 3 skipped, doctests, platform harnesses, supply chain, packaging, actionlint, markdownlint)Scope note
A prompt framework that intentionally emits a leading newline before every prompt (for example starship
add_newline = true, its default) is a prompt choice, not a bitty grid offset; this change does not suppress prompt bytes the shell intentionally writes.Summary by CodeRabbit