Class: RatatuiRuby::Backend::WindowSize

Inherits:
Object
  • Object
show all
Defined in:
lib/ratatui_ruby/backend/window_size.rb

Overview

Terminal window dimensions in characters and pixels.

Some operations need both character grid size and pixel dimensions. Sixel graphics, image rendering, and precise layout calculations all benefit from knowing both measurements at once.

This struct bundles both sizes together. It matches upstream Ratatui's backend::WindowSize struct exactly.

Both fields are Layout::Size instances. This reuses the same type for character and pixel dimensions, matching upstream design.

Note: Pixel dimensions may be zero on some systems. Unix marks these fields "unused" in TIOCGWINSZ. Windows does not implement them.

Example

--

SPDX-SnippetBegin SPDX-FileCopyrightText: 2026 Kerrick Long SPDX-License-Identifier: MIT-0 ++ ws = RatatuiRuby::Terminal.window_size if ws puts "#wsws.columns_rowsws.columns_rows.widthx#wsws.columns_rowsws.columns_rows.height chars" puts "#wsws.pixelsws.pixels.widthx#wsws.pixelsws.pixels.height pixels" end

SPDX-SnippetEnd ++