def prepare_modes
    buf = [0, 0, 0, 0, 0, 0, ''].pack("IIIICCA*")
    $stdout.ioctl(TCGETS, buf)
    @old_modes = buf.unpack("IIIICCA*")
    new_modes = @old_modes.clone
    new_modes[3] &= ~ECHO # echo off
    new_modes[3] &= ~ICANON # one char @ a time
    $stdout.ioctl(TCSETS, new_modes.pack("IIIICCA*"))
    print "\e[2J" # clear screen
    print "\e[H" # go home
    print "\e[?47h" # kick xterm into the alt screen
    print "\e[?1000h" # kindly ask for mouse positions to make up for it
    self.cursor = false
    flush
  end
def prepare_modes
    buf = [0, 0, 0, 0, 0, 0, ''].pack("IIIICCA*")
    $stdout.ioctl(TCGETS, buf)
    @old_modes = buf.unpack("IIIICCA*")
    new_modes = @old_modes.clone
    new_modes[3] &= ~ECHO 
    new_modes[3] &= ~ICANON 
    $stdout.ioctl(TCSETS, new_modes.pack("IIIICCA*"))
    print "\e[2J" 
    print "\e[H" 
    print "\e[?47h" 
    print "\e[?1000h" 
    self.cursor = false
    flush
  end
def prepare_modes buf = [ 0 , 0 , 0 , 0 , 0 , 0 , '' ] . pack ( "IIIICCA*" ) $stdout . ioctl ( TCGETS , buf ) @old_modes = buf . unpack ( "IIIICCA*" ) new_modes = @old_modes . clone new_modes [ 3 ] &= ~ ECHO # echo off new_modes [ 3 ] &= ~ ICANON # one char @ a time $stdout . ioctl ( TCSETS , new_modes . pack ( "IIIICCA*" ) ) print "\e[2J" # clear screen print "\e[H" # go home print "\e[?47h" # kick xterm into the alt screen print "\e[?1000h" # kindly ask for mouse positions to make up for it self . cursor = false flush end
had to convert these from C... fun
had to convert these from C ... fun