public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] vt: add modifier support to cursor and navigation keys
@ 2026-02-03  4:52 Nicolas Pitre
  2026-02-03  4:52 ` [PATCH 1/3] vt: add modifier support to cursor keys Nicolas Pitre
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Nicolas Pitre @ 2026-02-03  4:52 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Alexey Gladkov
  Cc: Nicolas Pitre, linux-serial, linux-kernel

This series adds xterm-style modifier encoding to cursor keys and navigation
keys on the Linux console.

Modern terminal applications (shells, editors, TUI programs) rely on
modifier+key combinations like Ctrl+Left, Shift+Home, or Alt+Delete for
navigation and selection. The xterm protocol encodes these as CSI sequences
with a modifier parameter (e.g., ESC [ 1 ; 5 D for Ctrl+Left).

While the existing func string table mechanism could technically support
these sequences, each modifier combination would require a separate entry,
quickly exhausting the limited string table space. This series instead
generates the sequences programmatically, providing full modifier support
without consuming string table entries.

This series addresses that in three patches:

1. Add modifier encoding to cursor keys (Up/Down/Left/Right). When
Shift, Alt, or Ctrl are held, the arrow keys now emit sequences like
ESC [ 1 ; 2 A instead of plain ESC [ A.

2. Add a new KT_CSI keysym type for navigation keys (Home, End, Insert,
Delete, PgUp, PgDn) and function keys. These generate CSI tilde
sequences (ESC [ n ~) with automatic modifier encoding.

3. Add automatic fallback to the plain keymap for modifier-aware key
types. This eliminates the need for explicit bindings for each
modifier combination - a single plain keymap entry handles all
modifier variants.

The modifier encoding follows the standard xterm convention:
  mod = 1 + (shift ? 1 : 0) + (alt ? 2 : 0) + (ctrl ? 4 : 0)

Explicit keymap bindings take precedence, preserving backward
compatibility with existing configurations.

Corresponding patches for the kbd package (loadkeys/dumpkeys) are ready
and will be submitted once this kernel support is available.

diffstat:
 drivers/tty/vt/keyboard.c     | 80 ++++++++++++++++++++++++++++++++--
 include/uapi/linux/keyboard.h | 29 +++++++++++++
 2 files changed, 103 insertions(+), 6 deletions(-)


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2026-03-13  8:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-03  4:52 [PATCH 0/3] vt: add modifier support to cursor and navigation keys Nicolas Pitre
2026-02-03  4:52 ` [PATCH 1/3] vt: add modifier support to cursor keys Nicolas Pitre
2026-02-03  4:52 ` [PATCH 2/3] vt: add KT_CSI keysym type for modifier-aware CSI sequences Nicolas Pitre
2026-02-03  4:52 ` [PATCH 3/3] vt: add fallback to plain map for modifier-aware key types Nicolas Pitre
2026-02-08 15:28 ` [PATCH 0/3] vt: add modifier support to cursor and navigation keys Greg Kroah-Hartman
2026-02-08 16:22   ` Nicolas Pitre
2026-02-10  6:53     ` Greg Kroah-Hartman
2026-03-06 18:26       ` Nicolas Pitre
2026-03-12 13:48         ` Greg Kroah-Hartman
2026-03-12 18:56           ` Nicolas Pitre
2026-03-13  7:11             ` Greg Kroah-Hartman
2026-03-13  8:38               ` Greg Kroah-Hartman
2026-03-09 12:35     ` Alexey Gladkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox