Skip to content

Commit 7aa37ff

Browse files
committed
Preserve multiple consecutive newlines when applying style (closes #231)
1 parent fa147da commit 7aa37ff

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/colors.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ function applyStyle() {
125125
var code = ansiStyles[nestedStyles[i]];
126126
str = code.open + str.replace(code.closeRe, code.open) + code.close;
127127
if (newLinesPresent) {
128-
str = str.replace(newLineRegex, code.close + '\n' + code.open);
128+
str = str.replace(newLineRegex, function(match) {
129+
return code.close + match + code.open;
130+
});
129131
}
130132
}
131133

0 commit comments

Comments
 (0)