feat: add terminalcursor option - #2441
Merged
Merged
Conversation
Collaborator
Author
|
@joelim-work Any thoughts on this? If you think this is too niche of a feature, I am fine with not merging it. |
joelim-work
approved these changes
Mar 19, 2026
joelim-work
left a comment
Contributor
There was a problem hiding this comment.
Thanks, I think this feature is fine to add, as other programs like Vim also allow you to change the cursor shape.
CatsDeservePets
marked this pull request as ready for review
March 19, 2026 00:26
joelim-work
approved these changes
Mar 19, 2026
joelim-work
left a comment
Contributor
There was a problem hiding this comment.
LGTM, thanks once again!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds the option
terminalcursor.It allows changing the appearance (i.e. shape and blinking) of the cursor and accepts one of these values:
default,block,underline,bar,blinkblock,blinkunderline,blinkbar.By default,
tcellusesdefaultanyway, so we only have to callSetCursorStylewhen actually overwriting it.Why not just change the default settings for your terminal?
In all my shells, I am using
vimodes which have their own cursor settings that take precedence over the terminal emulator config. That means I am not seeing the default cursor anyway most of the time.Doing it like this
tty-write "\033[5 q"does not work either.Things to consider:
SetCursorStylealso accepts optional colour parameters. If this should be supported, it might be better to change it from string to []string and perhaps also make blinking its own attribute.I chose the name
terminalcursorovercursorstyleto avoid confusion withcursoractivefmt,cursorparentfmtandcursorpreviewfmt. However, I am open for naming suggestions, including the styles themselves.After executing
shell-waitcommands and displayingwaitmsg, the default cursor is shown. This is caused by callingSuspendbefore, which temporarily restores terminal settings.