microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.03k stars 8.23k forks source link

Text input overlays text existing instead of inserting correctly #4147

Closed sinister3vil closed 2 years ago

sinister3vil commented 4 years ago

Environment

Windows build number: Microsoft Windows NT 10.0.18362.0
Windows Terminal version (if applicable):  0.7.3451.0

Steps to reproduce

When making corrections/inserting text, new text overlays over existing. This is clearly graphical, actual text sent is correct. This seems to be related to the text color. The most sure fire way reproduce is SSHing into Mikrotik RouterOS, where any input gets themed. Also happens in WSL, but haven't been able to reproduce effectively.

Below video better illustrates this.

https://www.youtube.com/watch?v=OkkZhDAl8sU

Expected behavior

Text should not overlay.

Actual behavior

Text gets overlayed.

Extra notes

This seems to be conhost related. Using the latest version of Terminus (https://github.com/Eugeny/terminus) with conPTY enabled does not produce this bug. Disabling conPTY results in this bug. Built-in windows consoles like cmd or powershell also have this issue. Non-console apps like PuTTY or MinTTY do not produce this bug.

zadjii-msft commented 4 years ago

To help debug this, let's just focus on the conhost (cmd/powershell) and none of the other terminal applications, as they might complicate the repro.

DHowett-MSFT commented 4 years ago

I believe this is just a known limitation of Terminal's current TSF text input control.

Instead of inserting your typed characters into the terminal with the other text, it displays them on a layer on top of the terminal. It hasn't been updated to properly update the text underneath it.

DHowett-MSFT commented 4 years ago

image

and if you're using "retro", you can see how the little input box doesn't match the rest of the terminal :smile:

image

sinister3vil commented 4 years ago

To help debug this, let's just focus on the conhost (cmd/powershell) and none of the other terminal applications, as they might complicate the repro.

  • Which shell application are you running on the Mikrotik RouterOS machine? bash, zsh, pwsh, etc

    • do you have any extra config for that shell application that might be relevant?
  • While ssh'd, could you share the output of infocmp and stty -a?

Hello zadjii-msft,

While RouterOS is based on linux they have they're own shell implementation which does not allow normal *nix commands.

I believe this is just a known limitation of Terminal's current TSF text input control.

Instead of inserting your typed characters into the terminal with the other text, it displays them on a layer on top of the terminal. It hasn't been updated to properly update the text underneath it.

Just want to point out that it's not just the Terminal, as in Windows Terminal, but any terminal that uses conhost, to the best of my understanding.

Also want to point out that this seems to have started after the May 2019 Windows update, which I got during the summer, July or so.

Apologies for not being more helpful, being able to only casually reproduce this on Mikrotiks surely limits your ability to further debug the issue. I've also seen it on bash, on occasion, though I'm not sure where, but it was surely when running a terminal app that does it's own syntax highlighting on the input.

PS, you can fool around on a RouterOS shell here, if you believe it can help : ssh demo@demo.mt.lv (provided by Mikrotik)

sinister3vil commented 4 years ago

Just wanted to add that by logging in as demo+c@demo.mt.tv it will disable all colors in the shell, and then the issue is more apparent, any text typed gets overlayed, so I'm guessing it has something to do with how "white" text is handled.

awachowiak commented 3 years ago

Do we have any progress regarding this issue? I'm having same problem when connecting via ssh to remote server, using bash shell.

niedzwiedzislaw commented 3 years ago

Just to make this more baffling, I'll add my findings.

awachowiak commented 3 years ago

I've managed to diagnose this issue. In my case it was happening only when connection to remote server via ssh. On remote machine, inside .profile file, was line export TERM="xterm-color". Removing this line solved problem.

No more input overlay :)

niedzwiedzislaw commented 3 years ago

Now that you mention it, my broken terminals have TERM="xterm-color". My working terminals have TERM="xterm-256color". Thanks.

zadjii-msft commented 2 years ago

Hey sorry this one sat on the backlog for so long. @sinister3vil you still seeing this? If so, did the remote machine have TERM=xterm-color set? Does removing that fix it?

DHowett commented 2 years ago

That's weird. TERM should not be able to change this behavior! This is a well known issue in our IME implementation.

zadjii-msft commented 2 years ago

@DHowett looking at the original bug, I'm not sure there's any IME involved here. When we're proposing text via the IME, there's usually a tiny little underline, but that's not in this video at all.

ghost commented 2 years ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

sinister3vil commented 2 years ago

Hey sorry this one sat on the backlog for so long. @sinister3vil you still seeing this? If so, did the remote machine have TERM=xterm-color set? Does removing that fix it?

Hello @zadjii-msft, unfortunately I don't have access to a windows system any more to test it. Still, imho, even if the issue was the terminal type set to xterm-color, which I cannot confirm for RouterOS, the terminal should work as expected with that type and just use an 8-color palette.

zadjii-msft commented 2 years ago

I'm playing around with the demo link you sent, and frankly I have no idea how to get the TERM out of that. I'd suspect that they're not even using TERM, since it doesn't seem to really be running a typical shell like bash or fish, it's some specific use shell.

I also can't get anything like the OP to occur anymore, which makes me think that the original bug was probably fixed sometime in the last two years. Thanks for filing this! Sorry there's not a more specific resolution here.