Skip to content

Default all G-sets to ASCII unless ISO-2022 is requested (was: Terminal breaks on \x1b O) #10408

Closed

Description

Windows Terminal version (or Windows build number)

1.8.1521.0

Other Software

OpenSSH_5.3p1

Steps to reproduce

  1. SSH to linux server (for me it's CentOS, if it matters)
  2. echo -e '\x1bo'

Expected Behavior

I expect that terminal will continue to work properly

Actual Behavior

I can no longer type "actual" text in terminal, every key press transforms in a mess seen on screenshot. CTRL+Something sequences are also no longer working.

изображение

Stumbled upon this issue when I was debugging gsm7 encodings in python program (\x1b is a common byte for this encoding). On yet another 'print()' terminal became a mess.

Issue is not reproduced if i'm using powershell.exe or cmd.exe without it being embeded in WT.

Activity

  1. ghost added
    Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting
    on Jun 11, 2021
  2. ghost added
    Needs-Tag-FixDoesn't match tag requirements
    on Jun 11, 2021
  3. KalleOlaviNiemitalo commented on Jun 11, 2021

    @KalleOlaviNiemitalo

    ESC 06/15 is LS3 - LOCKING-SHIFT THREE. That was implemented in #4496.

    Have you tried the same command in a different terminal, such as xterm or in the Linux console? I expect you'd get the same result with those.

  4. iamdbychkov commented on Jun 11, 2021

    @iamdbychkov
    Author

    ESC 06/15 is LS3 - LOCKING-SHIFT THREE. That was implemented in #4496.

    Have you tried the same command in a different terminal, such as xterm or in the Linux console? I expect you'd get the same result with those.

    I have no problem running mentioned command on the same server while using putty as my gui ssh client / winsshterm (which is putty)/penguinet and no problems with Debian's default console.

  5. KalleOlaviNiemitalo commented on Jun 11, 2021

    @KalleOlaviNiemitalo

    From https://www.man7.org/linux/man-pages/man4/console_codes.4.html, I get the impression that the Linux console does not implement LS3, while xterm does.

  6. KalleOlaviNiemitalo commented on Jun 11, 2021

    @KalleOlaviNiemitalo

    Is there already a feature request for an action that resets the character sets to the defaults? Similar to #1882 for the scrollback.

  7. changed the title [-]Winodws terminal breaks on \x1b O if connected to remote server using ssh. [/-] [+]Windows terminal breaks on \x1b O if connected to a remote server using ssh. [/+] on Jun 11, 2021
  8. j4james commented on Jun 11, 2021

    @j4james
    Collaborator

    FYI, typing reset in bash should fix this. I also sometimes include a soft reset (\x1b[!p) in my prompt, which fix most issues like this automatically. But an action would be good too - I think most terminal emulators have something like that. I'm sure we've discussed this before actually, but I can't find an existing issue for it now, so maybe I'm misremembering.

  9. iamdbychkov commented on Jun 13, 2021

    @iamdbychkov
    Author

    Yes, thank you, typing reset in bash indeed worked, but unfortunately it won't work in the environments like python console, one in which I initially discovered the issue

  10. j4james commented on Jun 13, 2021

    @j4james
    Collaborator

    If it happens again in a python console, you can use print '\x1bc' to reset. Not suggesting that's a good long term solution, but it's better than having to exit and restart.

  11. WSLUser commented on Jun 14, 2021

    @WSLUser
    Contributor

    Other Software
    OpenSSH_5.3p1

    Can you bump your Win32-OpenSSH to 8.6? https://github.com/PowerShell/Win32-OpenSSH/releases

    Before 8.1, it was handling VT sequences itself instead of allowing conhost to do so instead.

  12. iamdbychkov commented on Jun 15, 2021

    @iamdbychkov
    Author

    Can you bump your Win32-OpenSSH to 8.6? https://github.com/PowerShell/Win32-OpenSSH/releases

    Before 8.1, it was handling VT sequences itself instead of allowing conhost to do so instead.

    Sadly, it didn't make a difference:

    PS C:\Program Files\OpenSSH> ./ssh -V
    OpenSSH_for_Windows_8.6p1, LibreSSL 3.3.3
    PS C:\Program Files\OpenSSH> ./ssh dev35p4
    [dbychkov@dev35p4 ~]$ echo -e '\x1bo'

    ÛäâùãèëïöÀäåö³µð´ þݤ 

  13. WSLUser commented on Jun 15, 2021

    @WSLUser
  14. j4james commented on Jun 15, 2021

    @j4james
    Collaborator

    I'm fairly certain OpenSSH has nothing to do with this. As KalleOlaviNiemitalo pointed out at the start, LS3 is a standard control sequence that is intended to change the character set - it's working as designed. You'll get the exact same behaviour in a local shell. What we're missing, is a way for users to easily reset the terminal when it gets into a state that they weren't expecting.

  15. zadjii-msft commented on Jun 15, 2021

    @zadjii-msft
    Member

    It seems totally reasonable to me for us to have a "Reset Terminal" command ~~that's just a sendInput("\x1bc") command,~~bound by default. Good thinking.

    It can't just be a sendInput command - it'll need to immediately trigger it like it was sent as client output, but yea it's a good idea.

  16. 21 remaining items

  17. added
    Product-ConhostFor issues in the Console codebase
    Issue-BugIt either shouldn't be doing this or needs an investigation.
    and removed
    Area-TerminalControlIssues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.)
    Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting
    on Jul 6, 2021
  18. j4james commented on Jul 6, 2021

    @j4james
    Collaborator

    It seems like if we do 1, we can later do 2 with no perceived change to the user experience.

    Yeah, that make sense to me. Although we may want to skip the bit about the setting the G-sets correctly when switching to ISO-2022 mode if we want to remain forward-compatible with DECAUPSS being added later. I'm not totally sure about that, but either way is OK with me. As long as there is some series of escape sequences a user can send to get things the way they want, then I think we're good.

    Should we be storing the user preference supplemental set somewhere, when we do do 2?

    If you mean in a setting, then ideally yes. It was certainly a user-controlled setting in the original hardware terminals, and I suspect most real terminal emulators would have a setting for it. If combined with a way to start up in ISO-2022 mode, it would enable users to easily run legacy 8-bit applications designed for a particular code page.

    That said, I don't think there's a huge demand for that sort of thing anymore, so it's not essential if you don't want WT to go that route. Also, it would have to wait until we have a proper conpty pass-through implementation, since all the character set mapping is currently handled on the conhost side.

  19. ghost added
    In-PRThis issue has a related PR
    on Oct 30, 2021
  20. ghost closed this as completedin #11658on Nov 3, 2021
  21. ghost removed
    In-PRThis issue has a related PR
    on Nov 3, 2021
  22. ghost added
    Resolution-Fix-CommittedFix is checked in, but it might be 3-4 weeks until a release.
    on Nov 3, 2021
  23. ghost added a commit that references this issue on Nov 3, 2021
    27e042b
  24. added 2 commits that reference this issue on Dec 13, 2021
    830e0be
    ab683c0
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

    Area-VTVirtual Terminal sequence supportHelp WantedWe encourage anyone to jump in on these.Issue-BugIt either shouldn't be doing this or needs an investigation.Issue-TaskIt's a feature request, but it doesn't really need a major design.Priority-2A description (P2)Product-ConhostFor issues in the Console codebaseProduct-TerminalThe new Windows Terminal.Resolution-Fix-CommittedFix is checked in, but it might be 3-4 weeks until a release.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions