end
end
-
def ask domain, question, default=nil, &block
raise "impossible!" if @asking
@asking = true
- @textfields[domain] ||= TextField.new Ncurses.stdscr, Ncurses.rows - 1, 0, Ncurses.cols
+ @textfields[domain] ||= TextField.new
tf = @textfields[domain]
completion_buf = nil
## this goddamn ncurses form shit is a fucking 1970's nightmare.
## jesus christ. the exact sequence of ncurses events that needs
## to happen in order to display a form and have the entire screen
- ## not disappear and have the cursor in the right place is TOO
- ## FUCKING COMPLICATED.
+ ## not disappear and have the cursor in the right place can only
+ ## be determined by hours of trial and error and is TOO FUCKING
+ ## COMPLICATED.
Ncurses.sync do
- tf.activate question, default, &block
+ tf.activate Ncurses.stdscr, Ncurses.rows - 1, 0, Ncurses.cols, question, default, &block
@dirty = true
draw_screen :skip_minibuf => true, :sync => false
tf.position_cursor
## in sup, completion support is implemented through BufferManager#ask
## and CompletionMode.
class TextField
- def initialize window, y, x, width
- @w, @x, @y = window, x, y
- @width = width
+ def initialize
@i = nil
@history = []
def value; @value || get_cursed_value end
- def activate question, default=nil, &block
+ def activate window, y, x, width, question, default=nil, &block
+ @w, @y, @x, @width = window, y, x, width
@question = question
@completion_block = block
@field = Ncurses::Form.new_field 1, @width - question.length,