struct Termisu::Event::Resize

Overview

Terminal resize event.

Generated when the terminal window size changes (SIGWINCH). Optionally includes previous dimensions for incremental resize handling.

Example:

event = termisu.poll_event
if event.is_a?(Termisu::Event::Resize)
  puts "Terminal resized to #{event.width}x#{event.height}"
  if event.changed?
    puts "Changed from #{event.old_width}x#{event.old_height}"
  end
  termisu.sync # Force full redraw
end

Defined in:

termisu/event/resize.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(width : Int32, height : Int32, old_width : Int32 | Nil = nil, old_height : Int32 | Nil = nil) #

[View source]

Instance Method Detail

def changed? : Bool #

Returns true if the dimensions have changed from previous values.

Returns true if:

  • Previous dimensions are unknown (nil)
  • Width or height differs from previous values

[View source]
def height : Int32 #

New terminal height in rows.


[View source]
def old_height : Int32 | Nil #

Previous terminal height in rows (nil if unknown or first resize).


[View source]
def old_width : Int32 | Nil #

Previous terminal width in columns (nil if unknown or first resize).


[View source]
def width : Int32 #

New terminal width in columns.


[View source]