Skip to content

Prevent overwriting editing keys with keypad keys#19181

Draft
AstroSnail wants to merge 1 commit intovim:masterfrom
AstroSnail:got_code_from_term
Draft

Prevent overwriting editing keys with keypad keys#19181
AstroSnail wants to merge 1 commit intovim:masterfrom
AstroSnail:got_code_from_term

Conversation

@AstroSnail
Copy link

@AstroSnail AstroSnail commented Jan 15, 2026

Suggested fix for #17331, alternative to #19145. In principle there is no conflict with the other fix.

An advantage of this fix over #19145 is that it doesn't rely on the builtin <xHome>. Instead, vim will associate the correct termcode with <Home>.

The test fails because <PageUp> and <PageDown> are still not fixed. Fixing those requires improving find_term_bykeys to recognize that ^[[5;*~ is a match for ^[[5~. If the maintainers are interested I can try doing such an improvement and un-draft this PR.

Problem:  In XTerm, with 'xtermcodes' enabled (default), when the user
	  presses <Home> vim will see <kHome>. This affects `:map`pings
	  and `:terminal`, which care whether a keypress was <Home> or
	  <kHome>.
Cause:    Vim requests termcodes for keys like <Home>, <End>, <PageUp>,
	  <PageDown>, and their keypad counterparts <kHome>, etc. If
	  XTerm replies with the same termcode for <Home> and <kHome>,
	  vim will only keep <kHome> because it is requested after
	  <Home>.
Solution: When a termcode reply is a keypad key and it would replace a
          different key, skip it.

Signed-off-by: AstroSnail <astrosnail@protonmail.com>
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.

1 participant