Skip to content

refactor(tui): drop viewport-budget row allocator (stage 3 of #1529)#1536

Merged
esengine merged 1 commit into
mainfrom
feat/static-history-stage3
May 22, 2026
Merged

refactor(tui): drop viewport-budget row allocator (stage 3 of #1529)#1536
esengine merged 1 commit into
mainfrom
feat/static-history-stage3

Conversation

@esengine

Copy link
Copy Markdown
Owner

Summary

Stage 3 of #1529. The vertical row allocator (viewport-budget) existed so a full-screen persistent frame could parcel rows between zones — modal, status, input, stream, safety. With Static-anchored history the persistent frame sizes to content and the zones don't compete; there's nothing left to allocate.

Deleted

  • src/cli/ui/layout/viewport-budget.tsx (160 lines: reducer, allocator, ViewportBudgetProvider, useReserveRows, useTotalRows)
  • tests/viewport-budget.test.ts

Trimmed

  • App.tsx — drop <ViewportBudgetProvider> (and the indentation it imposed on the rest of the tree)
  • StreamingCard, PromptInput, ChoiceConfirm, PathConfirm, ShellConfirm, PlanCheckpointConfirm — side-effect-only useReserveRows calls deleted
  • EditConfirm, PlanConfirm — swap useTotalRows() for useStdout().stdout?.rows and inline the max into a direct expression (these were the only consumers that read the allocator's return value)
  • tests/plan-confirm.test.tsx — render without the provider wrapper

Kept

  • src/cli/ui/prompt-viewport.ts — this powers the composer's own input-cell math (CJK width, paste-sentinel rendering, single-row slicing). It's composer-internal and unaffected by the chat-history refactor. The Stage 3 line in Move the conversation stream to append-only; drop the self-managed virtual-view layer #1529 said "drop viewport-budget / prompt-viewport, after confirming the composer no longer depends on them"; the composer still depends on prompt-viewport, so it stays.

Net diff: 727 deletions, 433 insertions across 12 files. (Most of the App.tsx insertion count is biome re-indenting the subtree that lost its 4-space wrapper.)

Test plan

  • npm run typecheck
  • npm run lint (no new errors; 2 pre-existing biome suggestions remain)
  • npm run build
  • npm run test — all 3557 tests pass (90-line viewport-budget.test.ts deleted; plan-confirm.test.tsx updated to drop the provider wrapper)
  • Manual smoke: send a long message, open an EditConfirm and a PlanConfirm in a small terminal — they should still fit and scroll within their inline budget

Part of #1529. Stage 4 (drop src/frame/*) is next.

The vertical row allocator existed so a full-screen persistent frame
could parcel its rows between zones (modal, status, input, stream,
safety). With Static-anchored history, the persistent frame sizes to
content and the zones don't compete — there's nothing to allocate.

- Delete `src/cli/ui/layout/viewport-budget.tsx` and its tests.
- Remove `<ViewportBudgetProvider>` from `App.tsx` (and the indentation
  it imposed on the rest of the tree).
- Remove side-effect-only `useReserveRows` calls in `StreamingCard`,
  `PromptInput`, `ChoiceConfirm`, `PathConfirm`, `ShellConfirm`, and
  `PlanCheckpointConfirm`.
- `EditConfirm` and `PlanConfirm` actually used the return value; both
  swap `useTotalRows()` for `useStdout().stdout?.rows` and inline the
  allocator's max into a direct expression.
- Update `plan-confirm.test.tsx` to render without the provider wrapper.

`prompt-viewport.ts` stays — it powers the composer's own input-cell
math (CJK width, paste sentinels, single-row slicing), which is
composer-internal and unaffected by the chat-history refactor.
@esengine esengine merged commit b465b73 into main May 22, 2026
4 checks passed
@esengine esengine deleted the feat/static-history-stage3 branch May 22, 2026 08:50
esengine pushed a commit that referenced this pull request May 22, 2026
…, theme) (#1524)

Localizes the remaining hardcoded CLI output strings — `reasonix mcp list / search / install` flow, `sessions` listing, `prune-sessions`, and the `/theme` slash handler — so zh-CN users see translated text instead of mixed EN/CN output.

31 new keys across `sessions` / `mcpCli` / `app` namespaces with full EN ↔ zh-CN parity. Mechanical migration — `t()` calls replace each string with the same parameters; no behavior change.

Verified clean rebase on top of the stage-1-through-4 refactor (#1530 / #1534 / #1536 / #1537) plus the path-approval bridge (#1540): typecheck + lint + 3528 tests all pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant