tput: debug info for {init,reset}_file. fix global var.
This commit is contained in:
parent
77695f994a
commit
02ca94a8d9
11
lib/tput.js
11
lib/tput.js
|
@ -705,7 +705,8 @@ Tput.prototype.inject = function(info) {
|
|||
// ~/ncurses/ncurses/tinfo/lib_tparm.c
|
||||
// ~/ncurses/ncurses/tinfo/comp_scan.c
|
||||
Tput.prototype._compile = function(info, key, str) {
|
||||
var self = this;
|
||||
var self = this
|
||||
, v;
|
||||
|
||||
this._debug('Compiling %s: %s', key, JSON.stringify(str));
|
||||
|
||||
|
@ -729,8 +730,14 @@ Tput.prototype._compile = function(info, key, str) {
|
|||
// ~/ncurses/progs/tset.c - set_init() - L992
|
||||
if (key === 'init_file' || key === 'reset_file') {
|
||||
try {
|
||||
// NOTE: Should we consider this code and parse it instead?
|
||||
str = fs.readFileSync(str, 'utf8');
|
||||
if (this.debug) {
|
||||
v = ('return "' + str + '";')
|
||||
.replace(/\x1b/g, '\\x1b')
|
||||
.replace(/\r/g, '\\r')
|
||||
.replace(/\n/g, '\\n');
|
||||
process.stdout.write(v + '\n');
|
||||
}
|
||||
return function() { return str; };
|
||||
} catch (e) {
|
||||
return noop;
|
||||
|
|
Loading…
Reference in New Issue