Skip to content

GetConsoleScreenBufferInfo().dwCursorPosition problem with cursor movement #356

Closed
@tartley

Description

@tartley

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.

Activity

tartley

tartley commented on Oct 19, 2022

@tartley
OwnerAuthor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      GetConsoleScreenBufferInfo().dwCursorPosition problem with cursor movement · Issue #356 · tartley/colorama