Closed wez closed 2 years ago
Another option here is for survey to explicitly disable DECCKM mode on startup so that they key behave the way it wants!
Sending CSI ? 1 l
will reset that mode to produce ANSI encoded cursor keys.
Hey @wez - thanks for reporting this! I'm not sure I will have the time to add support for DECCKM but if you wanted to take a shot, i would love to support you however I can. Feel free to reach out on the gophers slack :)
That being said, if you could find the time to disable the mode, it would be much appreciated!
I don't have time to do that, however: https://github.com/PowerShell/PowerShell/issues/12268#issuecomment-819924104 claims to have resolved the underlying issue in powershell, so it may be OK just to wait for that to become broadly available and do nothing special here.
We had a user with this issue today on macOS, it seems the fish
shell enables the DECCKM mode by default as well. This seems like the related fish issue: https://github.com/fish-shell/fish-shell/issues/2139. That issue lead me to the useful tput rmkx
command which resets the terminal back to a mode that works with Survey. To reproduce this error with Survey you can use tput smkx
.
PowerShell 7.2.0-preview.8 no longer exhibits this issue.
What operating system and terminal are you using?
https://github.com/cli/cli/issues/3071 has more context, but:
gh auth login
What did you expect to see?
The cursor keys should navigate to select one of the login options
What did you see instead?
could not prompt: Unexpected Escape Sequence: ['\x1b' 'O']
Analysis
Due to https://github.com/PowerShell/PowerShell/issues/12268 powershell enables DECCKM which changes the cursor key encoding from
CSI A..D
toSS3 A..D
instead. SS3 is encoded asESC O
in 7-bit encoding.It is technically a bug that powershell leaves the cursor keys in that mode. However, it should be pretty simple to support this encoding here in survey:
https://github.com/AlecAivazis/survey/blob/dbdb3e56a5e332b0478e0a8e8522e53a49fb7dcd/terminal/runereader_posix.go#L79-L81
by allowing either
[
orO