mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-21 04:10:17 +08:00
Fix the "test for nothing was streamed" so it doesn't add empty elements -- but only when there wasn't already something there.
This commit is contained in:
parent
50fa35b1cc
commit
e8be6bbe50
@ -623,12 +623,8 @@ var IPython = (function (IPython) {
|
||||
if (json.stream == undefined){
|
||||
json.stream = 'stdout';
|
||||
}
|
||||
|
||||
var text = utils.fixConsole(json.text);
|
||||
if (!text){
|
||||
// fixConsole gives nothing (empty string, \r, etc.)
|
||||
// so don't append any elements, which might add undesirable space
|
||||
return;
|
||||
}
|
||||
var subclass = "output_"+json.stream;
|
||||
if (this.outputs.length > 0){
|
||||
// have at least one output to consider
|
||||
@ -644,6 +640,12 @@ var IPython = (function (IPython) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!text.replace("\r", "")) {
|
||||
// text is nothing (empty string, \r, etc.)
|
||||
// so don't append any elements, which might add undesirable space
|
||||
return;
|
||||
}
|
||||
|
||||
// If we got here, attach a new div
|
||||
var toinsert = this.create_output_area();
|
||||
this.append_text(text, toinsert, "output_stream "+subclass);
|
||||
|
@ -57,7 +57,6 @@ IPython.utils = (function (IPython) {
|
||||
var cmds = [];
|
||||
var opener = "";
|
||||
var closer = "";
|
||||
// \r does nothing, so shouldn't be included
|
||||
while (re.test(txt)) {
|
||||
var cmds = txt.match(re)[1].split(";");
|
||||
closer = opened?"</span>":"";
|
||||
|
Loading…
Reference in New Issue
Block a user