Skip to content

Add SSH backend and custom-backend row diff rendering#3

Closed
laudney wants to merge 1 commit intodevelopfrom
pr/ssh-backend-runtime
Closed

Add SSH backend and custom-backend row diff rendering#3
laudney wants to merge 1 commit intodevelopfrom
pr/ssh-backend-runtime

Conversation

@laudney
Copy link

@laudney laudney commented Feb 20, 2026

Summary

Adds a first-class SSH backend and a custom-backend rendering path in Runtime that is optimized for remote PTY sessions.

Why

Remote rendering over SSH has different failure modes than local raw TTY rendering:

  • stale row artifacts during view transitions
  • edge behavior at terminal boundaries
  • per-session isolation requirements for buffer management and runtime context

This PR introduces a dedicated backend and runtime path so SSH sessions are stable without regressing local raw/TTY behavior.

What changed

New backend

  • Added TermUI.Backend.SSH with:
    • alternate screen lifecycle
    • cursor visibility management
    • mouse mode toggles
    • resize support (update_size/3)
    • row-based draw strategy (clear touched rows, redraw left-to-right)
    • autowrap off/on lifecycle around session rendering
    • bottom-right edge guard to avoid terminal scroll artifacts

Runtime custom-backend support

  • Added custom-backend message handling (:ssh_input, :ssh_resize).
  • Added backend-specific resize handling (no Terminal singleton assumptions).
  • Added custom-backend row-diff extraction:
    • compute changed rows
    • redraw full changed rows (including spaces)
  • Added Buffer.fill/2 and optional runtime :background support for deterministic first-frame rendering.
  • Isolated custom backend cleanup behavior from local raw/TTY terminal restoration paths.
  • Ensured custom backends use unique BufferManager names to avoid cross-session collisions.

Tests

  • Added comprehensive unit tests for TermUI.Backend.SSH.
  • Added integration tests for runtime + SSH rendering behavior:
    • changed-row redraw on shrink updates
    • bottom-right edge behavior

Validation

  • mix test test/term_ui/backend/ssh_test.exs test/integration/ssh_runtime_rendering_test.exs

@laudney
Copy link
Author

laudney commented Feb 20, 2026

Moved upstream: pcharbon70#33

@laudney
Copy link
Author

laudney commented Feb 20, 2026

Closing in fork repo; tracked upstream in pcharbon70#33

@laudney laudney closed this Feb 20, 2026
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