ConPTY: Entire line is reprinted for every prompt character after a space #2280

Closed
opened 2026-01-30 22:51:21 +00:00 by claunia · 7 comments
Owner

Originally created by @Tyriar on GitHub (Jun 26, 2019).

Originally assigned to: @zadjii-msft on GitHub.

Related: https://github.com/microsoft/terminal/issues/1646

Environment

Windows build number: Microsoft Windows [Version 10.0.18922.1000]
vscode 1.36.0 insiders

Steps to reproduce

Repros in both cmd and python

  1. Type a
  2. Press space
  3. Repeat

Expected behavior

Only a and space should be sent from conpty until the end of the line is reached

Actual behavior

a

[?25l
C:\Users\daimms.REDMOND>a a[?25h

[?25l
C:\Users\daimms.REDMOND>a a a[?25h

[?25l
C:\Users\daimms.REDMOND>a a a a[?25h

[?25l
C:\Users\daimms.REDMOND>a a a a a[?25h

[?25l
C:\Users\daimms.REDMOND>a a a a a a[?25h

[?25l
C:\Users\daimms.REDMOND>a a a a a a a[?25h

[?25l
C:\Users\daimms.REDMOND>a a a a a a a a[?25h

Originally created by @Tyriar on GitHub (Jun 26, 2019). Originally assigned to: @zadjii-msft on GitHub. Related: https://github.com/microsoft/terminal/issues/1646 <!-- 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. 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.18922.1000] vscode 1.36.0 insiders ``` # Steps to reproduce Repros in both cmd and python 1. Type a 2. Press space 3. Repeat # Expected behavior Only a and space should be sent from conpty until the end of the line is reached # Actual behavior ``` a  [?25l C:\Users\daimms.REDMOND>a a[?25h  [?25l C:\Users\daimms.REDMOND>a a a[?25h  [?25l C:\Users\daimms.REDMOND>a a a a[?25h  [?25l C:\Users\daimms.REDMOND>a a a a a[?25h  [?25l C:\Users\daimms.REDMOND>a a a a a a[?25h  [?25l C:\Users\daimms.REDMOND>a a a a a a a[?25h  [?25l C:\Users\daimms.REDMOND>a a a a a a a a[?25h  ```
Author
Owner

@zadjii-msft commented on GitHub (Jul 2, 2019):

Both of these are horrific and I hope we can get to them soon.

Out of curiosity, does it repro with powershell or wsl? Might be helpful to know if this is related to how COOKED_READ handles the prompt line, or if it's for any scenario like this. (powershell and wsl won't be using COOKED_READ, while cmd will)

@zadjii-msft commented on GitHub (Jul 2, 2019): Both of these are _horrific_ and I hope we can get to them soon. Out of curiosity, does it repro with powershell or wsl? Might be helpful to know if this is related to how `COOKED_READ` handles the prompt line, or if it's for any scenario like this. (powershell and wsl won't be using `COOKED_READ`, while `cmd` will)
Author
Owner

@Tyriar commented on GitHub (Jul 3, 2019):

pwsh output:

a

a 
a a[?25h
a a [?25h
a a a[?25h
a a a [?25h
a a a a[?25h

wsl output (correct):

a
 
a
 
a
 
a
@Tyriar commented on GitHub (Jul 3, 2019): pwsh output: ``` a  a a a[?25h a a [?25h a a a[?25h a a a [?25h a a a a[?25h ``` wsl output (correct): ``` a a a a ```
Author
Owner

@zadjii-msft commented on GitHub (Jul 3, 2019):

That at least makes me feel better. Looks like it is COOKED_READ related, and if I had to guess, PSReadline redraws the prompt on every character, so that might be out of our control.

@zadjii-msft commented on GitHub (Jul 3, 2019): That at least makes me feel _better_. Looks like it is COOKED_READ related, and if I had to guess, PSReadline redraws the prompt on every character, so that might be out of our control.
Author
Owner

@Tyriar commented on GitHub (Jul 3, 2019):

@zadjii-msft hmm... On PSReadline, I'm beginning to think terminals that want to support screen readers well will need to have some buffer diffing as well to avoid reading out prompts when they're reprinted, fish has some fancy auto-complete for example that would probably be awful for screen readers for example and I think zsh might do similar for character attributes.

But this is still a valid report right, cmd.exe shouldn't be reprinting?

@Tyriar commented on GitHub (Jul 3, 2019): @zadjii-msft hmm... On PSReadline, I'm beginning to think terminals that want to support screen readers well will need to have some buffer diffing as well to avoid reading out prompts when they're reprinted, fish has some fancy auto-complete for example that would probably be awful for screen readers for example and I think zsh might do similar for character attributes. But this is still a valid report right, cmd.exe shouldn't be reprinting?
Author
Owner

@zadjii-msft commented on GitHub (Jul 3, 2019):

Oh yea it's definitely still valid. Now I know where to look :)


IIRC the UIA stuff we have in conhost today chokes on things like PSReadline too - taking a larger diff than change-by-change is a good idea, but I'm not super familiar with that code. I doubt it'd be possible with the architecture we currently have. @adiviness can correct me if I'm wrong, and @carlos-zamora may be interested in this side-bar.
@zadjii-msft commented on GitHub (Jul 3, 2019): Oh yea it's definitely still valid. Now I know where to look :) <hr> IIRC the UIA stuff we have in conhost today chokes on things like PSReadline too - taking a larger diff than change-by-change is a good idea, but I'm not super familiar with that code. I doubt it'd be possible with the architecture we currently have. @adiviness can correct me if I'm wrong, and @carlos-zamora may be interested in this side-bar.
Author
Owner

@zadjii-msft commented on GitHub (Sep 4, 2019):

@Tyriar Are you still seeing this? When I try booting up python in conpty and following the repro of a a a a a, I get the following:

^[]0;C:\Users\migrie\AppData\Local\Temp\OpenConsole\15550\conhost.exeSPC-SPCpython^G
PythonSPC3.7.3SPC(v3.7.3:ef4ec6ed12,SPCMarSPC25SPC2019,SPC22:22:05)SPC[MSCSPCv.1916SPC64SPCbitSPC(AMD64)]SPConSPCwin32^M^J
TypeSPC"help",SPC"copyright",SPC"credits"SPCorSPC"license"SPCforSPCmoreSPCinformation.^M^J>>>SPC^[[66X
Input "a" [1]
a
Input "SPC" [1]
SPC
Input "a" [1]
a
Input "SPC" [1]
SPC
Input "a" [1]
a
Input "SPC" [1]
SPC

(where SPC is a space)

Similarly, I'm only ever seeing as and s when I do the same thing in cmd.

There were some optimizations that went into conpty around April, but it looks to me like those actually made it to master around 18883.1000.rsmaster.190417-1356. The task/bug/pr I'm looking at are MSFT:20297559, MSFT:21091917, and MSFT:3121537.

@zadjii-msft commented on GitHub (Sep 4, 2019): @Tyriar Are you still seeing this? When I try booting up python in conpty and following the repro of `a a a a a`, I get the following: ``` ^[]0;C:\Users\migrie\AppData\Local\Temp\OpenConsole\15550\conhost.exeSPC-SPCpython^G PythonSPC3.7.3SPC(v3.7.3:ef4ec6ed12,SPCMarSPC25SPC2019,SPC22:22:05)SPC[MSCSPCv.1916SPC64SPCbitSPC(AMD64)]SPConSPCwin32^M^J TypeSPC"help",SPC"copyright",SPC"credits"SPCorSPC"license"SPCforSPCmoreSPCinformation.^M^J>>>SPC^[[66X Input "a" [1] a Input "SPC" [1] SPC Input "a" [1] a Input "SPC" [1] SPC Input "a" [1] a Input "SPC" [1] SPC ``` (where `SPC` is a space) Similarly, I'm only ever seeing `a`s and ` `s when I do the same thing in `cmd`. There were some optimizations that went into conpty around April, but it looks to me like those actually made it to master around 18883.1000.rsmaster.190417-1356. The task/bug/pr I'm looking at are MSFT:20297559, MSFT:21091917, and MSFT:3121537.
Author
Owner

@Tyriar commented on GitHub (Sep 9, 2019):

Fixed in 10.0.18970.1005:

image

@Tyriar commented on GitHub (Sep 9, 2019): Fixed in 10.0.18970.1005: ![image](https://user-images.githubusercontent.com/2193314/64541554-e8147580-d2d6-11e9-8a62-96afe03ac148.png)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#2280