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

GetConsoleScreenBufferInfo().dwCursorPosition problem with cursor movement #356

Closed
tartley opened this issue Oct 19, 2022 · 1 comment
Closed

Comments

@tartley
Copy link
Owner

tartley commented Oct 19, 2022

Reported by the fabulous @LqdBcnAtWork in #352:

colorama.win32.GetConsoleScreenBufferInfo().dwCursorPosition is unreliable when used immediately after Cursor movement codes:

The following code has shown the issue and is repeatable for me:

from time import sleep
from colorama import Cursor
import colorama

colorama.just_fix_windows_console()

space = 10

print(1)
print("\n"*space,Cursor.UP(space),end="\r",sep="") # run with end="" and end="\r"
sleep(1) # take note of where the cursor is while 'sleeping'
pos = colorama.win32.GetConsoleScreenBufferInfo().dwCursorPosition
print(2)
print("pos:",pos.Y)

By having end="" the Y position is calculated while not respecting the movement done by Cursor.UP, however having something print after the reposition fixes the issue.

@tartley
Copy link
Owner Author

tartley commented Oct 19, 2022

njsmith replied in that thread: Huh, weird. Sounds like this is a quirk on Microsoft's end, so not much we can do about it, but useful to know.

So I'm filing this as a (closed) issue, then at least people can find it in searches in case it comes up.

@tartley tartley closed this as completed Oct 19, 2022
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

1 participant