Resetting terminal cursor shape after exiting helix seems broken in 24.03
Discussed in https://github.com/helix-editor/helix/discussions/10071
Originally posted by wyw March 31, 2024
https://github.com/helix-editor/helix/assets/11427457/011b634b-89bd-4caf-b3bf-7f8b14980406
Related issue & PR:
- https://github.com/helix-editor/helix/issues/2684
- https://github.com/helix-editor/helix/pull/8591
- commits/553ffbc
Resetting the terminal cursor shape after exiting helix worked before the commit 553ffbc in version a2767269:
https://github.com/helix-editor/helix/assets/11427457/1d25ddfc-f02e-4c95-86e6-f8f2e4b2a50e
Relevant comment from @kladd https://github.com/helix-editor/helix/pull/8591#issuecomment-1798215620 that I've originally missed since it was made after the PR was already merged
We should probably check what vim does and copy that. Terminfo is just a garden of weirdly noncompatible stuff (as is everything with terminals in general)
Same behavior for me.
Are we planning to backport this to 24.03? It seems like it could be a significant regression.
Detection seems to be handled by the second variable on https://github.com/neovim/neovim/blob/30b94ae4942b4e82030bc079368dd7fcb5481456/src/nvim/tui/tui.c#L133
They have a dedicated function for terminfo: https://github.com/neovim/neovim/blob/30b94ae4942b4e82030bc079368dd7fcb5481456/src/nvim/tui/tui.c#L1882
https://github.com/neovim/neovim/blob/30b94ae4942b4e82030bc079368dd7fcb5481456/src/nvim/tui/tui.c#L2106-L2110 https://github.com/neovim/neovim/blob/30b94ae4942b4e82030bc079368dd7fcb5481456/src/nvim/tui/tui.c#L2143-L2173 https://github.com/neovim/neovim/blob/30b94ae4942b4e82030bc079368dd7fcb5481456/src/nvim/tui/tui.c#L2189-L2195
Oh god that is an abomination.
Probably need to implement that since we don't allow people to override escape sequences themselves
I think we'd want to add it to this function: https://github.com/helix-editor/helix/blob/97afd67fca0b505600e5fbba7ca59f06a4eec3ff/helix-tui/src/backend/crossterm.rs#L57-L78
temporary workaround for fish users using alacritty, shouldn't be to hard to adapt for other shells:
# FIXME: remove once https://github.com/helix-editor/helix/issues/10089 is fixed
function hx
command hx $argv
printf '\033[0 q'
end
EDIT: doesn't reset the cursor if helix is run in other ways, e.g. via git commit
https://github.com/helix-editor/helix/issues/6565 is related