forked from anomalyco/opencode
-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Context
Deep-dive research into 3 production terminal chat TUIs (AIChat/Rust, Aider/Python, blessed/Node.js) revealed that neither AIChat nor Aider uses ANSI scroll regions (DECSTBM). Both use a simple append-only stdout model where:
- Output prints to stdout, terminal scrolls naturally
- A dedicated line editor library owns input at the bottom (cursor is naturally there)
- No fixed panels, no scroll regions
Our scroll region layout (layout.ts, commit 4659b6c81) caused 3 critical bugs:
- Input frozen:
editor.render()never called aftereditor.handle() - Scroll region broken:
focusInput()writes outside scroll bounds (rows-1vsrows-3) - Double prompt: Layout methods fighting for same screen lines
Plan
Revert commit 4659b6c81
This removes layout.ts and restores the working append-only architecture from before the scroll region attempt. Files affected:
layout.ts(delete — new file from that commit)index.ts(revert layout integration)spinner.ts(revert callback mode)
Verify after revert
- oclite accepts keyboard input
- Streaming output renders correctly
- Spinner displays during thinking
- Tool calls render inline
- Markdown rendering works
- No double prompt
Research Evidence
| Project | Uses DECSTBM? | Architecture |
|---|---|---|
| AIChat (Rust, 9.2k ⭐) | ❌ No | reedline + append stdout + cursor tracking |
| Aider (Python, 40.1k ⭐) | ❌ No | prompt_toolkit + append stdout + Rich Live rerender |
| blessed (Node.js) | ✅ Yes | But requires 16k+ LOC, double-buffer, 3-step CSR reset cycle |
Acceptance Criteria
- Commit
4659b6c81reverted cleanly - oclite binary builds and runs
- All pre-existing features work (markdown, tools, spinner, input)
-
bun run typecheckpasses -
bun testpasses
Metadata
Metadata
Assignees
Labels
No labels