Question

How can I make my Ruby application do nothing and continue if Curses.getch takes too long (over x amount of milliseconds) to respond?

Example:

case Curses.getch
  when ?a (do stuff)
  when ?s (do stuff)
  etc.
  when takesTooLong (do nothing)
end

I want the application to continue if the user does not press a key in the specified amount of time.

How can I do this? I thought about doing a sleep after the Curses.getch, but the sleep would execute after the user presses a key.

Was it helpful?

Solution

Use Curses::timeout=, Doorknob.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top