Pergunta

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.

Foi útil?

Solução

Use Curses::timeout=, Doorknob.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top