Skip to content

[Architecture] oclite: Revert scroll region layout, adopt append-only output model #73

@randomm

Description

@randomm

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:

  1. Output prints to stdout, terminal scrolls naturally
  2. A dedicated line editor library owns input at the bottom (cursor is naturally there)
  3. No fixed panels, no scroll regions

Our scroll region layout (layout.ts, commit 4659b6c81) caused 3 critical bugs:

  • Input frozen: editor.render() never called after editor.handle()
  • Scroll region broken: focusInput() writes outside scroll bounds (rows-1 vs rows-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 4659b6c81 reverted cleanly
  • oclite binary builds and runs
  • All pre-existing features work (markdown, tools, spinner, input)
  • bun run typecheck passes
  • bun test passes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions