I'm running some test code on a 32-bit ARM machine in a Linux terminal using the Orca screen reader, in case it helps. Testing this code snippit, I notice some very odd behavior of both Input and Line Input.
Code: Select all
dim as string lineIn
do
line input ": ", lineIn
if len (lineIn) > 0 then print "Your input was": print lineIn
loop while true
end
Yes, I know that code looks a little weird, but I'm just using it to run some tests. In any case, I break out of the program with control+c, which works great for the purposes of the test. So I compiled my test code and ran the resulting executable. My problem is that if I type too quickly or hold down any key, even the backspace key so that it repeats, my terminal seems to trip over itself in some way. By this I mean that only part of my input is displayed, and pressing the enter key just adds one more character. For example, I type "This is a test." on my prompt line. If I type it too quickly, I may get "This is a te," so I press enter to finish the line input, and the s is displayed. If I press any other key, I see the t, another and I see the period, and then one more key and the program finally gets the new line character that terminates the input and I see the output that says "Your output was This is a test." The program continues to show 3 characters behind, occasionally lagging further behind, until I terminate the program. I should note that the first couple of iterations through the loop seem to run without difficulty, and compiling with the -mt option seems to help slightly. But the first time it falls behind, sometimes it falls behind by only one key, while at other times it can fall behind immediately by 2 or three keys. In any case, as I mention above, it gets progressively worse until I terminate the program.
At first, I thought I may have spotted a bug in the latest git source, as this is the version that I built from a nightly bootstrap dated January 12. But I built the 1.07.1 release and still see the same issue. At one point I thought I may have caused my terminal to lag somehow with some other tests I was running, but closing the terminal and reopening it only works for a short time, and then the problem returns. Still trying to rule out a terminal bug, I rewrote the test code using another programming language and another compiler, but try as I may, I am unable to reproduce the problem using the new test code. I did try writing my own FreeBASIC subroutine to handle line input, but I couldn't figure out how to at least get backspace working. Did my crazy test somehow uncover a bug that only appears when doing crazy stuff like this? Is there a better way to handle multiple terminal line inputs? Any help is greatly appreciated.