`printf "\e[6n"` command causes nushell prompt to output `^[[<row>;<col>R` every time enter is pressed
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 818
- Forks
- 249
- Avg merge
- 4d 14h
- Merged PRs (30d)
- 30
Description
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 -versiongivesXTerm(394))rrxvt-unicode(urxvt) v9.31 - released: 2023-01-02
The 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 https://github.com/nushell/nushell/issues/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
- Open terminal
- Type
printf "\e[6n" - Press enter
- Observe that the string
^[[<row>;<col>Rflashes on every subsequent enter
Expected behavior
- Open terminal
- Type
printf "\e[6n" - Press enter
- Observe that
^[[<row>;<col>Rhas been printed to the terminal by nushell
This is almost the behaviour I get with bash. With bash I get
[myprompt]$ printf "\e[6n"
^[[<n>;<n>R
[myprompt]$ ;1R
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 get bash: syntax error near unexpected token ';'
Configuration
| key | value |
|---|---|
| version | 0.98.0 |
| major | 0 |
| minor | 98 |
| patch | 0 |
| branch | |
| commit_hash | |
| build_os | linux-x86_64 |
| build_target | x86_64-unknown-linux-gnu |
| rust_version | rustc 1.81.0 (eeb90cda1 2024-09-04) (built from a source tarball) |
| cargo_version | cargo 1.81.0 (2dbb1af80 2024-08-20) |
| build_time | 1980-01-01 00:00:00 +00:00 |
| build_rust_channel | release |
| allocator | mimalloc |
| features | default, sqlite, trash |
| installed_plugins |
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue in reedline using the documented printf "\e[6n" sequence, then compare the behavior with the linked recording and the later reedline-only report. Trace how the terminal response is handled after Enter; done means the response is not emitted on subsequent prompts or enters.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100