rio icon indicating copy to clipboard operation
rio copied to clipboard

[Feature Request] Add Option for “Default” Cursor Shape or Allow Applications to Change It

Open rsenna opened this issue 9 months ago • 6 comments

Currently, Rio offers the following cursor (or "caret") shape options:

  1. Block
  2. Underline
  3. Beam
  4. Hidden

However, some CLI programs define their own cursor shapes. For example, Fish shell 4 (in vi mode) can display a “beam” in insert mode or a “block” in normal mode. Rio does not respect these changes: it enforces the cursor shape set in config.toml, overriding any changes made by the running application.

This behaviour differs from terminal emulators like iTerm2, which allow the shell or application to modify the cursor shape dynamically.

By enforcing a fixed cursor style, Rio may be preventing shells and other applications from updating it as intended. This could also be related to issues such as #918 and #867, I suppose (just a hunch, I have not really looked into the code to know if that's the case.)

Would it be possible to either introduce a “default” cursor mode, that simply delegate to the running applications to control the cursor shape? Or "identify" if the cursor shape has been changed (somehow), and allow it to happen...?

Thanks in advance.

rsenna avatar Mar 03 '25 21:03 rsenna

Hey @rsenna thanks for the issue,

However, some CLI programs define their own cursor shapes. For example, Fish shell 4 (in vi mode) can display a “beam” in insert mode or a “block” in normal mode. Rio does not respect these changes: it enforces the cursor shape set in config.toml, overriding any changes made by the running application.

Which CLI program are you talking about? (If isn't changing it's a bug)

Rio + nvim for me

Image

raphamorim avatar Mar 03 '25 21:03 raphamorim

It's on the shell itself - fish in this case (https://fishshell.com/), when you configure it to use vi mode. I'm on macOS Sequoia 15.3.1 btw.

On iTerm

Insert mode: Image

Normal mode: Image

On Rio

Insert mode: Image

Normal mode: Image

Notes

  1. This is (most) of my rio/configs.toml file:
hide-cursor-when-typing = false

[cursor]
shape = 'block'
blinking = false
blinking-interval = 250

[window]
width = 2000
height = 1100
mode = "Fullscreen"
opacity = 0.2
blur = false
decorations = "Transparent"

[renderer]
performance = "low"
backend = "Metal"
disable-unfocused-render = true
level = 1
filters = [
  '/<redacted>/slang-shaders/crt/crt-consumer.slangp',
]

# [keyboard]
use-kitty-keyboard-protocol = true
# disable-ctlseqs-alt = false
# [fonts]
hinting = true

[navigation]
mode = "bookmark"
clickable = true
hide-if-single = true
use-current-path = false
color-automation = []

# MacOS with fish shell from homebrew:
[shell]
program = "/opt/homebrew/bin/fish"
args = ["--login"]
  1. Parabéns pelo trabalho, o Rio é muito bom cara! 🇧🇷💪🏽

rsenna avatar Mar 05 '25 13:03 rsenna

It's on the shell itself - fish in this case (fishshell.com), when you configure it to use vi mode.

Interesting! I've tried to reproduce locally without success on wezterm and iterm2 (but I assume could be related to a terminfo file capacity, will double check)

Image

Parabéns pelo trabalho, o Rio é muito bom cara! 🇧🇷💪🏽

Muito obrigado pela mensagem e por usar o Rio 🙏

raphamorim avatar Mar 06 '25 03:03 raphamorim

@rsenna what's the output of echo $TERM for you?

raphamorim avatar Mar 06 '25 03:03 raphamorim

Hey @raphamorim, sorry for the delay (I'm on vacations at the moment.)

Image

And it really only happens at the shell prompt level - you were right, inside of vim, neovim, cursor shape gets changed just fine. Also, if I use a terminal multiplexer, cursor settings like shape, color, etc. are correctly applied, but shape does get changed, according to the fish shell vi mode (tested with tmux and zellij).

So, yeah, I agree it's interesting, but probably not super important... 😅 Feel free to ignore this "terrible" bug!

rsenna avatar Mar 09 '25 23:03 rsenna

I'm running into the same problem, both on Arch/bash and Windows/Powershell. Interestingly, the cursor does change in NeoVim, even when I open up the :term.

Also, I noticed that there is no rio-terminfo package for arch anymore. The link on this page is dead.

Drllap avatar Apr 09 '25 21:04 Drllap