scrollViewport method

void scrollViewport(
  1. VtTerminalScrollViewport behavior
)

Scrolls the visible viewport within the terminal scrollback.

Implementation

void scrollViewport(VtTerminalScrollViewport behavior) {
  _ensureOpen();
  final behaviorPtr = calloc<bindings.GhosttyTerminalScrollViewport>();
  try {
    behaviorPtr.ref.tagAsInt = behavior._tag.value;
    if (behavior._tag ==
        bindings
            .GhosttyTerminalScrollViewportTag
            .GHOSTTY_SCROLL_VIEWPORT_DELTA) {
      behaviorPtr.ref.value.delta = behavior.delta;
    }
    bindings.ghostty_terminal_scroll_viewport(_handle, behaviorPtr.ref);
  } finally {
    calloc.free(behaviorPtr);
  }
}