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

Test and support Windows #32

Open
tschm opened this issue Jan 15, 2025 · 2 comments
Open

Test and support Windows #32

tschm opened this issue Jan 15, 2025 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@tschm
Copy link
Owner

tschm commented Jan 15, 2025

We are facing issues with Windows.

@tschm tschm added the help wanted Extra attention is needed label Jan 15, 2025
@tschm
Copy link
Owner Author

tschm commented Jan 15, 2025

@tschm
Copy link
Owner Author

tschm commented Jan 15, 2025

self = <prompt_toolkit.output.win32.Win32Output object at 0x000001AE767C37D0>

def get_win32_screen_buffer_info(self) -> CONSOLE_SCREEN_BUFFER_INFO:
    """
    Return Screen buffer info.
    """
    # NOTE: We don't call the `GetConsoleScreenBufferInfo` API through
    #     `self._winapi`. Doing so causes Python to crash on certain 64bit
    #     Python versions. (Reproduced with 64bit Python 2.7.6, on Windows
    #     10). It is not clear why. Possibly, it has to do with passing
    #     these objects as an argument, or through *args.

    # The Python documentation contains the following - possibly related - warning:
    #     ctypes does not support passing unions or structures with
    #     bit-fields to functions by value. While this may work on 32-bit
    #     x86, it's not guaranteed by the library to work in the general
    #     case. Unions and structures with bit-fields should always be
    #     passed to functions by pointer.

    # Also see:
    #    - https://github.com/ipython/ipython/issues/10070
    #    - https://github.com/jonathanslenders/python-prompt-toolkit/issues/406
    #    - https://github.com/jonathanslenders/python-prompt-toolkit/issues/86

    self.flush()
    sbinfo = CONSOLE_SCREEN_BUFFER_INFO()
    success = windll.kernel32.GetConsoleScreenBufferInfo(
        self.hconsole, byref(sbinfo)
    )

    # success = self._winapi(windll.kernel32.GetConsoleScreenBufferInfo,
    #                        self.hconsole, byref(sbinfo))

    if success:
        return sbinfo
    else:
      raise NoConsoleScreenBufferError

E prompt_toolkit.output.win32.NoConsoleScreenBufferError: No Windows console found. Are you running cmd.exe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant