Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 23b0df5

Browse files
committed
Try to use suspensions for print
Note - not fully working. not sure why
1 parent 5318905 commit 23b0df5

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

runestone/activecode/js/activecode.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,8 @@ export class ActiveCode extends RunestoneBase {
708708
this.output = document.createElement("pre");
709709
this.output.id = this.divid + "_stdout";
710710
$(this.output).css("visibility", "hidden");
711+
$(this.output).css("max-height", "400px");
712+
$(this.output).css("overflow", "auto");
711713
this.graphics = document.createElement("div");
712714
this.graphics.id = this.divid + "_graphics";
713715
$(this.graphics).addClass("ac-canvas");
@@ -1104,25 +1106,26 @@ Yet another is that there is an internal error. The internal error message is:
11041106
.replace(/>/g, ">")
11051107
.replace(/\n/g, "<br/>");
11061108
// todo: try to make this use the suspension mechanism in skulpt
1107-
return Promise.resolve().then(
1108-
function () {
1109+
return new Sk.misceval.promiseToSuspension(new Promise(function (resolve) {
11091110
setTimeout(
11101111
function () {
11111112
if (this.outputLineCount < 1000) {
11121113
$(this.output).append(text);
11131114
this.outputLineCount += 1;
1115+
resolve(Sk.builtin.none.none$)
11141116
} else {
11151117
if (this.outputLineCount == 1000) {
11161118
$(this.output).append("Too Much output");
11171119
this.outputLineCount += 1;
11181120
stopExecution = true;
1121+
resolve(Sk.builtin.none.none$)
11191122
}
11201123
}
11211124
}.bind(this),
1122-
0
1125+
1
11231126
);
11241127
}.bind(this)
1125-
);
1128+
));
11261129
}
11271130

11281131
filewriter(fobj, bytes) {

0 commit comments

Comments
 (0)