Sha256: 23de08f3b1004081985f715c1cdd01317c8e64af5dd8300c702237a9611721b7
Contents?: true
Size: 1.07 KB
Versions: 5
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true module MTLibuv class TTY < Handle include Stream def initialize(reactor, fileno, readable) @reactor = reactor tty_ptr = ::MTLibuv::Ext.allocate_handle_tty error = check_result(::MTLibuv::Ext.tty_init(reactor.handle, tty_ptr, fileno, readable ? 1 : 0)) super(tty_ptr, error) end def enable_raw_mode return if @closed check_result ::MTLibuv::Ext.tty_set_mode(handle, 1) self end def disable_raw_mode return if @closed check_result ::MTLibuv::Ext.tty_set_mode(handle, 0) self end def reset_mode ::MTLibuv::Ext.tty_reset_mode self end def winsize return [] if @closed width = FFI::MemoryPointer.new(:int) height = FFI::MemoryPointer.new(:int) ::MTLibuv::Ext.tty_get_winsize(handle, width, height) [width.get_int(0), height.get_int(0)] end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
mt-libuv-4.1.04 | lib/mt-libuv/tty.rb |
mt-libuv-4.1.03 | lib/mt-libuv/tty.rb |
mt-libuv-4.1.02 | lib/mt-libuv/tty.rb |
mt-libuv-4.1.01 | lib/mt-libuv/tty.rb |
mt-libuv-4.1.0 | lib/mt-libuv/tty.rb |