Class: Rfd::CommandLineWindow
- Defined in:
- lib/rfd/windows.rb
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
Constructor Details
#initialize ⇒ CommandLineWindow
Returns a new instance of CommandLineWindow.
138 139 140 |
# File 'lib/rfd/windows.rb', line 138 def initialize super maxy: 1, maxx: Curses.cols, begy: Curses.lines - 1, begx: 0 end |
Instance Method Details
#get_command(prompt: nil) ⇒ Object
148 149 150 151 152 153 154 155 156 |
# File 'lib/rfd/windows.rb', line 148 def get_command(prompt: nil) Curses.echo startx = prompt ? prompt.size : 1 setpos 0, startx s = getstr "#{prompt[1..-1] if prompt}#{s.strip}" ensure Curses.noecho end |
#set_prompt(str) ⇒ Object
142 143 144 145 146 |
# File 'lib/rfd/windows.rb', line 142 def set_prompt(str) attron(Curses.color_pair(Curses::COLOR_WHITE) | Curses::A_BOLD) do writeln 0, str end end |
#show_error(str) ⇒ Object
158 159 160 161 162 163 |
# File 'lib/rfd/windows.rb', line 158 def show_error(str) attron(Curses.color_pair(Curses::COLOR_RED) | Curses::A_BOLD) do writeln 0, str end noutrefresh end |