From 59de26fcbe7ce0fe806bbdd851f0bc2f9acaddcf Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sun, 24 Feb 2013 08:13:25 -0600 Subject: [PATCH] fix and test padding. --- example/tput.js | 5 +++++ lib/tput.js | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/example/tput.js b/example/tput.js index 0851c4c..a77cecb 100644 --- a/example/tput.js +++ b/example/tput.js @@ -18,3 +18,8 @@ console.log('Max colors: %d.', tput.max_colors); //tput.readTermcap(); //console.log(tput.termcap.terms); + +//tput.padding = true; +//tput._parsePadding('hello$<1000/>world', console.log, function() { +// tput._parsePadding('$<1000*>foo$<1000/>bar', console.log, process.exit); +//}); diff --git a/lib/tput.js b/lib/tput.js index ed344f4..b952f9f 100644 --- a/lib/tput.js +++ b/lib/tput.js @@ -798,9 +798,8 @@ Tput.prototype._parsePadding = function(code, print, done) { return next(); } - part = part.substring(padding[0].cap); + part = part.substring(padding[0].length); - // From terminfo man page: // A `*' indicates that the padding required is proportional to the number // of lines affected by the operation, and the amount given is the // per-affected-unit padding required. (In the case of insert character, @@ -811,7 +810,6 @@ Tput.prototype._parsePadding = function(code, print, done) { ; } - // From terminfo man page: // A `/' suffix indicates that the padding is mandatory and forces a // delay of the given number of milliseconds even on devices for which xon // is present to indicate flow control.