From de1cd8b4b1c2db132661de2c6ba064c9e32a9df8 Mon Sep 17 00:00:00 2001 From: elliottcable Date: Sat, 14 Mar 2009 21:45:22 -0400 Subject: [PATCH] Wrapped `Nfoiled::read!`'s contents in a block so that it can actually use the new asynchronous `Window#getk` interface. --- lib/nfoiled.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/nfoiled.rb b/lib/nfoiled.rb index 42e7b2b..4978a11 100644 --- a/lib/nfoiled.rb +++ b/lib/nfoiled.rb @@ -74,10 +74,11 @@ module Nfoiled # (if such a block has been defined). See `getch(3X)`. def read! while true - key = Terminal.current.acceptor.getk - # TODO: This should be handled more naturally by a Key handler or something - exit if [Key.new(:etx), Key.new(:eot)].include? key # ^C, ^D - Terminal.current.acceptor.on_key[key] if key + Terminal.current.acceptor.getk do |key| + # TODO: This should be handled more naturally by a Key handler or something + exit if [Key.new(:etx), Key.new(:eot)].include? key # ^C, ^D + Terminal.current.acceptor.on_key[key] + end end end end -- 2.11.4.GIT