Skip to content

Separate UI Logic from Rendering Implementation#1

Open
hectr wants to merge 4 commits intomainfrom
renderer-protocol
Open

Separate UI Logic from Rendering Implementation#1
hectr wants to merge 4 commits intomainfrom
renderer-protocol

Conversation

@hectr
Copy link
Owner

@hectr hectr commented Sep 20, 2024

This pull request refactors the framework to separate the UI primitives, diffing, etc. from the rendering implementation. The goal is to decouple the core logic of the framework from the specific rendering backend, making it easier to support alternative backends.

Key changes:

  • Renderer is a protocol implemented by TerminalRenderer;
  • There is a new InputHandler protocol implemented by TerminalInputHandler;
  • Renderer and InputHandler are injected to Application;
  • Window and Control have a common abstract parent class: LayoutObject;
  • LayerDrawing, Cell, CellAttributes, EscapeSequence, and ArrowKeyParser are now implementation details of the terminal renderer backend.

Many more ACLs are public now, as Renderer and InputHandler implementations might need visibility of all the controls and other supporting types.

Only tested on macOS 14.6.1 - Xcode 15.4 (15F31d)

EDIT: Tested also on Linux with official Docker image. On Windows it won't build (see #4).

hectr added 3 commits October 13, 2024 16:57
RGB is universally supported. This should help prevent code duplication in renderer implementations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant