bpo-37827: IDLE shell handling of \r and \b control chars by taleinat · Pull Request #15211 · python/cpython

Had to do a bit of experimenting with the intial example test from Terry to properly test \b after reading the recently added documentation. So far, the results are significant improved compared to my previous test, however, there are still some issues.

In lower numbers, the control character \b functions as expected, the number is continuously overwritten:
image

However, once around 39,000 is reached, the shell attempts to condense the output into fewer total characters, even though the cursor position did not move beyond the end of the last digit of the most recent number:
image

Clicking upon one of the "Squeezed text" boxes reveals the following:
image
It looks like this is happening due to '\b' adding invisible characters after the end of each number. To fix this, it might be required to modify the code responsible for condensing the output, to prevent the condensation from occurring from the invisible characters.

However, this might be a bit of an edge case. In most situations, I don't think users would require the usage of that many \b characters. For a simple percentage display, it still works correctly:
image

As a result of it providing a significant improvement for most use cases, I approve of this PR. If the bug can be fixed with minimal time investment, it could be done in the same PR. Otherwise, the edge case bug could be fixed separately.