Skip to content

Unexpected Escape Sequence: ['\x1b' 'O'] #3071

Closed

Description

@gaborbernat

Describe the bug

When using powershell on macOS the application crashes when pressing arrow keys (e.g. on gh auth login). The \x1bO sequence that gh doesn't like is the SS3 encoding for cursor keys that is used when DEC application key mode is enabled. It's technically a bug in the gh cursor key handling for it to not recognize that cursor key encoding.

Steps to reproduce the behavior

See logs.

Expected vs actual behavior

Support running with DEC application key mode.

Logs

 gh auth login
? What account do you want to log into?  [Use arrows to move, type to filter]
> GitHub.com
  GitHub Enterprise Server
could not prompt: Unexpected Escape Sequence: ['\x1b' 'O']

Originally reported at wezterm/wezterm#510, but the DEC is left on due to PowerShell/PowerShell#12268.

Per @wez this is likely an issue upstream here https://github.com/AlecAivazis/survey/blob/dbdb3e56a5e332b0478e0a8e8522e53a49fb7dcd/terminal/runereader_posix.go#L80

PS. Opened AlecAivazis/survey#341 upstream.

Activity

  1. mislav commented on Mar 3, 2021

    @mislav
    Contributor

    Thank you for reporting both here and in upstream!

    Loosely related: #404

  2. added
    priority-3Affects a small number of users or is largely cosmetic
    on Mar 8, 2021
  3. corbob commented on Aug 4, 2021

    @corbob

    @mislav I've had a chance to test the workaround here PowerShell/PowerShell#12268 (comment) and can confirm that adding that code resolves the arrows issue for me. I've also installed pwsh-preview 7.2.0-preview.8 and can confirm that the issue is resolved there too 😄

  4. darthwalsh commented on Oct 11, 2021

    @darthwalsh
    Contributor

    Another workaround is, instead of using arrows, type in the text of your selection, i.e. ssh to filter the choice then press enter.

    (For me, the default settings of chrouton ubuntu cause this same escape sequence problem.)

  5. mislav commented on Oct 11, 2021

    @mislav
    Contributor

    This was fixed in trunk #4405 and will be effective in the next release!

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

    bugSomething isn't workingpriority-3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions