|
@@ -307,7 +307,11 @@ export class OutputAreaModel implements IOutputAreaModel {
|
|
|
if (
|
|
|
nbformat.isStream(value) &&
|
|
|
this._lastStream &&
|
|
|
- value.name === this._lastName
|
|
|
+ value.name === this._lastName &&
|
|
|
+ this.shouldCombine({
|
|
|
+ value,
|
|
|
+ lastModel: this.list.get(this.length - 1)
|
|
|
+ })
|
|
|
) {
|
|
|
// In order to get a list change event, we add the previous
|
|
|
// text to the current item and replace the previous item.
|
|
@@ -342,6 +346,19 @@ export class OutputAreaModel implements IOutputAreaModel {
|
|
|
return this.list.push(item);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Whether a new value should be consolidated with the previous output.
|
|
|
+ *
|
|
|
+ * This will only be called if the minimal criteria of both being stream
|
|
|
+ * messages of the same type.
|
|
|
+ */
|
|
|
+ protected shouldCombine(options: {
|
|
|
+ value: nbformat.IOutput;
|
|
|
+ lastModel: IOutputModel;
|
|
|
+ }) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* A flag that is set when we want to clear the output area
|
|
|
* *after* the next addition to it.
|