mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-01-09 10:42:02 +00:00
Revert "use sprintf"
This reverts commit af1ad01b9952c4b5765ab6a1e910d2b5dd681167.
This commit is contained in:
parent
af1ad01b99
commit
1684a267dc
23
lib/tput.js
23
lib/tput.js
@ -636,16 +636,32 @@ Tput.prototype._compile = function(val) {
|
|||||||
// next character to be a `-' flag, avoiding interpreting "%-" as an
|
// next character to be a `-' flag, avoiding interpreting "%-" as an
|
||||||
// operator.
|
// operator.
|
||||||
if (read(/^%((?::-|[+# ]){1,4})?(\d+(?:\.\d+)?)?([doxXs])/)) {
|
if (read(/^%((?::-|[+# ]){1,4})?(\d+(?:\.\d+)?)?([doxXs])/)) {
|
||||||
echo('sprintf("'+ cap[0].replace(':-', '-') + '", stack.pop())');
|
// echo('sprintf("'+ cap[0].replace(':-', '-') + '", stack.pop())');
|
||||||
|
echo('stack.pop()');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// %c print pop() like %c in printf
|
// %c print pop() like %c in printf
|
||||||
if (read(/^%c/)) {
|
if (read(/^%c/)) {
|
||||||
echo('sprintf("%c", stack.pop())');
|
// echo('sprintf("%c", stack.pop())');
|
||||||
|
// echo('stack.pop()');
|
||||||
|
echo('String.fromCharCode(stack.pop())');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// %d print pop()
|
||||||
|
// "Print (e.g., "%d") is a special case."
|
||||||
|
//if (read(/^%d/)) {
|
||||||
|
// echo('stack.pop()');
|
||||||
|
// continue;
|
||||||
|
//}
|
||||||
|
|
||||||
|
// %s print pop() like %s in printf
|
||||||
|
//if (read(/^%s/)) {
|
||||||
|
// echo('stack.pop()');
|
||||||
|
// continue;
|
||||||
|
//}
|
||||||
|
|
||||||
// %p[1-9]
|
// %p[1-9]
|
||||||
// push i'th parameter
|
// push i'th parameter
|
||||||
if (read(/^%p([1-9])/)) {
|
if (read(/^%p([1-9])/)) {
|
||||||
@ -841,7 +857,8 @@ Tput.prototype._compile = function(val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return new Function('sprintf, params', code).bind(null, sprintf);
|
return new Function('params', code);
|
||||||
|
// return new Function('sprintf, params', code).bind(null, sprintf);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
e.stack = e.stack.replace(/\x1b/g, '\\x1b');
|
e.stack = e.stack.replace(/\x1b/g, '\\x1b');
|
||||||
throw e;
|
throw e;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user