Class: Charming::Internal::Renderer::FullRepaint

Inherits:
Object
  • Object
show all
Defined in:
lib/charming/internal/renderer/full_repaint.rb

Overview

FullRepaint clears the screen and rewrites the entire frame on every render. It is used as the initial render path by Differential and as a fallback for backends that don’t support partial line writes.

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ FullRepaint

output is the terminal backend (must support ‘clear`, `move_cursor`, and `write_frame` per the Adapter contract).



12
13
14
# File 'lib/charming/internal/renderer/full_repaint.rb', line 12

def initialize(output)
  @output = output
end

Instance Method Details

#render(frame) ⇒ Object

Clears the screen, homes the cursor, and writes the entire frame string.



17
18
19
20
21
# File 'lib/charming/internal/renderer/full_repaint.rb', line 17

def render(frame)
  @output.clear
  @output.move_cursor(1, 1)
  @output.write_frame(frame)
end