Ticket #39640

Special characters for cursor save/restore not working properly.

Open Date: 2019-10-06 05:35 Last Update: 2019-10-06 05:35

5 - Medium
5 - Medium
Score: 1
100.0% (1/1)
0.0% (0/1)


Bug Description:

Terminal is not using special terminal commands to save and restore the cursor correctly.

Example Files: http://bit.ly/2LMcRF4

Example application (TeraTerm Bug Example.exe) will create a telnet server on a windows computer (tested on Windows 10). You can connect any terminal application to it at localhost:8888.

Source included for experimentation.

While loop in main function is upkeep on the server to listen for connections.

EmbeddedTestBench.cpp, Function Socket_SendData is the part that matters. Function is called when a telnet connection is made to localhost on port 8888. Function will output the text required to see the bug only.

2 nested for loops. Outer loop prints the test number, 6 lines of description text, then the special character to save the cursor location (\x1B[s) Inner Loop sends the special characters to restore the cursor position and clear from their to the end (\x1B[u then \x1B[0J), then prints 12 lines of text.

The inner loop will run 2 times, the second inner loop run should replace all the text from the first inner loop.

The outer loop will then run another test as outlined above.


The first 3 runs will perform as expected, but the 4th run will only erase the 12th line of the repeating line set. Once this glitch happens, the repeated text will be corrupted every time until the terminal is restarted. This can be tested by changing the loop counts in the example application. It is important to also note that if the repeating text is only one line, this glitch never seems to happen. It will also happen at different times depending on how much text is being replaced.

Interesting to note, putty has the same error case, but happens in the 2nd test instead of the 4th with this example application. Powershell using command "telnet localhost 8888" will display the test properly. I have not observed this bug in powershell at all.

Ticket History (1/1 Histories)

2019-10-06 05:35 Updated by: jgvicke
  • New Ticket "Special characters for cursor save/restore not working properly." created

Attachment File List

No attachments


You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login