summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
8903cde)
The main event loop was interpreting ctrl-c's correctly, but other getch
callers (like asking for input) were not. This change will treat ctrl-c as
ctrl-g in those cases.
until Redwood::exceptions.nonempty? || $die
c = begin
Ncurses.nonblocking_getch
until Redwood::exceptions.nonempty? || $die
c = begin
Ncurses.nonblocking_getch
raise if BufferManager.ask_yes_or_no "Die ungracefully now?"
BufferManager.draw_screen
nil
raise if BufferManager.ask_yes_or_no "Die ungracefully now?"
BufferManager.draw_screen
nil
- module_function :rows, :cols, :curx, :nonblocking_getch, :mutex, :sync
+ ## pretends ctrl-c's are ctrl-g's
+ def safe_nonblocking_getch
+ nonblocking_getch
+ rescue Interrupt
+ KEY_CANCEL
+ end
+
+ module_function :rows, :cols, :curx, :nonblocking_getch, :safe_nonblocking_getch, :mutex, :sync
remove_const :KEY_ENTER
remove_const :KEY_CANCEL
remove_const :KEY_ENTER
remove_const :KEY_CANCEL
draw_screen
until mode.done?
draw_screen
until mode.done?
- c = Ncurses.nonblocking_getch
+ c = Ncurses.safe_nonblocking_getch
next unless c # getch timeout
break if c == Ncurses::KEY_CANCEL
begin
next unless c # getch timeout
break if c == Ncurses::KEY_CANCEL
begin
- c = Ncurses.nonblocking_getch
+ c = Ncurses.safe_nonblocking_getch
next unless c # getch timeout
break unless tf.handle_input c # process keystroke
next unless c # getch timeout
break unless tf.handle_input c # process keystroke
ret = nil
done = false
until done
ret = nil
done = false
until done
- key = Ncurses.nonblocking_getch or next
+ key = Ncurses.safe_nonblocking_getch or next
if key == Ncurses::KEY_CANCEL
done = true
elsif accept.nil? || accept.empty? || accept.member?(key)
if key == Ncurses::KEY_CANCEL
done = true
elsif accept.nil? || accept.empty? || accept.member?(key)