It appears that the root cause of the problem is that TYPE is being buffered and so the cursor position is not updated prior to the call to CURSOR. Therefore, the cursor keeps getting reset to the same position after updating the display of accept / reject status. Flushing the buffer prior to reading the cursor appears to fix this.
A bit torn on this one - on the one hand, it seems like reading the CURSOR position should have no side effects. That said, I feel like having the position returned by CURSOR dependent on internal buffering is a larger surprise when it happens.
While the non-wxWidgets implementation don't display the bug in this case, I did update their version of lcursor for consistency and did not see any negative side effects during testing.
Testing
Ran a variety of strings including a, b, and other characters. The code appears to work as expected.
Test Environments
OSX Catalina (10.15.7) w/ wxWidgets 3.0.5
OSX Catalina (10.15.7) console only
Ubuntu Bionic (18.04.5) w/ wxWidgets 3.0.5
Ubuntu Bionic (18.04.5) console only
Windows 10 Home (1909) w/ wxWidgets 3.0.5
Resolves #96
Summary
It appears that the root cause of the problem is that
TYPE
is being buffered and so the cursor position is not updated prior to the call toCURSOR
. Therefore, the cursor keeps getting reset to the same position after updating the display of accept / reject status. Flushing the buffer prior to reading the cursor appears to fix this.A bit torn on this one - on the one hand, it seems like reading the
CURSOR
position should have no side effects. That said, I feel like having the position returned byCURSOR
dependent on internal buffering is a larger surprise when it happens.While the non-wxWidgets implementation don't display the bug in this case, I did update their version of
lcursor
for consistency and did not see any negative side effects during testing.Testing
Ran a variety of strings including a, b, and other characters. The code appears to work as expected.
Test Environments
OSX Catalina (10.15.7) w/ wxWidgets 3.0.5 OSX Catalina (10.15.7) console only Ubuntu Bionic (18.04.5) w/ wxWidgets 3.0.5 Ubuntu Bionic (18.04.5) console only Windows 10 Home (1909) w/ wxWidgets 3.0.5