helix icon indicating copy to clipboard operation
helix copied to clipboard

Resetting terminal cursor shape after exiting helix seems broken in 24.03

Open archseer opened this issue 2 years ago • 15 comments

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

archseer avatar Apr 01 '24 17:04 archseer

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

archseer avatar Apr 01 '24 17:04 archseer

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)

pascalkuthe avatar Apr 01 '24 17:04 pascalkuthe

Same behavior for me.

lpoirothattermann avatar Apr 01 '24 20:04 lpoirothattermann

Are we planning to backport this to 24.03? It seems like it could be a significant regression.

kirawi avatar Apr 01 '24 22:04 kirawi

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

kirawi avatar Apr 03 '24 01:04 kirawi

Oh god that is an abomination.

Probably need to implement that since we don't allow people to override escape sequences themselves

pascalkuthe avatar Apr 03 '24 11:04 pascalkuthe

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

kirawi avatar Apr 06 '24 15:04 kirawi

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

cjbayliss avatar Apr 09 '24 22:04 cjbayliss

https://github.com/helix-editor/helix/issues/6565 is related

kirawi avatar Apr 13 '24 02:04 kirawi