-
Notifications
You must be signed in to change notification settings - Fork 281
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
Add a function to get the cursor style (shape, blinking) #646
Comments
According to this pr microsoft/terminal#11152 requesting DECSCUSR via DECRQSS might land in a future pr. Personally I think xterm should be the reference to judge if a feature should be added or not, windows terminal is catching up with the spec, and I imagine macos have other terminals where this work. |
Maybe for Windows systems, we could get some kind of idea by querying: https://docs.microsoft.com/en-us/windows/console/console-cursor-info-str. Otherwise, might be nice to have an |
It's interesting to note that, on Windows (tested with cmd.exe and PowerShell), if the cursor style was modified in the alternate screen, it is automatically restored upon leaving the alternate screen. Maybe we should implement that on other terminals, when possible, to have an uniform behavior. |
Idk why, but whatever the shape of the cursor, the reported |
The reported Here is the code that I ran (using execute!(io::stdout(), SetCursorShape(CursorShape::Block)).unwrap();
let _ = crossterm::cursor::style();
execute!(io::stdout(), SetCursorShape(CursorShape::Line)).unwrap();
let _ = crossterm::cursor::style();
execute!(io::stdout(), SetCursorShape(CursorShape::UnderScore)).unwrap();
let _ = crossterm::cursor::style();
execute!(io::stdout(), Hide).unwrap();
let _ = crossterm::cursor::style();
execute!(io::stdout(), Show).unwrap();
let _ = crossterm::cursor::style(); |
The way I understand it, is that Windows terminals have their own cursor which is a block with variable height (default 25%). And on top of that, they support ANSI cursors (block, line and underscore) where |
This was closed in #742 although that PR only added (And |
Currently, it's possible to modify the cursor shape and whether it's blinking or not, but the previous state can't be restored. A function that can retrieve the cursor style would be useful, because one could save the old style and restore it when the program exits, so users can keep their terminal the way they prefer it.
I don't know if this is possible. For now, I forked the project and I've a proof of concept that works only on Xterm compatible terminals using DECRQSS with DECSCUSR (see this).
What works:
What doesn't:
I've 2 questions:
The text was updated successfully, but these errors were encountered: