Skip to content

ConPTY leaves the cursor one row above the prompt after an interactive program starts at the bottom of a full screen #20886

Open

Description

@0dminnimda

ConPTY leaves the cursor one row above the prompt after an interactive program starts at the bottom of a full screen

Windows Terminal version

OpenConsole.exe 1.26.2609.30004 used as ConPTY host (same with 1.24.x and 1.25.2609.30003). Inbox conhost.exe does not reproduce.

Windows build number

10.0.19045.5371

Other software

Any ConPTY client (reproduced with our own terminal emulator; the bytes below come straight from the PTY output pipe). Python 3.11 (python -q), parent shell cmd.exe (also reproduces with MSYS2 bash).

Steps to reproduce

  1. Create a pseudoconsole 112x33 hosted by OpenConsole.exe and run cmd.exe.
  2. Fill the screen so the prompt sits on the last row, e.g. for /l %i in (1,1,120) do @echo %i.
  3. Type python -q and press Enter (the echoed command line is on row 33, the CRLF scrolls it to row 32).
  4. When >>> appears, type e.

Expected behavior

>>> and the typed e stay on row 33; row 32 still shows the command line.

Actual behavior

ConPTY first draws >>> on row 33, then sends a full repaint whose rows 28-32 and the >>> on row 33 are correct, but it ends with ESC[32;5H, so its cursor is one row above its own prompt. The next keystroke is rendered as >>> e over the start of the command line on row 32 (C:\re replaced, pos\... kept), and row 33 is left with a stale prompt.

Relevant PTY output (escaped, timestamps in seconds):

0.0111 ESC[33;43H"...python.exe" -q ESC[33;112H
0.0111 ESC[33;112H \r\n
0.8082 ESC[0m >>>  ESC[?25l ESC[33;1H ESC[0m >>>
0.8082 ESC7 ESC[1;1H ...blank rows 1-33... ESC[1;1H 91 ... ESC[28;1H 118 ESC[29;1H 119 ESC[30;1H 120
       ESC[31;1H (blank) ESC[32;1H C:\repos\...>"...python.exe" -q ESC[33;5H (blank) ESC[32;5H   <-- wrong row

The client sent no input (no DSR/CPR reply, no resize) between the Enter and the repaint. A full byte trace is available on request.

Possibly related

Activity

  1. added
    Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting
    Needs-Tag-FixDoesn't match tag requirements
    on Nov 4, 2026
  2. AnubhavMaheshwari commented on Nov 4, 2026

    @AnubhavMaheshwari

    Hi, I'd like to investigate and work on this issue. I can reproduce the problem using ConPTY and would like to contribute a fix along with regression tests. Please let me know if this issue is available for contribution.

  3. DHowett commented on Nov 4, 2026

    @DHowett
    Member

    Anubhav Maheshwari (@AnubhavMaheshwari) the issue was first filed only TWENTY MINUTES AGO. Cool your jets, son.

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

    Needs-Tag-FixDoesn't match tag requirementsNeeds-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions