improve console output

This commit is contained in:
Vladimir Polyakov 2015-07-08 23:37:31 +03:00
parent 75799493c0
commit d401113523
2 changed files with 22 additions and 3 deletions

View File

@ -1,13 +1,25 @@
.terminal {
box-sizing: border-box;
&_code {
height: 300px;
padding: 4px;
padding: 8px;
box-sizing: border-box;
overflow-y: scroll;
border: none;
white-space: pre-wrap;
color: white;
background-color: black;
line-height: 0.8;
font-size: 12px;
font-family: Monaco, Monosapce, sans-serif;
&_newline {
display: block;
margin: 0.8em 0;
white-space: pre;
&:first-child {
margin-top: 0;
}
}
}
}

View File

@ -33,10 +33,17 @@ define([
}
this.ignoreScrollEvent = false;
},
prepareOutput: function(output) {
var text = output.replace(
/(.*)\n/gi,
'<span class="terminal_code_newline">$1</span>'
);
return ansiUp.ansi_to_html(text);
},
updateItems: function(build) {
// listen just our console update
if (build.buildId === this.props.build) {
this.setState({data: ansiUp.ansi_to_html(build.data)});
this.setState({data: this.prepareOutput(build.data)});
_.defer(this.ensureScrollPosition);
this.ensureScrollPosition();
}