mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-01-10 19:16:20 +00:00
more tput fixes/improvements/refactoring.
This commit is contained in:
parent
e771fc9fc9
commit
fe9406aba1
@ -103,10 +103,10 @@ Program.prototype.setupTput = function() {
|
||||
|
||||
var tput = this.tput = new Tput({
|
||||
term: this.terminal,
|
||||
padding: options.padding || false,
|
||||
extended: options.extended || false,
|
||||
printf: options.printf || false,
|
||||
termcap: options.termcap || false
|
||||
padding: options.padding,
|
||||
extended: options.extended,
|
||||
printf: options.printf,
|
||||
termcap: options.termcap
|
||||
});
|
||||
|
||||
this.put = function() {
|
||||
|
974
lib/tput.js
974
lib/tput.js
File diff suppressed because it is too large
Load Diff
@ -20,6 +20,8 @@
|
||||
name: 'xterm',
|
||||
names: [ 'xterm' ],
|
||||
desc: 'xterm terminal emulator (X Window System)',
|
||||
dir: '/usr/share/terminfo',
|
||||
file: '/usr/share/terminfo/x/xterm',
|
||||
bools:
|
||||
{ auto_left_margin: false,
|
||||
auto_right_margin: true,
|
||||
@ -304,7 +306,68 @@
|
||||
ka2: '',
|
||||
kb1: '',
|
||||
kb3: '',
|
||||
kc2: '' } }
|
||||
kc2: '' },
|
||||
features:
|
||||
{ unicode: true,
|
||||
brokenACS: false,
|
||||
PCRomSet: false,
|
||||
magicCookie: true,
|
||||
padding: true,
|
||||
setbuf: true,
|
||||
acsc:
|
||||
{ '`': '◆',
|
||||
a: '▒',
|
||||
f: '°',
|
||||
g: '±',
|
||||
i: '\u000b',
|
||||
j: '┘',
|
||||
k: '┐',
|
||||
l: '┌',
|
||||
m: '└',
|
||||
n: '┼',
|
||||
o: '⎺',
|
||||
p: '⎻',
|
||||
q: '─',
|
||||
r: '⎼',
|
||||
s: '⎽',
|
||||
t: '├',
|
||||
u: '┤',
|
||||
v: '┴',
|
||||
w: '┬',
|
||||
x: '│',
|
||||
y: '≤',
|
||||
z: '≥',
|
||||
'{': 'π',
|
||||
'|': '≠',
|
||||
'}': '£',
|
||||
'~': '·' },
|
||||
acscr:
|
||||
{ '◆': '`',
|
||||
'▒': 'a',
|
||||
'°': 'f',
|
||||
'±': 'g',
|
||||
'\u000b': 'i',
|
||||
'┘': 'j',
|
||||
'┐': 'k',
|
||||
'┌': 'l',
|
||||
'└': 'm',
|
||||
'┼': 'n',
|
||||
'⎺': 'o',
|
||||
'⎻': 'p',
|
||||
'─': 'q',
|
||||
'⎼': 'r',
|
||||
'⎽': 's',
|
||||
'├': 't',
|
||||
'┤': 'u',
|
||||
'┴': 'v',
|
||||
'┬': 'w',
|
||||
'│': 'x',
|
||||
'≤': 'y',
|
||||
'≥': 'z',
|
||||
'π': '{',
|
||||
'≠': '|',
|
||||
'£': '}',
|
||||
'·': '~' } } }
|
||||
Compiling auto_left_margin: false
|
||||
Compiling auto_right_margin: true
|
||||
Compiling no_esc_ctlc: false
|
||||
@ -364,7 +427,7 @@ Compiling U8: -1
|
||||
Compiling back_tab: "\u001b[Z"
|
||||
return "\x1b[Z";
|
||||
Compiling bell: "\u0007"
|
||||
return "\u0007";
|
||||
return "\x07";
|
||||
Compiling carriage_return: "\r"
|
||||
return "\r";
|
||||
Compiling change_scroll_region: "\u001b[%i%p1%d;%p2%dr"
|
||||
@ -434,7 +497,7 @@ return "\x1b[27m";
|
||||
Compiling exit_underline_mode: "\u001b[24m"
|
||||
return "\x1b[24m";
|
||||
Compiling flash_screen: "\u001b[?5h$<100/>\u001b[?5l"
|
||||
var out = "\x1b[?5h";out += "\x1b[?5l";return out;
|
||||
return "\x1b[?5h\x1b[?5l";
|
||||
Compiling init_2string: "\u001b[!p\u001b[?3;4l\u001b[4l\u001b>"
|
||||
return "\x1b[!p\x1b[?3;4l\x1b[4l\x1b>";
|
||||
Compiling insert_line: "\u001b[L"
|
||||
@ -808,4 +871,3 @@ Compiling ka2: ""
|
||||
Compiling kb1: ""
|
||||
Compiling kb3: ""
|
||||
Compiling kc2: ""
|
||||
Max colors: 8.
|
||||
|
36
test/tput.js
36
test/tput.js
@ -81,7 +81,7 @@ function parseArg() {
|
||||
var argv = parseArg();
|
||||
|
||||
var tput = blessed.tput({
|
||||
term: argv[0] || 'xterm',
|
||||
term: argv[0] && argv[0] !== 'all' ? argv[0] : 'xterm',
|
||||
extended: true,
|
||||
debug: true,
|
||||
termcap: argv.termcap,
|
||||
@ -90,7 +90,39 @@ var tput = blessed.tput({
|
||||
termcapFile: argv.c || argv.cfile
|
||||
});
|
||||
|
||||
console.log('Max colors: %d.', tput.colors);
|
||||
if (!argv[0] || argv[0] === 'all') {
|
||||
console.log('');
|
||||
|
||||
var rl = require('readline').createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout
|
||||
});
|
||||
|
||||
var text = '\x1b[31mWARNING:\x1b[m '
|
||||
+ 'This will compile every single terminfo file on your disk.\n'
|
||||
+ 'It will probably use a lot of CPU.\n'
|
||||
+ 'Do you wish to proceed? (Y/n) ';
|
||||
|
||||
rl.question(text, function(result) {
|
||||
result = result.trim().toLowerCase();
|
||||
if (result !== 'y') return process.exit(0);
|
||||
console.log('\x1b[32m(You bet your ass I wish to proceed.)\x1b[m');
|
||||
setTimeout(function() { process.stdout.write('.'); }, 1000);
|
||||
setTimeout(function() { process.stdout.write('.'); }, 2000);
|
||||
setTimeout(function() { process.stdout.write('.'); }, 3000);
|
||||
setTimeout(function() {
|
||||
console.log('Let\'s go...');
|
||||
}, 3000);
|
||||
setTimeout(function() {
|
||||
tput.compileAll(argv[1]);
|
||||
process.exit(0);
|
||||
}, 4000);
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// console.log('Max colors: %d.', tput.colors);
|
||||
|
||||
// console.log(tput.strings.acs_chars.split('').map(function(ch) { return ch.charCodeAt(0); }));
|
||||
// console.log(JSON.stringify(tput.strings.acs_chars));
|
||||
|
Loading…
x
Reference in New Issue
Block a user