Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Carriage Return Inconsistency #553

Closed
poipoi300 opened this issue Jul 6, 2022 · 1 comment
Closed

Carriage Return Inconsistency #553

poipoi300 opened this issue Jul 6, 2022 · 1 comment

Comments

@poipoi300
Copy link

Context

I was writing a simple progress indicator for use internally in Spyder and found out that carriage returns don't always work, meaning that trying to print over lines in the console sometimes appends the new text instead. When I discovered this, I took out Spyder from the equation and tested directly in Qt Console. I experienced the same problem. I then updated Qt Console to the latest version (5.3.1), and the problem got better, however it still occurred and a new issue popped up where text would be updated much less often (sometimes not at all until the final output). I have tested this in the windows command line, and it behaves exactly as expected. I have tested this on 2 systems, both running windows (10 and 11).

Expected behavior

Carriage returns always return the cursor to the start of the line and the console's output is updated for each new print.

Actual behavior

Carriage returns are sometimes not taken into account, and text is appended when it should not be. The console's output updates are also delayed.

Reproducing the behavior

# If this snippet does not show issues, run it more times or add iterations.

for i in range(1000000):
    print(f'{i} ', end = '\r') # Flushing makes the issue worse 

# Example output:
# 999999 142189 773780

IPython.sys_info() output

{'commit_hash': 'e321e760a',
 'commit_source': 'installation',
 'default_encoding': 'cp1252',
 'ipython_path': 'C:\\ProgramData\\Anaconda3\\Lib\\site-packages\\IPython',
 'ipython_version': '7.31.1',
 'os_name': 'nt',
 'platform': 'Windows-10-10.0.22000-SP0',
 'sys_executable': 'C:\\ProgramData\\Anaconda3\\python.exe',
 'sys_platform': 'win32',
 'sys_version': '3.9.12 (main, Apr  4 2022, 05:22:27) [MSC v.1916 64 bit '
                '(AMD64)]'}
@ccordoba12
Copy link
Collaborator

Hey @poipoi300, thanks for reporting. This is basically a duplicate of issue #350.

It'd be great if you could give us a hand to improve our ANSI pre-processor. On that issue you can find the minimal info to do it, in case you are interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants