initialize method

  1. @override
void initialize()
override

Initializes the renderer.

Sets up the terminal for fullscreen rendering.

Implementation

@override
void initialize() {
  if (_initialized) return;

  if (_options.altScreen) {
    terminal.enterAltScreen();
  }
  if (_options.hideCursor) {
    terminal.hideCursor();
  }
  terminal.clearScreen();
  // Disable auto-wrap while this renderer owns the screen: a row longer
  // than the terminal (a transient mid-resize state, before the app has
  // rebuilt its view for the new size) must clip at the right margin, not
  // wrap and scroll — a scroll would shift the whole screen under the
  // diff's absolute row addressing. Restored in [dispose].
  if (terminal.supportsAnsi) {
    terminal.write(UvAnsi.resetModeAutoWrap);
  }
  _initialized = true;
}