@socketsecurity/cli-with-sentry 0.14.137 → 0.14.139
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blessed/LICENSE +20 -0
- package/dist/blessed/lib/alias.js +519 -0
- package/dist/blessed/lib/blessed.js +32 -0
- package/dist/blessed/lib/colors.js +490 -0
- package/dist/blessed/lib/events.js +195 -0
- package/dist/blessed/lib/gpmclient.js +245 -0
- package/dist/blessed/lib/helpers.js +170 -0
- package/dist/blessed/lib/keys.js +512 -0
- package/dist/blessed/lib/program.js +4530 -0
- package/dist/blessed/lib/tput.js +3111 -0
- package/dist/blessed/lib/unicode.js +912 -0
- package/dist/blessed/lib/widget.js +60 -0
- package/dist/blessed/lib/widgets/ansiimage.js +173 -0
- package/dist/blessed/lib/widgets/bigtext.js +170 -0
- package/dist/blessed/lib/widgets/box.js +34 -0
- package/dist/blessed/lib/widgets/button.js +62 -0
- package/dist/blessed/lib/widgets/checkbox.js +95 -0
- package/dist/blessed/lib/widgets/element.js +2871 -0
- package/dist/blessed/lib/widgets/filemanager.js +223 -0
- package/dist/blessed/lib/widgets/form.js +301 -0
- package/dist/blessed/lib/widgets/image.js +71 -0
- package/dist/blessed/lib/widgets/input.js +34 -0
- package/dist/blessed/lib/widgets/layout.js +249 -0
- package/dist/blessed/lib/widgets/line.js +59 -0
- package/dist/blessed/lib/widgets/list.js +652 -0
- package/dist/blessed/lib/widgets/listbar.js +452 -0
- package/dist/blessed/lib/widgets/listtable.js +265 -0
- package/dist/blessed/lib/widgets/loading.js +88 -0
- package/dist/blessed/lib/widgets/log.js +82 -0
- package/dist/blessed/lib/widgets/message.js +145 -0
- package/dist/blessed/lib/widgets/node.js +314 -0
- package/dist/blessed/lib/widgets/overlayimage.js +794 -0
- package/dist/blessed/lib/widgets/progressbar.js +166 -0
- package/dist/blessed/lib/widgets/prompt.js +127 -0
- package/dist/blessed/lib/widgets/question.js +129 -0
- package/dist/blessed/lib/widgets/radiobutton.js +62 -0
- package/dist/blessed/lib/widgets/radioset.js +36 -0
- package/dist/blessed/lib/widgets/screen.js +2485 -0
- package/dist/blessed/lib/widgets/scrollablebox.js +415 -0
- package/dist/blessed/lib/widgets/scrollabletext.js +35 -0
- package/dist/blessed/lib/widgets/table.js +383 -0
- package/dist/blessed/lib/widgets/terminal.js +452 -0
- package/dist/blessed/lib/widgets/text.js +35 -0
- package/dist/blessed/lib/widgets/textarea.js +376 -0
- package/dist/blessed/lib/widgets/textbox.js +79 -0
- package/dist/blessed/lib/widgets/video.js +130 -0
- package/dist/blessed/usr/fonts/AUTHORS +1 -0
- package/dist/blessed/usr/fonts/LICENSE +94 -0
- package/dist/blessed/usr/fonts/README +340 -0
- package/dist/blessed/usr/fonts/ter-u14b.json +17826 -0
- package/dist/blessed/usr/fonts/ter-u14n.json +17826 -0
- package/dist/blessed/usr/linux +0 -0
- package/dist/blessed/usr/windows-ansi +0 -0
- package/dist/blessed/usr/xterm +0 -0
- package/dist/blessed/usr/xterm-256color +0 -0
- package/dist/blessed/usr/xterm.termcap +243 -0
- package/dist/blessed/usr/xterm.terminfo +1977 -0
- package/dist/blessed/vendor/tng.js +1876 -0
- package/dist/blessed-contrib/LICENSE.md +21 -0
- package/dist/blessed-contrib/lib/layout/carousel.js +82 -0
- package/dist/blessed-contrib/lib/layout/grid.js +46 -0
- package/dist/blessed-contrib/lib/server-utils.js +83 -0
- package/dist/blessed-contrib/lib/utils.js +73 -0
- package/dist/blessed-contrib/lib/widget/canvas.js +52 -0
- package/dist/blessed-contrib/lib/widget/charts/bar.js +99 -0
- package/dist/blessed-contrib/lib/widget/charts/line.js +311 -0
- package/dist/blessed-contrib/lib/widget/charts/stacked-bar.js +245 -0
- package/dist/blessed-contrib/lib/widget/donut.js +183 -0
- package/dist/blessed-contrib/lib/widget/gauge-list.js +111 -0
- package/dist/blessed-contrib/lib/widget/gauge.js +127 -0
- package/dist/blessed-contrib/lib/widget/lcd.js +497 -0
- package/dist/blessed-contrib/lib/widget/log.js +32 -0
- package/dist/blessed-contrib/lib/widget/map.js +97 -0
- package/dist/blessed-contrib/lib/widget/markdown.js +68 -0
- package/dist/blessed-contrib/lib/widget/picture.js +61 -0
- package/dist/blessed-contrib/lib/widget/sparkline.js +66 -0
- package/dist/blessed-contrib/lib/widget/table.js +141 -0
- package/dist/blessed-contrib/lib/widget/tree.js +179 -0
- package/dist/blessed-contrib/node_modules/ansi-regex/index.js +6 -0
- package/dist/blessed-contrib/node_modules/ansi-regex/license +21 -0
- package/dist/blessed-contrib/node_modules/ansi-regex/package.json +64 -0
- package/dist/blessed-contrib/node_modules/ansi-regex/readme.md +39 -0
- package/dist/blessed-contrib/node_modules/ansi-styles/index.js +67 -0
- package/dist/blessed-contrib/node_modules/ansi-styles/license +21 -0
- package/dist/blessed-contrib/node_modules/ansi-styles/package.json +50 -0
- package/dist/blessed-contrib/node_modules/ansi-styles/readme.md +86 -0
- package/dist/blessed-contrib/node_modules/chalk/index.js +118 -0
- package/dist/blessed-contrib/node_modules/chalk/license +21 -0
- package/dist/blessed-contrib/node_modules/chalk/package.json +70 -0
- package/dist/blessed-contrib/node_modules/chalk/readme.md +213 -0
- package/dist/blessed-contrib/node_modules/escape-string-regexp/index.js +13 -0
- package/dist/blessed-contrib/node_modules/escape-string-regexp/license +21 -0
- package/dist/blessed-contrib/node_modules/escape-string-regexp/package.json +41 -0
- package/dist/blessed-contrib/node_modules/escape-string-regexp/readme.md +27 -0
- package/dist/blessed-contrib/node_modules/strip-ansi/index.js +8 -0
- package/dist/blessed-contrib/node_modules/strip-ansi/license +21 -0
- package/dist/blessed-contrib/node_modules/strip-ansi/package.json +57 -0
- package/dist/blessed-contrib/node_modules/strip-ansi/readme.md +33 -0
- package/dist/blessed-contrib/node_modules/supports-color/index.js +52 -0
- package/dist/blessed-contrib/node_modules/supports-color/license +21 -0
- package/dist/blessed-contrib/node_modules/supports-color/package.json +49 -0
- package/dist/blessed-contrib/node_modules/supports-color/readme.md +36 -0
- package/dist/cli.js +9 -8
- package/dist/cli.js.map +1 -1
- package/dist/instrument-with-sentry.js +2 -2
- package/dist/instrument-with-sentry.js.map +1 -1
- package/dist/shadow-npm-inject.js +2 -2
- package/dist/shadow-npm-inject.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* terminal.js - term.js terminal element for blessed
|
|
3
|
+
* Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License).
|
|
4
|
+
* https://github.com/chjj/blessed
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Modules
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const nextTick = global.setImmediate || process.nextTick.bind(process)
|
|
12
|
+
|
|
13
|
+
const Node = require('./node')
|
|
14
|
+
const Box = require('./box')
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Terminal
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
function Terminal(options) {
|
|
21
|
+
if (!(this instanceof Node)) {
|
|
22
|
+
return new Terminal(options)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
options = options || {}
|
|
26
|
+
options.scrollable = false
|
|
27
|
+
|
|
28
|
+
Box.call(this, options)
|
|
29
|
+
|
|
30
|
+
// XXX Workaround for all motion
|
|
31
|
+
if (this.screen.program.tmux && this.screen.program.tmuxVersion >= 2) {
|
|
32
|
+
this.screen.program.enableMouse()
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
this.handler = options.handler
|
|
36
|
+
this.shell = options.shell || process.env.SHELL || 'sh'
|
|
37
|
+
this.args = options.args || []
|
|
38
|
+
|
|
39
|
+
this.cursor = this.options.cursor
|
|
40
|
+
this.cursorBlink = this.options.cursorBlink
|
|
41
|
+
this.screenKeys = this.options.screenKeys
|
|
42
|
+
|
|
43
|
+
this.style = this.style || {}
|
|
44
|
+
this.style.bg = this.style.bg || 'default'
|
|
45
|
+
this.style.fg = this.style.fg || 'default'
|
|
46
|
+
|
|
47
|
+
this.termName =
|
|
48
|
+
options.terminal || options.term || process.env.TERM || 'xterm'
|
|
49
|
+
|
|
50
|
+
this.bootstrap()
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
Object.setPrototypeOf(Terminal.prototype, Box.prototype)
|
|
54
|
+
|
|
55
|
+
Terminal.prototype.type = 'terminal'
|
|
56
|
+
|
|
57
|
+
Terminal.prototype.bootstrap = function () {
|
|
58
|
+
const self = this
|
|
59
|
+
|
|
60
|
+
const element = {
|
|
61
|
+
// window
|
|
62
|
+
get document() {
|
|
63
|
+
return element
|
|
64
|
+
},
|
|
65
|
+
navigator: { userAgent: 'node.js' },
|
|
66
|
+
|
|
67
|
+
// document
|
|
68
|
+
get defaultView() {
|
|
69
|
+
return element
|
|
70
|
+
},
|
|
71
|
+
get documentElement() {
|
|
72
|
+
return element
|
|
73
|
+
},
|
|
74
|
+
createElement: function () {
|
|
75
|
+
return element
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
// element
|
|
79
|
+
get ownerDocument() {
|
|
80
|
+
return element
|
|
81
|
+
},
|
|
82
|
+
addEventListener: function () {},
|
|
83
|
+
removeEventListener: function () {},
|
|
84
|
+
getElementsByTagName: function () {
|
|
85
|
+
return [element]
|
|
86
|
+
},
|
|
87
|
+
getElementById: function () {
|
|
88
|
+
return element
|
|
89
|
+
},
|
|
90
|
+
parentNode: null,
|
|
91
|
+
offsetParent: null,
|
|
92
|
+
appendChild: function () {},
|
|
93
|
+
removeChild: function () {},
|
|
94
|
+
setAttribute: function () {},
|
|
95
|
+
getAttribute: function () {},
|
|
96
|
+
style: {},
|
|
97
|
+
focus: function () {},
|
|
98
|
+
blur: function () {},
|
|
99
|
+
console: console
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
element.parentNode = element
|
|
103
|
+
element.offsetParent = element
|
|
104
|
+
|
|
105
|
+
this.term = require('term.js')({
|
|
106
|
+
termName: this.termName,
|
|
107
|
+
cols: this.width - this.iwidth,
|
|
108
|
+
rows: this.height - this.iheight,
|
|
109
|
+
context: element,
|
|
110
|
+
document: element,
|
|
111
|
+
body: element,
|
|
112
|
+
parent: element,
|
|
113
|
+
cursorBlink: this.cursorBlink,
|
|
114
|
+
screenKeys: this.screenKeys
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
this.term.refresh = function () {
|
|
118
|
+
self.screen.render()
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
this.term.keyDown = function () {}
|
|
122
|
+
this.term.keyPress = function () {}
|
|
123
|
+
|
|
124
|
+
this.term.open(element)
|
|
125
|
+
|
|
126
|
+
// Emits key sequences in html-land.
|
|
127
|
+
// Technically not necessary here.
|
|
128
|
+
// In reality if we wanted to be neat, we would overwrite the keyDown and
|
|
129
|
+
// keyPress methods with our own node.js-keys->terminal-keys methods, but
|
|
130
|
+
// since all the keys are already coming in as escape sequences, we can just
|
|
131
|
+
// send the input directly to the handler/socket (see below).
|
|
132
|
+
// this.term.on('data', function(data) {
|
|
133
|
+
// self.handler(data);
|
|
134
|
+
// });
|
|
135
|
+
|
|
136
|
+
// Incoming keys and mouse inputs.
|
|
137
|
+
// NOTE: Cannot pass mouse events - coordinates will be off!
|
|
138
|
+
this.screen.program.input.on(
|
|
139
|
+
'data',
|
|
140
|
+
(this._onData = function (data) {
|
|
141
|
+
if (self.screen.focused === self && !self._isMouse(data)) {
|
|
142
|
+
self.handler(data)
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
this.onScreenEvent('mouse', function (data) {
|
|
148
|
+
if (self.screen.focused !== self) {
|
|
149
|
+
return
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (data.x < self.aleft + self.ileft) {
|
|
153
|
+
return
|
|
154
|
+
}
|
|
155
|
+
if (data.y < self.atop + self.itop) {
|
|
156
|
+
return
|
|
157
|
+
}
|
|
158
|
+
if (data.x > self.aleft - self.ileft + self.width) {
|
|
159
|
+
return
|
|
160
|
+
}
|
|
161
|
+
if (data.y > self.atop - self.itop + self.height) {
|
|
162
|
+
return
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (
|
|
166
|
+
self.term.x10Mouse ||
|
|
167
|
+
self.term.vt200Mouse ||
|
|
168
|
+
self.term.normalMouse ||
|
|
169
|
+
self.term.mouseEvents ||
|
|
170
|
+
self.term.utfMouse ||
|
|
171
|
+
self.term.sgrMouse ||
|
|
172
|
+
self.term.urxvtMouse
|
|
173
|
+
) {
|
|
174
|
+
} else {
|
|
175
|
+
return
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
let b = data.raw[0],
|
|
179
|
+
x = data.x - self.aleft,
|
|
180
|
+
y = data.y - self.atop,
|
|
181
|
+
s
|
|
182
|
+
|
|
183
|
+
if (self.term.urxvtMouse) {
|
|
184
|
+
if (self.screen.program.sgrMouse) {
|
|
185
|
+
b += 32
|
|
186
|
+
}
|
|
187
|
+
s = '\x1b[' + b + ';' + (x + 32) + ';' + (y + 32) + 'M'
|
|
188
|
+
} else if (self.term.sgrMouse) {
|
|
189
|
+
if (!self.screen.program.sgrMouse) {
|
|
190
|
+
b -= 32
|
|
191
|
+
}
|
|
192
|
+
s =
|
|
193
|
+
'\x1b[<' +
|
|
194
|
+
b +
|
|
195
|
+
';' +
|
|
196
|
+
x +
|
|
197
|
+
';' +
|
|
198
|
+
y +
|
|
199
|
+
(data.action === 'mousedown' ? 'M' : 'm')
|
|
200
|
+
} else {
|
|
201
|
+
if (self.screen.program.sgrMouse) {
|
|
202
|
+
b += 32
|
|
203
|
+
}
|
|
204
|
+
s =
|
|
205
|
+
'\x1b[M' +
|
|
206
|
+
String.fromCharCode(b) +
|
|
207
|
+
String.fromCharCode(x + 32) +
|
|
208
|
+
String.fromCharCode(y + 32)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
self.handler(s)
|
|
212
|
+
})
|
|
213
|
+
|
|
214
|
+
this.on('focus', function () {
|
|
215
|
+
self.term.focus()
|
|
216
|
+
})
|
|
217
|
+
|
|
218
|
+
this.on('blur', function () {
|
|
219
|
+
self.term.blur()
|
|
220
|
+
})
|
|
221
|
+
|
|
222
|
+
this.term.on('title', function (title) {
|
|
223
|
+
self.title = title
|
|
224
|
+
self.emit('title', title)
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
this.term.on('passthrough', function (data) {
|
|
228
|
+
self.screen.program.flush()
|
|
229
|
+
self.screen.program._owrite(data)
|
|
230
|
+
})
|
|
231
|
+
|
|
232
|
+
this.on('resize', function () {
|
|
233
|
+
nextTick(function () {
|
|
234
|
+
self.term.resize(self.width - self.iwidth, self.height - self.iheight)
|
|
235
|
+
})
|
|
236
|
+
})
|
|
237
|
+
|
|
238
|
+
this.once('render', function () {
|
|
239
|
+
self.term.resize(self.width - self.iwidth, self.height - self.iheight)
|
|
240
|
+
})
|
|
241
|
+
|
|
242
|
+
this.on('destroy', function () {
|
|
243
|
+
self.kill()
|
|
244
|
+
self.screen.program.input.removeListener('data', self._onData)
|
|
245
|
+
})
|
|
246
|
+
|
|
247
|
+
if (this.handler) {
|
|
248
|
+
return
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
this.pty = require('pty.js').fork(this.shell, this.args, {
|
|
252
|
+
name: this.termName,
|
|
253
|
+
cols: this.width - this.iwidth,
|
|
254
|
+
rows: this.height - this.iheight,
|
|
255
|
+
cwd: process.env.HOME,
|
|
256
|
+
env: this.options.env || process.env
|
|
257
|
+
})
|
|
258
|
+
|
|
259
|
+
this.on('resize', function () {
|
|
260
|
+
nextTick(function () {
|
|
261
|
+
try {
|
|
262
|
+
self.pty.resize(self.width - self.iwidth, self.height - self.iheight)
|
|
263
|
+
} catch (e) {}
|
|
264
|
+
})
|
|
265
|
+
})
|
|
266
|
+
|
|
267
|
+
this.handler = function (data) {
|
|
268
|
+
self.pty.write(data)
|
|
269
|
+
self.screen.render()
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
this.pty.on('data', function (data) {
|
|
273
|
+
self.write(data)
|
|
274
|
+
self.screen.render()
|
|
275
|
+
})
|
|
276
|
+
|
|
277
|
+
this.pty.on('exit', function (code) {
|
|
278
|
+
self.emit('exit', code || null)
|
|
279
|
+
})
|
|
280
|
+
|
|
281
|
+
this.onScreenEvent('keypress', function () {
|
|
282
|
+
self.screen.render()
|
|
283
|
+
})
|
|
284
|
+
|
|
285
|
+
this.screen._listenKeys(this)
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
Terminal.prototype.write = function (data) {
|
|
289
|
+
return this.term.write(data)
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
Terminal.prototype.render = function () {
|
|
293
|
+
const ret = this._render()
|
|
294
|
+
if (!ret) {
|
|
295
|
+
return
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
this.dattr = this.sattr(this.style)
|
|
299
|
+
|
|
300
|
+
let xi = ret.xi + this.ileft,
|
|
301
|
+
xl = ret.xl - this.iright,
|
|
302
|
+
yi = ret.yi + this.itop,
|
|
303
|
+
yl = ret.yl - this.ibottom,
|
|
304
|
+
cursor
|
|
305
|
+
|
|
306
|
+
const scrollback = this.term.lines.length - (yl - yi)
|
|
307
|
+
|
|
308
|
+
for (let y = Math.max(yi, 0); y < yl; y++) {
|
|
309
|
+
const line = this.screen.lines[y]
|
|
310
|
+
if (!line || !this.term.lines[scrollback + y - yi]) {
|
|
311
|
+
break
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
if (
|
|
315
|
+
y === yi + this.term.y &&
|
|
316
|
+
this.term.cursorState &&
|
|
317
|
+
this.screen.focused === this &&
|
|
318
|
+
(this.term.ydisp === this.term.ybase || this.term.selectMode) &&
|
|
319
|
+
!this.term.cursorHidden
|
|
320
|
+
) {
|
|
321
|
+
cursor = xi + this.term.x
|
|
322
|
+
} else {
|
|
323
|
+
cursor = -1
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
for (let x = Math.max(xi, 0); x < xl; x++) {
|
|
327
|
+
if (!line[x] || !this.term.lines[scrollback + y - yi][x - xi]) {
|
|
328
|
+
break
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
line[x][0] = this.term.lines[scrollback + y - yi][x - xi][0]
|
|
332
|
+
|
|
333
|
+
if (x === cursor) {
|
|
334
|
+
if (this.cursor === 'line') {
|
|
335
|
+
line[x][0] = this.dattr
|
|
336
|
+
line[x][1] = '\u2502'
|
|
337
|
+
continue
|
|
338
|
+
} else if (this.cursor === 'underline') {
|
|
339
|
+
line[x][0] = this.dattr | (2 << 18)
|
|
340
|
+
} else if (this.cursor === 'block' || !this.cursor) {
|
|
341
|
+
line[x][0] = this.dattr | (8 << 18)
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
line[x][1] = this.term.lines[scrollback + y - yi][x - xi][1]
|
|
346
|
+
|
|
347
|
+
// default foreground = 257
|
|
348
|
+
if (((line[x][0] >> 9) & 0x1ff) === 257) {
|
|
349
|
+
line[x][0] &= ~(0x1ff << 9)
|
|
350
|
+
line[x][0] |= ((this.dattr >> 9) & 0x1ff) << 9
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// default background = 256
|
|
354
|
+
if ((line[x][0] & 0x1ff) === 256) {
|
|
355
|
+
line[x][0] &= ~0x1ff
|
|
356
|
+
line[x][0] |= this.dattr & 0x1ff
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
line.dirty = true
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
return ret
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
Terminal.prototype._isMouse = function (buf) {
|
|
367
|
+
let s = buf
|
|
368
|
+
if (Buffer.isBuffer(s)) {
|
|
369
|
+
if (s[0] > 127 && s[1] === undefined) {
|
|
370
|
+
s[0] -= 128
|
|
371
|
+
s = '\x1b' + s.toString('utf-8')
|
|
372
|
+
} else {
|
|
373
|
+
s = s.toString('utf-8')
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
return (
|
|
377
|
+
(buf[0] === 0x1b && buf[1] === 0x5b && buf[2] === 0x4d) ||
|
|
378
|
+
/^\x1b\[M([\x00\u0020-\uffff]{3})/.test(s) ||
|
|
379
|
+
/^\x1b\[(\d+;\d+;\d+)M/.test(s) ||
|
|
380
|
+
/^\x1b\[<(\d+;\d+;\d+)([mM])/.test(s) ||
|
|
381
|
+
/^\x1b\[<(\d+;\d+;\d+;\d+)&w/.test(s) ||
|
|
382
|
+
/^\x1b\[24([0135])~\[(\d+),(\d+)\]\r/.test(s) ||
|
|
383
|
+
/^\x1b\[(O|I)/.test(s)
|
|
384
|
+
)
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
Terminal.prototype.setScroll = Terminal.prototype.scrollTo = function (offset) {
|
|
388
|
+
this.term.ydisp = offset
|
|
389
|
+
return this.emit('scroll')
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
Terminal.prototype.getScroll = function () {
|
|
393
|
+
return this.term.ydisp
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
Terminal.prototype.scroll = function (offset) {
|
|
397
|
+
this.term.scrollDisp(offset)
|
|
398
|
+
return this.emit('scroll')
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
Terminal.prototype.resetScroll = function () {
|
|
402
|
+
this.term.ydisp = 0
|
|
403
|
+
this.term.ybase = 0
|
|
404
|
+
return this.emit('scroll')
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
Terminal.prototype.getScrollHeight = function () {
|
|
408
|
+
return this.term.rows - 1
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
Terminal.prototype.getScrollPerc = function () {
|
|
412
|
+
return (this.term.ydisp / this.term.ybase) * 100
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
Terminal.prototype.setScrollPerc = function (i) {
|
|
416
|
+
return this.setScroll(((i / 100) * this.term.ybase) | 0)
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
Terminal.prototype.screenshot = function (xi, xl, yi, yl) {
|
|
420
|
+
xi = 0 + (xi || 0)
|
|
421
|
+
if (xl != null) {
|
|
422
|
+
xl = 0 + (xl || 0)
|
|
423
|
+
} else {
|
|
424
|
+
xl = this.term.lines[0].length
|
|
425
|
+
}
|
|
426
|
+
yi = 0 + (yi || 0)
|
|
427
|
+
if (yl != null) {
|
|
428
|
+
yl = 0 + (yl || 0)
|
|
429
|
+
} else {
|
|
430
|
+
yl = this.term.lines.length
|
|
431
|
+
}
|
|
432
|
+
return this.screen.screenshot(xi, xl, yi, yl, this.term)
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
Terminal.prototype.kill = function () {
|
|
436
|
+
if (this.pty) {
|
|
437
|
+
this.pty.destroy()
|
|
438
|
+
this.pty.kill()
|
|
439
|
+
}
|
|
440
|
+
this.term.refresh = function () {}
|
|
441
|
+
this.term.write('\x1b[H\x1b[J')
|
|
442
|
+
if (this.term._blink) {
|
|
443
|
+
clearInterval(this.term._blink)
|
|
444
|
+
}
|
|
445
|
+
this.term.destroy()
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Expose
|
|
450
|
+
*/
|
|
451
|
+
|
|
452
|
+
module.exports = Terminal
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* text.js - text element for blessed
|
|
3
|
+
* Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License).
|
|
4
|
+
* https://github.com/chjj/blessed
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Modules
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const Node = require('./node')
|
|
12
|
+
const Element = require('./element')
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Text
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
function Text(options) {
|
|
19
|
+
if (!(this instanceof Node)) {
|
|
20
|
+
return new Text(options)
|
|
21
|
+
}
|
|
22
|
+
options = options || {}
|
|
23
|
+
options.shrink = true
|
|
24
|
+
Element.call(this, options)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
Object.setPrototypeOf(Text.prototype, Element.prototype)
|
|
28
|
+
|
|
29
|
+
Text.prototype.type = 'text'
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Expose
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
module.exports = Text
|