Sha256: f69ad9be82a3373d2446da371d3b198e0255bb5c74eab3a2de1a7d7e82b68d78
Contents?: true
Size: 836 Bytes
Versions: 3
Compression:
Stored size: 836 Bytes
Contents
require 'curses' # # Resizing the window shouldn't cause an error. # # Currently it does in Curses 1.0.1 because getch is blocking all # Ruby threads. # @listeners = [] def size_changed # Calling the each method on the array will cause the following error: # undefined method `call' for []:Array (NoMethodError) # @listeners.each { |listener| # Notify all listeners ... } end begin Signal.trap('SIGWINCH', size_changed ) Curses.init_screen Curses.raw Curses.clear Curses.curs_set(0) Curses.noecho Curses.cbreak Curses.start_color Curses.stdscr.setpos(0, 0) Curses.stdscr.addstr("Resizing window shouldn't cause an error ") Curses.stdscr.getch rescue SystemExit, Interrupt # Empty Catch block so ruby doesn't puke out # a stack trace when CTRL-C is used ensure Curses.close_screen end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ppcurses-0.1.2 | test/threads/handle_resize.rb |
ppcurses-0.1.1 | test/threads/handle_resize.rb |
ppcurses-0.1.0 | test/threads/handle_resize.rb |