diff --git a/rich/_win32_console.py b/rich/_win32_console.py index e969d8164..371ec09fa 100644 --- a/rich/_win32_console.py +++ b/rich/_win32_console.py @@ -2,6 +2,7 @@ The API that this module wraps is documented at https://docs.microsoft.com/en-us/windows/console/console-functions """ + import ctypes import sys from typing import Any @@ -380,7 +381,7 @@ def cursor_position(self) -> WindowsCoordinates: WindowsCoordinates: The current cursor position. """ coord: COORD = GetConsoleScreenBufferInfo(self._handle).dwCursorPosition - return WindowsCoordinates(row=cast(int, coord.Y), col=cast(int, coord.X)) + return WindowsCoordinates(row=coord.Y, col=coord.X) @property def screen_size(self) -> WindowsCoordinates: @@ -390,9 +391,7 @@ def screen_size(self) -> WindowsCoordinates: WindowsCoordinates: The width and height of the screen as WindowsCoordinates. """ screen_size: COORD = GetConsoleScreenBufferInfo(self._handle).dwSize - return WindowsCoordinates( - row=cast(int, screen_size.Y), col=cast(int, screen_size.X) - ) + return WindowsCoordinates(row=screen_size.Y, col=screen_size.X) def write_text(self, text: str) -> None: """Write text directly to the terminal without any modification of styles