Termisu::Event::ModeChange
Inherits Struct / Value / Object
Terminal mode change event.
Generated when the terminal mode is changed via set_mode or with_mode.
Includes both the new mode and previous mode for tracking transitions.
Example:
termisu.each_event do |event|
case event
when Termisu::Event::ModeChange
puts "Mode changed: #{event.previous_mode} -> #{event.mode}"
if event.to_raw?
# Re-entering TUI mode
elsif event.from_raw?
# Leaving TUI mode
end
end
end
Constructors
new(mode : Terminal::Mode, previous_mode : Terminal::Mode | Nil = nil)
SourceInstance methods
changed?
Returns true if the mode actually changed.
Returns false if:
- Previous mode is nil (first mode assignment, not a change)
- Previous mode equals current mode
to_user_interactive?
Returns true if transitioning to a user-interactive mode.
User-interactive modes have canonical input or echo enabled, where the terminal driver handles input rather than the application.