forked from gdamore/tcell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
term.go
112 lines (106 loc) · 3.24 KB
/
term.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
// Copyright 2021 The TCell Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use file except in compliance with the License.
// You may obtain a copy of the license at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// This terminal definition is hand-coded, as the default terminfo for
// this terminal is busted with respect to color. Unlike pretty much every
// other ANSI compliant terminal, this terminal cannot combine foreground and
// background escapes. The default terminfo also only provides escapes for
// 16-bit color.
package sun
import "github.com/gdamore/tcell/v2/terminfo"
func init() {
// Sun Microsystems Inc. workstation console
terminfo.AddTerminfo(&terminfo.Terminfo{
Name: "sun",
Aliases: []string{"sun1", "sun2"},
Columns: 80,
Lines: 34,
Bell: "\a",
Clear: "\f",
AttrOff: "\x1b[m",
Reverse: "\x1b[7m",
PadChar: "\x00",
SetCursor: "\x1b[%i%p1%d;%p2%dH",
CursorBack1: "\b",
CursorUp1: "\x1b[A",
KeyUp: "\x1b[A",
KeyDown: "\x1b[B",
KeyRight: "\x1b[C",
KeyLeft: "\x1b[D",
KeyInsert: "\x1b[247z",
KeyDelete: "\u007f",
KeyBackspace: "\b",
KeyHome: "\x1b[214z",
KeyEnd: "\x1b[220z",
KeyPgUp: "\x1b[216z",
KeyPgDn: "\x1b[222z",
KeyF1: "\x1b[224z",
KeyF2: "\x1b[225z",
KeyF3: "\x1b[226z",
KeyF4: "\x1b[227z",
KeyF5: "\x1b[228z",
KeyF6: "\x1b[229z",
KeyF7: "\x1b[230z",
KeyF8: "\x1b[231z",
KeyF9: "\x1b[232z",
KeyF10: "\x1b[233z",
KeyF11: "\x1b[234z",
KeyF12: "\x1b[235z",
AutoMargin: true,
InsertChar: "\x1b[@",
})
// Sun Microsystems Workstation console with color support (IA systems)
terminfo.AddTerminfo(&terminfo.Terminfo{
Name: "sun-color",
Columns: 80,
Lines: 34,
Colors: 256,
Bell: "\a",
Clear: "\f",
AttrOff: "\x1b[m",
Bold: "\x1b[1m",
Reverse: "\x1b[7m",
SetFg: "\x1b[38;5;%p1%dm",
SetBg: "\x1b[48;5;%p1%dm",
ResetFgBg: "\x1b[0m",
PadChar: "\x00",
SetCursor: "\x1b[%i%p1%d;%p2%dH",
CursorBack1: "\b",
CursorUp1: "\x1b[A",
KeyUp: "\x1b[A",
KeyDown: "\x1b[B",
KeyRight: "\x1b[C",
KeyLeft: "\x1b[D",
KeyInsert: "\x1b[247z",
KeyDelete: "\u007f",
KeyBackspace: "\b",
KeyHome: "\x1b[214z",
KeyEnd: "\x1b[220z",
KeyPgUp: "\x1b[216z",
KeyPgDn: "\x1b[222z",
KeyF1: "\x1b[224z",
KeyF2: "\x1b[225z",
KeyF3: "\x1b[226z",
KeyF4: "\x1b[227z",
KeyF5: "\x1b[228z",
KeyF6: "\x1b[229z",
KeyF7: "\x1b[230z",
KeyF8: "\x1b[231z",
KeyF9: "\x1b[232z",
KeyF10: "\x1b[233z",
KeyF11: "\x1b[234z",
KeyF12: "\x1b[235z",
AutoMargin: true,
InsertChar: "\x1b[@",
})
}