Skip to content

feat: add terminalcursor option - #2441

Merged
CatsDeservePets merged 4 commits into
gokcehan:masterfrom
CatsDeservePets:cursor
Mar 19, 2026
Merged

feat: add terminalcursor option#2441
CatsDeservePets merged 4 commits into
gokcehan:masterfrom
CatsDeservePets:cursor

Conversation

@CatsDeservePets

Copy link
Copy Markdown
Collaborator

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, tcell uses default anyway, so we only have to call SetCursorStyle when actually overwriting it.

Why not just change the default settings for your terminal?
In all my shells, I am using vi modes 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:

  • SetCursorStyle also 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 terminalcursor over cursorstyle to avoid confusion with cursoractivefmt, cursorparentfmt and cursorpreviewfmt. However, I am open for naming suggestions, including the styles themselves.

  • After executing shell-wait commands and displaying waitmsg, the default cursor is shown. This is caused by calling Suspend before, which temporarily restores terminal settings.

@CatsDeservePets

Copy link
Copy Markdown
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 joelim-work left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I think this feature is fine to add, as other programs like Vim also allow you to change the cursor shape.

Comment thread eval.go Outdated
@CatsDeservePets
CatsDeservePets marked this pull request as ready for review March 19, 2026 00:26

@joelim-work joelim-work left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks once again!

@CatsDeservePets
CatsDeservePets merged commit bf8486f into gokcehan:master Mar 19, 2026
32 checks passed
@CatsDeservePets CatsDeservePets added the new Pull requests that add new behavior label Mar 19, 2026
@CatsDeservePets
CatsDeservePets deleted the cursor branch March 22, 2026 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new Pull requests that add new behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants