feat(panel): persist the panel size and fix the divider drag without a terminal - #679
Merged
Merged
Conversation
|
Warning Review limit reachedNext included review available in 28 minutes. View limit detailsLimit details: You’ve used all 2 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository: eugenioenko/ttt/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (10)
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 |
eugenioenko
force-pushed
the
feat/panel-size-state
branch
from
September 27, 2026 15:27
33d5eac to
b962631
Compare
…a terminal The bottom panel height and right-docked panel width reset on every launch. Save both to state.json when a divider drag ends or the panel resize commands run, and restore them at startup. Sizes below MinPanelHeight (5) and MinPanelWidth (30) are never saved or restored, and reopening the panel after dragging it that small resets it to a usable size, matching the sidebar's rule. Dragging the divider also started a terminal on the first mouse move when none existed. Spawning moves focus, and the focus change canceled the pointer capture, so the drag stopped after one step and switched an open Output or Problems panel to the Terminal tab. The drag now only resizes; a terminal starts when the drag ends, and only when the drag opened a closed panel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
eugenioenko
force-pushed
the
feat/panel-size-state
branch
from
September 27, 2026 15:36
c4961e2 to
22651e2
Compare
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.
Why
The bottom panel height and the right-docked panel width reset on every launch, while the sidebar and commit history sizes are already restored from
state.json.Change
state.jsongainspanelHeightandpanelWidth, stored separately since the two docks are not interchangeable. Saved once when a divider drag ends (theOnResizeEndhook from fix(sidebar): restore closed state and a usable width on launch #678) and by View: Increase/Decrease Panel Size; restored at startup. The fullscreen terminal toggle does not save, so a full-height terminal is not remembered as your size.ui.MinPanelHeight = 5(divider, tab bar, and three content rows, the same rule aschangesHistoryMinHeight) andui.MinPanelWidth = 30. You can still drag below them or close the panel, but those sizes are not saved or restored, and reopening resets them to a usable size (previously only a height of 1 or less was reset, and width never was). The three copies of that reopen logic are folded intoensureUsablePanelSize.state.json.Tests
Unit tests in
internal/app:TestPanelSizeRestoresAndPersists: sizes round-trip through a rebuild, sizes under the minimums are not saved, and saved sizes under the minimums are not restored.TestReopeningTinyPanelResetsSize: reopening after a tiny drag resets height to half the area and width to the default.The save-on-release contract of
ContentSplitWidget.OnResizeEndis covered byTestCommitHistoryDragPersistsOnlyOnReleasefrom #678.Exercised in the real binary with an isolated
TTT_CONFIG_DIR:{"panelHeight":21,...}; the next launch opens at 21.state.jsonkeeps 21.{"panelWidth":36,...}; the next launch opens at 36.Fix: panel drag canceled when no terminal exists
Dragging the divider started a terminal on the first mouse move when none existed. Spawning moves focus, and the focus change canceled the pointer capture (
Root.SetFocus→CancelPointerCapture), so the drag stopped after one step; it also switched an open Output or Problems panel to the Terminal tab. Reproduces on main:The drag now only resizes (
resizePanel).finishPanelResizestarts a terminal when the drag ends, and only if the drag opened a closed panel. Covered by two e2e tests intests/e2e/panel_drag_test.go, both failing on the old code:TestPanelDragWithoutTerminalKeepsDragAndTab: resizing an open Output panel keeps the drag alive, reaches the dragged height, starts no terminal, and stays on Output.TestPanelDraggedOpenStartsTerminalOnRelease: dragging a closed panel open starts no terminal mid-drag and one on release.The repro above now ends at height 21 on the Output tab.
make testpasses.make lintreports only pre-existing staticcheck SA5011 issues in unrelated test files.🤖 Generated with Claude Code