Class: Rfd::CommandLineWindow
Instance Attribute Summary
Attributes inherited from Window
Instance Method Summary collapse
- #get_command(prompt: nil) ⇒ Object
-
#initialize ⇒ CommandLineWindow
constructor
A new instance of CommandLineWindow.
- #set_prompt(str) ⇒ Object
- #show_error(str) ⇒ Object
Methods inherited from Window
#begx, #begy, #draw_border, #maxx, #maxy, #mvwaddstr, #subwin, #waddstr, #wclear, #wclrtoeol, #wmove, #wrefresh
Constructor Details
#initialize ⇒ CommandLineWindow
Returns a new instance of CommandLineWindow.
211 212 213 |
# File 'lib/rfd/windows.rb', line 211 def initialize @window = subwin 1, Curses.COLS, Curses.LINES - 1, 0 end |
Instance Method Details
#get_command(prompt: nil) ⇒ Object
223 224 225 226 227 228 229 230 231 |
# File 'lib/rfd/windows.rb', line 223 def get_command(prompt: nil) Curses.echo startx = prompt ? prompt.size : 1 s = ' ' * 100 Curses.mvwgetstr window, 0, startx, s "#{prompt[1..-1] if prompt}#{s.strip}" ensure Curses.noecho end |