UNPKG

3.44 kBJavaScriptView Raw
1/*
2 Terminal Kit
3
4 Copyright (c) 2009 - 2020 Cédric Ronvel
5
6 The MIT License (MIT)
7
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
14
15 The above copyright notice and this permission notice shall be included in all
16 copies or substantial portions of the Software.
17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 SOFTWARE.
25*/
26
27"use strict" ;
28
29
30
31const tree = require( 'tree-kit' ) ;
32const xterm = require( './xterm.js' ) ;
33
34
35
36const esc = tree.extend( null , Object.create( xterm.esc ) , {
37 // Not supported...
38 setClipboardLL: { na: true } ,
39 requestClipboard: { na: true } ,
40
41 // Cursor styles not supported
42 blockCursor: { on: '' , na: true } ,
43 blinkingBlockCursor: { on: '' , na: true } ,
44 underlineCursor: { on: '' , na: true } ,
45 blinkingUnderlineCursor: { on: '' , na: true } ,
46 beamCursor: { on: '' , na: true } ,
47 blinkingBeamCursor: { on: '' , na: true } ,
48
49 // Not capable, fallback to mouseButton
50 mouseDrag: { on: '\x1b[?1000h' , off: '\x1b[?1000l' , fb: true } ,
51 mouseMotion: { on: '\x1b[?1000h' , off: '\x1b[?1000l' , fb: true } ,
52
53 requestColor: { on: '%D' , na: true } // not capable
54} ) ;
55
56
57
58
59
60/* Key Mapping */
61
62
63
64const keymap = tree.extend( null , Object.create( xterm.keymap ) , {
65 F1: '\x1b[11~' ,
66 F2: '\x1b[12~' ,
67 F3: '\x1b[13~' ,
68 F4: '\x1b[14~' ,
69
70 //SHIFT_F1: '\x1b[25~' , // no difference with F11
71 //SHIFT_F2: '\x1b[26~' , // no difference with F12
72 SHIFT_F3: '\x1b[25~' ,
73 SHIFT_F4: '\x1b[26~' ,
74 SHIFT_F5: '\x1b[28~' ,
75 SHIFT_F6: '\x1b[29~' ,
76 SHIFT_F7: '\x1b[31~' ,
77 SHIFT_F8: '\x1b[32~' ,
78 SHIFT_F9: '\x1b[33~' ,
79 SHIFT_F10: '\x1b[34~' ,
80 SHIFT_F11: '\x1b[23$' ,
81 SHIFT_F12: '\x1b[24$' ,
82
83 CTRL_F1: '\x1b[11^' ,
84 CTRL_F2: '\x1b[12^' ,
85 CTRL_F3: '\x1b[13^' ,
86 CTRL_F4: '\x1b[14^' ,
87 CTRL_F5: '\x1b[15^' ,
88 CTRL_F6: '\x1b[17^' ,
89 CTRL_F7: '\x1b[18^' ,
90 CTRL_F8: '\x1b[19^' ,
91 CTRL_F9: '\x1b[20^' ,
92 CTRL_F10: '\x1b[21^' ,
93 CTRL_F11: '\x1b[23^' ,
94 CTRL_F12: '\x1b[24^' ,
95
96 //CTRL_SHIFT_F1: '\x1b[11^' , // no difference with CTRL_F11
97 //CTRL_SHIFT_F2: '\x1b[12^' , // no difference with CTRL_F12
98 CTRL_SHIFT_F3: '\x1b[25^' ,
99 CTRL_SHIFT_F4: '\x1b[26^' ,
100 CTRL_SHIFT_F5: '\x1b[28^' ,
101 CTRL_SHIFT_F6: '\x1b[29^' ,
102 CTRL_SHIFT_F7: '\x1b[31^' ,
103 CTRL_SHIFT_F8: '\x1b[32^' ,
104 CTRL_SHIFT_F9: '\x1b[33^' ,
105 CTRL_SHIFT_F10: '\x1b[34^' ,
106 CTRL_SHIFT_F11: '\x1b[23@' ,
107 CTRL_SHIFT_F12: '\x1b[24@'
108
109} ) ;
110
111
112
113const handler = Object.create( xterm.handler ) ;
114
115
116
117module.exports = {
118 esc: esc ,
119 keymap: keymap ,
120 handler: handler ,
121 support: {
122 deltaEscapeSequence: true ,
123 "256colors": false ,
124 "24bitsColors": false , // DEPRECATED
125 "trueColor": false
126 } ,
127 colorRegister: require( '../colorScheme/xterm.json' )
128} ;
129