feat(tui): grid layout + auto-growing scroll input - #481
Merged
Merged
Conversation
Replace the dock-based layout (docked input + footer + 1fr main) with a
four-row Grid (`grid-rows: 1 1fr auto 1`) so every pane is placed by the
layout system — no dock hacks, `Header { dock: none }` opts the title bar
into the grid. The input TextArea auto-grows with content (min 3 rows,
max 8) and scrolls internally past the cap, so a long prompt never
squeezes the conversation out of its 1fr row.
Streaming render path (#407: plain Static during stream, one Markdown
parse at finalise) is untouched — the responsiveness win comes from the
layout giving the conversation the full remaining height.
Also: point ty at the uv workspace venv via `[tool.ty.environment]
python = ".venv"` (directory form is portable across OSes) so the LSP
auxiliary scanner resolves third-party imports instead of reporting
false unresolved-import noise.
Tests: 2 new layout-contract tests (vertical stacking order + input
auto-grow/scroll cap). 101 TUI tests green, ruff + ty clean.
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.
What
Redesign the TUI layout for streaming responsiveness — fully layout-driven, no dock hacks.
Layout: dock stacking → Grid
The old CSS mixed
layout: verticalwithheight: 1frand twodock: bottomwidgets (input, footer). Replaced with a four-row Grid:Every pane is placed by the grid; the footer's
dock: bottomis removed from its own CSS (the grid owns placement).Input: auto-growing scroll input
The input
TextAreagrows with content (min-height: 3,max-height: 8) then scrolls internally past the cap, so a long prompt never squeezes the conversation out of its 1fr row. Single input box; Ctrl+Enter send and/-command semantics unchanged.Streaming path
Untouched — #407 (plain
Staticduring the stream, one Markdown parse at finalisation, 50 ms refresh throttle) is already the optimal shape. The responsiveness win is the layout: the conversation gets the full remaining height.Tooling: ty venv resolution
Adds
[tool.ty.environment] python = ".venv"to the rootpyproject.toml. The LSP auxiliary ty scanner launchedty serverfrom a cwd where.venvauto-discovery missed, so it reported falseunresolved-importfindings for every third-party and first-party module (the realty checkwas already clean). The directory form is portable across OSes — ty locatesbin/python/Scripts/python.exeinside the venv itself.Changes
packages/cothis-tui/src/cothis/tui.py: Grid CSS,Header { dock: none }, input auto-grow CSS, footer dock removal, docstring updated for the four-row layout.pyproject.toml:[tool.ty.environment] python = ".venv".tests/test_tui.py: two new layout-contract tests.tests/test_tui_pty.py: docstring updated for the four-row grid;# noqa: B009on the deliberate Windows-ty-safegetattrpattern.Problem fixed
unresolved-importerrors because itsty servercould not resolve the project venv.Tests
test_grid_layout_stacks_panes_vertically— header < main < input < footer vertical order; conversation taller than input + footer; full width in single-session mode.test_input_auto_grows_then_scrolls_internally— input grows past the min-height floor, caps at max-height, scrolls internally; conversation shrinks accordingly.101 TUI tests green;
ruff check+ty checkclean (venv, from any cwd). CI green on all three OSes.Pre-existing, not from this PR
test_startup_latency.py::test_cothis_help_under_startup_budgetfails on this machine (1156 ms vs 1100 ms ceiling) — it reproduces on a clean checkout oforigin/main(stash-verified). This PR touches no CLI startup path; CI runners pass it.