forked from chjj/blessed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwidget-term-blessed.js
62 lines (54 loc) · 1.09 KB
/
widget-term-blessed.js
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
var blessed = require('../');
var screen = blessed.screen({
dump: __dirname + '/logs/termblessed.log',
smartCSR: true,
warnings: true
});
var terminal = blessed.terminal({
parent: screen,
// cursor: 'line',
cursorBlink: true,
screenKeys: false,
top: 'center',
left: 'center',
width: '90%',
height: '90%',
border: 'line',
handler: function() {},
style: {
fg: 'default',
bg: 'default',
focus: {
border: {
fg: 'green'
}
}
}
});
terminal.focus();
var term = terminal.term;
var screen2 = blessed.screen({
dump: __dirname + '/logs/termblessed2.log',
smartCSR: true,
warnings: true,
input: term,
output: term
});
var box1 = blessed.box({
parent: screen2,
top: 'center',
left: 'center',
width: 20,
height: 10,
border: 'line',
content: 'Hello world'
});
screen.key('C-q', function() {
// NOTE:
// not necessary since screen.destroy causes terminal.term to be destroyed
// (screen2's input and output are no longer readable/writable)
// screen2.destroy();
return screen.destroy();
});
screen2.render();
screen.render();