Skip to content

Commit 0851898

Browse files
knzmuesli
authored andcommitted
Reorder the function keys in key.go for better troubleshootability
Here the list of keys did not change, I simply re-ordered the lines in the file.
1 parent ce923aa commit 0851898

File tree

1 file changed

+81
-64
lines changed

1 file changed

+81
-64
lines changed

key.go

Lines changed: 81 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -449,80 +449,97 @@ var sequences = map[string]Key{
449449
"\x1b[[E": {Type: KeyF5}, // linux console
450450

451451
// Function keys, X11
452-
"\x1bOP": {Type: KeyF1}, // vt100
453-
"\x1bOQ": {Type: KeyF2}, // vt100
454-
"\x1bOR": {Type: KeyF3}, // vt100
455-
"\x1bOS": {Type: KeyF4}, // vt100
456-
"\x1b[15~": {Type: KeyF5}, // also urxvt
457-
"\x1b[17~": {Type: KeyF6}, // also urxvt
458-
"\x1b[18~": {Type: KeyF7}, // also urxvt
459-
"\x1b[19~": {Type: KeyF8}, // also urxvt
460-
"\x1b[20~": {Type: KeyF9}, // also urxvt
461-
"\x1b[21~": {Type: KeyF10}, // also urxvt
462-
"\x1b[23~": {Type: KeyF11}, // also urxvt
463-
"\x1b[24~": {Type: KeyF12}, // also urxvt
464-
"\x1b[1;2P": {Type: KeyF13},
465-
"\x1b[1;2Q": {Type: KeyF14},
466-
"\x1b[1;2R": {Type: KeyF15},
467-
"\x1b[1;2S": {Type: KeyF16},
452+
"\x1bOP": {Type: KeyF1}, // vt100, xterm
453+
"\x1bOQ": {Type: KeyF2}, // vt100, xterm
454+
"\x1bOR": {Type: KeyF3}, // vt100, xterm
455+
"\x1bOS": {Type: KeyF4}, // vt100, xterm
456+
457+
"\x1b[1;3P": {Type: KeyF1, Alt: true}, // vt100, xterm
458+
"\x1b[1;3Q": {Type: KeyF2, Alt: true}, // vt100, xterm
459+
"\x1b[1;3R": {Type: KeyF3, Alt: true}, // vt100, xterm
460+
"\x1b[1;3S": {Type: KeyF4, Alt: true}, // vt100, xterm
461+
462+
"\x1b[11~": {Type: KeyF1}, // urxvt
463+
"\x1b[12~": {Type: KeyF2}, // urxvt
464+
"\x1b[13~": {Type: KeyF3}, // urxvt
465+
"\x1b[14~": {Type: KeyF4}, // urxvt
466+
467+
"\x1b\x1b[11~": {Type: KeyF1, Alt: true}, // urxvt
468+
"\x1b\x1b[12~": {Type: KeyF2, Alt: true}, // urxvt
469+
"\x1b\x1b[13~": {Type: KeyF3, Alt: true}, // urxvt
470+
"\x1b\x1b[14~": {Type: KeyF4, Alt: true}, // urxvt
471+
472+
"\x1b[15~": {Type: KeyF5}, // vt100, xterm, also urxvt
473+
474+
"\x1b[15;3~": {Type: KeyF5, Alt: true}, // vt100, xterm, also urxvt
475+
476+
"\x1b\x1b[15~": {Type: KeyF5, Alt: true}, // urxvt
477+
478+
"\x1b[17~": {Type: KeyF6}, // vt100, xterm, also urxvt
479+
"\x1b[18~": {Type: KeyF7}, // vt100, xterm, also urxvt
480+
"\x1b[19~": {Type: KeyF8}, // vt100, xterm, also urxvt
481+
"\x1b[20~": {Type: KeyF9}, // vt100, xterm, also urxvt
482+
"\x1b[21~": {Type: KeyF10}, // vt100, xterm, also urxvt
483+
484+
"\x1b\x1b[17~": {Type: KeyF6, Alt: true}, // urxvt
485+
"\x1b\x1b[18~": {Type: KeyF7, Alt: true}, // urxvt
486+
"\x1b\x1b[19~": {Type: KeyF8, Alt: true}, // urxvt
487+
"\x1b\x1b[20~": {Type: KeyF9, Alt: true}, // urxvt
488+
"\x1b\x1b[21~": {Type: KeyF10, Alt: true}, // urxvt
489+
490+
"\x1b[17;3~": {Type: KeyF6, Alt: true}, // vt100, xterm
491+
"\x1b[18;3~": {Type: KeyF7, Alt: true}, // vt100, xterm
492+
"\x1b[19;3~": {Type: KeyF8, Alt: true}, // vt100, xterm
493+
"\x1b[20;3~": {Type: KeyF9, Alt: true}, // vt100, xterm
494+
"\x1b[21;3~": {Type: KeyF10, Alt: true}, // vt100, xterm
495+
496+
"\x1b[23~": {Type: KeyF11}, // vt100, xterm, also urxvt
497+
"\x1b[24~": {Type: KeyF12}, // vt100, xterm, also urxvt
498+
499+
"\x1b[23;3~": {Type: KeyF11, Alt: true}, // vt100, xterm
500+
"\x1b[24;3~": {Type: KeyF12, Alt: true}, // vt100, xterm
501+
502+
"\x1b\x1b[23~": {Type: KeyF11, Alt: true}, // urxvt
503+
"\x1b\x1b[24~": {Type: KeyF12, Alt: true}, // urxvt
504+
505+
"\x1b[1;2P": {Type: KeyF13},
506+
"\x1b[1;2Q": {Type: KeyF14},
507+
508+
"\x1b[25~": {Type: KeyF13}, // vt100, xterm, also urxvt
509+
"\x1b[26~": {Type: KeyF14}, // vt100, xterm, also urxvt
510+
511+
"\x1b[25;3~": {Type: KeyF13, Alt: true}, // vt100, xterm
512+
"\x1b[26;3~": {Type: KeyF14, Alt: true}, // vt100, xterm
513+
514+
"\x1b\x1b[25~": {Type: KeyF13, Alt: true}, // urxvt
515+
"\x1b\x1b[26~": {Type: KeyF14, Alt: true}, // urxvt
516+
517+
"\x1b[1;2R": {Type: KeyF15},
518+
"\x1b[1;2S": {Type: KeyF16},
519+
520+
"\x1b[28~": {Type: KeyF15}, // vt100, xterm, also urxvt
521+
"\x1b[29~": {Type: KeyF16}, // vt100, xterm, also urxvt
522+
523+
"\x1b[28;3~": {Type: KeyF15, Alt: true}, // vt100, xterm
524+
"\x1b[29;3~": {Type: KeyF16, Alt: true}, // vt100, xterm
525+
526+
"\x1b\x1b[28~": {Type: KeyF15, Alt: true}, // urxvt
527+
"\x1b\x1b[29~": {Type: KeyF16, Alt: true}, // urxvt
528+
468529
"\x1b[15;2~": {Type: KeyF17},
469530
"\x1b[17;2~": {Type: KeyF18},
470531
"\x1b[18;2~": {Type: KeyF19},
471532
"\x1b[19;2~": {Type: KeyF20},
472533

473-
// Function keys with the alt modifier, X11
474-
"\x1b[1;3P": {Type: KeyF1, Alt: true},
475-
"\x1b[1;3Q": {Type: KeyF2, Alt: true},
476-
"\x1b[1;3R": {Type: KeyF3, Alt: true},
477-
"\x1b[1;3S": {Type: KeyF4, Alt: true},
478-
"\x1b[15;3~": {Type: KeyF5, Alt: true},
479-
"\x1b[17;3~": {Type: KeyF6, Alt: true},
480-
"\x1b[18;3~": {Type: KeyF7, Alt: true},
481-
"\x1b[19;3~": {Type: KeyF8, Alt: true},
482-
"\x1b[20;3~": {Type: KeyF9, Alt: true},
483-
"\x1b[21;3~": {Type: KeyF10, Alt: true},
484-
"\x1b[23;3~": {Type: KeyF11, Alt: true},
485-
"\x1b[24;3~": {Type: KeyF12, Alt: true},
486-
"\x1b[25;3~": {Type: KeyF13, Alt: true},
487-
"\x1b[26;3~": {Type: KeyF14, Alt: true},
488-
"\x1b[28;3~": {Type: KeyF15, Alt: true},
489-
"\x1b[29;3~": {Type: KeyF16, Alt: true},
490-
491-
// Function keys, urxvt
492-
"\x1b[11~": {Type: KeyF1},
493-
"\x1b[12~": {Type: KeyF2},
494-
"\x1b[13~": {Type: KeyF3},
495-
"\x1b[14~": {Type: KeyF4},
496-
"\x1b[25~": {Type: KeyF13},
497-
"\x1b[26~": {Type: KeyF14},
498-
"\x1b[28~": {Type: KeyF15},
499-
"\x1b[29~": {Type: KeyF16},
500534
"\x1b[31~": {Type: KeyF17},
501535
"\x1b[32~": {Type: KeyF18},
502536
"\x1b[33~": {Type: KeyF19},
503537
"\x1b[34~": {Type: KeyF20},
504538

505-
// Function keys with the alt modifier, urxvt
506-
"\x1b\x1b[11~": {Type: KeyF1, Alt: true},
507-
"\x1b\x1b[12~": {Type: KeyF2, Alt: true},
508-
"\x1b\x1b[13~": {Type: KeyF3, Alt: true},
509-
"\x1b\x1b[14~": {Type: KeyF4, Alt: true},
510-
"\x1b\x1b[15~": {Type: KeyF5, Alt: true},
511-
"\x1b\x1b[17~": {Type: KeyF6, Alt: true},
512-
"\x1b\x1b[18~": {Type: KeyF7, Alt: true},
513-
"\x1b\x1b[19~": {Type: KeyF8, Alt: true},
514-
"\x1b\x1b[20~": {Type: KeyF9, Alt: true},
515-
"\x1b\x1b[21~": {Type: KeyF10, Alt: true},
516-
"\x1b\x1b[23~": {Type: KeyF11, Alt: true},
517-
"\x1b\x1b[24~": {Type: KeyF12, Alt: true},
518-
"\x1b\x1b[25~": {Type: KeyF13, Alt: true},
519-
"\x1b\x1b[26~": {Type: KeyF14, Alt: true},
520-
"\x1b\x1b[28~": {Type: KeyF15, Alt: true},
521-
"\x1b\x1b[29~": {Type: KeyF16, Alt: true},
522-
"\x1b\x1b[31~": {Type: KeyF17, Alt: true},
523-
"\x1b\x1b[32~": {Type: KeyF18, Alt: true},
524-
"\x1b\x1b[33~": {Type: KeyF19, Alt: true},
525-
"\x1b\x1b[34~": {Type: KeyF20, Alt: true},
539+
"\x1b\x1b[31~": {Type: KeyF17, Alt: true}, // urxvt
540+
"\x1b\x1b[32~": {Type: KeyF18, Alt: true}, // urxvt
541+
"\x1b\x1b[33~": {Type: KeyF19, Alt: true}, // urxvt
542+
"\x1b\x1b[34~": {Type: KeyF20, Alt: true}, // urxvt
526543
}
527544

528545
// Hex code mappings.

0 commit comments

Comments
 (0)