Curses programming: cursor handled incorrectly #5761

Closed
opened 2026-01-31 00:21:01 +00:00 by claunia · 4 comments
Owner

Originally created by @thautwarm on GitHub (Jan 3, 2020).

Environment

Windows build number: Microsoft Windows [Version 10.0.19041.1]
Windows Terminal version : Version: 0.7.3451.0

CPython: 3.7.4
CPython package curses(Windows-curses)

Steps to reproduce

Open cmd or PowerShell inside Windows Terminal, with python run

def main():
    window = curses.initscr()
    curses.noecho()
    curses.nonl()
    curses.nocbreak()
    curses.raw()
    window.keypad(False)
    x = 0
    y = 0
    while True:
        window.refresh()
        c = window.getch()
        window.addstr(0, 0, str(c))
        if c == ord('q'):
            return
        elif c == ord('a'):
            x = 10
        elif c == ord('b'):
            y = 10
        else:
            x = 0
            y = 0
            pass

        window.move(y, x)
try:
    main()
finally:
    curses.endwin()

Expected behavior

Press a, the cursor move to (0, 10) immediately.

Actual behavior

After pressing a, the cursor doesn't move to (0, 10) immediately, i.e., the screen show doesn't change at all. Then after an another pressing, the cursor moves to (0, 10).

P.S:

  • Expected behavior is according to the package curses bundled in Python of Linux distros.
  • Things work perfectly when we use cmd or PowerShell without Windows Terminal.

https://github.com/zephyrproject-rtos/windows-curses/issues/7

Originally created by @thautwarm on GitHub (Jan 3, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: Microsoft Windows [Version 10.0.19041.1] Windows Terminal version : Version: 0.7.3451.0 CPython: 3.7.4 CPython package curses(Windows-curses) ``` # Steps to reproduce Open `cmd` or `PowerShell` inside Windows Terminal, with `python` run ```python def main(): window = curses.initscr() curses.noecho() curses.nonl() curses.nocbreak() curses.raw() window.keypad(False) x = 0 y = 0 while True: window.refresh() c = window.getch() window.addstr(0, 0, str(c)) if c == ord('q'): return elif c == ord('a'): x = 10 elif c == ord('b'): y = 10 else: x = 0 y = 0 pass window.move(y, x) try: main() finally: curses.endwin() ``` # Expected behavior Press `a`, the cursor move to `(0, 10)` immediately. # Actual behavior After pressing `a`, the cursor doesn't move to `(0, 10)` immediately, i.e., the screen show doesn't change at all. Then after an another pressing, the cursor moves to `(0, 10)`. P.S: - Expected behavior is according to the package `curses` bundled in Python of Linux distros. - Things work perfectly when we use `cmd` or `PowerShell` without Windows Terminal. https://github.com/zephyrproject-rtos/windows-curses/issues/7
Author
Owner

@zadjii-msft commented on GitHub (Jan 3, 2020):

Yep that looks broken to me. Definitely something wrong in conpty, since this repros in inception (cmd.exe /c wsl.exe cmd.exe) as well. Thanks for the clear report with easy repro steps!

(future me: I put the file in %~%\dev\tmp)

@zadjii-msft commented on GitHub (Jan 3, 2020): Yep that looks broken to me. Definitely something wrong in conpty, since this repros in inception (`cmd.exe /c wsl.exe cmd.exe`) as well. Thanks for the clear report with easy repro steps! (future me: I put the file in `%~%\dev\tmp`)
Author
Owner

@j4james commented on GitHub (Jan 5, 2020):

I expect this is the same bug as #4107.

@j4james commented on GitHub (Jan 5, 2020): I expect this is the same bug as #4107.
Author
Owner

@DHowett-MSFT commented on GitHub (Jan 6, 2020):

Nah, this one is separate from #4107. It repros in inception (https://github.com/microsoft/terminal/issues/4102#issuecomment-570584042), and the inbox conhost servicing interop hasn't been updated to the changeset that regressed 4107.

@DHowett-MSFT commented on GitHub (Jan 6, 2020): Nah, this one is separate from #4107. It repros in inception (https://github.com/microsoft/terminal/issues/4102#issuecomment-570584042), and the inbox conhost servicing interop hasn't been updated to the changeset that regressed 4107.
Author
Owner

@ghost commented on GitHub (Feb 13, 2020):

:tada:This issue was addressed in #4372, which has now been successfully released as Windows Terminal Preview v0.9.433.0.🎉

Handy links:

@ghost commented on GitHub (Feb 13, 2020): :tada:This issue was addressed in #4372, which has now been successfully released as `Windows Terminal Preview v0.9.433.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v0.9.433.0) * [Store Download](https://www.microsoft.com/store/apps/9n0dx20hk701?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#5761