Class: PPCurses::Window

Inherits:
Curses::Window show all
Defined in:
lib/ppcurses/window/pp_window.rb

Instance Method Summary collapse

Methods inherited from Curses::Window

#cur_point, #move_to_point, #set_pos_by_point

Constructor Details

#initialize(height, width, top, left) ⇒ Window

TODO - use optional parameters. A rect or a Curses window to wrap.



6
7
8
9
10
11
12
13
# File 'lib/ppcurses/window/pp_window.rb', line 6

def initialize(height, width, top, left)
  super(height,width,top,left)

  # Enables reading arrow keys in getch
  keypad(true)

  box('|', '-')
end

Instance Method Details

#get_ch_handle_signalsObject

EXPERIMENTAL/HACK

The following could be used to wrap all getch calls and support window resizes when the getch is blocking all threads.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/ppcurses/window/pp_window.rb', line 23

def get_ch_handle_signals
  got_input = false
  until got_input
    begin
      c = getch
      got_input = true
    rescue NoMethodError
      # Assuming a SIGWINCH occurred -- reposition..
      c = ''
    end
  end

  c
end