diff --git a/lib/tput.js b/lib/tput.js index 86c5cfe..8c9b738 100644 --- a/lib/tput.js +++ b/lib/tput.js @@ -342,6 +342,10 @@ Tput.prototype._compile = function(val) { , i , v + var then + , els + , end; + function clear() { if (buff) { echo(JSON.stringify(buff).replace(/\\u001b/g, '\\x1b')); @@ -654,10 +658,11 @@ Tput.prototype._compile = function(val) { } if (read(/^%e/)) { - var end = val.indexOf('%;'); - var els = val.indexOf('%e'); - var then = val.indexOf('%t'); - // does else if's like this: %?[expr]%t...%e[expr]%t...%; + then = val.indexOf('%t'); + els = val.indexOf('%e'); + end = val.indexOf('%;'); + // Terminfo does elseif's like + // this: %?[expr]%t...%e[expr]%t...%; if (then < end && then < els) { stmt('} else if ('); } else {