class HighLine::Terminal::NCurses

NCurses HighLine::Terminal @note Code migrated UNTESTED from the old code base to the new terminal api.

Public Instance Methods

raw_no_echo_mode() click to toggle source

(see HighLine::Terminal#raw_no_echo_mode)

# File lib/highline/terminal/ncurses.rb, line 11
def raw_no_echo_mode
  FFI::NCurses.initscr
  FFI::NCurses.cbreak
end
restore_mode() click to toggle source

(see HighLine::Terminal#restore_mode)

# File lib/highline/terminal/ncurses.rb, line 17
def restore_mode
  FFI::NCurses.endwin
end
terminal_size() click to toggle source

(see HighLine::Terminal#terminal_size) A ncurses savvy method to fetch the console columns, and rows.

# File lib/highline/terminal/ncurses.rb, line 25
def terminal_size
  size = [80, 40]
  FFI::NCurses.initscr
  begin
    size = FFI::NCurses.getmaxyx(FFI::NCurses.stdscr).reverse
  ensure
    FFI::NCurses.endwin
  end
  size
end