pasky/speedread — pull request #6 by AndreasTPC (2014-03-03 21:01:35+00:00)
Title: More accurate timing and responsive UI

I noticed that the UI wasn't very responsive, if you pressed a button it didn't respond until the next word was displayed, so how fast the UI was responding was depending on what WPM you had set.

This patch changes it so it'll sleep for shorter intervals and keep checking for keypresses at regular intervals (currently 20 times / second) even if the word hasn't changed. That way the UI will appear to respond instantly to keypresses.

The new method also keeps track of what time the last word was displayed and sets the time the next word is to be displayed to that time + word_delay, rather than just sleeping for the delay. That way we don't get longer than intended delays because of overhead, and if we want to in the future we could accurately predict how long it will take to display a certain set of words.

I also added in the change to when the resume message should be displayed that you requested.