-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
printf "\e[6n"
command causes nushell prompt to output ^[[<row>;<col>R
every time enter is pressed
#860
Comments
On Windows, I get the response from the terminal. Then I can clear the line and type other commands, hitting enter after each one, without issue. Have you tried on version 100? |
Of note is that when I perform a "Query Device Code" and "Query Device Status" (see https://www2.ccs.neu.edu/research/gpc/VonaUtils/vona/terminal/vtansi.htm), i.e. I type |
If you're going to query the terminal you should use the new ❯ term query (ansi size) --terminator 'R' --prefix "\e["
Length: 6 (0x6) bytes | printable whitespace ascii_other non_ascii
00000000: 35 31 3b 32 30 39 51;209
❯ term query "\e[c" --terminator 'c' --prefix "\e[" --keep
Length: 34 (0x22) bytes | printable whitespace ascii_other non_ascii
00000000: 1b 5b 3f 36 31 3b 36 3b 37 3b 31 34 3b 32 31 3b •[?61;6;7;14;21;
00000010: 32 32 3b 32 33 3b 32 34 3b 32 38 3b 33 32 3b 34 22;23;24;28;32;4
00000020: 32 63 2c
❯ term query "\e[5n" --prefix "\e[" --terminator 'n' --keep
Length: 4 (0x4) bytes | printable whitespace ascii_other non_ascii
00000000: 1b 5b 30 6e •[0n |
For context I stumbled across this behaviour of nushell when working on my own terminal emulator that I'm writing as a side project. I got this bug simply by running |
Could replicate, with nushell v.100 and gnome terminal version |
I dug around a little more and I managed to produce a similar behavior in the Details Steps to reproduce (For unix/linux, not Windows)
The recording is from when I was testing on
but instead I get
i.e. the
i.e. there's an extra newline, and occasionally I get
I tested with |
I moved it here to reedline. |
Describe the bug
EDIT: Initially I described this bug in terms of nushell behaviour. In a later comment (what I presume to be) the same bug is exhibited using only
reedline
Here is a recording.
I can reproduced this bug in the three terminals I've tested:
st 0.9.2
(with some patches)xterm
(xterm -version
givesXTerm(394)
)rrxvt-unicode
(urxvt) v9.31 - released: 2023-01-02The bug appears to be independent of terminal used, and is not present with the bash I'm using, so I imagine it's a bug in nushell. If I'm not wrong nushell itself sends
\e[6n
to the terminal (3 times?) when printing the default prompt. Maybe Nushell expects to receive\e[6n
strings from the terminal at very specific times and so when this happens unexpectedly the internal state get's mixed up 🤔 That's just my backseat debugging though..To me this looks similar to this issue nushell/nushell#13570
Please let me know if you'd like me to try and reproduce with other setups! :-)
Or if there is something else I can do to help.
How to reproduce
printf "\e[6n"
^[[<row>;<col>R
flashes on every subsequent enterExpected behavior
printf "\e[6n"
^[[<row>;<col>R
has been printed to the terminal by nushellThis is almost the behaviour I get with bash. With bash I get
i.e. after having pressed enter the shell prints
^[[<n>;<n>R
to the terminal but my prompt ends up having the characters;1R
, so if I press enter immediately I getbash: syntax error near unexpected token ';'
Configuration
The text was updated successfully, but these errors were encountered: