When running on a Linux text console/terminal, "SLEEP" does not wait for a keypress or time amount if a character is already present in the keyboard buffer.
In fact, SLEEP should never empty the keyboard buffer, but any characters already present in the keyboard buffer must not modify the SLEEP's behavior (by acting as if a key was really pressed at the beginning of the waiting time of the instruction).
Last edit: fxm (freebasic.net) 2018-04-13
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
See discussion at FreeBASIC forum:
https://www.freebasic.net/forum/viewtopic.php?f=5&t=26580
In fact, SLEEP should never empty the keyboard buffer, but any characters already present in the keyboard buffer must not modify the SLEEP's behavior (by acting as if a key was really pressed at the beginning of the waiting time of the instruction).
Last edit: fxm (freebasic.net) 2018-04-13
Discussion page at https://www.freebasic.net/forum/viewtopic.php?t=26580
Proposed fix at https://github.com/freebasic/fbc/pull/84
fix SLEEP behaviour in linux console
Fixed in
https://github.com/freebasic/fbc/commit/5cef359c81a3fbacef88e6e83ea67835ef1e6000