Repository navigation
Description
Describe the bug
For all my terminals, I have the cursor set to the block-style at all times.
When I enter nushell, the default is to have the cursor in line-style.
However, when I exit nushell, the terminal continues to use the line-style for the cursor in the current session.
I have confirmed this is both the case with Kitty terminal on linux and Windows terminal (with WSL) on Windows 11.
How to reproduce
This is easiest to see when you have a tmux instance open (so you can compare).
- Update the config for your terminal to use block-style cursors
- Open a session of nushell
- Verify that the cursor is line-style (by default)
- Exit the session
- See that the cursor remains in the line-style
It's worth noting at this point that if you open another tmux session, then the cursor style is as you originally configured (block-style in my case).
Expected behavior
I'd expect the cursor style to not be overridden once you've exited a nushell session.
Screenshots
Before booting into a shell
inside the shell session
outside the session after exit
Configuration
| key | value |
| ------------------ | ---------------------------------------- |
| version | 0.77.0 |
| branch | main |
| commit_hash | fd09609b44b53d41ac7929e90708cdeba7bfb571 |
| build_os | linux-x86_64 |
| build_target | x86_64-unknown-linux-gnu |
| rust_version | rustc 1.66.1 (90743e729 2023-01-10) |
| rust_channel | 1.66.1-x86_64-unknown-linux-gnu |
| cargo_version | cargo 1.66.1 (ad779e08b 2023-01-10) |
| build_time | 2023-03-14 19:46:05 +00:00 |
| build_rust_channel | debug |
| features | default, zip |
| installed_plugins | |
Additional context
No response



Activity
fdncred commentedon Mar 14, 2023
You can change your cursor shape in the config file like this
Also, if your terminal supports xterm sequences you can follow these rules, outside of nushell, to reset your cursor shape.
So, for a steady block you'd type
reference
aetherplex commentedon Mar 19, 2023
Is it possible to change the default cursor to block?
fdncred commentedon Mar 20, 2023
I don't understand @aetherplex, I explained how to change it in the comment above yours. Am I misunderstanding your question?
scallaway commentedon Mar 21, 2023
@fdncred
I think what you've suggested for changing the cursor is perfectly valid, however I think I'd prefer to understand why it's changing the terminal cursor when I'm not in a
nushellsession.Surely any changes that are made inside the session should be reverted when exited?
fdncred commentedon Mar 21, 2023
@scallaway, my question was directed at @aetherplex.
Regarding your question about after nushell, maybe you're right. I'm not sure. Cursors are usually controlled by the terminal or the prompt. We're a few versions behind on our crossterm crate, which controls this. I'm not sure if there is a change in it or not. We also could have a bug in reedline or nushell that is causing this. It'll take a dedicated soul to try and figure that out.
It seems like your terminal is taking a passive approach, meaning that whomever changes the cursor, it will just use that. You could try the echo statement I have above to change it however you see fit. Currently, I think nushell takes the opposite approach, which is to set the cursor no matter what you change it to in the terminal and the only way to change it is to change it in the config.
cassepipe commentedon Mar 28, 2023
I encounter the same issue.
The terminal is not the issue here, it just obeys the commands the line editor gives it I believe.
If I remember correctly, it is considered good practice for any terminal program to store the state of terminal when it starts and restore that state it as it was before when it exits.
fdncred commentedon Mar 28, 2023
It can work either way but I get your point.
We'd probably accept a PR to reedline and/or nushell to help with this.
aerique commentedon Aug 31, 2023
I have something similar which may or may not have the same cause: I'm playing around with nushell, trying it out, changing some config options, launching it and exiting it again. This is all from Fish shell. In Fish my cursor is a solid block, in nushell I configured it to be a solid block as well but:
When I exit nushell to Fish my cursor is a blinking solid block so I run it like this now to reset it to a non-blinking solid block
nu ; echo -en '\e[2 q'.I do not have this issue with any other programs I launch from Fish, including my own shell I'm developing.
mb21 commentedon Sep 7, 2023
Seems crossterm has now a function to get cursor shape so nushell could use that to restore the cursor before exit?
fdncred commentedon Sep 7, 2023
I don't see the function. Is it in crossterm or just in someone's fork?
Make cursor_shape optional (#10289)
fdncred commentedon Sep 9, 2023
closing since #10289 landed. let's open a new issue if there are still problems.