From 709868d93d418a77b875f204c1c02661c47ac4bb Mon Sep 17 00:00:00 2001 From: delthas Date: Mon, 10 Jul 2023 12:02:06 +0200 Subject: [PATCH] Support Xterm modifier keys for dynamic terminfos Previously, modified function keys in dyanmic terminals were not supported (like shift/control/alt + arrow keys). Even though xterm-compatible terminals were dynamically discovered and their keys added to the terminfo struct, the Modifiers field was not supported and therefore the modified Xterm keys were not added to the keycodes map (prepareXtermModifiers was skipped). This fixes the issue by setting the Modifiers field when we discover that the terminal is xterm-compatible. --- terminfo/dynamic/dynamic.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/terminfo/dynamic/dynamic.go b/terminfo/dynamic/dynamic.go index 08ff248..5340715 100644 --- a/terminfo/dynamic/dynamic.go +++ b/terminfo/dynamic/dynamic.go @@ -314,6 +314,8 @@ func LoadTerminfo(name string) (*terminfo.Terminfo, string, error) { // but modern XTerm and emulators often have them. Let's add them, // if the shifted right and left arrows are defined. if t.KeyShfRight == "\x1b[1;2C" && t.KeyShfLeft == "\x1b[1;2D" { + t.Modifiers = terminfo.ModifiersXTerm + t.KeyShfUp = "\x1b[1;2A" t.KeyShfDown = "\x1b[1;2B" t.KeyMetaUp = "\x1b[1;9A"