Sha256: ed28ffbe34f93b448c0a0fd7f5dd4a2b82aea61b39c160cc22d8dead1fb26931

Contents?: true

Size: 766 Bytes

Versions: 3

Compression:

Stored size: 766 Bytes

Contents

module PPCurses

  class Window < Curses::Window

    # TODO - use optional parameters.  A rect or a Curses window to wrap.
    def initialize(height, width, top, left)
      super(height,width,top,left)

      # Enables reading arrow keys in getch
      keypad(true)

      box('|', '-')
    end



    # EXPERIMENTAL/HACK
    #
    # The following could be used to wrap all getch calls
    # and support window resizes when the getch is blocking
    # all threads.
    #
    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

  end



end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ppcurses-0.1.2 lib/ppcurses/window/pp_window.rb
ppcurses-0.1.1 lib/ppcurses/window/pp_window.rb
ppcurses-0.1.0 lib/ppcurses/window/pp_window.rb