Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(compatibility): home and end in cursor keys mode #1190

Merged
merged 2 commits into from
Mar 9, 2022

Conversation

tlinford
Copy link
Contributor

@tlinford tlinford commented Mar 8, 2022

When DECCKM is set, Home and End should also be adjusted. This builds upon the fix in #815 for vim compatibility, but should be also compatible with applications that don't expect the keys in DECCKM format.
Fixes #1182.

cc @imsnif

@tlinford tlinford temporarily deployed to cachix March 8, 2022 12:02 Inactive
@tlinford tlinford temporarily deployed to cachix March 8, 2022 12:02 Inactive
@tlinford tlinford changed the title fix(compatibility) home and end in cursor keys mode fix(compatibility): home and end in cursor keys mode Mar 8, 2022
@imsnif imsnif self-assigned this Mar 8, 2022
@imsnif
Copy link
Member

imsnif commented Mar 8, 2022

Ah, awesome! I was going to take a look at it this week. I'll review it in the next day or two

@colemickens
Copy link

Very quick testing indicates this fixed Home/End in helix under zellij. Thanks @tlinford !

@imsnif
Copy link
Member

imsnif commented Mar 9, 2022

@tlinford - great find! (reference: https://www.xfree86.org/current/ctlseqs.html)

I'm not sure why we removed the terminfo adjustments here though... aren't these unrelated?

@tlinford
Copy link
Contributor Author

tlinford commented Mar 9, 2022

Adding some details to clarify how this pr hopefully solves the problem without creating regressions.
With the changes in #815, these sequences are always transformed:

  • Home: ESC [ H -> terminfo entry for khome
  • End: ESC [ F -> terminfo entry for kend

Most terminfos seem to define:

  • khome: ESC O H
  • kend: ESC O F

This fixed vim not working, and apparently many other programs read both these encodings fine. Helix on the other hand (via crossterm), does not recognize these ESC O variants.

With this change the transformation is only done when DECCKM has been set (this was already the case for the other cursor keys).

I removed the terminfo lookups since it would have been slightly annoying to attach it in that part of the code, and also because it's not being done for the existing DECCKM transformations we have, but it's worth keeping in mind that it's probably the right thing to do.

@tlinford tlinford merged commit 7e008bb into main Mar 9, 2022
@tlinford tlinford deleted the fix-compatibility-home-end-cursor-keys-mode branch March 9, 2022 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Home and End keys do not work in helix while using zellij
3 participants