Skip to content

defaultcursor

bakkeby edited this page Jun 12, 2023 · 2 revisions

This patch makes st interpret cursor 0 as the default cursor.

According to the specification the "Set cursor style (DECSCUSR), VT520." escape sequences define both values of 0 and 1 as a blinking block, with 1 being the default.

Refer to:

https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h4-Functions-using-CSI-_-ordered-by-the-final-character-lparen-s-rparen:CSI-Ps-SP-q.1D81

This patch allows the default cursor to be set when value 0 is used, as opposed to setting the cursor to a blinking block.

This allows a command like this to restore the cursor to what st is configured with:

$ echo -ne "\e[ q"

While many terminal emulators do this it is not adhering to specification. xterm is an example terminal that sets a blinking block instead of the configured one, same as st.

Example use case is changing cursor shape in vim depending on what mode is used:

https://vim.fandom.com/wiki/Change_cursor_shape_in_different_modes

https://askubuntu.com/questions/42663/how-to-make-cursor-change-from-thin-line-to-block-based-on-normal-or-insert-mode

The alternative in this case would be to explicitly set the cursor back to what you expect it to be (underline, bar) in the vim configuration.

Download

Clone this wiki locally