Closed
Description
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.
Metadata
Metadata
Assignees
Labels
No labels
Activity
tartley commentedon 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.