Skip to content

Commit 89a2d73

Browse files
author
Philip Guo
committed
added jumpToEnd parameter, and fixed minor assert bug
1 parent 2693f25 commit 89a2d73

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

PyTutorGAE/embedding-examples.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PyTutorGAE/js/pytutor.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ var curVisualizerID = 1; // global to uniquely identify each ExecutionVisualizer
3434
// code - string of executed code
3535
// trace - a full execution trace
3636
// params contains optional parameters, such as:
37+
// jumpToEnd - if non-null, jump to the very end of execution
3738
// startingInstruction - the (zero-indexed) execution point to display upon rendering
3839
// hideOutput - hide "Program output" and "Generate URL" displays
3940
// codeDivHeight - maximum height of #pyCodeOutputDiv (in pixels)
@@ -270,11 +271,15 @@ ExecutionVisualizer.prototype.render = function() {
270271

271272

272273
if (this.params && this.params.startingInstruction) {
273-
assert(1 <= this.params.startingInstruction &&
274-
this.params.startingInstruction <= this.curTrace.length);
274+
assert(0 <= this.params.startingInstruction &&
275+
this.params.startingInstruction < this.curTrace.length);
275276
this.curInstr = this.params.startingInstruction;
276277
}
277278

279+
if (this.params.jumpToEnd) {
280+
this.curInstr = this.curTrace.length - 1;
281+
}
282+
278283

279284
this.setKeyboardBindings();
280285

0 commit comments

Comments
 (0)