mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-06 11:35:24 +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){
|
if (json.stream == undefined){
|
||||||
json.stream = 'stdout';
|
json.stream = 'stdout';
|
||||||
}
|
}
|
||||||
|
|
||||||
var text = utils.fixConsole(json.text);
|
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;
|
var subclass = "output_"+json.stream;
|
||||||
if (this.outputs.length > 0){
|
if (this.outputs.length > 0){
|
||||||
// have at least one output to consider
|
// 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
|
// If we got here, attach a new div
|
||||||
var toinsert = this.create_output_area();
|
var toinsert = this.create_output_area();
|
||||||
this.append_text(text, toinsert, "output_stream "+subclass);
|
this.append_text(text, toinsert, "output_stream "+subclass);
|
||||||
|
@ -57,7 +57,6 @@ IPython.utils = (function (IPython) {
|
|||||||
var cmds = [];
|
var cmds = [];
|
||||||
var opener = "";
|
var opener = "";
|
||||||
var closer = "";
|
var closer = "";
|
||||||
// \r does nothing, so shouldn't be included
|
|
||||||
while (re.test(txt)) {
|
while (re.test(txt)) {
|
||||||
var cmds = txt.match(re)[1].split(";");
|
var cmds = txt.match(re)[1].split(";");
|
||||||
closer = opened?"</span>":"";
|
closer = opened?"</span>":"";
|
||||||
|
Loading…
Reference in New Issue
Block a user