Bug: Deleting a prompt during code generation pastes incorrectly

In the Javascript Sandbox if a code prompt is deleted while it is running the results continue to be added to a remaining prompt box.
Example: Enter the following
Make a canvas 640 by 640 pixels in size

Result:

var canvas = document.createElement('canvas');
canvas.width = 640;
canvas.height = 640;
document.body.appendChild(canvas);

Enter: Draw a fractal
Result: Runaway process
var ctx = canvas.getContext(‘2d’);
ctx.fillStyle = ‘#000’;
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = ‘#fff’;
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = ‘#f00’;
ctx.fillRect(0, 0, canvas.width, canvas.height);
repeats

Entering “Draw a fractal” and deleting it while it repeats results in the repeating code pasted into the first action, like below:
var canvas = document.createElement(‘canvas’);
canvas.width = 640;
canvas.height = 640;
document.body.appendChild(canvas);
ctx.fillStyle = ‘#ff0’;
ctx.fillRect(0, 0, canvas.width, canvas.height);
Last two lines repeat

1 Like