diff --git a/HISTORY.md b/HISTORY.md
index 30dcf384..f14c2043 100755
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -12,6 +12,9 @@
* **Translation Updates:**
* German (for error messages)
+### 2022-01-21
+* threads: refactored Context >> image
+
### 2022-01-20
* German translation update (for error messages)
* threads: added more localizable error strings
diff --git a/snap.html b/snap.html
index f6e24ff0..73eb045f 100755
--- a/snap.html
+++ b/snap.html
@@ -17,7 +17,7 @@
-
+
diff --git a/src/threads.js b/src/threads.js
index 24b0a241..81054a75 100644
--- a/src/threads.js
+++ b/src/threads.js
@@ -64,7 +64,7 @@ SnapExtensions, AlignmentMorph, TextMorph, Cloud, HatBlockMorph*/
/*jshint esversion: 6*/
-modules.threads = '2022-January-20';
+modules.threads = '2022-January-21';
var ThreadManager;
var Process;
@@ -7003,6 +7003,11 @@ Context.prototype.toString = function () {
};
Context.prototype.image = function () {
+ var ring = this.toBlock();
+ return ring.doWithAlpha(1, () => ring.fullImage());
+};
+
+Context.prototype.toBlock = function () {
var ring = new RingMorph(),
block,
cont;
@@ -7021,21 +7026,16 @@ Context.prototype.image = function () {
}
}
ring.embed(block, this.inputs);
- return ring.doWithAlpha(
- 1,
- () => {
- ring.clearAlpha();
- return ring.fullImage();
- }
- );
+ ring.clearAlpha();
+ return ring;
}
if (this.expression instanceof Array) {
block = this.expression[this.pc].fullCopy();
if (block instanceof RingMorph && !block.contents()) { // empty ring
- return block.doWithAlpha(1, () => block.fullImage());
+ return block;
}
ring.embed(block, this.isContinuation ? [] : this.inputs);
- return ring.doWithAlpha(1, () => ring.fullImage());
+ return ring;
}
// otherwise show an empty ring
@@ -7048,7 +7048,7 @@ Context.prototype.image = function () {
ring.parts()[1].addInput(inp)
);
}
- return ring.doWithAlpha(1, () => ring.fullImage());
+ return ring;
};
// Context continuations: