style nits

This commit is contained in:
DABH 2018-04-23 15:41:19 -07:00 committed by GitHub
parent 9aebcadf1b
commit 0a5a26c5e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -105,10 +105,7 @@ function applyStyle() {
return str; return str;
} }
var newLinesPresent = false; var newLinesPresent = str.indexOf('\n') != -1;
if(str.indexOf('\n') != -1){
newLinesPresent = true;
}
var nestedStyles = this._styles; var nestedStyles = this._styles;
@ -116,7 +113,7 @@ function applyStyle() {
while (i--) { while (i--) {
var code = ansiStyles[nestedStyles[i]]; var code = ansiStyles[nestedStyles[i]];
str = code.open + str.replace(code.closeRe, code.open) + code.close; str = code.open + str.replace(code.closeRe, code.open) + code.close;
if(newLinesPresent){ if (newLinesPresent){
str = str.replace(newLineRegex, code.close + '\n' + code.open); str = str.replace(newLineRegex, code.close + '\n' + code.open);
} }
} }