You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
new_panel materializing a tiled base over an empty workspace (the #2223
path) installs the layout before spawning the fresh shell. set_layout
re-homes focus to the new leaf, so a post-install inherited_cwd_for read
compared the target with itself, found no surviving source, and the new shell
fell back to the default $HOME instead of the surviving float/pin's OSC 7
directory.
commit_new_leaf now captures the inheritance source before runtime.set_layout(layout) and passes it through spawn_pane_shell_in(..., inherited_cwd.as_deref()). The capture contract is
unchanged: inherited_cwd_for still resolves the focused view, ignores a
source equal to the target, and only returns an existing directory from that
pane's session report (explicit spawn cwd or OSC 7); otherwise the PTY
default ($HOME/USERPROFILE, else process cwd) stands. inherited_cwd_for
is now pub + #[must_use] so layout-installing creation paths can read it
before the install.
Under BisectLargest only the focused-survivor source changed: split-target
selection (panel_bisect_target) is untouched, and spawn sizing plus cwd
inheritance still read the focused pane per the CTX-0964/DEC-0099 contract.
Regressions
Both tests drive the real chord and real PTY path, asserting the panel's
rendered grid shows the survivor's OSC 7 directory (/tmp):
new_panel_over_empty_base_inherits_float_osc7_cwd_issue_2240 — detach a
float reporting file:///tmp, drain the tiled base, NewPanel.
new_panel_over_empty_base_inherits_pin_osc7_cwd_issue_2240 — pin a
survivor reporting file:///tmp, drain the tiled base, NewPanel.
Mutation evidence
Moving the capture back after runtime.set_layout(layout) (throwing the fix
away, tests kept) fails both regressions deterministically after the 10s
drain bound:
FAIL tests::new_panel_over_empty_base_inherits_float_osc7_cwd_issue_2240
FAIL tests::new_panel_over_empty_base_inherits_pin_osc7_cwd_issue_2240
new panel must inherit the surviving float's OSC 7 cwd (/tmp):
"/home/fuyu ..."
new panel must inherit the surviving pin's OSC 7 cwd (/tmp):
"/home/fuyu ..."
The mutation was reverted byte-for-byte and the worktree is clean.
Reviewing files that changed from the base of the PR and between 126579d and dd35e7f.
📒 Files selected for processing: 3
crates/bitty-runtime/src/runtime/panes.rs
crates/bitty-terminal/src/chrome_keys.rs
crates/bitty-terminal/src/tests.rs
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
📝 Walkthrough
New panel creation now captures the inherited working directory before installing the layout and passes it to the new shell. Unix PTY tests verify inheritance from surviving floats and pinned panels.
Changes: New panel cwd inheritance
Layer / File(s)
Summary
Capture and validate inherited cwd crates/bitty-runtime/src/runtime/panes.rs, crates/bitty-terminal/src/chrome_keys.rs, crates/bitty-terminal/src/tests.rs
inherited_cwd_for is now public. commit_new_leaf captures the cwd before layout installation and passes it to shell creation. Unix PTY tests cover surviving floats and pinned panels with an OSC 7 cwd.
No actionable merge-blocking risk is identified for new-panel cwd inheritance. Normal checks remain appropriate before merging.
Pre-merge checks: 5
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title clearly and concisely describes the main change: inheriting the surviving view's working directory when creating a new panel.
Linked Issues check
Issue #2240 requires pre-install cwd capture and regression coverage for float and pin survivors. commit_new_leaf calls inherited_cwd_for(new_id) before set_layout, then passes the result to `sp…
Out of Scope Changes check
The changes stay within issue #2240. The public inherited_cwd_for API and its documentation enable the required pre-install read. The commit_new_leaf change fixes cwd propagation. The added test h…
Docstring Coverage
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 3 files.
Full details: Linked Issues check
Explanation
Issue #2240 requires pre-install cwd capture and regression coverage for float and pin survivors. commit_new_leaf calls inherited_cwd_for(new_id) before set_layout, then passes the result to spawn_pane_shell_in. The PR summary reports real-chord, real-PTY tests for both float and pin survivors, with /tmp assertions. The focused diff confirms the capture order and spawn argument.
Full details: Out of Scope Changes check
Explanation
The changes stay within issue #2240. The public inherited_cwd_for API and its documentation enable the required pre-install read. The commit_new_leaf change fixes cwd propagation. The added test helpers and regression tests verify the requested UI behavior. No unrelated behavior is demonstrated.
✨ Finishing Touches
📝 Generate docstrings
Commit to this branch
Create a new PR
🧪 Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
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
area:uiArea: UI / layoutfixBug fixP2Priority: medium
1 participant
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
new_panelmaterializing a tiled base over an empty workspace (the #2223path) installs the layout before spawning the fresh shell.
set_layoutre-homes focus to the new leaf, so a post-install
inherited_cwd_forreadcompared the target with itself, found no surviving source, and the new shell
fell back to the default
$HOMEinstead of the surviving float/pin'sOSC 7directory.
commit_new_leafnow captures the inheritance source beforeruntime.set_layout(layout)and passes it throughspawn_pane_shell_in(..., inherited_cwd.as_deref()). The capture contract isunchanged:
inherited_cwd_forstill resolves the focused view, ignores asource equal to the target, and only returns an existing directory from that
pane's session report (explicit spawn cwd or
OSC 7); otherwise the PTYdefault (
$HOME/USERPROFILE, else process cwd) stands.inherited_cwd_foris now
pub+#[must_use]so layout-installing creation paths can read itbefore the install.
Under
BisectLargestonly the focused-survivor source changed: split-targetselection (
panel_bisect_target) is untouched, and spawn sizing plus cwdinheritance still read the focused pane per the CTX-0964/DEC-0099 contract.
Regressions
Both tests drive the real chord and real PTY path, asserting the panel's
rendered grid shows the survivor's
OSC 7directory (/tmp):new_panel_over_empty_base_inherits_float_osc7_cwd_issue_2240— detach afloat reporting
file:///tmp, drain the tiled base,NewPanel.new_panel_over_empty_base_inherits_pin_osc7_cwd_issue_2240— pin asurvivor reporting
file:///tmp, drain the tiled base,NewPanel.Mutation evidence
Moving the capture back after
runtime.set_layout(layout)(throwing the fixaway, tests kept) fails both regressions deterministically after the 10s
drain bound:
The mutation was reverted byte-for-byte and the worktree is clean.
Gates
cargo fmt --all -- --check— passcargo clippy --workspace --all-targets --locked -- -D warnings— passcargo clippy -p bitty-terminal --features dev-tools --all-targets --locked -- -D warnings— passcargo nextest run -p bitty-terminal --locked— 1215 passed, 0 skippedRUSTFLAGS="-D warnings" cargo check --workspace --all-targets --locked --target x86_64-pc-windows-gnu— passRebased onto
origin/mainat126579da(CTX-1346 Lua error decoding) on topof
ec3698eb(CTX-1338) andbb4c01ff(CTX-1332); no conflicts.Closes #2240
Summary by CodeRabbit