Unexpected behavior of input()

More
1 week 1 day ago - 1 week 1 day ago #112 by ludojoey
Hi!

Here are a few lines of code:
Code:
memSet(0x3000,48000,0,0x60);//clear bitmap. text t={3}; print("Type something:"); input(t,3);

When running this small program, after a few executions (1, 2, 3, 4...), the "input()" function no longer waits for character input and behaves as if the Enter key had been pressed immediately.

When this happens, after returning to the OS, the next character typed is duplicated. For example, if you type A then AA is displayed.

If I remove the memSet() line, the issue no longer seems to occur.

Version 0.7.7 used.
Last edit: 1 week 1 day ago by ludojoey.

Please Log in or Create an account to join the conversation.

More
1 week 11 hours ago - 1 week 11 hours ago #117 by Franck
There seems to be a strange bug indeed when something is already in the text display buffer on the same line as the input line.
I need to investigate. I'll get back to you when I find the problem.
Last edit: 1 week 11 hours ago by Franck.
The following user(s) said Thank You: ludojoey

Please Log in or Create an account to join the conversation.

More
6 days 4 hours ago #119 by Franck
Found the bug. Not related to input buffer line as stated above.

It was the autorepeat timer that would re-trigger an Enter keypress if by any bad luck the first Enter was press a fraction of second before the timer interrupt was fired-up and the release of the key before the input() function execution in the VM, effectively registering two key presses. The memSet() function takes a bit of time and was allowing this to happen more often.

Fixed in 0.7.8
The following user(s) said Thank You: Lenko, ludojoey

Please Log in or Create an account to join the conversation.

Time to create page: 0.162 seconds
Powered by Kunena Forum