Skip to content

[quality] Add diffed rendering #50

Description

@owainlewis

Goal: Replace full-screen redraws with a small diffed renderer that only writes changed terminal cells.

Context: The PRD treats latency and flicker-free paint as core product quality.
The current renderer builds a frame and clears/redraws the whole screen on every render.
That is fine for the prototype, but it is not the path to a world-class terminal editor.

Proposed approach:

  • Introduce a cell/frame representation that includes grapheme or character text plus style attributes needed by the renderer.
  • Keep a shadow copy of the last drawn frame inside the renderer.
  • On render, compare new cells to the shadow frame and emit terminal updates only for changed cells.
  • Still handle terminal resize by invalidating the shadow frame.
  • Preserve cursor hiding/showing, color reset behavior, and terminal cleanup.
  • Keep the public renderer boundary suitable for future multi-window rendering.

Acceptance criteria:

  • Rendering no longer clears the full screen on every normal frame.
  • Unchanged cells are not rewritten on ordinary cursor movement or status updates, except where required for correctness.
  • Resize forces a correct full redraw and resets the shadow frame.
  • Syntax colors, selection, gutter, modeline, command line, picker, and cursor placement remain correct.
  • The terminal is left in a clean state after exit.
  • Renderer tests cover diff behavior without relying only on manual inspection.

Verification:

  • Run cargo test.
  • Add a focused render-output test that proves unchanged cells are skipped.
  • Manually open a file, move the cursor, type, resize, open picker, return to editor, and quit.
  • Manually confirm no obvious flicker and a usable shell after exit.

Out of scope:

  • Async rendering.
  • GPU or alternate backend work.
  • Soft wrap.
  • New visual features.
  • Multi-pane rendering unless the split issue has already landed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions