From 84d0c5503d60f8f934a223e3c63a8f087ab39616 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 29 Aug 2020 10:48:54 -0700 Subject: [PATCH] fixes #369 Better support for modifier keys This replaces high numbered function keys on xterm style emulators with modifiers. So pressing SHIFT-ALT-F1 is reported as exactly that, for example. This also extends that to the insert, delete, home, end, etc. There is a chance that this will break some emulators -- of particular concern are older VTE based emulators and rxvt (and derivatives). However, we think that most VTE derivatives are now much more closely aligned to xterm. The Wyse50 alternate character set was changed (likely due to a bug fix in ncurses). --- terminfo/a/alacritty/term.go | 202 +++-------- terminfo/g/gnome/term.go | 408 ++++++---------------- terminfo/k/konsole/term.go | 404 ++++++---------------- terminfo/mkinfo.go | 225 +++++------- terminfo/r/rxvt/term.go | 47 +-- terminfo/s/simpleterm/term.go | 412 +++++++--------------- terminfo/t/termite/term.go | 198 +++-------- terminfo/terminfo.go | 17 +- terminfo/w/wy50/term.go | 2 +- terminfo/x/xfce/term.go | 200 +++-------- terminfo/x/xterm/term.go | 608 +++++++++------------------------ terminfo/x/xterm_kitty/term.go | 199 +++-------- tscreen.go | 124 +++++-- 13 files changed, 926 insertions(+), 2120 deletions(-) diff --git a/terminfo/a/alacritty/term.go b/terminfo/a/alacritty/term.go index 930b35f..bb5fa7b 100644 --- a/terminfo/a/alacritty/term.go +++ b/terminfo/a/alacritty/term.go @@ -8,152 +8,60 @@ func init() { // alacritty terminal emulator terminfo.AddTerminfo(&terminfo.Terminfo{ - Name: "alacritty", - Columns: 80, - Lines: 24, - Colors: 256, - Bell: "\a", - Clear: "\x1b[H\x1b[2J", - EnterCA: "\x1b[?1049h\x1b[22;0;0t", - ExitCA: "\x1b[?1049l\x1b[23;0;0t", - ShowCursor: "\x1b[?12l\x1b[?25h", - HideCursor: "\x1b[?25l", - AttrOff: "\x1b(B\x1b[m", - Underline: "\x1b[4m", - Bold: "\x1b[1m", - Italic: "\x1b[3m", - Dim: "\x1b[2m", - Blink: "\x1b[5m", - Reverse: "\x1b[7m", - EnterKeypad: "\x1b[?1h\x1b=", - ExitKeypad: "\x1b[?1l\x1b>", - SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", - SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", - SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", - AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", - EnterAcs: "\x1b(0", - ExitAcs: "\x1b(B", - Mouse: "\x1b[M", - MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", - SetCursor: "\x1b[%i%p1%d;%p2%dH", - CursorBack1: "\b", - CursorUp1: "\x1b[A", - KeyUp: "\x1bOA", - KeyDown: "\x1bOB", - KeyRight: "\x1bOC", - KeyLeft: "\x1bOD", - KeyInsert: "\x1b[2~", - KeyDelete: "\x1b[3~", - KeyBackspace: "\b", - KeyHome: "\x1bOH", - KeyEnd: "\x1bOF", - KeyPgUp: "\x1b[5~", - KeyPgDn: "\x1b[6~", - KeyF1: "\x1bOP", - KeyF2: "\x1bOQ", - KeyF3: "\x1bOR", - KeyF4: "\x1bOS", - KeyF5: "\x1b[15~", - KeyF6: "\x1b[17~", - KeyF7: "\x1b[18~", - KeyF8: "\x1b[19~", - KeyF9: "\x1b[20~", - KeyF10: "\x1b[21~", - KeyF11: "\x1b[23~", - KeyF12: "\x1b[24~", - KeyF13: "\x1b[1;2P", - KeyF14: "\x1b[1;2Q", - KeyF15: "\x1b[1;2R", - KeyF16: "\x1b[1;2S", - KeyF17: "\x1b[15;2~", - KeyF18: "\x1b[17;2~", - KeyF19: "\x1b[18;2~", - KeyF20: "\x1b[19;2~", - KeyF21: "\x1b[20;2~", - KeyF22: "\x1b[21;2~", - KeyF23: "\x1b[23;2~", - KeyF24: "\x1b[24;2~", - KeyF25: "\x1b[1;5P", - KeyF26: "\x1b[1;5Q", - KeyF27: "\x1b[1;5R", - KeyF28: "\x1b[1;5S", - KeyF29: "\x1b[15;5~", - KeyF30: "\x1b[17;5~", - KeyF31: "\x1b[18;5~", - KeyF32: "\x1b[19;5~", - KeyF33: "\x1b[20;5~", - KeyF34: "\x1b[21;5~", - KeyF35: "\x1b[23;5~", - KeyF36: "\x1b[24;5~", - KeyF37: "\x1b[1;6P", - KeyF38: "\x1b[1;6Q", - KeyF39: "\x1b[1;6R", - KeyF40: "\x1b[1;6S", - KeyF41: "\x1b[15;6~", - KeyF42: "\x1b[17;6~", - KeyF43: "\x1b[18;6~", - KeyF44: "\x1b[19;6~", - KeyF45: "\x1b[20;6~", - KeyF46: "\x1b[21;6~", - KeyF47: "\x1b[23;6~", - KeyF48: "\x1b[24;6~", - KeyF49: "\x1b[1;3P", - KeyF50: "\x1b[1;3Q", - KeyF51: "\x1b[1;3R", - KeyF52: "\x1b[1;3S", - KeyF53: "\x1b[15;3~", - KeyF54: "\x1b[17;3~", - KeyF55: "\x1b[18;3~", - KeyF56: "\x1b[19;3~", - KeyF57: "\x1b[20;3~", - KeyF58: "\x1b[21;3~", - KeyF59: "\x1b[23;3~", - KeyF60: "\x1b[24;3~", - KeyF61: "\x1b[1;4P", - KeyF62: "\x1b[1;4Q", - KeyF63: "\x1b[1;4R", - KeyBacktab: "\x1b[Z", - KeyShfLeft: "\x1b[1;2D", - KeyShfRight: "\x1b[1;2C", - KeyShfUp: "\x1b[1;2A", - KeyShfDown: "\x1b[1;2B", - KeyCtrlLeft: "\x1b[1;5D", - KeyCtrlRight: "\x1b[1;5C", - KeyCtrlUp: "\x1b[1;5A", - KeyCtrlDown: "\x1b[1;5B", - KeyMetaLeft: "\x1b[1;9D", - KeyMetaRight: "\x1b[1;9C", - KeyMetaUp: "\x1b[1;9A", - KeyMetaDown: "\x1b[1;9B", - KeyAltLeft: "\x1b[1;3D", - KeyAltRight: "\x1b[1;3C", - KeyAltUp: "\x1b[1;3A", - KeyAltDown: "\x1b[1;3B", - KeyAltShfLeft: "\x1b[1;4D", - KeyAltShfRight: "\x1b[1;4C", - KeyAltShfUp: "\x1b[1;4A", - KeyAltShfDown: "\x1b[1;4B", - KeyMetaShfLeft: "\x1b[1;10D", - KeyMetaShfRight: "\x1b[1;10C", - KeyMetaShfUp: "\x1b[1;10A", - KeyMetaShfDown: "\x1b[1;10B", - KeyCtrlShfLeft: "\x1b[1;6D", - KeyCtrlShfRight: "\x1b[1;6C", - KeyCtrlShfUp: "\x1b[1;6A", - KeyCtrlShfDown: "\x1b[1;6B", - KeyShfHome: "\x1b[1;2H", - KeyShfEnd: "\x1b[1;2F", - KeyCtrlHome: "\x1b[1;5H", - KeyCtrlEnd: "\x1b[1;5F", - KeyAltHome: "\x1b[1;9H", - KeyAltEnd: "\x1b[1;9F", - KeyCtrlShfHome: "\x1b[1;6H", - KeyCtrlShfEnd: "\x1b[1;6F", - KeyMetaShfHome: "\x1b[1;10H", - KeyMetaShfEnd: "\x1b[1;10F", - KeyAltShfHome: "\x1b[1;4H", - KeyAltShfEnd: "\x1b[1;4F", - KeyShfPgUp: "\x1b[5;2~", - KeyShfPgDn: "\x1b[6;2~", + Name: "alacritty", + Columns: 80, + Lines: 24, + Colors: 256, + Bell: "\a", + Clear: "\x1b[H\x1b[2J", + EnterCA: "\x1b[?1049h\x1b[22;0;0t", + ExitCA: "\x1b[?1049l\x1b[23;0;0t", + ShowCursor: "\x1b[?12l\x1b[?25h", + HideCursor: "\x1b[?25l", + AttrOff: "\x1b(B\x1b[m", + Underline: "\x1b[4m", + Bold: "\x1b[1m", + Dim: "\x1b[2m", + Italic: "\x1b[3m", + Blink: "\x1b[5m", + Reverse: "\x1b[7m", + EnterKeypad: "\x1b[?1h\x1b=", + ExitKeypad: "\x1b[?1l\x1b>", + SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", + SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", + SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", + AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", + EnterAcs: "\x1b(0", + ExitAcs: "\x1b(B", + Mouse: "\x1b[<", + MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", + SetCursor: "\x1b[%i%p1%d;%p2%dH", + CursorBack1: "\b", + CursorUp1: "\x1b[A", + KeyUp: "\x1bOA", + KeyDown: "\x1bOB", + KeyRight: "\x1bOC", + KeyLeft: "\x1bOD", + KeyInsert: "\x1b[2~", + KeyDelete: "\x1b[3~", + KeyBackspace: "\u007f", + KeyHome: "\x1bOH", + KeyEnd: "\x1bOF", + KeyPgUp: "\x1b[5~", + KeyPgDn: "\x1b[6~", + KeyF1: "\x1bOP", + KeyF2: "\x1bOQ", + KeyF3: "\x1bOR", + KeyF4: "\x1bOS", + KeyF5: "\x1b[15~", + KeyF6: "\x1b[17~", + KeyF7: "\x1b[18~", + KeyF8: "\x1b[19~", + KeyF9: "\x1b[20~", + KeyF10: "\x1b[21~", + KeyF11: "\x1b[23~", + KeyF12: "\x1b[24~", + KeyBacktab: "\x1b[Z", + Modifiers: 1, }) } diff --git a/terminfo/g/gnome/term.go b/terminfo/g/gnome/term.go index 2b0e406..511416f 100644 --- a/terminfo/g/gnome/term.go +++ b/terminfo/g/gnome/term.go @@ -8,305 +8,121 @@ func init() { // GNOME Terminal terminfo.AddTerminfo(&terminfo.Terminfo{ - Name: "gnome", - Columns: 80, - Lines: 24, - Colors: 8, - Bell: "\a", - Clear: "\x1b[H\x1b[2J", - EnterCA: "\x1b7\x1b[?47h", - ExitCA: "\x1b[2J\x1b[?47l\x1b8", - ShowCursor: "\x1b[?25h", - HideCursor: "\x1b[?25l", - AttrOff: "\x1b[0m\x0f", - Underline: "\x1b[4m", - Bold: "\x1b[1m", - Dim: "\x1b[2m", - Italic: "\x1b[3m", - Reverse: "\x1b[7m", - EnterKeypad: "\x1b[?1h\x1b=", - ExitKeypad: "\x1b[?1l\x1b>", - SetFg: "\x1b[3%p1%dm", - SetBg: "\x1b[4%p1%dm", - SetFgBg: "\x1b[3%p1%d;4%p2%dm", - PadChar: "\x00", - AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", - EnterAcs: "\x0e", - ExitAcs: "\x0f", - EnableAcs: "\x1b)0", - Mouse: "\x1b[M", - MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", - SetCursor: "\x1b[%i%p1%d;%p2%dH", - CursorBack1: "\b", - CursorUp1: "\x1b[A", - KeyUp: "\x1bOA", - KeyDown: "\x1bOB", - KeyRight: "\x1bOC", - KeyLeft: "\x1bOD", - KeyInsert: "\x1b[2~", - KeyDelete: "\x1b[3~", - KeyBackspace: "\u007f", - KeyHome: "\x1bOH", - KeyEnd: "\x1bOF", - KeyPgUp: "\x1b[5~", - KeyPgDn: "\x1b[6~", - KeyF1: "\x1bOP", - KeyF2: "\x1bOQ", - KeyF3: "\x1bOR", - KeyF4: "\x1bOS", - KeyF5: "\x1b[15~", - KeyF6: "\x1b[17~", - KeyF7: "\x1b[18~", - KeyF8: "\x1b[19~", - KeyF9: "\x1b[20~", - KeyF10: "\x1b[21~", - KeyF11: "\x1b[23~", - KeyF12: "\x1b[24~", - KeyF13: "\x1bO1;2P", - KeyF14: "\x1bO1;2Q", - KeyF15: "\x1bO1;2R", - KeyF16: "\x1bO1;2S", - KeyF17: "\x1b[15;2~", - KeyF18: "\x1b[17;2~", - KeyF19: "\x1b[18;2~", - KeyF20: "\x1b[19;2~", - KeyF21: "\x1b[20;2~", - KeyF22: "\x1b[21;2~", - KeyF23: "\x1b[23;2~", - KeyF24: "\x1b[24;2~", - KeyF25: "\x1bO1;5P", - KeyF26: "\x1bO1;5Q", - KeyF27: "\x1bO1;5R", - KeyF28: "\x1bO1;5S", - KeyF29: "\x1b[15;5~", - KeyF30: "\x1b[17;5~", - KeyF31: "\x1b[18;5~", - KeyF32: "\x1b[19;5~", - KeyF33: "\x1b[20;5~", - KeyF34: "\x1b[21;5~", - KeyF35: "\x1b[23;5~", - KeyF36: "\x1b[24;5~", - KeyF37: "\x1bO1;6P", - KeyF38: "\x1bO1;6Q", - KeyF39: "\x1bO1;6R", - KeyF40: "\x1bO1;6S", - KeyF41: "\x1b[15;6~", - KeyF42: "\x1b[17;6~", - KeyF43: "\x1b[18;6~", - KeyF44: "\x1b[19;6~", - KeyF45: "\x1b[20;6~", - KeyF46: "\x1b[21;6~", - KeyF47: "\x1b[23;6~", - KeyF48: "\x1b[24;6~", - KeyF49: "\x1bO1;3P", - KeyF50: "\x1bO1;3Q", - KeyF51: "\x1bO1;3R", - KeyF52: "\x1bO1;3S", - KeyF53: "\x1b[15;3~", - KeyF54: "\x1b[17;3~", - KeyF55: "\x1b[18;3~", - KeyF56: "\x1b[19;3~", - KeyF57: "\x1b[20;3~", - KeyF58: "\x1b[21;3~", - KeyF59: "\x1b[23;3~", - KeyF60: "\x1b[24;3~", - KeyF61: "\x1bO1;4P", - KeyF62: "\x1bO1;4Q", - KeyF63: "\x1bO1;4R", - KeyBacktab: "\x1b[Z", - KeyShfLeft: "\x1b[1;2D", - KeyShfRight: "\x1b[1;2C", - KeyShfUp: "\x1b[1;2A", - KeyShfDown: "\x1b[1;2B", - KeyCtrlLeft: "\x1b[1;5D", - KeyCtrlRight: "\x1b[1;5C", - KeyCtrlUp: "\x1b[1;5A", - KeyCtrlDown: "\x1b[1;5B", - KeyMetaLeft: "\x1b[1;9D", - KeyMetaRight: "\x1b[1;9C", - KeyMetaUp: "\x1b[1;9A", - KeyMetaDown: "\x1b[1;9B", - KeyAltLeft: "\x1b[1;3D", - KeyAltRight: "\x1b[1;3C", - KeyAltUp: "\x1b[1;3A", - KeyAltDown: "\x1b[1;3B", - KeyAltShfLeft: "\x1b[1;4D", - KeyAltShfRight: "\x1b[1;4C", - KeyAltShfUp: "\x1b[1;4A", - KeyAltShfDown: "\x1b[1;4B", - KeyMetaShfLeft: "\x1b[1;10D", - KeyMetaShfRight: "\x1b[1;10C", - KeyMetaShfUp: "\x1b[1;10A", - KeyMetaShfDown: "\x1b[1;10B", - KeyCtrlShfLeft: "\x1b[1;6D", - KeyCtrlShfRight: "\x1b[1;6C", - KeyCtrlShfUp: "\x1b[1;6A", - KeyCtrlShfDown: "\x1b[1;6B", - KeyShfHome: "\x1b[1;2H", - KeyShfEnd: "\x1b[1;2F", - KeyCtrlHome: "\x1b[1;5H", - KeyCtrlEnd: "\x1b[1;5F", - KeyAltHome: "\x1b[1;9H", - KeyAltEnd: "\x1b[1;9F", - KeyCtrlShfHome: "\x1b[1;6H", - KeyCtrlShfEnd: "\x1b[1;6F", - KeyMetaShfHome: "\x1b[1;10H", - KeyMetaShfEnd: "\x1b[1;10F", - KeyAltShfHome: "\x1b[1;4H", - KeyAltShfEnd: "\x1b[1;4F", - KeyShfPgUp: "\x1b[5;2~", - KeyShfPgDn: "\x1b[6;2~", + Name: "gnome", + Columns: 80, + Lines: 24, + Colors: 8, + Bell: "\a", + Clear: "\x1b[H\x1b[2J", + EnterCA: "\x1b7\x1b[?47h", + ExitCA: "\x1b[2J\x1b[?47l\x1b8", + ShowCursor: "\x1b[?25h", + HideCursor: "\x1b[?25l", + AttrOff: "\x1b[0m\x0f", + Underline: "\x1b[4m", + Bold: "\x1b[1m", + Dim: "\x1b[2m", + Italic: "\x1b[3m", + Reverse: "\x1b[7m", + EnterKeypad: "\x1b[?1h\x1b=", + ExitKeypad: "\x1b[?1l\x1b>", + SetFg: "\x1b[3%p1%dm", + SetBg: "\x1b[4%p1%dm", + SetFgBg: "\x1b[3%p1%d;4%p2%dm", + PadChar: "\x00", + AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", + EnterAcs: "\x0e", + ExitAcs: "\x0f", + EnableAcs: "\x1b)0", + Mouse: "\x1b[M", + MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", + SetCursor: "\x1b[%i%p1%d;%p2%dH", + CursorBack1: "\b", + CursorUp1: "\x1b[A", + KeyUp: "\x1bOA", + KeyDown: "\x1bOB", + KeyRight: "\x1bOC", + KeyLeft: "\x1bOD", + KeyInsert: "\x1b[2~", + KeyDelete: "\x1b[3~", + KeyBackspace: "\u007f", + KeyHome: "\x1bOH", + KeyEnd: "\x1bOF", + KeyPgUp: "\x1b[5~", + KeyPgDn: "\x1b[6~", + KeyF1: "\x1bOP", + KeyF2: "\x1bOQ", + KeyF3: "\x1bOR", + KeyF4: "\x1bOS", + KeyF5: "\x1b[15~", + KeyF6: "\x1b[17~", + KeyF7: "\x1b[18~", + KeyF8: "\x1b[19~", + KeyF9: "\x1b[20~", + KeyF10: "\x1b[21~", + KeyF11: "\x1b[23~", + KeyF12: "\x1b[24~", + KeyBacktab: "\x1b[Z", + Modifiers: 1, }) // GNOME Terminal with xterm 256-colors terminfo.AddTerminfo(&terminfo.Terminfo{ - Name: "gnome-256color", - Columns: 80, - Lines: 24, - Colors: 256, - Bell: "\a", - Clear: "\x1b[H\x1b[2J", - EnterCA: "\x1b7\x1b[?47h", - ExitCA: "\x1b[2J\x1b[?47l\x1b8", - ShowCursor: "\x1b[?25h", - HideCursor: "\x1b[?25l", - AttrOff: "\x1b[0m\x0f", - Underline: "\x1b[4m", - Bold: "\x1b[1m", - Dim: "\x1b[2m", - Italic: "\x1b[3m", - Reverse: "\x1b[7m", - EnterKeypad: "\x1b[?1h\x1b=", - ExitKeypad: "\x1b[?1l\x1b>", - SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", - SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", - SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", - PadChar: "\x00", - AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", - EnterAcs: "\x0e", - ExitAcs: "\x0f", - EnableAcs: "\x1b)0", - Mouse: "\x1b[<", - MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", - SetCursor: "\x1b[%i%p1%d;%p2%dH", - CursorBack1: "\b", - CursorUp1: "\x1b[A", - KeyUp: "\x1bOA", - KeyDown: "\x1bOB", - KeyRight: "\x1bOC", - KeyLeft: "\x1bOD", - KeyInsert: "\x1b[2~", - KeyDelete: "\x1b[3~", - KeyBackspace: "\u007f", - KeyHome: "\x1bOH", - KeyEnd: "\x1bOF", - KeyPgUp: "\x1b[5~", - KeyPgDn: "\x1b[6~", - KeyF1: "\x1bOP", - KeyF2: "\x1bOQ", - KeyF3: "\x1bOR", - KeyF4: "\x1bOS", - KeyF5: "\x1b[15~", - KeyF6: "\x1b[17~", - KeyF7: "\x1b[18~", - KeyF8: "\x1b[19~", - KeyF9: "\x1b[20~", - KeyF10: "\x1b[21~", - KeyF11: "\x1b[23~", - KeyF12: "\x1b[24~", - KeyF13: "\x1b[1;2P", - KeyF14: "\x1b[1;2Q", - KeyF15: "\x1b[1;2R", - KeyF16: "\x1b[1;2S", - KeyF17: "\x1b[15;2~", - KeyF18: "\x1b[17;2~", - KeyF19: "\x1b[18;2~", - KeyF20: "\x1b[19;2~", - KeyF21: "\x1b[20;2~", - KeyF22: "\x1b[21;2~", - KeyF23: "\x1b[23;2~", - KeyF24: "\x1b[24;2~", - KeyF25: "\x1b[1;5P", - KeyF26: "\x1b[1;5Q", - KeyF27: "\x1b[1;5R", - KeyF28: "\x1b[1;5S", - KeyF29: "\x1b[15;5~", - KeyF30: "\x1b[17;5~", - KeyF31: "\x1b[18;5~", - KeyF32: "\x1b[19;5~", - KeyF33: "\x1b[20;5~", - KeyF34: "\x1b[21;5~", - KeyF35: "\x1b[23;5~", - KeyF36: "\x1b[24;5~", - KeyF37: "\x1b[1;6P", - KeyF38: "\x1b[1;6Q", - KeyF39: "\x1b[1;6R", - KeyF40: "\x1b[1;6S", - KeyF41: "\x1b[15;6~", - KeyF42: "\x1b[17;6~", - KeyF43: "\x1b[18;6~", - KeyF44: "\x1b[19;6~", - KeyF45: "\x1b[20;6~", - KeyF46: "\x1b[21;6~", - KeyF47: "\x1b[23;6~", - KeyF48: "\x1b[24;6~", - KeyF49: "\x1b[1;3P", - KeyF50: "\x1b[1;3Q", - KeyF51: "\x1b[1;3R", - KeyF52: "\x1b[1;3S", - KeyF53: "\x1b[15;3~", - KeyF54: "\x1b[17;3~", - KeyF55: "\x1b[18;3~", - KeyF56: "\x1b[19;3~", - KeyF57: "\x1b[20;3~", - KeyF58: "\x1b[21;3~", - KeyF59: "\x1b[23;3~", - KeyF60: "\x1b[24;3~", - KeyF61: "\x1b[1;4P", - KeyF62: "\x1b[1;4Q", - KeyF63: "\x1b[1;4R", - KeyBacktab: "\x1b[Z", - KeyShfLeft: "\x1b[1;2D", - KeyShfRight: "\x1b[1;2C", - KeyShfUp: "\x1b[1;2A", - KeyShfDown: "\x1b[1;2B", - KeyCtrlLeft: "\x1b[1;5D", - KeyCtrlRight: "\x1b[1;5C", - KeyCtrlUp: "\x1b[1;5A", - KeyCtrlDown: "\x1b[1;5B", - KeyMetaLeft: "\x1b[1;9D", - KeyMetaRight: "\x1b[1;9C", - KeyMetaUp: "\x1b[1;9A", - KeyMetaDown: "\x1b[1;9B", - KeyAltLeft: "\x1b[1;3D", - KeyAltRight: "\x1b[1;3C", - KeyAltUp: "\x1b[1;3A", - KeyAltDown: "\x1b[1;3B", - KeyAltShfLeft: "\x1b[1;4D", - KeyAltShfRight: "\x1b[1;4C", - KeyAltShfUp: "\x1b[1;4A", - KeyAltShfDown: "\x1b[1;4B", - KeyMetaShfLeft: "\x1b[1;10D", - KeyMetaShfRight: "\x1b[1;10C", - KeyMetaShfUp: "\x1b[1;10A", - KeyMetaShfDown: "\x1b[1;10B", - KeyCtrlShfLeft: "\x1b[1;6D", - KeyCtrlShfRight: "\x1b[1;6C", - KeyCtrlShfUp: "\x1b[1;6A", - KeyCtrlShfDown: "\x1b[1;6B", - KeyShfHome: "\x1b[1;2H", - KeyShfEnd: "\x1b[1;2F", - KeyCtrlHome: "\x1b[1;5H", - KeyCtrlEnd: "\x1b[1;5F", - KeyAltHome: "\x1b[1;9H", - KeyAltEnd: "\x1b[1;9F", - KeyCtrlShfHome: "\x1b[1;6H", - KeyCtrlShfEnd: "\x1b[1;6F", - KeyMetaShfHome: "\x1b[1;10H", - KeyMetaShfEnd: "\x1b[1;10F", - KeyAltShfHome: "\x1b[1;4H", - KeyAltShfEnd: "\x1b[1;4F", - KeyShfPgUp: "\x1b[5;2~", - KeyShfPgDn: "\x1b[6;2~", + Name: "gnome-256color", + Columns: 80, + Lines: 24, + Colors: 256, + Bell: "\a", + Clear: "\x1b[H\x1b[2J", + EnterCA: "\x1b7\x1b[?47h", + ExitCA: "\x1b[2J\x1b[?47l\x1b8", + ShowCursor: "\x1b[?25h", + HideCursor: "\x1b[?25l", + AttrOff: "\x1b[0m\x0f", + Underline: "\x1b[4m", + Bold: "\x1b[1m", + Dim: "\x1b[2m", + Italic: "\x1b[3m", + Reverse: "\x1b[7m", + EnterKeypad: "\x1b[?1h\x1b=", + ExitKeypad: "\x1b[?1l\x1b>", + SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", + SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", + SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", + PadChar: "\x00", + AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", + EnterAcs: "\x0e", + ExitAcs: "\x0f", + EnableAcs: "\x1b)0", + Mouse: "\x1b[M", + MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", + SetCursor: "\x1b[%i%p1%d;%p2%dH", + CursorBack1: "\b", + CursorUp1: "\x1b[A", + KeyUp: "\x1bOA", + KeyDown: "\x1bOB", + KeyRight: "\x1bOC", + KeyLeft: "\x1bOD", + KeyInsert: "\x1b[2~", + KeyDelete: "\x1b[3~", + KeyBackspace: "\u007f", + KeyHome: "\x1bOH", + KeyEnd: "\x1bOF", + KeyPgUp: "\x1b[5~", + KeyPgDn: "\x1b[6~", + KeyF1: "\x1bOP", + KeyF2: "\x1bOQ", + KeyF3: "\x1bOR", + KeyF4: "\x1bOS", + KeyF5: "\x1b[15~", + KeyF6: "\x1b[17~", + KeyF7: "\x1b[18~", + KeyF8: "\x1b[19~", + KeyF9: "\x1b[20~", + KeyF10: "\x1b[21~", + KeyF11: "\x1b[23~", + KeyF12: "\x1b[24~", + KeyBacktab: "\x1b[Z", + Modifiers: 1, }) } diff --git a/terminfo/k/konsole/term.go b/terminfo/k/konsole/term.go index c676b8c..57faa66 100644 --- a/terminfo/k/konsole/term.go +++ b/terminfo/k/konsole/term.go @@ -8,303 +8,119 @@ func init() { // KDE console window terminfo.AddTerminfo(&terminfo.Terminfo{ - Name: "konsole", - Columns: 80, - Lines: 24, - Colors: 8, - Clear: "\x1b[H\x1b[2J", - EnterCA: "\x1b7\x1b[?47h", - ExitCA: "\x1b[2J\x1b[?47l\x1b8", - ShowCursor: "\x1b[?25h", - HideCursor: "\x1b[?25l", - AttrOff: "\x1b[0m\x0f", - Underline: "\x1b[4m", - Bold: "\x1b[1m", - Dim: "\x1b[2m", - Italic: "\x1b[3m", - Blink: "\x1b[5m", - Reverse: "\x1b[7m", - EnterKeypad: "\x1b[?1h\x1b=", - ExitKeypad: "\x1b[?1l\x1b>", - SetFg: "\x1b[3%p1%dm", - SetBg: "\x1b[4%p1%dm", - SetFgBg: "\x1b[3%p1%d;4%p2%dm", - AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", - EnterAcs: "\x0e", - ExitAcs: "\x0f", - EnableAcs: "\x1b)0", - Mouse: "\x1b[M", - MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", - SetCursor: "\x1b[%i%p1%d;%p2%dH", - CursorBack1: "\b", - CursorUp1: "\x1b[A", - KeyUp: "\x1bOA", - KeyDown: "\x1bOB", - KeyRight: "\x1bOC", - KeyLeft: "\x1bOD", - KeyInsert: "\x1b[2~", - KeyDelete: "\x1b[3~", - KeyBackspace: "\u007f", - KeyHome: "\x1bOH", - KeyEnd: "\x1bOF", - KeyPgUp: "\x1b[5~", - KeyPgDn: "\x1b[6~", - KeyF1: "\x1bOP", - KeyF2: "\x1bOQ", - KeyF3: "\x1bOR", - KeyF4: "\x1bOS", - KeyF5: "\x1b[15~", - KeyF6: "\x1b[17~", - KeyF7: "\x1b[18~", - KeyF8: "\x1b[19~", - KeyF9: "\x1b[20~", - KeyF10: "\x1b[21~", - KeyF11: "\x1b[23~", - KeyF12: "\x1b[24~", - KeyF13: "\x1bO2P", - KeyF14: "\x1bO2Q", - KeyF15: "\x1bO2R", - KeyF16: "\x1bO2S", - KeyF17: "\x1b[15;2~", - KeyF18: "\x1b[17;2~", - KeyF19: "\x1b[18;2~", - KeyF20: "\x1b[19;2~", - KeyF21: "\x1b[20;2~", - KeyF22: "\x1b[21;2~", - KeyF23: "\x1b[23;2~", - KeyF24: "\x1b[24;2~", - KeyF25: "\x1bO5P", - KeyF26: "\x1bO5Q", - KeyF27: "\x1bO5R", - KeyF28: "\x1bO5S", - KeyF29: "\x1b[15;5~", - KeyF30: "\x1b[17;5~", - KeyF31: "\x1b[18;5~", - KeyF32: "\x1b[19;5~", - KeyF33: "\x1b[20;5~", - KeyF34: "\x1b[21;5~", - KeyF35: "\x1b[23;5~", - KeyF36: "\x1b[24;5~", - KeyF37: "\x1bO6P", - KeyF38: "\x1bO6Q", - KeyF39: "\x1bO6R", - KeyF40: "\x1bO6S", - KeyF41: "\x1b[15;6~", - KeyF42: "\x1b[17;6~", - KeyF43: "\x1b[18;6~", - KeyF44: "\x1b[19;6~", - KeyF45: "\x1b[20;6~", - KeyF46: "\x1b[21;6~", - KeyF47: "\x1b[23;6~", - KeyF48: "\x1b[24;6~", - KeyF49: "\x1bO3P", - KeyF50: "\x1bO3Q", - KeyF51: "\x1bO3R", - KeyF52: "\x1bO3S", - KeyF53: "\x1b[15;3~", - KeyF54: "\x1b[17;3~", - KeyF55: "\x1b[18;3~", - KeyF56: "\x1b[19;3~", - KeyF57: "\x1b[20;3~", - KeyF58: "\x1b[21;3~", - KeyF59: "\x1b[23;3~", - KeyF60: "\x1b[24;3~", - KeyF61: "\x1bO4P", - KeyF62: "\x1bO4Q", - KeyF63: "\x1bO4R", - KeyBacktab: "\x1b[Z", - KeyShfLeft: "\x1b[1;2D", - KeyShfRight: "\x1b[1;2C", - KeyShfUp: "\x1b[1;2A", - KeyShfDown: "\x1b[1;2B", - KeyCtrlLeft: "\x1b[1;5D", - KeyCtrlRight: "\x1b[1;5C", - KeyCtrlUp: "\x1b[1;5A", - KeyCtrlDown: "\x1b[1;5B", - KeyMetaLeft: "\x1b[1;9D", - KeyMetaRight: "\x1b[1;9C", - KeyMetaUp: "\x1b[1;9A", - KeyMetaDown: "\x1b[1;9B", - KeyAltLeft: "\x1b[1;3D", - KeyAltRight: "\x1b[1;3C", - KeyAltUp: "\x1b[1;3A", - KeyAltDown: "\x1b[1;3B", - KeyAltShfLeft: "\x1b[1;4D", - KeyAltShfRight: "\x1b[1;4C", - KeyAltShfUp: "\x1b[1;4A", - KeyAltShfDown: "\x1b[1;4B", - KeyMetaShfLeft: "\x1b[1;10D", - KeyMetaShfRight: "\x1b[1;10C", - KeyMetaShfUp: "\x1b[1;10A", - KeyMetaShfDown: "\x1b[1;10B", - KeyCtrlShfLeft: "\x1b[1;6D", - KeyCtrlShfRight: "\x1b[1;6C", - KeyCtrlShfUp: "\x1b[1;6A", - KeyCtrlShfDown: "\x1b[1;6B", - KeyShfHome: "\x1b[1;2H", - KeyShfEnd: "\x1b[1;2F", - KeyCtrlHome: "\x1b[1;5H", - KeyCtrlEnd: "\x1b[1;5F", - KeyAltHome: "\x1b[1;9H", - KeyAltEnd: "\x1b[1;9F", - KeyCtrlShfHome: "\x1b[1;6H", - KeyCtrlShfEnd: "\x1b[1;6F", - KeyMetaShfHome: "\x1b[1;10H", - KeyMetaShfEnd: "\x1b[1;10F", - KeyAltShfHome: "\x1b[1;4H", - KeyAltShfEnd: "\x1b[1;4F", - KeyShfPgUp: "\x1b[5;2~", - KeyShfPgDn: "\x1b[6;2~", + Name: "konsole", + Columns: 80, + Lines: 24, + Colors: 8, + Clear: "\x1b[H\x1b[2J", + EnterCA: "\x1b7\x1b[?47h", + ExitCA: "\x1b[2J\x1b[?47l\x1b8", + ShowCursor: "\x1b[?25h", + HideCursor: "\x1b[?25l", + AttrOff: "\x1b[0m\x0f", + Underline: "\x1b[4m", + Bold: "\x1b[1m", + Dim: "\x1b[2m", + Italic: "\x1b[3m", + Blink: "\x1b[5m", + Reverse: "\x1b[7m", + EnterKeypad: "\x1b[?1h\x1b=", + ExitKeypad: "\x1b[?1l\x1b>", + SetFg: "\x1b[3%p1%dm", + SetBg: "\x1b[4%p1%dm", + SetFgBg: "\x1b[3%p1%d;4%p2%dm", + AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", + EnterAcs: "\x0e", + ExitAcs: "\x0f", + EnableAcs: "\x1b)0", + Mouse: "\x1b[<", + MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", + SetCursor: "\x1b[%i%p1%d;%p2%dH", + CursorBack1: "\b", + CursorUp1: "\x1b[A", + KeyUp: "\x1bOA", + KeyDown: "\x1bOB", + KeyRight: "\x1bOC", + KeyLeft: "\x1bOD", + KeyInsert: "\x1b[2~", + KeyDelete: "\x1b[3~", + KeyBackspace: "\u007f", + KeyHome: "\x1bOH", + KeyEnd: "\x1bOF", + KeyPgUp: "\x1b[5~", + KeyPgDn: "\x1b[6~", + KeyF1: "\x1bOP", + KeyF2: "\x1bOQ", + KeyF3: "\x1bOR", + KeyF4: "\x1bOS", + KeyF5: "\x1b[15~", + KeyF6: "\x1b[17~", + KeyF7: "\x1b[18~", + KeyF8: "\x1b[19~", + KeyF9: "\x1b[20~", + KeyF10: "\x1b[21~", + KeyF11: "\x1b[23~", + KeyF12: "\x1b[24~", + KeyBacktab: "\x1b[Z", + Modifiers: 1, }) // KDE console window with xterm 256-colors terminfo.AddTerminfo(&terminfo.Terminfo{ - Name: "konsole-256color", - Columns: 80, - Lines: 24, - Colors: 256, - Clear: "\x1b[H\x1b[2J", - EnterCA: "\x1b7\x1b[?47h", - ExitCA: "\x1b[2J\x1b[?47l\x1b8", - ShowCursor: "\x1b[?25h", - HideCursor: "\x1b[?25l", - AttrOff: "\x1b[0m\x0f", - Underline: "\x1b[4m", - Bold: "\x1b[1m", - Dim: "\x1b[2m", - Italic: "\x1b[3m", - Blink: "\x1b[5m", - Reverse: "\x1b[7m", - EnterKeypad: "\x1b[?1h\x1b=", - ExitKeypad: "\x1b[?1l\x1b>", - SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", - SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", - SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", - AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", - EnterAcs: "\x0e", - ExitAcs: "\x0f", - EnableAcs: "\x1b)0", - Mouse: "\x1b[M", - MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", - SetCursor: "\x1b[%i%p1%d;%p2%dH", - CursorBack1: "\b", - CursorUp1: "\x1b[A", - KeyUp: "\x1bOA", - KeyDown: "\x1bOB", - KeyRight: "\x1bOC", - KeyLeft: "\x1bOD", - KeyInsert: "\x1b[2~", - KeyDelete: "\x1b[3~", - KeyBackspace: "\u007f", - KeyHome: "\x1bOH", - KeyEnd: "\x1bOF", - KeyPgUp: "\x1b[5~", - KeyPgDn: "\x1b[6~", - KeyF1: "\x1bOP", - KeyF2: "\x1bOQ", - KeyF3: "\x1bOR", - KeyF4: "\x1bOS", - KeyF5: "\x1b[15~", - KeyF6: "\x1b[17~", - KeyF7: "\x1b[18~", - KeyF8: "\x1b[19~", - KeyF9: "\x1b[20~", - KeyF10: "\x1b[21~", - KeyF11: "\x1b[23~", - KeyF12: "\x1b[24~", - KeyF13: "\x1bO2P", - KeyF14: "\x1bO2Q", - KeyF15: "\x1bO2R", - KeyF16: "\x1bO2S", - KeyF17: "\x1b[15;2~", - KeyF18: "\x1b[17;2~", - KeyF19: "\x1b[18;2~", - KeyF20: "\x1b[19;2~", - KeyF21: "\x1b[20;2~", - KeyF22: "\x1b[21;2~", - KeyF23: "\x1b[23;2~", - KeyF24: "\x1b[24;2~", - KeyF25: "\x1bO5P", - KeyF26: "\x1bO5Q", - KeyF27: "\x1bO5R", - KeyF28: "\x1bO5S", - KeyF29: "\x1b[15;5~", - KeyF30: "\x1b[17;5~", - KeyF31: "\x1b[18;5~", - KeyF32: "\x1b[19;5~", - KeyF33: "\x1b[20;5~", - KeyF34: "\x1b[21;5~", - KeyF35: "\x1b[23;5~", - KeyF36: "\x1b[24;5~", - KeyF37: "\x1bO6P", - KeyF38: "\x1bO6Q", - KeyF39: "\x1bO6R", - KeyF40: "\x1bO6S", - KeyF41: "\x1b[15;6~", - KeyF42: "\x1b[17;6~", - KeyF43: "\x1b[18;6~", - KeyF44: "\x1b[19;6~", - KeyF45: "\x1b[20;6~", - KeyF46: "\x1b[21;6~", - KeyF47: "\x1b[23;6~", - KeyF48: "\x1b[24;6~", - KeyF49: "\x1bO3P", - KeyF50: "\x1bO3Q", - KeyF51: "\x1bO3R", - KeyF52: "\x1bO3S", - KeyF53: "\x1b[15;3~", - KeyF54: "\x1b[17;3~", - KeyF55: "\x1b[18;3~", - KeyF56: "\x1b[19;3~", - KeyF57: "\x1b[20;3~", - KeyF58: "\x1b[21;3~", - KeyF59: "\x1b[23;3~", - KeyF60: "\x1b[24;3~", - KeyF61: "\x1bO4P", - KeyF62: "\x1bO4Q", - KeyF63: "\x1bO4R", - KeyBacktab: "\x1b[Z", - KeyShfLeft: "\x1b[1;2D", - KeyShfRight: "\x1b[1;2C", - KeyShfUp: "\x1b[1;2A", - KeyShfDown: "\x1b[1;2B", - KeyCtrlLeft: "\x1b[1;5D", - KeyCtrlRight: "\x1b[1;5C", - KeyCtrlUp: "\x1b[1;5A", - KeyCtrlDown: "\x1b[1;5B", - KeyMetaLeft: "\x1b[1;9D", - KeyMetaRight: "\x1b[1;9C", - KeyMetaUp: "\x1b[1;9A", - KeyMetaDown: "\x1b[1;9B", - KeyAltLeft: "\x1b[1;3D", - KeyAltRight: "\x1b[1;3C", - KeyAltUp: "\x1b[1;3A", - KeyAltDown: "\x1b[1;3B", - KeyAltShfLeft: "\x1b[1;4D", - KeyAltShfRight: "\x1b[1;4C", - KeyAltShfUp: "\x1b[1;4A", - KeyAltShfDown: "\x1b[1;4B", - KeyMetaShfLeft: "\x1b[1;10D", - KeyMetaShfRight: "\x1b[1;10C", - KeyMetaShfUp: "\x1b[1;10A", - KeyMetaShfDown: "\x1b[1;10B", - KeyCtrlShfLeft: "\x1b[1;6D", - KeyCtrlShfRight: "\x1b[1;6C", - KeyCtrlShfUp: "\x1b[1;6A", - KeyCtrlShfDown: "\x1b[1;6B", - KeyShfHome: "\x1b[1;2H", - KeyShfEnd: "\x1b[1;2F", - KeyCtrlHome: "\x1b[1;5H", - KeyCtrlEnd: "\x1b[1;5F", - KeyAltHome: "\x1b[1;9H", - KeyAltEnd: "\x1b[1;9F", - KeyCtrlShfHome: "\x1b[1;6H", - KeyCtrlShfEnd: "\x1b[1;6F", - KeyMetaShfHome: "\x1b[1;10H", - KeyMetaShfEnd: "\x1b[1;10F", - KeyAltShfHome: "\x1b[1;4H", - KeyAltShfEnd: "\x1b[1;4F", - KeyShfPgUp: "\x1b[5;2~", - KeyShfPgDn: "\x1b[6;2~", + Name: "konsole-256color", + Columns: 80, + Lines: 24, + Colors: 256, + Clear: "\x1b[H\x1b[2J", + EnterCA: "\x1b7\x1b[?47h", + ExitCA: "\x1b[2J\x1b[?47l\x1b8", + ShowCursor: "\x1b[?25h", + HideCursor: "\x1b[?25l", + AttrOff: "\x1b[0m\x0f", + Underline: "\x1b[4m", + Bold: "\x1b[1m", + Dim: "\x1b[2m", + Italic: "\x1b[3m", + Blink: "\x1b[5m", + Reverse: "\x1b[7m", + EnterKeypad: "\x1b[?1h\x1b=", + ExitKeypad: "\x1b[?1l\x1b>", + SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", + SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", + SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", + AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", + EnterAcs: "\x0e", + ExitAcs: "\x0f", + EnableAcs: "\x1b)0", + Mouse: "\x1b[<", + MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", + SetCursor: "\x1b[%i%p1%d;%p2%dH", + CursorBack1: "\b", + CursorUp1: "\x1b[A", + KeyUp: "\x1bOA", + KeyDown: "\x1bOB", + KeyRight: "\x1bOC", + KeyLeft: "\x1bOD", + KeyInsert: "\x1b[2~", + KeyDelete: "\x1b[3~", + KeyBackspace: "\u007f", + KeyHome: "\x1bOH", + KeyEnd: "\x1bOF", + KeyPgUp: "\x1b[5~", + KeyPgDn: "\x1b[6~", + KeyF1: "\x1bOP", + KeyF2: "\x1bOQ", + KeyF3: "\x1bOR", + KeyF4: "\x1bOS", + KeyF5: "\x1b[15~", + KeyF6: "\x1b[17~", + KeyF7: "\x1b[18~", + KeyF8: "\x1b[19~", + KeyF9: "\x1b[20~", + KeyF10: "\x1b[21~", + KeyF11: "\x1b[23~", + KeyF12: "\x1b[24~", + KeyBacktab: "\x1b[Z", + Modifiers: 1, }) } diff --git a/terminfo/mkinfo.go b/terminfo/mkinfo.go index 0131163..175fdec 100644 --- a/terminfo/mkinfo.go +++ b/terminfo/mkinfo.go @@ -1,6 +1,6 @@ // +build ignore -// Copyright 2019 The TCell Authors +// Copyright 2020 The TCell Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use file except in compliance with the License. @@ -249,58 +249,6 @@ func getinfo(name string) (*terminfo.Terminfo, string, error) { t.KeyF10 = tc.getstr("kf10") t.KeyF11 = tc.getstr("kf11") t.KeyF12 = tc.getstr("kf12") - t.KeyF13 = tc.getstr("kf13") - t.KeyF14 = tc.getstr("kf14") - t.KeyF15 = tc.getstr("kf15") - t.KeyF16 = tc.getstr("kf16") - t.KeyF17 = tc.getstr("kf17") - t.KeyF18 = tc.getstr("kf18") - t.KeyF19 = tc.getstr("kf19") - t.KeyF20 = tc.getstr("kf20") - t.KeyF21 = tc.getstr("kf21") - t.KeyF22 = tc.getstr("kf22") - t.KeyF23 = tc.getstr("kf23") - t.KeyF24 = tc.getstr("kf24") - t.KeyF25 = tc.getstr("kf25") - t.KeyF26 = tc.getstr("kf26") - t.KeyF27 = tc.getstr("kf27") - t.KeyF28 = tc.getstr("kf28") - t.KeyF29 = tc.getstr("kf29") - t.KeyF30 = tc.getstr("kf30") - t.KeyF31 = tc.getstr("kf31") - t.KeyF32 = tc.getstr("kf32") - t.KeyF33 = tc.getstr("kf33") - t.KeyF34 = tc.getstr("kf34") - t.KeyF35 = tc.getstr("kf35") - t.KeyF36 = tc.getstr("kf36") - t.KeyF37 = tc.getstr("kf37") - t.KeyF38 = tc.getstr("kf38") - t.KeyF39 = tc.getstr("kf39") - t.KeyF40 = tc.getstr("kf40") - t.KeyF41 = tc.getstr("kf41") - t.KeyF42 = tc.getstr("kf42") - t.KeyF43 = tc.getstr("kf43") - t.KeyF44 = tc.getstr("kf44") - t.KeyF45 = tc.getstr("kf45") - t.KeyF46 = tc.getstr("kf46") - t.KeyF47 = tc.getstr("kf47") - t.KeyF48 = tc.getstr("kf48") - t.KeyF49 = tc.getstr("kf49") - t.KeyF50 = tc.getstr("kf50") - t.KeyF51 = tc.getstr("kf51") - t.KeyF52 = tc.getstr("kf52") - t.KeyF53 = tc.getstr("kf53") - t.KeyF54 = tc.getstr("kf54") - t.KeyF55 = tc.getstr("kf55") - t.KeyF56 = tc.getstr("kf56") - t.KeyF57 = tc.getstr("kf57") - t.KeyF58 = tc.getstr("kf58") - t.KeyF59 = tc.getstr("kf59") - t.KeyF60 = tc.getstr("kf60") - t.KeyF61 = tc.getstr("kf61") - t.KeyF62 = tc.getstr("kf62") - t.KeyF63 = tc.getstr("kf63") - t.KeyF64 = tc.getstr("kf64") t.KeyInsert = tc.getstr("kich1") t.KeyDelete = tc.getstr("kdch1") t.KeyBackspace = tc.getstr("kbs") @@ -323,64 +271,84 @@ func getinfo(name string) (*terminfo.Terminfo, string, error) { t.ExitAcs = tc.getstr("rmacs") t.EnableAcs = tc.getstr("enacs") t.Mouse = tc.getstr("kmous") - t.KeyShfRight = tc.getstr("kRIT") - t.KeyShfLeft = tc.getstr("kLFT") - t.KeyShfHome = tc.getstr("kHOM") - t.KeyShfEnd = tc.getstr("kEND") + + t.Modifiers = terminfo.ModifiersNone // Terminfo lacks descriptions for a bunch of modified keys, - // 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.KeyShfUp = "\x1b[1;2A" - t.KeyShfDown = "\x1b[1;2B" - t.KeyMetaUp = "\x1b[1;9A" - t.KeyMetaDown = "\x1b[1;9B" - t.KeyMetaRight = "\x1b[1;9C" - t.KeyMetaLeft = "\x1b[1;9D" - t.KeyAltUp = "\x1b[1;3A" - t.KeyAltDown = "\x1b[1;3B" - t.KeyAltRight = "\x1b[1;3C" - t.KeyAltLeft = "\x1b[1;3D" - t.KeyCtrlUp = "\x1b[1;5A" - t.KeyCtrlDown = "\x1b[1;5B" - t.KeyCtrlRight = "\x1b[1;5C" - t.KeyCtrlLeft = "\x1b[1;5D" - t.KeyAltShfUp = "\x1b[1;4A" - t.KeyAltShfDown = "\x1b[1;4B" - t.KeyAltShfRight = "\x1b[1;4C" - t.KeyAltShfLeft = "\x1b[1;4D" - - t.KeyMetaShfUp = "\x1b[1;10A" - t.KeyMetaShfDown = "\x1b[1;10B" - t.KeyMetaShfRight = "\x1b[1;10C" - t.KeyMetaShfLeft = "\x1b[1;10D" - - t.KeyCtrlShfUp = "\x1b[1;6A" - t.KeyCtrlShfDown = "\x1b[1;6B" - t.KeyCtrlShfRight = "\x1b[1;6C" - t.KeyCtrlShfLeft = "\x1b[1;6D" - - t.KeyShfPgUp = "\x1b[5;2~" - t.KeyShfPgDn = "\x1b[6;2~" - } - // And also for Home and End - if t.KeyShfHome == "\x1b[1;2H" && t.KeyShfEnd == "\x1b[1;2F" { - t.KeyCtrlHome = "\x1b[1;5H" - t.KeyCtrlEnd = "\x1b[1;5F" - t.KeyAltHome = "\x1b[1;9H" - t.KeyAltEnd = "\x1b[1;9F" - t.KeyCtrlShfHome = "\x1b[1;6H" - t.KeyCtrlShfEnd = "\x1b[1;6F" - t.KeyAltShfHome = "\x1b[1;4H" - t.KeyAltShfEnd = "\x1b[1;4F" - t.KeyMetaShfHome = "\x1b[1;10H" - t.KeyMetaShfEnd = "\x1b[1;10F" + // but modern XTerm and emulators often have them. We detect + // this based on compatible definitions for shifted right. + // We also choose to use our modifiers for function keys -- + // the terminfo entries list these all as higher coded escape + // keys, but it's nicer to match them to modifiers. + if tc.getstr("kRIT") == "\x1b[1;2C" { + t.Modifiers = terminfo.ModifiersXTerm + } else { + // Lookup high level function keys. + t.KeyShfInsert = tc.getstr("kIC") + t.KeyShfDelete = tc.getstr("kDC") + t.KeyShfRight = tc.getstr("kRIT") + t.KeyShfLeft = tc.getstr("kLFT") + t.KeyShfHome = tc.getstr("kHOM") + t.KeyShfEnd = tc.getstr("kEND") + t.KeyF13 = tc.getstr("kf13") + t.KeyF14 = tc.getstr("kf14") + t.KeyF15 = tc.getstr("kf15") + t.KeyF16 = tc.getstr("kf16") + t.KeyF17 = tc.getstr("kf17") + t.KeyF18 = tc.getstr("kf18") + t.KeyF19 = tc.getstr("kf19") + t.KeyF20 = tc.getstr("kf20") + t.KeyF21 = tc.getstr("kf21") + t.KeyF22 = tc.getstr("kf22") + t.KeyF23 = tc.getstr("kf23") + t.KeyF24 = tc.getstr("kf24") + t.KeyF25 = tc.getstr("kf25") + t.KeyF26 = tc.getstr("kf26") + t.KeyF27 = tc.getstr("kf27") + t.KeyF28 = tc.getstr("kf28") + t.KeyF29 = tc.getstr("kf29") + t.KeyF30 = tc.getstr("kf30") + t.KeyF31 = tc.getstr("kf31") + t.KeyF32 = tc.getstr("kf32") + t.KeyF33 = tc.getstr("kf33") + t.KeyF34 = tc.getstr("kf34") + t.KeyF35 = tc.getstr("kf35") + t.KeyF36 = tc.getstr("kf36") + t.KeyF37 = tc.getstr("kf37") + t.KeyF38 = tc.getstr("kf38") + t.KeyF39 = tc.getstr("kf39") + t.KeyF40 = tc.getstr("kf40") + t.KeyF41 = tc.getstr("kf41") + t.KeyF42 = tc.getstr("kf42") + t.KeyF43 = tc.getstr("kf43") + t.KeyF44 = tc.getstr("kf44") + t.KeyF45 = tc.getstr("kf45") + t.KeyF46 = tc.getstr("kf46") + t.KeyF47 = tc.getstr("kf47") + t.KeyF48 = tc.getstr("kf48") + t.KeyF49 = tc.getstr("kf49") + t.KeyF50 = tc.getstr("kf50") + t.KeyF51 = tc.getstr("kf51") + t.KeyF52 = tc.getstr("kf52") + t.KeyF53 = tc.getstr("kf53") + t.KeyF54 = tc.getstr("kf54") + t.KeyF55 = tc.getstr("kf55") + t.KeyF56 = tc.getstr("kf56") + t.KeyF57 = tc.getstr("kf57") + t.KeyF58 = tc.getstr("kf58") + t.KeyF59 = tc.getstr("kf59") + t.KeyF60 = tc.getstr("kf60") + t.KeyF61 = tc.getstr("kf61") + t.KeyF62 = tc.getstr("kf62") + t.KeyF63 = tc.getstr("kf63") + t.KeyF64 = tc.getstr("kf64") } - // And the same thing for rxvt and workalikes (Eterm, aterm, etc.) + // And the same thing for rxvt. // It seems that urxvt at least send ESC as ALT prefix for these, - // although some places seem to indicate a separate ALT key sesquence. + // although some places seem to indicate a separate ALT key sequence. + // Users are encouraged to update to an emulator that more closely + // matches xterm for better functionality. if t.KeyShfRight == "\x1b[c" && t.KeyShfLeft == "\x1b[d" { t.KeyShfUp = "\x1b[a" t.KeyShfDown = "\x1b[b" @@ -553,6 +521,8 @@ func dotGoInfo(w io.Writer, terms []*TData) { dotGoAddStr(w, "KeyF10", t.KeyF10) dotGoAddStr(w, "KeyF11", t.KeyF11) dotGoAddStr(w, "KeyF12", t.KeyF12) + // Extended keys. We don't report these if they are going to be + // handled as if they were XTerm sequences. dotGoAddStr(w, "KeyF13", t.KeyF13) dotGoAddStr(w, "KeyF14", t.KeyF14) dotGoAddStr(w, "KeyF15", t.KeyF15) @@ -615,46 +585,17 @@ func dotGoInfo(w io.Writer, terms []*TData) { dotGoAddStr(w, "KeyShfRight", t.KeyShfRight) dotGoAddStr(w, "KeyShfUp", t.KeyShfUp) dotGoAddStr(w, "KeyShfDown", t.KeyShfDown) - dotGoAddStr(w, "KeyCtrlLeft", t.KeyCtrlLeft) - dotGoAddStr(w, "KeyCtrlRight", t.KeyCtrlRight) - dotGoAddStr(w, "KeyCtrlUp", t.KeyCtrlUp) - dotGoAddStr(w, "KeyCtrlDown", t.KeyCtrlDown) - dotGoAddStr(w, "KeyMetaLeft", t.KeyMetaLeft) - dotGoAddStr(w, "KeyMetaRight", t.KeyMetaRight) - dotGoAddStr(w, "KeyMetaUp", t.KeyMetaUp) - dotGoAddStr(w, "KeyMetaDown", t.KeyMetaDown) - dotGoAddStr(w, "KeyAltLeft", t.KeyAltLeft) - dotGoAddStr(w, "KeyAltRight", t.KeyAltRight) - dotGoAddStr(w, "KeyAltUp", t.KeyAltUp) - dotGoAddStr(w, "KeyAltDown", t.KeyAltDown) - dotGoAddStr(w, "KeyAltShfLeft", t.KeyAltShfLeft) - dotGoAddStr(w, "KeyAltShfRight", t.KeyAltShfRight) - dotGoAddStr(w, "KeyAltShfUp", t.KeyAltShfUp) - dotGoAddStr(w, "KeyAltShfDown", t.KeyAltShfDown) - dotGoAddStr(w, "KeyMetaShfLeft", t.KeyMetaShfLeft) - dotGoAddStr(w, "KeyMetaShfRight", t.KeyMetaShfRight) - dotGoAddStr(w, "KeyMetaShfUp", t.KeyMetaShfUp) - dotGoAddStr(w, "KeyMetaShfDown", t.KeyMetaShfDown) - dotGoAddStr(w, "KeyCtrlShfLeft", t.KeyCtrlShfLeft) - dotGoAddStr(w, "KeyCtrlShfRight", t.KeyCtrlShfRight) - dotGoAddStr(w, "KeyCtrlShfUp", t.KeyCtrlShfUp) - dotGoAddStr(w, "KeyCtrlShfDown", t.KeyCtrlShfDown) dotGoAddStr(w, "KeyShfHome", t.KeyShfHome) dotGoAddStr(w, "KeyShfEnd", t.KeyShfEnd) + dotGoAddStr(w, "KeyShfInsert", t.KeyShfInsert) + dotGoAddStr(w, "KeyShfDelete", t.KeyShfDelete) + dotGoAddStr(w, "KeyCtrlUp", t.KeyCtrlUp) + dotGoAddStr(w, "KeyCtrlDown", t.KeyCtrlDown) + dotGoAddStr(w, "KeyCtrlRight", t.KeyCtrlRight) + dotGoAddStr(w, "KeyCtrlLeft", t.KeyCtrlLeft) dotGoAddStr(w, "KeyCtrlHome", t.KeyCtrlHome) dotGoAddStr(w, "KeyCtrlEnd", t.KeyCtrlEnd) - dotGoAddStr(w, "KeyMetaHome", t.KeyMetaHome) - dotGoAddStr(w, "KeyMetaEnd", t.KeyMetaEnd) - dotGoAddStr(w, "KeyAltHome", t.KeyAltHome) - dotGoAddStr(w, "KeyAltEnd", t.KeyAltEnd) - dotGoAddStr(w, "KeyCtrlShfHome", t.KeyCtrlShfHome) - dotGoAddStr(w, "KeyCtrlShfEnd", t.KeyCtrlShfEnd) - dotGoAddStr(w, "KeyMetaShfHome", t.KeyMetaShfHome) - dotGoAddStr(w, "KeyMetaShfEnd", t.KeyMetaShfEnd) - dotGoAddStr(w, "KeyAltShfHome", t.KeyAltShfHome) - dotGoAddStr(w, "KeyAltShfEnd", t.KeyAltShfEnd) - dotGoAddStr(w, "KeyShfPgUp", t.KeyShfPgUp) - dotGoAddStr(w, "KeyShfPgDn", t.KeyShfPgDn) + dotGoAddInt(w, "Modifiers", t.Modifiers) fmt.Fprintln(w, "\t})") } fmt.Fprintln(w, "}") diff --git a/terminfo/r/rxvt/term.go b/terminfo/r/rxvt/term.go index 69eb4b4..8db8989 100644 --- a/terminfo/r/rxvt/term.go +++ b/terminfo/r/rxvt/term.go @@ -98,12 +98,13 @@ func init() { KeyShfRight: "\x1b[c", KeyShfUp: "\x1b[a", KeyShfDown: "\x1b[b", - KeyCtrlLeft: "\x1b[Od", - KeyCtrlRight: "\x1b[Oc", - KeyCtrlUp: "\x1b[Oa", - KeyCtrlDown: "\x1b[Ob", KeyShfHome: "\x1b[7$", KeyShfEnd: "\x1b[8$", + KeyShfDelete: "\x1b[3$", + KeyCtrlUp: "\x1b[Oa", + KeyCtrlDown: "\x1b[Ob", + KeyCtrlRight: "\x1b[Oc", + KeyCtrlLeft: "\x1b[Od", KeyCtrlHome: "\x1b[7^", KeyCtrlEnd: "\x1b[8^", }) @@ -200,12 +201,13 @@ func init() { KeyShfRight: "\x1b[c", KeyShfUp: "\x1b[a", KeyShfDown: "\x1b[b", - KeyCtrlLeft: "\x1b[Od", - KeyCtrlRight: "\x1b[Oc", - KeyCtrlUp: "\x1b[Oa", - KeyCtrlDown: "\x1b[Ob", KeyShfHome: "\x1b[7$", KeyShfEnd: "\x1b[8$", + KeyShfDelete: "\x1b[3$", + KeyCtrlUp: "\x1b[Oa", + KeyCtrlDown: "\x1b[Ob", + KeyCtrlRight: "\x1b[Oc", + KeyCtrlLeft: "\x1b[Od", KeyCtrlHome: "\x1b[7^", KeyCtrlEnd: "\x1b[8^", }) @@ -302,12 +304,13 @@ func init() { KeyShfRight: "\x1b[c", KeyShfUp: "\x1b[a", KeyShfDown: "\x1b[b", - KeyCtrlLeft: "\x1b[Od", - KeyCtrlRight: "\x1b[Oc", - KeyCtrlUp: "\x1b[Oa", - KeyCtrlDown: "\x1b[Ob", KeyShfHome: "\x1b[7$", KeyShfEnd: "\x1b[8$", + KeyShfDelete: "\x1b[3$", + KeyCtrlUp: "\x1b[Oa", + KeyCtrlDown: "\x1b[Ob", + KeyCtrlRight: "\x1b[Oc", + KeyCtrlLeft: "\x1b[Od", KeyCtrlHome: "\x1b[7^", KeyCtrlEnd: "\x1b[8^", }) @@ -379,12 +382,14 @@ func init() { KeyShfRight: "\x1b[c", KeyShfUp: "\x1b[a", KeyShfDown: "\x1b[b", - KeyCtrlLeft: "\x1b[Od", - KeyCtrlRight: "\x1b[Oc", - KeyCtrlUp: "\x1b[Oa", - KeyCtrlDown: "\x1b[Ob", KeyShfHome: "\x1b[7$", KeyShfEnd: "\x1b[8$", + KeyShfInsert: "\x1b[2$", + KeyShfDelete: "\x1b[3$", + KeyCtrlUp: "\x1b[Oa", + KeyCtrlDown: "\x1b[Ob", + KeyCtrlRight: "\x1b[Oc", + KeyCtrlLeft: "\x1b[Od", KeyCtrlHome: "\x1b[7^", KeyCtrlEnd: "\x1b[8^", }) @@ -456,12 +461,14 @@ func init() { KeyShfRight: "\x1b[c", KeyShfUp: "\x1b[a", KeyShfDown: "\x1b[b", - KeyCtrlLeft: "\x1b[Od", - KeyCtrlRight: "\x1b[Oc", - KeyCtrlUp: "\x1b[Oa", - KeyCtrlDown: "\x1b[Ob", KeyShfHome: "\x1b[7$", KeyShfEnd: "\x1b[8$", + KeyShfInsert: "\x1b[2$", + KeyShfDelete: "\x1b[3$", + KeyCtrlUp: "\x1b[Oa", + KeyCtrlDown: "\x1b[Ob", + KeyCtrlRight: "\x1b[Oc", + KeyCtrlLeft: "\x1b[Od", KeyCtrlHome: "\x1b[7^", KeyCtrlEnd: "\x1b[8^", }) diff --git a/terminfo/s/simpleterm/term.go b/terminfo/s/simpleterm/term.go index 1ec6061..e30f1a8 100644 --- a/terminfo/s/simpleterm/term.go +++ b/terminfo/s/simpleterm/term.go @@ -8,307 +8,123 @@ func init() { // simpleterm terminfo.AddTerminfo(&terminfo.Terminfo{ - Name: "st", - Aliases: []string{"stterm"}, - Columns: 80, - Lines: 24, - Colors: 8, - Bell: "\a", - Clear: "\x1b[H\x1b[2J", - EnterCA: "\x1b[?1049h", - ExitCA: "\x1b[?1049l", - ShowCursor: "\x1b[?12l\x1b[?25h", - HideCursor: "\x1b[?25l", - AttrOff: "\x1b[0m", - Underline: "\x1b[4m", - Bold: "\x1b[1m", - Dim: "\x1b[2m", - Italic: "\x1b[3m", - Blink: "\x1b[5m", - Reverse: "\x1b[7m", - EnterKeypad: "\x1b[?1h\x1b=", - ExitKeypad: "\x1b[?1l\x1b>", - SetFg: "\x1b[3%p1%dm", - SetBg: "\x1b[4%p1%dm", - SetFgBg: "\x1b[3%p1%d;4%p2%dm", - AltChars: "+C,D-A.B0E``aaffgghFiGjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", - EnterAcs: "\x1b(0", - ExitAcs: "\x1b(B", - EnableAcs: "\x1b)0", - Mouse: "\x1b[M", - MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", - SetCursor: "\x1b[%i%p1%d;%p2%dH", - CursorBack1: "\b", - CursorUp1: "\x1b[A", - KeyUp: "\x1bOA", - KeyDown: "\x1bOB", - KeyRight: "\x1bOC", - KeyLeft: "\x1bOD", - KeyInsert: "\x1b[2~", - KeyDelete: "\x1b[3~", - KeyBackspace: "\u007f", - KeyHome: "\x1b[1~", - KeyEnd: "\x1b[4~", - KeyPgUp: "\x1b[5~", - KeyPgDn: "\x1b[6~", - KeyF1: "\x1bOP", - KeyF2: "\x1bOQ", - KeyF3: "\x1bOR", - KeyF4: "\x1bOS", - KeyF5: "\x1b[15~", - KeyF6: "\x1b[17~", - KeyF7: "\x1b[18~", - KeyF8: "\x1b[19~", - KeyF9: "\x1b[20~", - KeyF10: "\x1b[21~", - KeyF11: "\x1b[23~", - KeyF12: "\x1b[24~", - KeyF13: "\x1b[1;2P", - KeyF14: "\x1b[1;2Q", - KeyF15: "\x1b[1;2R", - KeyF16: "\x1b[1;2S", - KeyF17: "\x1b[15;2~", - KeyF18: "\x1b[17;2~", - KeyF19: "\x1b[18;2~", - KeyF20: "\x1b[19;2~", - KeyF21: "\x1b[20;2~", - KeyF22: "\x1b[21;2~", - KeyF23: "\x1b[23;2~", - KeyF24: "\x1b[24;2~", - KeyF25: "\x1b[1;5P", - KeyF26: "\x1b[1;5Q", - KeyF27: "\x1b[1;5R", - KeyF28: "\x1b[1;5S", - KeyF29: "\x1b[15;5~", - KeyF30: "\x1b[17;5~", - KeyF31: "\x1b[18;5~", - KeyF32: "\x1b[19;5~", - KeyF33: "\x1b[20;5~", - KeyF34: "\x1b[21;5~", - KeyF35: "\x1b[23;5~", - KeyF36: "\x1b[24;5~", - KeyF37: "\x1b[1;6P", - KeyF38: "\x1b[1;6Q", - KeyF39: "\x1b[1;6R", - KeyF40: "\x1b[1;6S", - KeyF41: "\x1b[15;6~", - KeyF42: "\x1b[17;6~", - KeyF43: "\x1b[18;6~", - KeyF44: "\x1b[19;6~", - KeyF45: "\x1b[20;6~", - KeyF46: "\x1b[21;6~", - KeyF47: "\x1b[23;6~", - KeyF48: "\x1b[24;6~", - KeyF49: "\x1b[1;3P", - KeyF50: "\x1b[1;3Q", - KeyF51: "\x1b[1;3R", - KeyF52: "\x1b[1;3S", - KeyF53: "\x1b[15;3~", - KeyF54: "\x1b[17;3~", - KeyF55: "\x1b[18;3~", - KeyF56: "\x1b[19;3~", - KeyF57: "\x1b[20;3~", - KeyF58: "\x1b[21;3~", - KeyF59: "\x1b[23;3~", - KeyF60: "\x1b[24;3~", - KeyF61: "\x1b[1;4P", - KeyF62: "\x1b[1;4Q", - KeyF63: "\x1b[1;4R", - KeyClear: "\x1b[3;5~", - KeyShfLeft: "\x1b[1;2D", - KeyShfRight: "\x1b[1;2C", - KeyShfUp: "\x1b[1;2A", - KeyShfDown: "\x1b[1;2B", - KeyCtrlLeft: "\x1b[1;5D", - KeyCtrlRight: "\x1b[1;5C", - KeyCtrlUp: "\x1b[1;5A", - KeyCtrlDown: "\x1b[1;5B", - KeyMetaLeft: "\x1b[1;9D", - KeyMetaRight: "\x1b[1;9C", - KeyMetaUp: "\x1b[1;9A", - KeyMetaDown: "\x1b[1;9B", - KeyAltLeft: "\x1b[1;3D", - KeyAltRight: "\x1b[1;3C", - KeyAltUp: "\x1b[1;3A", - KeyAltDown: "\x1b[1;3B", - KeyAltShfLeft: "\x1b[1;4D", - KeyAltShfRight: "\x1b[1;4C", - KeyAltShfUp: "\x1b[1;4A", - KeyAltShfDown: "\x1b[1;4B", - KeyMetaShfLeft: "\x1b[1;10D", - KeyMetaShfRight: "\x1b[1;10C", - KeyMetaShfUp: "\x1b[1;10A", - KeyMetaShfDown: "\x1b[1;10B", - KeyCtrlShfLeft: "\x1b[1;6D", - KeyCtrlShfRight: "\x1b[1;6C", - KeyCtrlShfUp: "\x1b[1;6A", - KeyCtrlShfDown: "\x1b[1;6B", - KeyShfHome: "\x1b[1;2H", - KeyShfEnd: "\x1b[1;2F", - KeyCtrlHome: "\x1b[1;5H", - KeyCtrlEnd: "\x1b[1;5F", - KeyAltHome: "\x1b[1;9H", - KeyAltEnd: "\x1b[1;9F", - KeyCtrlShfHome: "\x1b[1;6H", - KeyCtrlShfEnd: "\x1b[1;6F", - KeyMetaShfHome: "\x1b[1;10H", - KeyMetaShfEnd: "\x1b[1;10F", - KeyAltShfHome: "\x1b[1;4H", - KeyAltShfEnd: "\x1b[1;4F", - KeyShfPgUp: "\x1b[5;2~", - KeyShfPgDn: "\x1b[6;2~", + Name: "st", + Aliases: []string{"stterm"}, + Columns: 80, + Lines: 24, + Colors: 8, + Bell: "\a", + Clear: "\x1b[H\x1b[2J", + EnterCA: "\x1b[?1049h", + ExitCA: "\x1b[?1049l", + ShowCursor: "\x1b[?12l\x1b[?25h", + HideCursor: "\x1b[?25l", + AttrOff: "\x1b[0m", + Underline: "\x1b[4m", + Bold: "\x1b[1m", + Dim: "\x1b[2m", + Italic: "\x1b[3m", + Blink: "\x1b[5m", + Reverse: "\x1b[7m", + EnterKeypad: "\x1b[?1h\x1b=", + ExitKeypad: "\x1b[?1l\x1b>", + SetFg: "\x1b[3%p1%dm", + SetBg: "\x1b[4%p1%dm", + SetFgBg: "\x1b[3%p1%d;4%p2%dm", + AltChars: "+C,D-A.B0E``aaffgghFiGjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", + EnterAcs: "\x1b(0", + ExitAcs: "\x1b(B", + EnableAcs: "\x1b)0", + Mouse: "\x1b[M", + MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", + SetCursor: "\x1b[%i%p1%d;%p2%dH", + CursorBack1: "\b", + CursorUp1: "\x1b[A", + KeyUp: "\x1bOA", + KeyDown: "\x1bOB", + KeyRight: "\x1bOC", + KeyLeft: "\x1bOD", + KeyInsert: "\x1b[2~", + KeyDelete: "\x1b[3~", + KeyBackspace: "\u007f", + KeyHome: "\x1b[1~", + KeyEnd: "\x1b[4~", + KeyPgUp: "\x1b[5~", + KeyPgDn: "\x1b[6~", + KeyF1: "\x1bOP", + KeyF2: "\x1bOQ", + KeyF3: "\x1bOR", + KeyF4: "\x1bOS", + KeyF5: "\x1b[15~", + KeyF6: "\x1b[17~", + KeyF7: "\x1b[18~", + KeyF8: "\x1b[19~", + KeyF9: "\x1b[20~", + KeyF10: "\x1b[21~", + KeyF11: "\x1b[23~", + KeyF12: "\x1b[24~", + KeyClear: "\x1b[3;5~", + Modifiers: 1, }) // simpleterm with 256 colors terminfo.AddTerminfo(&terminfo.Terminfo{ - Name: "st-256color", - Aliases: []string{"stterm-256color"}, - Columns: 80, - Lines: 24, - Colors: 256, - Bell: "\a", - Clear: "\x1b[H\x1b[2J", - EnterCA: "\x1b[?1049h", - ExitCA: "\x1b[?1049l", - ShowCursor: "\x1b[?12l\x1b[?25h", - HideCursor: "\x1b[?25l", - AttrOff: "\x1b[0m", - Underline: "\x1b[4m", - Bold: "\x1b[1m", - Dim: "\x1b[2m", - Italic: "\x1b[3m", - Blink: "\x1b[5m", - Reverse: "\x1b[7m", - EnterKeypad: "\x1b[?1h\x1b=", - ExitKeypad: "\x1b[?1l\x1b>", - SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", - SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", - SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", - AltChars: "+C,D-A.B0E``aaffgghFiGjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", - EnterAcs: "\x1b(0", - ExitAcs: "\x1b(B", - EnableAcs: "\x1b)0", - Mouse: "\x1b[M", - MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", - SetCursor: "\x1b[%i%p1%d;%p2%dH", - CursorBack1: "\b", - CursorUp1: "\x1b[A", - KeyUp: "\x1bOA", - KeyDown: "\x1bOB", - KeyRight: "\x1bOC", - KeyLeft: "\x1bOD", - KeyInsert: "\x1b[2~", - KeyDelete: "\x1b[3~", - KeyBackspace: "\u007f", - KeyHome: "\x1b[1~", - KeyEnd: "\x1b[4~", - KeyPgUp: "\x1b[5~", - KeyPgDn: "\x1b[6~", - KeyF1: "\x1bOP", - KeyF2: "\x1bOQ", - KeyF3: "\x1bOR", - KeyF4: "\x1bOS", - KeyF5: "\x1b[15~", - KeyF6: "\x1b[17~", - KeyF7: "\x1b[18~", - KeyF8: "\x1b[19~", - KeyF9: "\x1b[20~", - KeyF10: "\x1b[21~", - KeyF11: "\x1b[23~", - KeyF12: "\x1b[24~", - KeyF13: "\x1b[1;2P", - KeyF14: "\x1b[1;2Q", - KeyF15: "\x1b[1;2R", - KeyF16: "\x1b[1;2S", - KeyF17: "\x1b[15;2~", - KeyF18: "\x1b[17;2~", - KeyF19: "\x1b[18;2~", - KeyF20: "\x1b[19;2~", - KeyF21: "\x1b[20;2~", - KeyF22: "\x1b[21;2~", - KeyF23: "\x1b[23;2~", - KeyF24: "\x1b[24;2~", - KeyF25: "\x1b[1;5P", - KeyF26: "\x1b[1;5Q", - KeyF27: "\x1b[1;5R", - KeyF28: "\x1b[1;5S", - KeyF29: "\x1b[15;5~", - KeyF30: "\x1b[17;5~", - KeyF31: "\x1b[18;5~", - KeyF32: "\x1b[19;5~", - KeyF33: "\x1b[20;5~", - KeyF34: "\x1b[21;5~", - KeyF35: "\x1b[23;5~", - KeyF36: "\x1b[24;5~", - KeyF37: "\x1b[1;6P", - KeyF38: "\x1b[1;6Q", - KeyF39: "\x1b[1;6R", - KeyF40: "\x1b[1;6S", - KeyF41: "\x1b[15;6~", - KeyF42: "\x1b[17;6~", - KeyF43: "\x1b[18;6~", - KeyF44: "\x1b[19;6~", - KeyF45: "\x1b[20;6~", - KeyF46: "\x1b[21;6~", - KeyF47: "\x1b[23;6~", - KeyF48: "\x1b[24;6~", - KeyF49: "\x1b[1;3P", - KeyF50: "\x1b[1;3Q", - KeyF51: "\x1b[1;3R", - KeyF52: "\x1b[1;3S", - KeyF53: "\x1b[15;3~", - KeyF54: "\x1b[17;3~", - KeyF55: "\x1b[18;3~", - KeyF56: "\x1b[19;3~", - KeyF57: "\x1b[20;3~", - KeyF58: "\x1b[21;3~", - KeyF59: "\x1b[23;3~", - KeyF60: "\x1b[24;3~", - KeyF61: "\x1b[1;4P", - KeyF62: "\x1b[1;4Q", - KeyF63: "\x1b[1;4R", - KeyClear: "\x1b[3;5~", - KeyShfLeft: "\x1b[1;2D", - KeyShfRight: "\x1b[1;2C", - KeyShfUp: "\x1b[1;2A", - KeyShfDown: "\x1b[1;2B", - KeyCtrlLeft: "\x1b[1;5D", - KeyCtrlRight: "\x1b[1;5C", - KeyCtrlUp: "\x1b[1;5A", - KeyCtrlDown: "\x1b[1;5B", - KeyMetaLeft: "\x1b[1;9D", - KeyMetaRight: "\x1b[1;9C", - KeyMetaUp: "\x1b[1;9A", - KeyMetaDown: "\x1b[1;9B", - KeyAltLeft: "\x1b[1;3D", - KeyAltRight: "\x1b[1;3C", - KeyAltUp: "\x1b[1;3A", - KeyAltDown: "\x1b[1;3B", - KeyAltShfLeft: "\x1b[1;4D", - KeyAltShfRight: "\x1b[1;4C", - KeyAltShfUp: "\x1b[1;4A", - KeyAltShfDown: "\x1b[1;4B", - KeyMetaShfLeft: "\x1b[1;10D", - KeyMetaShfRight: "\x1b[1;10C", - KeyMetaShfUp: "\x1b[1;10A", - KeyMetaShfDown: "\x1b[1;10B", - KeyCtrlShfLeft: "\x1b[1;6D", - KeyCtrlShfRight: "\x1b[1;6C", - KeyCtrlShfUp: "\x1b[1;6A", - KeyCtrlShfDown: "\x1b[1;6B", - KeyShfHome: "\x1b[1;2H", - KeyShfEnd: "\x1b[1;2F", - KeyCtrlHome: "\x1b[1;5H", - KeyCtrlEnd: "\x1b[1;5F", - KeyAltHome: "\x1b[1;9H", - KeyAltEnd: "\x1b[1;9F", - KeyCtrlShfHome: "\x1b[1;6H", - KeyCtrlShfEnd: "\x1b[1;6F", - KeyMetaShfHome: "\x1b[1;10H", - KeyMetaShfEnd: "\x1b[1;10F", - KeyAltShfHome: "\x1b[1;4H", - KeyAltShfEnd: "\x1b[1;4F", - KeyShfPgUp: "\x1b[5;2~", - KeyShfPgDn: "\x1b[6;2~", + Name: "st-256color", + Aliases: []string{"stterm-256color"}, + Columns: 80, + Lines: 24, + Colors: 256, + Bell: "\a", + Clear: "\x1b[H\x1b[2J", + EnterCA: "\x1b[?1049h", + ExitCA: "\x1b[?1049l", + ShowCursor: "\x1b[?12l\x1b[?25h", + HideCursor: "\x1b[?25l", + AttrOff: "\x1b[0m", + Underline: "\x1b[4m", + Bold: "\x1b[1m", + Dim: "\x1b[2m", + Italic: "\x1b[3m", + Blink: "\x1b[5m", + Reverse: "\x1b[7m", + EnterKeypad: "\x1b[?1h\x1b=", + ExitKeypad: "\x1b[?1l\x1b>", + SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", + SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", + SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", + AltChars: "+C,D-A.B0E``aaffgghFiGjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", + EnterAcs: "\x1b(0", + ExitAcs: "\x1b(B", + EnableAcs: "\x1b)0", + Mouse: "\x1b[M", + MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", + SetCursor: "\x1b[%i%p1%d;%p2%dH", + CursorBack1: "\b", + CursorUp1: "\x1b[A", + KeyUp: "\x1bOA", + KeyDown: "\x1bOB", + KeyRight: "\x1bOC", + KeyLeft: "\x1bOD", + KeyInsert: "\x1b[2~", + KeyDelete: "\x1b[3~", + KeyBackspace: "\u007f", + KeyHome: "\x1b[1~", + KeyEnd: "\x1b[4~", + KeyPgUp: "\x1b[5~", + KeyPgDn: "\x1b[6~", + KeyF1: "\x1bOP", + KeyF2: "\x1bOQ", + KeyF3: "\x1bOR", + KeyF4: "\x1bOS", + KeyF5: "\x1b[15~", + KeyF6: "\x1b[17~", + KeyF7: "\x1b[18~", + KeyF8: "\x1b[19~", + KeyF9: "\x1b[20~", + KeyF10: "\x1b[21~", + KeyF11: "\x1b[23~", + KeyF12: "\x1b[24~", + KeyClear: "\x1b[3;5~", + Modifiers: 1, }) } diff --git a/terminfo/t/termite/term.go b/terminfo/t/termite/term.go index 2caa5b0..871a677 100644 --- a/terminfo/t/termite/term.go +++ b/terminfo/t/termite/term.go @@ -8,150 +8,58 @@ func init() { // VTE-based terminal terminfo.AddTerminfo(&terminfo.Terminfo{ - Name: "termite", - Columns: 80, - Lines: 24, - Colors: 256, - Bell: "\a", - Clear: "\x1b[H\x1b[2J", - EnterCA: "\x1b[?1049h", - ExitCA: "\x1b[?1049l", - ShowCursor: "\x1b[?12l\x1b[?25h", - HideCursor: "\x1b[?25l", - AttrOff: "\x1b(B\x1b[m", - Underline: "\x1b[4m", - Bold: "\x1b[1m", - Italic: "\x1b[3m", - Reverse: "\x1b[7m", - EnterKeypad: "\x1b[?1h\x1b=", - ExitKeypad: "\x1b[?1l\x1b>", - SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", - SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", - SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", - AltChars: "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", - EnterAcs: "\x1b(0", - ExitAcs: "\x1b(B", - Mouse: "\x1b[M", - MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", - SetCursor: "\x1b[%i%p1%d;%p2%dH", - CursorBack1: "\b", - CursorUp1: "\x1b[A", - KeyUp: "\x1bOA", - KeyDown: "\x1bOB", - KeyRight: "\x1bOC", - KeyLeft: "\x1bOD", - KeyInsert: "\x1b[2~", - KeyDelete: "\x1b[3~", - KeyBackspace: "\u007f", - KeyHome: "\x1bOH", - KeyEnd: "\x1bOF", - KeyPgUp: "\x1b[5~", - KeyPgDn: "\x1b[6~", - KeyF1: "\x1bOP", - KeyF2: "\x1bOQ", - KeyF3: "\x1bOR", - KeyF4: "\x1bOS", - KeyF5: "\x1b[15~", - KeyF6: "\x1b[17~", - KeyF7: "\x1b[18~", - KeyF8: "\x1b[19~", - KeyF9: "\x1b[20~", - KeyF10: "\x1b[21~", - KeyF11: "\x1b[23~", - KeyF12: "\x1b[24~", - KeyF13: "\x1b[1;2P", - KeyF14: "\x1b[1;2Q", - KeyF15: "\x1b[1;2R", - KeyF16: "\x1b[1;2S", - KeyF17: "\x1b[15;2~", - KeyF18: "\x1b[17;2~", - KeyF19: "\x1b[18;2~", - KeyF20: "\x1b[19;2~", - KeyF21: "\x1b[20;2~", - KeyF22: "\x1b[21;2~", - KeyF23: "\x1b[23;2~", - KeyF24: "\x1b[24;2~", - KeyF25: "\x1b[1;5P", - KeyF26: "\x1b[1;5Q", - KeyF27: "\x1b[1;5R", - KeyF28: "\x1b[1;5S", - KeyF29: "\x1b[15;5~", - KeyF30: "\x1b[17;5~", - KeyF31: "\x1b[18;5~", - KeyF32: "\x1b[19;5~", - KeyF33: "\x1b[20;5~", - KeyF34: "\x1b[21;5~", - KeyF35: "\x1b[23;5~", - KeyF36: "\x1b[24;5~", - KeyF37: "\x1b[1;6P", - KeyF38: "\x1b[1;6Q", - KeyF39: "\x1b[1;6R", - KeyF40: "\x1b[1;6S", - KeyF41: "\x1b[15;6~", - KeyF42: "\x1b[17;6~", - KeyF43: "\x1b[18;6~", - KeyF44: "\x1b[19;6~", - KeyF45: "\x1b[20;6~", - KeyF46: "\x1b[21;6~", - KeyF47: "\x1b[23;6~", - KeyF48: "\x1b[24;6~", - KeyF49: "\x1b[1;3P", - KeyF50: "\x1b[1;3Q", - KeyF51: "\x1b[1;3R", - KeyF52: "\x1b[1;3S", - KeyF53: "\x1b[15;3~", - KeyF54: "\x1b[17;3~", - KeyF55: "\x1b[18;3~", - KeyF56: "\x1b[19;3~", - KeyF57: "\x1b[20;3~", - KeyF58: "\x1b[21;3~", - KeyF59: "\x1b[23;3~", - KeyF60: "\x1b[24;3~", - KeyF61: "\x1b[1;4P", - KeyF62: "\x1b[1;4Q", - KeyF63: "\x1b[1;4R", - KeyBacktab: "\x1b[Z", - KeyShfLeft: "\x1b[1;2D", - KeyShfRight: "\x1b[1;2C", - KeyShfUp: "\x1b[1;2A", - KeyShfDown: "\x1b[1;2B", - KeyCtrlLeft: "\x1b[1;5D", - KeyCtrlRight: "\x1b[1;5C", - KeyCtrlUp: "\x1b[1;5A", - KeyCtrlDown: "\x1b[1;5B", - KeyMetaLeft: "\x1b[1;9D", - KeyMetaRight: "\x1b[1;9C", - KeyMetaUp: "\x1b[1;9A", - KeyMetaDown: "\x1b[1;9B", - KeyAltLeft: "\x1b[1;3D", - KeyAltRight: "\x1b[1;3C", - KeyAltUp: "\x1b[1;3A", - KeyAltDown: "\x1b[1;3B", - KeyAltShfLeft: "\x1b[1;4D", - KeyAltShfRight: "\x1b[1;4C", - KeyAltShfUp: "\x1b[1;4A", - KeyAltShfDown: "\x1b[1;4B", - KeyMetaShfLeft: "\x1b[1;10D", - KeyMetaShfRight: "\x1b[1;10C", - KeyMetaShfUp: "\x1b[1;10A", - KeyMetaShfDown: "\x1b[1;10B", - KeyCtrlShfLeft: "\x1b[1;6D", - KeyCtrlShfRight: "\x1b[1;6C", - KeyCtrlShfUp: "\x1b[1;6A", - KeyCtrlShfDown: "\x1b[1;6B", - KeyShfHome: "\x1b[1;2H", - KeyShfEnd: "\x1b[1;2F", - KeyCtrlHome: "\x1b[1;5H", - KeyCtrlEnd: "\x1b[1;5F", - KeyAltHome: "\x1b[1;9H", - KeyAltEnd: "\x1b[1;9F", - KeyCtrlShfHome: "\x1b[1;6H", - KeyCtrlShfEnd: "\x1b[1;6F", - KeyMetaShfHome: "\x1b[1;10H", - KeyMetaShfEnd: "\x1b[1;10F", - KeyAltShfHome: "\x1b[1;4H", - KeyAltShfEnd: "\x1b[1;4F", - KeyShfPgUp: "\x1b[5;2~", - KeyShfPgDn: "\x1b[6;2~", + Name: "termite", + Columns: 80, + Lines: 24, + Colors: 256, + Bell: "\a", + Clear: "\x1b[H\x1b[2J", + EnterCA: "\x1b[?1049h", + ExitCA: "\x1b[?1049l", + ShowCursor: "\x1b[?12l\x1b[?25h", + HideCursor: "\x1b[?25l", + AttrOff: "\x1b(B\x1b[m", + Underline: "\x1b[4m", + Bold: "\x1b[1m", + Italic: "\x1b[3m", + Reverse: "\x1b[7m", + EnterKeypad: "\x1b[?1h\x1b=", + ExitKeypad: "\x1b[?1l\x1b>", + SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", + SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", + SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", + AltChars: "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", + EnterAcs: "\x1b(0", + ExitAcs: "\x1b(B", + Mouse: "\x1b[M", + MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", + SetCursor: "\x1b[%i%p1%d;%p2%dH", + CursorBack1: "\b", + CursorUp1: "\x1b[A", + KeyUp: "\x1bOA", + KeyDown: "\x1bOB", + KeyRight: "\x1bOC", + KeyLeft: "\x1bOD", + KeyInsert: "\x1b[2~", + KeyDelete: "\x1b[3~", + KeyBackspace: "\u007f", + KeyHome: "\x1bOH", + KeyEnd: "\x1bOF", + KeyPgUp: "\x1b[5~", + KeyPgDn: "\x1b[6~", + KeyF1: "\x1bOP", + KeyF2: "\x1bOQ", + KeyF3: "\x1bOR", + KeyF4: "\x1bOS", + KeyF5: "\x1b[15~", + KeyF6: "\x1b[17~", + KeyF7: "\x1b[18~", + KeyF8: "\x1b[19~", + KeyF9: "\x1b[20~", + KeyF10: "\x1b[21~", + KeyF11: "\x1b[23~", + KeyF12: "\x1b[24~", + KeyBacktab: "\x1b[Z", + Modifiers: 1, }) } diff --git a/terminfo/terminfo.go b/terminfo/terminfo.go index d4cb215..a789d4e 100644 --- a/terminfo/terminfo.go +++ b/terminfo/terminfo.go @@ -1,4 +1,4 @@ -// Copyright 2019 The TCell Authors +// Copyright 2020 The TCell Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use file except in compliance with the License. @@ -158,6 +158,8 @@ type Terminfo struct { KeyShfLeft string // kLFT KeyShfHome string // kHOM KeyShfEnd string // kEND + KeyShfInsert string // kIC + KeyShfDelete string // kDC // These are non-standard extensions to terminfo. This includes // true color support, and some additional keys. Its kind of bizarre @@ -209,8 +211,14 @@ type Terminfo struct { KeyAltShfEnd string KeyMetaShfHome string KeyMetaShfEnd string + Modifiers int } +const ( + ModifiersNone = 0 + ModifiersXTerm = 1 +) + type stackElem struct { s string i int @@ -289,13 +297,6 @@ func (st stack) PushBool(i bool) stack { return st.PushInt(0) } -func nextch(s string, index int) (byte, int) { - if index < len(s) { - return s[index], index + 1 - } - return 0, index -} - // static vars var svars [26]string diff --git a/terminfo/w/wy50/term.go b/terminfo/w/wy50/term.go index 720b937..542a4da 100644 --- a/terminfo/w/wy50/term.go +++ b/terminfo/w/wy50/term.go @@ -20,7 +20,7 @@ func init() { Dim: "\x1b`7\x1b)", Reverse: "\x1b`6\x1b)", PadChar: "\x00", - AltChars: "0wa_h[jukslrmqnxqzttuyv]wpxv", + AltChars: "a;j5k3l2m1n8q:t4u9v=w0x6", EnterAcs: "\x1bH\x02", ExitAcs: "\x1bH\x03", SetCursor: "\x1b=%p1%' '%+%c%p2%' '%+%c", diff --git a/terminfo/x/xfce/term.go b/terminfo/x/xfce/term.go index 26251c7..2670013 100644 --- a/terminfo/x/xfce/term.go +++ b/terminfo/x/xfce/term.go @@ -8,151 +8,59 @@ func init() { // Xfce Terminal terminfo.AddTerminfo(&terminfo.Terminfo{ - Name: "xfce", - Columns: 80, - Lines: 24, - Colors: 8, - Bell: "\a", - Clear: "\x1b[H\x1b[2J", - EnterCA: "\x1b7\x1b[?47h", - ExitCA: "\x1b[2J\x1b[?47l\x1b8", - ShowCursor: "\x1b[?25h", - HideCursor: "\x1b[?25l", - AttrOff: "\x1b[0m\x0f", - Underline: "\x1b[4m", - Bold: "\x1b[1m", - Reverse: "\x1b[7m", - EnterKeypad: "\x1b[?1h\x1b=", - ExitKeypad: "\x1b[?1l\x1b>", - SetFg: "\x1b[3%p1%dm", - SetBg: "\x1b[4%p1%dm", - SetFgBg: "\x1b[3%p1%d;4%p2%dm", - PadChar: "\x00", - AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", - EnterAcs: "\x0e", - ExitAcs: "\x0f", - EnableAcs: "\x1b)0", - Mouse: "\x1b[M", - MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", - SetCursor: "\x1b[%i%p1%d;%p2%dH", - CursorBack1: "\b", - CursorUp1: "\x1b[A", - KeyUp: "\x1bOA", - KeyDown: "\x1bOB", - KeyRight: "\x1bOC", - KeyLeft: "\x1bOD", - KeyInsert: "\x1b[2~", - KeyDelete: "\x1b[3~", - KeyBackspace: "\u007f", - KeyHome: "\x1bOH", - KeyEnd: "\x1bOF", - KeyPgUp: "\x1b[5~", - KeyPgDn: "\x1b[6~", - KeyF1: "\x1bOP", - KeyF2: "\x1bOQ", - KeyF3: "\x1bOR", - KeyF4: "\x1bOS", - KeyF5: "\x1b[15~", - KeyF6: "\x1b[17~", - KeyF7: "\x1b[18~", - KeyF8: "\x1b[19~", - KeyF9: "\x1b[20~", - KeyF10: "\x1b[21~", - KeyF11: "\x1b[23~", - KeyF12: "\x1b[24~", - KeyF13: "\x1bO1;2P", - KeyF14: "\x1bO1;2Q", - KeyF15: "\x1bO1;2R", - KeyF16: "\x1bO1;2S", - KeyF17: "\x1b[15;2~", - KeyF18: "\x1b[17;2~", - KeyF19: "\x1b[18;2~", - KeyF20: "\x1b[19;2~", - KeyF21: "\x1b[20;2~", - KeyF22: "\x1b[21;2~", - KeyF23: "\x1b[23;2~", - KeyF24: "\x1b[24;2~", - KeyF25: "\x1bO1;5P", - KeyF26: "\x1bO1;5Q", - KeyF27: "\x1bO1;5R", - KeyF28: "\x1bO1;5S", - KeyF29: "\x1b[15;5~", - KeyF30: "\x1b[17;5~", - KeyF31: "\x1b[18;5~", - KeyF32: "\x1b[19;5~", - KeyF33: "\x1b[20;5~", - KeyF34: "\x1b[21;5~", - KeyF35: "\x1b[23;5~", - KeyF36: "\x1b[24;5~", - KeyF37: "\x1bO1;6P", - KeyF38: "\x1bO1;6Q", - KeyF39: "\x1bO1;6R", - KeyF40: "\x1bO1;6S", - KeyF41: "\x1b[15;6~", - KeyF42: "\x1b[17;6~", - KeyF43: "\x1b[18;6~", - KeyF44: "\x1b[19;6~", - KeyF45: "\x1b[20;6~", - KeyF46: "\x1b[21;6~", - KeyF47: "\x1b[23;6~", - KeyF48: "\x1b[24;6~", - KeyF49: "\x1bO1;3P", - KeyF50: "\x1bO1;3Q", - KeyF51: "\x1bO1;3R", - KeyF52: "\x1bO1;3S", - KeyF53: "\x1b[15;3~", - KeyF54: "\x1b[17;3~", - KeyF55: "\x1b[18;3~", - KeyF56: "\x1b[19;3~", - KeyF57: "\x1b[20;3~", - KeyF58: "\x1b[21;3~", - KeyF59: "\x1b[23;3~", - KeyF60: "\x1b[24;3~", - KeyF61: "\x1bO1;4P", - KeyF62: "\x1bO1;4Q", - KeyF63: "\x1bO1;4R", - KeyBacktab: "\x1b[Z", - KeyShfLeft: "\x1b[1;2D", - KeyShfRight: "\x1b[1;2C", - KeyShfUp: "\x1b[1;2A", - KeyShfDown: "\x1b[1;2B", - KeyCtrlLeft: "\x1b[1;5D", - KeyCtrlRight: "\x1b[1;5C", - KeyCtrlUp: "\x1b[1;5A", - KeyCtrlDown: "\x1b[1;5B", - KeyMetaLeft: "\x1b[1;9D", - KeyMetaRight: "\x1b[1;9C", - KeyMetaUp: "\x1b[1;9A", - KeyMetaDown: "\x1b[1;9B", - KeyAltLeft: "\x1b[1;3D", - KeyAltRight: "\x1b[1;3C", - KeyAltUp: "\x1b[1;3A", - KeyAltDown: "\x1b[1;3B", - KeyAltShfLeft: "\x1b[1;4D", - KeyAltShfRight: "\x1b[1;4C", - KeyAltShfUp: "\x1b[1;4A", - KeyAltShfDown: "\x1b[1;4B", - KeyMetaShfLeft: "\x1b[1;10D", - KeyMetaShfRight: "\x1b[1;10C", - KeyMetaShfUp: "\x1b[1;10A", - KeyMetaShfDown: "\x1b[1;10B", - KeyCtrlShfLeft: "\x1b[1;6D", - KeyCtrlShfRight: "\x1b[1;6C", - KeyCtrlShfUp: "\x1b[1;6A", - KeyCtrlShfDown: "\x1b[1;6B", - KeyShfHome: "\x1b[1;2H", - KeyShfEnd: "\x1b[1;2F", - KeyCtrlHome: "\x1b[1;5H", - KeyCtrlEnd: "\x1b[1;5F", - KeyAltHome: "\x1b[1;9H", - KeyAltEnd: "\x1b[1;9F", - KeyCtrlShfHome: "\x1b[1;6H", - KeyCtrlShfEnd: "\x1b[1;6F", - KeyMetaShfHome: "\x1b[1;10H", - KeyMetaShfEnd: "\x1b[1;10F", - KeyAltShfHome: "\x1b[1;4H", - KeyAltShfEnd: "\x1b[1;4F", - KeyShfPgUp: "\x1b[5;2~", - KeyShfPgDn: "\x1b[6;2~", + Name: "xfce", + Columns: 80, + Lines: 24, + Colors: 8, + Bell: "\a", + Clear: "\x1b[H\x1b[2J", + EnterCA: "\x1b7\x1b[?47h", + ExitCA: "\x1b[2J\x1b[?47l\x1b8", + ShowCursor: "\x1b[?25h", + HideCursor: "\x1b[?25l", + AttrOff: "\x1b[0m\x0f", + Underline: "\x1b[4m", + Bold: "\x1b[1m", + Reverse: "\x1b[7m", + EnterKeypad: "\x1b[?1h\x1b=", + ExitKeypad: "\x1b[?1l\x1b>", + SetFg: "\x1b[3%p1%dm", + SetBg: "\x1b[4%p1%dm", + SetFgBg: "\x1b[3%p1%d;4%p2%dm", + PadChar: "\x00", + AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", + EnterAcs: "\x0e", + ExitAcs: "\x0f", + EnableAcs: "\x1b)0", + Mouse: "\x1b[M", + MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", + SetCursor: "\x1b[%i%p1%d;%p2%dH", + CursorBack1: "\b", + CursorUp1: "\x1b[A", + KeyUp: "\x1bOA", + KeyDown: "\x1bOB", + KeyRight: "\x1bOC", + KeyLeft: "\x1bOD", + KeyInsert: "\x1b[2~", + KeyDelete: "\x1b[3~", + KeyBackspace: "\u007f", + KeyHome: "\x1bOH", + KeyEnd: "\x1bOF", + KeyPgUp: "\x1b[5~", + KeyPgDn: "\x1b[6~", + KeyF1: "\x1bOP", + KeyF2: "\x1bOQ", + KeyF3: "\x1bOR", + KeyF4: "\x1bOS", + KeyF5: "\x1b[15~", + KeyF6: "\x1b[17~", + KeyF7: "\x1b[18~", + KeyF8: "\x1b[19~", + KeyF9: "\x1b[20~", + KeyF10: "\x1b[21~", + KeyF11: "\x1b[23~", + KeyF12: "\x1b[24~", + KeyBacktab: "\x1b[Z", + Modifiers: 1, }) } diff --git a/terminfo/x/xterm/term.go b/terminfo/x/xterm/term.go index 4c90d74..8489293 100644 --- a/terminfo/x/xterm/term.go +++ b/terminfo/x/xterm/term.go @@ -8,455 +8,179 @@ func init() { // X11 terminal emulator terminfo.AddTerminfo(&terminfo.Terminfo{ - Name: "xterm", - Aliases: []string{"xterm-debian"}, - Columns: 80, - Lines: 24, - Colors: 8, - Bell: "\a", - Clear: "\x1b[H\x1b[2J", - EnterCA: "\x1b[?1049h\x1b[22;0;0t", - ExitCA: "\x1b[?1049l\x1b[23;0;0t", - ShowCursor: "\x1b[?12l\x1b[?25h", - HideCursor: "\x1b[?25l", - AttrOff: "\x1b(B\x1b[m", - Underline: "\x1b[4m", - Bold: "\x1b[1m", - Dim: "\x1b[2m", - Italic: "\x1b[3m", - Blink: "\x1b[5m", - Reverse: "\x1b[7m", - EnterKeypad: "\x1b[?1h\x1b=", - ExitKeypad: "\x1b[?1l\x1b>", - SetFg: "\x1b[3%p1%dm", - SetBg: "\x1b[4%p1%dm", - SetFgBg: "\x1b[3%p1%d;4%p2%dm", - AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", - EnterAcs: "\x1b(0", - ExitAcs: "\x1b(B", - Mouse: "\x1b[M", - MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", - SetCursor: "\x1b[%i%p1%d;%p2%dH", - CursorBack1: "\b", - CursorUp1: "\x1b[A", - KeyUp: "\x1bOA", - KeyDown: "\x1bOB", - KeyRight: "\x1bOC", - KeyLeft: "\x1bOD", - KeyInsert: "\x1b[2~", - KeyDelete: "\x1b[3~", - KeyBackspace: "\u007f", - KeyHome: "\x1bOH", - KeyEnd: "\x1bOF", - KeyPgUp: "\x1b[5~", - KeyPgDn: "\x1b[6~", - KeyF1: "\x1bOP", - KeyF2: "\x1bOQ", - KeyF3: "\x1bOR", - KeyF4: "\x1bOS", - KeyF5: "\x1b[15~", - KeyF6: "\x1b[17~", - KeyF7: "\x1b[18~", - KeyF8: "\x1b[19~", - KeyF9: "\x1b[20~", - KeyF10: "\x1b[21~", - KeyF11: "\x1b[23~", - KeyF12: "\x1b[24~", - KeyF13: "\x1b[1;2P", - KeyF14: "\x1b[1;2Q", - KeyF15: "\x1b[1;2R", - KeyF16: "\x1b[1;2S", - KeyF17: "\x1b[15;2~", - KeyF18: "\x1b[17;2~", - KeyF19: "\x1b[18;2~", - KeyF20: "\x1b[19;2~", - KeyF21: "\x1b[20;2~", - KeyF22: "\x1b[21;2~", - KeyF23: "\x1b[23;2~", - KeyF24: "\x1b[24;2~", - KeyF25: "\x1b[1;5P", - KeyF26: "\x1b[1;5Q", - KeyF27: "\x1b[1;5R", - KeyF28: "\x1b[1;5S", - KeyF29: "\x1b[15;5~", - KeyF30: "\x1b[17;5~", - KeyF31: "\x1b[18;5~", - KeyF32: "\x1b[19;5~", - KeyF33: "\x1b[20;5~", - KeyF34: "\x1b[21;5~", - KeyF35: "\x1b[23;5~", - KeyF36: "\x1b[24;5~", - KeyF37: "\x1b[1;6P", - KeyF38: "\x1b[1;6Q", - KeyF39: "\x1b[1;6R", - KeyF40: "\x1b[1;6S", - KeyF41: "\x1b[15;6~", - KeyF42: "\x1b[17;6~", - KeyF43: "\x1b[18;6~", - KeyF44: "\x1b[19;6~", - KeyF45: "\x1b[20;6~", - KeyF46: "\x1b[21;6~", - KeyF47: "\x1b[23;6~", - KeyF48: "\x1b[24;6~", - KeyF49: "\x1b[1;3P", - KeyF50: "\x1b[1;3Q", - KeyF51: "\x1b[1;3R", - KeyF52: "\x1b[1;3S", - KeyF53: "\x1b[15;3~", - KeyF54: "\x1b[17;3~", - KeyF55: "\x1b[18;3~", - KeyF56: "\x1b[19;3~", - KeyF57: "\x1b[20;3~", - KeyF58: "\x1b[21;3~", - KeyF59: "\x1b[23;3~", - KeyF60: "\x1b[24;3~", - KeyF61: "\x1b[1;4P", - KeyF62: "\x1b[1;4Q", - KeyF63: "\x1b[1;4R", - KeyBacktab: "\x1b[Z", - KeyShfLeft: "\x1b[1;2D", - KeyShfRight: "\x1b[1;2C", - KeyShfUp: "\x1b[1;2A", - KeyShfDown: "\x1b[1;2B", - KeyCtrlLeft: "\x1b[1;5D", - KeyCtrlRight: "\x1b[1;5C", - KeyCtrlUp: "\x1b[1;5A", - KeyCtrlDown: "\x1b[1;5B", - KeyMetaLeft: "\x1b[1;9D", - KeyMetaRight: "\x1b[1;9C", - KeyMetaUp: "\x1b[1;9A", - KeyMetaDown: "\x1b[1;9B", - KeyAltLeft: "\x1b[1;3D", - KeyAltRight: "\x1b[1;3C", - KeyAltUp: "\x1b[1;3A", - KeyAltDown: "\x1b[1;3B", - KeyAltShfLeft: "\x1b[1;4D", - KeyAltShfRight: "\x1b[1;4C", - KeyAltShfUp: "\x1b[1;4A", - KeyAltShfDown: "\x1b[1;4B", - KeyMetaShfLeft: "\x1b[1;10D", - KeyMetaShfRight: "\x1b[1;10C", - KeyMetaShfUp: "\x1b[1;10A", - KeyMetaShfDown: "\x1b[1;10B", - KeyCtrlShfLeft: "\x1b[1;6D", - KeyCtrlShfRight: "\x1b[1;6C", - KeyCtrlShfUp: "\x1b[1;6A", - KeyCtrlShfDown: "\x1b[1;6B", - KeyShfHome: "\x1b[1;2H", - KeyShfEnd: "\x1b[1;2F", - KeyCtrlHome: "\x1b[1;5H", - KeyCtrlEnd: "\x1b[1;5F", - KeyAltHome: "\x1b[1;9H", - KeyAltEnd: "\x1b[1;9F", - KeyCtrlShfHome: "\x1b[1;6H", - KeyCtrlShfEnd: "\x1b[1;6F", - KeyMetaShfHome: "\x1b[1;10H", - KeyMetaShfEnd: "\x1b[1;10F", - KeyAltShfHome: "\x1b[1;4H", - KeyAltShfEnd: "\x1b[1;4F", - KeyShfPgUp: "\x1b[5;2~", - KeyShfPgDn: "\x1b[6;2~", + Name: "xterm", + Aliases: []string{"xterm-debian"}, + Columns: 80, + Lines: 24, + Colors: 8, + Bell: "\a", + Clear: "\x1b[H\x1b[2J", + EnterCA: "\x1b[?1049h\x1b[22;0;0t", + ExitCA: "\x1b[?1049l\x1b[23;0;0t", + ShowCursor: "\x1b[?12l\x1b[?25h", + HideCursor: "\x1b[?25l", + AttrOff: "\x1b(B\x1b[m", + Underline: "\x1b[4m", + Bold: "\x1b[1m", + Dim: "\x1b[2m", + Italic: "\x1b[3m", + Blink: "\x1b[5m", + Reverse: "\x1b[7m", + EnterKeypad: "\x1b[?1h\x1b=", + ExitKeypad: "\x1b[?1l\x1b>", + SetFg: "\x1b[3%p1%dm", + SetBg: "\x1b[4%p1%dm", + SetFgBg: "\x1b[3%p1%d;4%p2%dm", + AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", + EnterAcs: "\x1b(0", + ExitAcs: "\x1b(B", + Mouse: "\x1b[M", + MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", + SetCursor: "\x1b[%i%p1%d;%p2%dH", + CursorBack1: "\b", + CursorUp1: "\x1b[A", + KeyUp: "\x1bOA", + KeyDown: "\x1bOB", + KeyRight: "\x1bOC", + KeyLeft: "\x1bOD", + KeyInsert: "\x1b[2~", + KeyDelete: "\x1b[3~", + KeyBackspace: "\u007f", + KeyHome: "\x1bOH", + KeyEnd: "\x1bOF", + KeyPgUp: "\x1b[5~", + KeyPgDn: "\x1b[6~", + KeyF1: "\x1bOP", + KeyF2: "\x1bOQ", + KeyF3: "\x1bOR", + KeyF4: "\x1bOS", + KeyF5: "\x1b[15~", + KeyF6: "\x1b[17~", + KeyF7: "\x1b[18~", + KeyF8: "\x1b[19~", + KeyF9: "\x1b[20~", + KeyF10: "\x1b[21~", + KeyF11: "\x1b[23~", + KeyF12: "\x1b[24~", + KeyBacktab: "\x1b[Z", + Modifiers: 1, }) // xterm with 88 colors terminfo.AddTerminfo(&terminfo.Terminfo{ - Name: "xterm-88color", - Columns: 80, - Lines: 24, - Colors: 88, - Bell: "\a", - Clear: "\x1b[H\x1b[2J", - EnterCA: "\x1b[?1049h\x1b[22;0;0t", - ExitCA: "\x1b[?1049l\x1b[23;0;0t", - ShowCursor: "\x1b[?12l\x1b[?25h", - HideCursor: "\x1b[?25l", - AttrOff: "\x1b(B\x1b[m", - Underline: "\x1b[4m", - Bold: "\x1b[1m", - Dim: "\x1b[2m", - Italic: "\x1b[3m", - Blink: "\x1b[5m", - Reverse: "\x1b[7m", - EnterKeypad: "\x1b[?1h\x1b=", - ExitKeypad: "\x1b[?1l\x1b>", - SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", - SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", - SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", - AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", - EnterAcs: "\x1b(0", - ExitAcs: "\x1b(B", - Mouse: "\x1b[M", - MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", - SetCursor: "\x1b[%i%p1%d;%p2%dH", - CursorBack1: "\b", - CursorUp1: "\x1b[A", - KeyUp: "\x1bOA", - KeyDown: "\x1bOB", - KeyRight: "\x1bOC", - KeyLeft: "\x1bOD", - KeyInsert: "\x1b[2~", - KeyDelete: "\x1b[3~", - KeyBackspace: "\u007f", - KeyHome: "\x1bOH", - KeyEnd: "\x1bOF", - KeyPgUp: "\x1b[5~", - KeyPgDn: "\x1b[6~", - KeyF1: "\x1bOP", - KeyF2: "\x1bOQ", - KeyF3: "\x1bOR", - KeyF4: "\x1bOS", - KeyF5: "\x1b[15~", - KeyF6: "\x1b[17~", - KeyF7: "\x1b[18~", - KeyF8: "\x1b[19~", - KeyF9: "\x1b[20~", - KeyF10: "\x1b[21~", - KeyF11: "\x1b[23~", - KeyF12: "\x1b[24~", - KeyF13: "\x1b[1;2P", - KeyF14: "\x1b[1;2Q", - KeyF15: "\x1b[1;2R", - KeyF16: "\x1b[1;2S", - KeyF17: "\x1b[15;2~", - KeyF18: "\x1b[17;2~", - KeyF19: "\x1b[18;2~", - KeyF20: "\x1b[19;2~", - KeyF21: "\x1b[20;2~", - KeyF22: "\x1b[21;2~", - KeyF23: "\x1b[23;2~", - KeyF24: "\x1b[24;2~", - KeyF25: "\x1b[1;5P", - KeyF26: "\x1b[1;5Q", - KeyF27: "\x1b[1;5R", - KeyF28: "\x1b[1;5S", - KeyF29: "\x1b[15;5~", - KeyF30: "\x1b[17;5~", - KeyF31: "\x1b[18;5~", - KeyF32: "\x1b[19;5~", - KeyF33: "\x1b[20;5~", - KeyF34: "\x1b[21;5~", - KeyF35: "\x1b[23;5~", - KeyF36: "\x1b[24;5~", - KeyF37: "\x1b[1;6P", - KeyF38: "\x1b[1;6Q", - KeyF39: "\x1b[1;6R", - KeyF40: "\x1b[1;6S", - KeyF41: "\x1b[15;6~", - KeyF42: "\x1b[17;6~", - KeyF43: "\x1b[18;6~", - KeyF44: "\x1b[19;6~", - KeyF45: "\x1b[20;6~", - KeyF46: "\x1b[21;6~", - KeyF47: "\x1b[23;6~", - KeyF48: "\x1b[24;6~", - KeyF49: "\x1b[1;3P", - KeyF50: "\x1b[1;3Q", - KeyF51: "\x1b[1;3R", - KeyF52: "\x1b[1;3S", - KeyF53: "\x1b[15;3~", - KeyF54: "\x1b[17;3~", - KeyF55: "\x1b[18;3~", - KeyF56: "\x1b[19;3~", - KeyF57: "\x1b[20;3~", - KeyF58: "\x1b[21;3~", - KeyF59: "\x1b[23;3~", - KeyF60: "\x1b[24;3~", - KeyF61: "\x1b[1;4P", - KeyF62: "\x1b[1;4Q", - KeyF63: "\x1b[1;4R", - KeyBacktab: "\x1b[Z", - KeyShfLeft: "\x1b[1;2D", - KeyShfRight: "\x1b[1;2C", - KeyShfUp: "\x1b[1;2A", - KeyShfDown: "\x1b[1;2B", - KeyCtrlLeft: "\x1b[1;5D", - KeyCtrlRight: "\x1b[1;5C", - KeyCtrlUp: "\x1b[1;5A", - KeyCtrlDown: "\x1b[1;5B", - KeyMetaLeft: "\x1b[1;9D", - KeyMetaRight: "\x1b[1;9C", - KeyMetaUp: "\x1b[1;9A", - KeyMetaDown: "\x1b[1;9B", - KeyAltLeft: "\x1b[1;3D", - KeyAltRight: "\x1b[1;3C", - KeyAltUp: "\x1b[1;3A", - KeyAltDown: "\x1b[1;3B", - KeyAltShfLeft: "\x1b[1;4D", - KeyAltShfRight: "\x1b[1;4C", - KeyAltShfUp: "\x1b[1;4A", - KeyAltShfDown: "\x1b[1;4B", - KeyMetaShfLeft: "\x1b[1;10D", - KeyMetaShfRight: "\x1b[1;10C", - KeyMetaShfUp: "\x1b[1;10A", - KeyMetaShfDown: "\x1b[1;10B", - KeyCtrlShfLeft: "\x1b[1;6D", - KeyCtrlShfRight: "\x1b[1;6C", - KeyCtrlShfUp: "\x1b[1;6A", - KeyCtrlShfDown: "\x1b[1;6B", - KeyShfHome: "\x1b[1;2H", - KeyShfEnd: "\x1b[1;2F", - KeyCtrlHome: "\x1b[1;5H", - KeyCtrlEnd: "\x1b[1;5F", - KeyAltHome: "\x1b[1;9H", - KeyAltEnd: "\x1b[1;9F", - KeyCtrlShfHome: "\x1b[1;6H", - KeyCtrlShfEnd: "\x1b[1;6F", - KeyMetaShfHome: "\x1b[1;10H", - KeyMetaShfEnd: "\x1b[1;10F", - KeyAltShfHome: "\x1b[1;4H", - KeyAltShfEnd: "\x1b[1;4F", - KeyShfPgUp: "\x1b[5;2~", - KeyShfPgDn: "\x1b[6;2~", + Name: "xterm-88color", + Columns: 80, + Lines: 24, + Colors: 88, + Bell: "\a", + Clear: "\x1b[H\x1b[2J", + EnterCA: "\x1b[?1049h\x1b[22;0;0t", + ExitCA: "\x1b[?1049l\x1b[23;0;0t", + ShowCursor: "\x1b[?12l\x1b[?25h", + HideCursor: "\x1b[?25l", + AttrOff: "\x1b(B\x1b[m", + Underline: "\x1b[4m", + Bold: "\x1b[1m", + Dim: "\x1b[2m", + Italic: "\x1b[3m", + Blink: "\x1b[5m", + Reverse: "\x1b[7m", + EnterKeypad: "\x1b[?1h\x1b=", + ExitKeypad: "\x1b[?1l\x1b>", + SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", + SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", + SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", + AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", + EnterAcs: "\x1b(0", + ExitAcs: "\x1b(B", + Mouse: "\x1b[M", + MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", + SetCursor: "\x1b[%i%p1%d;%p2%dH", + CursorBack1: "\b", + CursorUp1: "\x1b[A", + KeyUp: "\x1bOA", + KeyDown: "\x1bOB", + KeyRight: "\x1bOC", + KeyLeft: "\x1bOD", + KeyInsert: "\x1b[2~", + KeyDelete: "\x1b[3~", + KeyBackspace: "\u007f", + KeyHome: "\x1bOH", + KeyEnd: "\x1bOF", + KeyPgUp: "\x1b[5~", + KeyPgDn: "\x1b[6~", + KeyF1: "\x1bOP", + KeyF2: "\x1bOQ", + KeyF3: "\x1bOR", + KeyF4: "\x1bOS", + KeyF5: "\x1b[15~", + KeyF6: "\x1b[17~", + KeyF7: "\x1b[18~", + KeyF8: "\x1b[19~", + KeyF9: "\x1b[20~", + KeyF10: "\x1b[21~", + KeyF11: "\x1b[23~", + KeyF12: "\x1b[24~", + KeyBacktab: "\x1b[Z", + Modifiers: 1, }) // xterm with 256 colors terminfo.AddTerminfo(&terminfo.Terminfo{ - Name: "xterm-256color", - Columns: 80, - Lines: 24, - Colors: 256, - Bell: "\a", - Clear: "\x1b[H\x1b[2J", - EnterCA: "\x1b[?1049h\x1b[22;0;0t", - ExitCA: "\x1b[?1049l\x1b[23;0;0t", - ShowCursor: "\x1b[?12l\x1b[?25h", - HideCursor: "\x1b[?25l", - AttrOff: "\x1b(B\x1b[m", - Underline: "\x1b[4m", - Bold: "\x1b[1m", - Dim: "\x1b[2m", - Italic: "\x1b[3m", - Blink: "\x1b[5m", - Reverse: "\x1b[7m", - EnterKeypad: "\x1b[?1h\x1b=", - ExitKeypad: "\x1b[?1l\x1b>", - SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", - SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", - SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", - AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", - EnterAcs: "\x1b(0", - ExitAcs: "\x1b(B", - Mouse: "\x1b[M", - MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", - SetCursor: "\x1b[%i%p1%d;%p2%dH", - CursorBack1: "\b", - CursorUp1: "\x1b[A", - KeyUp: "\x1bOA", - KeyDown: "\x1bOB", - KeyRight: "\x1bOC", - KeyLeft: "\x1bOD", - KeyInsert: "\x1b[2~", - KeyDelete: "\x1b[3~", - KeyBackspace: "\u007f", - KeyHome: "\x1bOH", - KeyEnd: "\x1bOF", - KeyPgUp: "\x1b[5~", - KeyPgDn: "\x1b[6~", - KeyF1: "\x1bOP", - KeyF2: "\x1bOQ", - KeyF3: "\x1bOR", - KeyF4: "\x1bOS", - KeyF5: "\x1b[15~", - KeyF6: "\x1b[17~", - KeyF7: "\x1b[18~", - KeyF8: "\x1b[19~", - KeyF9: "\x1b[20~", - KeyF10: "\x1b[21~", - KeyF11: "\x1b[23~", - KeyF12: "\x1b[24~", - KeyF13: "\x1b[1;2P", - KeyF14: "\x1b[1;2Q", - KeyF15: "\x1b[1;2R", - KeyF16: "\x1b[1;2S", - KeyF17: "\x1b[15;2~", - KeyF18: "\x1b[17;2~", - KeyF19: "\x1b[18;2~", - KeyF20: "\x1b[19;2~", - KeyF21: "\x1b[20;2~", - KeyF22: "\x1b[21;2~", - KeyF23: "\x1b[23;2~", - KeyF24: "\x1b[24;2~", - KeyF25: "\x1b[1;5P", - KeyF26: "\x1b[1;5Q", - KeyF27: "\x1b[1;5R", - KeyF28: "\x1b[1;5S", - KeyF29: "\x1b[15;5~", - KeyF30: "\x1b[17;5~", - KeyF31: "\x1b[18;5~", - KeyF32: "\x1b[19;5~", - KeyF33: "\x1b[20;5~", - KeyF34: "\x1b[21;5~", - KeyF35: "\x1b[23;5~", - KeyF36: "\x1b[24;5~", - KeyF37: "\x1b[1;6P", - KeyF38: "\x1b[1;6Q", - KeyF39: "\x1b[1;6R", - KeyF40: "\x1b[1;6S", - KeyF41: "\x1b[15;6~", - KeyF42: "\x1b[17;6~", - KeyF43: "\x1b[18;6~", - KeyF44: "\x1b[19;6~", - KeyF45: "\x1b[20;6~", - KeyF46: "\x1b[21;6~", - KeyF47: "\x1b[23;6~", - KeyF48: "\x1b[24;6~", - KeyF49: "\x1b[1;3P", - KeyF50: "\x1b[1;3Q", - KeyF51: "\x1b[1;3R", - KeyF52: "\x1b[1;3S", - KeyF53: "\x1b[15;3~", - KeyF54: "\x1b[17;3~", - KeyF55: "\x1b[18;3~", - KeyF56: "\x1b[19;3~", - KeyF57: "\x1b[20;3~", - KeyF58: "\x1b[21;3~", - KeyF59: "\x1b[23;3~", - KeyF60: "\x1b[24;3~", - KeyF61: "\x1b[1;4P", - KeyF62: "\x1b[1;4Q", - KeyF63: "\x1b[1;4R", - KeyBacktab: "\x1b[Z", - KeyShfLeft: "\x1b[1;2D", - KeyShfRight: "\x1b[1;2C", - KeyShfUp: "\x1b[1;2A", - KeyShfDown: "\x1b[1;2B", - KeyCtrlLeft: "\x1b[1;5D", - KeyCtrlRight: "\x1b[1;5C", - KeyCtrlUp: "\x1b[1;5A", - KeyCtrlDown: "\x1b[1;5B", - KeyMetaLeft: "\x1b[1;9D", - KeyMetaRight: "\x1b[1;9C", - KeyMetaUp: "\x1b[1;9A", - KeyMetaDown: "\x1b[1;9B", - KeyAltLeft: "\x1b[1;3D", - KeyAltRight: "\x1b[1;3C", - KeyAltUp: "\x1b[1;3A", - KeyAltDown: "\x1b[1;3B", - KeyAltShfLeft: "\x1b[1;4D", - KeyAltShfRight: "\x1b[1;4C", - KeyAltShfUp: "\x1b[1;4A", - KeyAltShfDown: "\x1b[1;4B", - KeyMetaShfLeft: "\x1b[1;10D", - KeyMetaShfRight: "\x1b[1;10C", - KeyMetaShfUp: "\x1b[1;10A", - KeyMetaShfDown: "\x1b[1;10B", - KeyCtrlShfLeft: "\x1b[1;6D", - KeyCtrlShfRight: "\x1b[1;6C", - KeyCtrlShfUp: "\x1b[1;6A", - KeyCtrlShfDown: "\x1b[1;6B", - KeyShfHome: "\x1b[1;2H", - KeyShfEnd: "\x1b[1;2F", - KeyCtrlHome: "\x1b[1;5H", - KeyCtrlEnd: "\x1b[1;5F", - KeyAltHome: "\x1b[1;9H", - KeyAltEnd: "\x1b[1;9F", - KeyCtrlShfHome: "\x1b[1;6H", - KeyCtrlShfEnd: "\x1b[1;6F", - KeyMetaShfHome: "\x1b[1;10H", - KeyMetaShfEnd: "\x1b[1;10F", - KeyAltShfHome: "\x1b[1;4H", - KeyAltShfEnd: "\x1b[1;4F", - KeyShfPgUp: "\x1b[5;2~", - KeyShfPgDn: "\x1b[6;2~", + Name: "xterm-256color", + Columns: 80, + Lines: 24, + Colors: 256, + Bell: "\a", + Clear: "\x1b[H\x1b[2J", + EnterCA: "\x1b[?1049h\x1b[22;0;0t", + ExitCA: "\x1b[?1049l\x1b[23;0;0t", + ShowCursor: "\x1b[?12l\x1b[?25h", + HideCursor: "\x1b[?25l", + AttrOff: "\x1b(B\x1b[m", + Underline: "\x1b[4m", + Bold: "\x1b[1m", + Dim: "\x1b[2m", + Italic: "\x1b[3m", + Blink: "\x1b[5m", + Reverse: "\x1b[7m", + EnterKeypad: "\x1b[?1h\x1b=", + ExitKeypad: "\x1b[?1l\x1b>", + SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", + SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", + SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", + AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", + EnterAcs: "\x1b(0", + ExitAcs: "\x1b(B", + Mouse: "\x1b[M", + MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", + SetCursor: "\x1b[%i%p1%d;%p2%dH", + CursorBack1: "\b", + CursorUp1: "\x1b[A", + KeyUp: "\x1bOA", + KeyDown: "\x1bOB", + KeyRight: "\x1bOC", + KeyLeft: "\x1bOD", + KeyInsert: "\x1b[2~", + KeyDelete: "\x1b[3~", + KeyBackspace: "\u007f", + KeyHome: "\x1bOH", + KeyEnd: "\x1bOF", + KeyPgUp: "\x1b[5~", + KeyPgDn: "\x1b[6~", + KeyF1: "\x1bOP", + KeyF2: "\x1bOQ", + KeyF3: "\x1bOR", + KeyF4: "\x1bOS", + KeyF5: "\x1b[15~", + KeyF6: "\x1b[17~", + KeyF7: "\x1b[18~", + KeyF8: "\x1b[19~", + KeyF9: "\x1b[20~", + KeyF10: "\x1b[21~", + KeyF11: "\x1b[23~", + KeyF12: "\x1b[24~", + KeyBacktab: "\x1b[Z", + Modifiers: 1, }) } diff --git a/terminfo/x/xterm_kitty/term.go b/terminfo/x/xterm_kitty/term.go index 880e9ca..1dde744 100644 --- a/terminfo/x/xterm_kitty/term.go +++ b/terminfo/x/xterm_kitty/term.go @@ -8,150 +8,59 @@ func init() { // KovIdTTY terminfo.AddTerminfo(&terminfo.Terminfo{ - Name: "xterm-kitty", - Columns: 80, - Lines: 24, - Colors: 256, - Bell: "\a", - Clear: "\x1b[H\x1b[2J", - EnterCA: "\x1b[?1049h", - ExitCA: "\x1b[?1049l", - ShowCursor: "\x1b[?12l\x1b[?25h", - HideCursor: "\x1b[?25l", - AttrOff: "\x1b(B\x1b[m", - Underline: "\x1b[4m", - Bold: "\x1b[1m", - Dim: "\x1b[2m", - Reverse: "\x1b[7m", - EnterKeypad: "\x1b[?1h", - ExitKeypad: "\x1b[?1l", - SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", - SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", - SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", - AltChars: "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", - EnterAcs: "\x1b(0", - ExitAcs: "\x1b(B", - Mouse: "\x1b[M", - MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", - SetCursor: "\x1b[%i%p1%d;%p2%dH", - CursorBack1: "\b", - CursorUp1: "\x1b[A", - KeyUp: "\x1bOA", - KeyDown: "\x1bOB", - KeyRight: "\x1bOC", - KeyLeft: "\x1bOD", - KeyInsert: "\x1b[2~", - KeyDelete: "\x1b[3~", - KeyBackspace: "\xff", - KeyHome: "\x1bOH", - KeyEnd: "\x1bOF", - KeyPgUp: "\x1b[5~", - KeyPgDn: "\x1b[6~", - KeyF1: "\x1bOP", - KeyF2: "\x1bOQ", - KeyF3: "\x1bOR", - KeyF4: "\x1bOS", - KeyF5: "\x1b[15~", - KeyF6: "\x1b[17~", - KeyF7: "\x1b[18~", - KeyF8: "\x1b[19~", - KeyF9: "\x1b[20~", - KeyF10: "\x1b[21~", - KeyF11: "\x1b[23~", - KeyF12: "\x1b[24~", - KeyF13: "\x1b[1;2P", - KeyF14: "\x1b[1;2Q", - KeyF15: "\x1b[1;2R", - KeyF16: "\x1b[1;2S", - KeyF17: "\x1b[15;2~", - KeyF18: "\x1b[17;2~", - KeyF19: "\x1b[18;2~", - KeyF20: "\x1b[19;2~", - KeyF21: "\x1b[20;2~", - KeyF22: "\x1b[21;2~", - KeyF23: "\x1b[23;2~", - KeyF24: "\x1b[24;2~", - KeyF25: "\x1b[1;5P", - KeyF26: "\x1b[1;5Q", - KeyF27: "\x1b[1;5R", - KeyF28: "\x1b[1;5S", - KeyF29: "\x1b[15;5~", - KeyF30: "\x1b[17;5~", - KeyF31: "\x1b[18;5~", - KeyF32: "\x1b[19;5~", - KeyF33: "\x1b[20;5~", - KeyF34: "\x1b[21;5~", - KeyF35: "\x1b[23;5~", - KeyF36: "\x1b[24;5~", - KeyF37: "\x1b[1;6P", - KeyF38: "\x1b[1;6Q", - KeyF39: "\x1b[1;6R", - KeyF40: "\x1b[1;6S", - KeyF41: "\x1b[15;6~", - KeyF42: "\x1b[17;6~", - KeyF43: "\x1b[18;6~", - KeyF44: "\x1b[19;6~", - KeyF45: "\x1b[20;6~", - KeyF46: "\x1b[21;6~", - KeyF47: "\x1b[23;6~", - KeyF48: "\x1b[24;6~", - KeyF49: "\x1b[1;3P", - KeyF50: "\x1b[1;3Q", - KeyF51: "\x1b[1;3R", - KeyF52: "\x1b[1;3S", - KeyF53: "\x1b[15;3~", - KeyF54: "\x1b[17;3~", - KeyF55: "\x1b[18;3~", - KeyF56: "\x1b[19;3~", - KeyF57: "\x1b[20;3~", - KeyF58: "\x1b[21;3~", - KeyF59: "\x1b[23;3~", - KeyF60: "\x1b[24;3~", - KeyF61: "\x1b[1;4P", - KeyF62: "\x1b[1;4Q", - KeyF63: "\x1b[1;4R", - KeyBacktab: "\x1b[Z", - KeyShfLeft: "\x1b[1;2D", - KeyShfRight: "\x1b[1;2C", - KeyShfUp: "\x1b[1;2A", - KeyShfDown: "\x1b[1;2B", - KeyCtrlLeft: "\x1b[1;5D", - KeyCtrlRight: "\x1b[1;5C", - KeyCtrlUp: "\x1b[1;5A", - KeyCtrlDown: "\x1b[1;5B", - KeyMetaLeft: "\x1b[1;9D", - KeyMetaRight: "\x1b[1;9C", - KeyMetaUp: "\x1b[1;9A", - KeyMetaDown: "\x1b[1;9B", - KeyAltLeft: "\x1b[1;3D", - KeyAltRight: "\x1b[1;3C", - KeyAltUp: "\x1b[1;3A", - KeyAltDown: "\x1b[1;3B", - KeyAltShfLeft: "\x1b[1;4D", - KeyAltShfRight: "\x1b[1;4C", - KeyAltShfUp: "\x1b[1;4A", - KeyAltShfDown: "\x1b[1;4B", - KeyMetaShfLeft: "\x1b[1;10D", - KeyMetaShfRight: "\x1b[1;10C", - KeyMetaShfUp: "\x1b[1;10A", - KeyMetaShfDown: "\x1b[1;10B", - KeyCtrlShfLeft: "\x1b[1;6D", - KeyCtrlShfRight: "\x1b[1;6C", - KeyCtrlShfUp: "\x1b[1;6A", - KeyCtrlShfDown: "\x1b[1;6B", - KeyShfHome: "\x1b[1;2H", - KeyShfEnd: "\x1b[1;2F", - KeyCtrlHome: "\x1b[1;5H", - KeyCtrlEnd: "\x1b[1;5F", - KeyAltHome: "\x1b[1;9H", - KeyAltEnd: "\x1b[1;9F", - KeyCtrlShfHome: "\x1b[1;6H", - KeyCtrlShfEnd: "\x1b[1;6F", - KeyMetaShfHome: "\x1b[1;10H", - KeyMetaShfEnd: "\x1b[1;10F", - KeyAltShfHome: "\x1b[1;4H", - KeyAltShfEnd: "\x1b[1;4F", - KeyShfPgUp: "\x1b[5;2~", - KeyShfPgDn: "\x1b[6;2~", + Name: "xterm-kitty", + Columns: 80, + Lines: 24, + Colors: 256, + Bell: "\a", + Clear: "\x1b[H\x1b[2J", + EnterCA: "\x1b[?1049h", + ExitCA: "\x1b[?1049l", + ShowCursor: "\x1b[?12l\x1b[?25h", + HideCursor: "\x1b[?25l", + AttrOff: "\x1b(B\x1b[m", + Underline: "\x1b[4m", + Bold: "\x1b[1m", + Dim: "\x1b[2m", + Italic: "\x1b[3m", + Reverse: "\x1b[7m", + EnterKeypad: "\x1b[?1h", + ExitKeypad: "\x1b[?1l", + SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", + SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", + SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", + AltChars: "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", + EnterAcs: "\x1b(0", + ExitAcs: "\x1b(B", + Mouse: "\x1b[M", + MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", + SetCursor: "\x1b[%i%p1%d;%p2%dH", + CursorBack1: "\b", + CursorUp1: "\x1b[A", + KeyUp: "\x1bOA", + KeyDown: "\x1bOB", + KeyRight: "\x1bOC", + KeyLeft: "\x1bOD", + KeyInsert: "\x1b[2~", + KeyDelete: "\x1b[3~", + KeyBackspace: "\u007f", + KeyHome: "\x1bOH", + KeyEnd: "\x1bOF", + KeyPgUp: "\x1b[5~", + KeyPgDn: "\x1b[6~", + KeyF1: "\x1bOP", + KeyF2: "\x1bOQ", + KeyF3: "\x1bOR", + KeyF4: "\x1bOS", + KeyF5: "\x1b[15~", + KeyF6: "\x1b[17~", + KeyF7: "\x1b[18~", + KeyF8: "\x1b[19~", + KeyF9: "\x1b[20~", + KeyF10: "\x1b[21~", + KeyF11: "\x1b[23~", + KeyF12: "\x1b[24~", + KeyBacktab: "\x1b[Z", + Modifiers: 1, }) } diff --git a/tscreen.go b/tscreen.go index ded3d7a..3e436aa 100644 --- a/tscreen.go +++ b/tscreen.go @@ -19,6 +19,7 @@ import ( "io" "os" "strconv" + "strings" "sync" "time" "unicode/utf8" @@ -186,7 +187,7 @@ func (t *tScreen) Init() error { func (t *tScreen) prepareKeyMod(key Key, mod ModMask, val string) { if val != "" { - // Do not overrride codes that already exist + // Do not override codes that already exist if _, exist := t.keycodes[val]; !exist { t.keyexist[key] = true t.keycodes[val] = &tKeyCode{key: key, mod: mod} @@ -194,6 +195,90 @@ func (t *tScreen) prepareKeyMod(key Key, mod ModMask, val string) { } } +func (t *tScreen) prepareKeyModReplace(key Key, replace Key, mod ModMask, val string) { + if val != "" { + // Do not override codes that already exist + if old, exist := t.keycodes[val]; !exist || old.key == replace { + t.keyexist[key] = true + t.keycodes[val] = &tKeyCode{key: key, mod: mod} + } + } +} + +func (t *tScreen) prepareKeyModXTerm(key Key, val string) { + + if strings.HasPrefix(val, "\x1b[") && strings.HasSuffix(val, "~") { + + // Drop the trailing ~ + val = val[:len(val)-1] + + // These suffixes are calculated assuming Xterm style modifier suffixes. + // Please see https://invisible-island.net/xterm/ctlseqs/ctlseqs.pdf for + // more information (specifically "PC-Style Function Keys"). + t.prepareKeyModReplace(key, key+12, ModShift, val+";2~") + t.prepareKeyModReplace(key, key+48, ModAlt, val+";3~") + t.prepareKeyModReplace(key, key+60, ModAlt|ModShift, val+";4~") + t.prepareKeyModReplace(key, key+24, ModCtrl, val+";5~") + t.prepareKeyModReplace(key, key+36, ModCtrl|ModShift, val+";6~") + t.prepareKeyMod(key, ModAlt|ModCtrl, val+";7~") + t.prepareKeyMod(key, ModShift|ModAlt|ModCtrl, val+";8~") + t.prepareKeyMod(key, ModMeta, val+";9~") + t.prepareKeyMod(key, ModMeta|ModShift, val+";10~") + t.prepareKeyMod(key, ModMeta|ModAlt, val+";11~") + t.prepareKeyMod(key, ModMeta|ModAlt|ModShift, val+";12~") + t.prepareKeyMod(key, ModMeta|ModCtrl, val+";13~") + t.prepareKeyMod(key, ModMeta|ModCtrl|ModShift, val+";14~") + t.prepareKeyMod(key, ModMeta|ModCtrl|ModAlt, val+";15~") + t.prepareKeyMod(key, ModMeta|ModCtrl|ModAlt|ModShift, val+";16~") + } else if strings.HasPrefix(val, "\x1bO") && len(val) == 3 { + val = val[2:] + t.prepareKeyModReplace(key, key+12, ModShift, "\x1b[1;2"+val) + t.prepareKeyModReplace(key, key+48, ModAlt, "\x1b[1;3"+val) + t.prepareKeyModReplace(key, key+24, ModCtrl, "\x1b[1;5"+val) + t.prepareKeyModReplace(key, key+36, ModCtrl|ModShift, "\x1b[1;6"+val) + t.prepareKeyModReplace(key, key+60, ModAlt|ModShift, "\x1b[1;4"+val) + t.prepareKeyMod(key, ModAlt|ModCtrl, "\x1b[1;7"+val) + t.prepareKeyMod(key, ModShift|ModAlt|ModCtrl, "\x1b[1;8"+val) + t.prepareKeyMod(key, ModMeta, "\x1b[1;9"+val) + t.prepareKeyMod(key, ModMeta|ModShift, "\x1b[1;10"+val) + t.prepareKeyMod(key, ModMeta|ModAlt, "\x1b[1;11"+val) + t.prepareKeyMod(key, ModMeta|ModAlt|ModShift, "\x1b[1;12"+val) + t.prepareKeyMod(key, ModMeta|ModCtrl, "\x1b[1;13"+val) + t.prepareKeyMod(key, ModMeta|ModCtrl|ModShift, "\x1b[1;14"+val) + t.prepareKeyMod(key, ModMeta|ModCtrl|ModAlt, "\x1b[1;15"+val) + t.prepareKeyMod(key, ModMeta|ModCtrl|ModAlt|ModShift, "\x1b[1;16"+val) + } +} + +func (t *tScreen) prepareXtermModifiers() { + if t.ti.Modifiers != terminfo.ModifiersXTerm { + return + } + time.Sleep(2 * time.Second) + t.prepareKeyModXTerm(KeyRight, t.ti.KeyRight) + t.prepareKeyModXTerm(KeyLeft, t.ti.KeyLeft) + t.prepareKeyModXTerm(KeyUp, t.ti.KeyUp) + t.prepareKeyModXTerm(KeyDown, t.ti.KeyDown) + t.prepareKeyModXTerm(KeyInsert, t.ti.KeyInsert) + t.prepareKeyModXTerm(KeyDelete, t.ti.KeyDelete) + t.prepareKeyModXTerm(KeyPgUp, t.ti.KeyPgUp) + t.prepareKeyModXTerm(KeyPgDn, t.ti.KeyPgDn) + t.prepareKeyModXTerm(KeyHome, t.ti.KeyHome) + t.prepareKeyModXTerm(KeyEnd, t.ti.KeyEnd) + t.prepareKeyModXTerm(KeyF1, t.ti.KeyF1) + t.prepareKeyModXTerm(KeyF2, t.ti.KeyF2) + t.prepareKeyModXTerm(KeyF3, t.ti.KeyF3) + t.prepareKeyModXTerm(KeyF4, t.ti.KeyF4) + t.prepareKeyModXTerm(KeyF5, t.ti.KeyF5) + t.prepareKeyModXTerm(KeyF6, t.ti.KeyF6) + t.prepareKeyModXTerm(KeyF7, t.ti.KeyF7) + t.prepareKeyModXTerm(KeyF8, t.ti.KeyF8) + t.prepareKeyModXTerm(KeyF9, t.ti.KeyF9) + t.prepareKeyModXTerm(KeyF10, t.ti.KeyF10) + t.prepareKeyModXTerm(KeyF11, t.ti.KeyF11) + t.prepareKeyModXTerm(KeyF12, t.ti.KeyF12) +} + func (t *tScreen) prepareKey(key Key, val string) { t.prepareKeyMod(key, ModNone, val) } @@ -297,41 +382,6 @@ func (t *tScreen) prepareKeys() { t.prepareKeyMod(KeyHome, ModCtrl, ti.KeyCtrlHome) t.prepareKeyMod(KeyEnd, ModCtrl, ti.KeyCtrlEnd) - t.prepareKeyMod(KeyRight, ModAlt, ti.KeyAltRight) - t.prepareKeyMod(KeyLeft, ModAlt, ti.KeyAltLeft) - t.prepareKeyMod(KeyUp, ModAlt, ti.KeyAltUp) - t.prepareKeyMod(KeyDown, ModAlt, ti.KeyAltDown) - t.prepareKeyMod(KeyHome, ModAlt, ti.KeyAltHome) - t.prepareKeyMod(KeyEnd, ModAlt, ti.KeyAltEnd) - - t.prepareKeyMod(KeyRight, ModAlt, ti.KeyMetaRight) - t.prepareKeyMod(KeyLeft, ModAlt, ti.KeyMetaLeft) - t.prepareKeyMod(KeyUp, ModAlt, ti.KeyMetaUp) - t.prepareKeyMod(KeyDown, ModAlt, ti.KeyMetaDown) - t.prepareKeyMod(KeyHome, ModAlt, ti.KeyMetaHome) - t.prepareKeyMod(KeyEnd, ModAlt, ti.KeyMetaEnd) - - t.prepareKeyMod(KeyRight, ModAlt|ModShift, ti.KeyAltShfRight) - t.prepareKeyMod(KeyLeft, ModAlt|ModShift, ti.KeyAltShfLeft) - t.prepareKeyMod(KeyUp, ModAlt|ModShift, ti.KeyAltShfUp) - t.prepareKeyMod(KeyDown, ModAlt|ModShift, ti.KeyAltShfDown) - t.prepareKeyMod(KeyHome, ModAlt|ModShift, ti.KeyAltShfHome) - t.prepareKeyMod(KeyEnd, ModAlt|ModShift, ti.KeyAltShfEnd) - - t.prepareKeyMod(KeyRight, ModAlt|ModShift, ti.KeyMetaShfRight) - t.prepareKeyMod(KeyLeft, ModAlt|ModShift, ti.KeyMetaShfLeft) - t.prepareKeyMod(KeyUp, ModAlt|ModShift, ti.KeyMetaShfUp) - t.prepareKeyMod(KeyDown, ModAlt|ModShift, ti.KeyMetaShfDown) - t.prepareKeyMod(KeyHome, ModAlt|ModShift, ti.KeyMetaShfHome) - t.prepareKeyMod(KeyEnd, ModAlt|ModShift, ti.KeyMetaShfEnd) - - t.prepareKeyMod(KeyRight, ModCtrl|ModShift, ti.KeyCtrlShfRight) - t.prepareKeyMod(KeyLeft, ModCtrl|ModShift, ti.KeyCtrlShfLeft) - t.prepareKeyMod(KeyUp, ModCtrl|ModShift, ti.KeyCtrlShfUp) - t.prepareKeyMod(KeyDown, ModCtrl|ModShift, ti.KeyCtrlShfDown) - t.prepareKeyMod(KeyHome, ModCtrl|ModShift, ti.KeyCtrlShfHome) - t.prepareKeyMod(KeyEnd, ModCtrl|ModShift, ti.KeyCtrlShfEnd) - // Sadly, xterm handling of keycodes is somewhat erratic. In // particular, different codes are sent depending on application // mode is in use or not, and the entries for many of these are @@ -364,6 +414,8 @@ func (t *tScreen) prepareKeys() { t.prepareKey(KeyHome, "\x1bOH") } + t.prepareXtermModifiers() + outer: // Add key mappings for control keys. for i := 0; i < ' '; i++ {