diff --git a/gui.js b/gui.js index 340f2429..6c9cdc5f 100644 --- a/gui.js +++ b/gui.js @@ -75,7 +75,7 @@ isRetinaSupported, SliderMorph, Animation*/ // Global stuff //////////////////////////////////////////////////////// -modules.gui = '2017-November-16'; +modules.gui = '2017-November-26'; // Declarations @@ -7203,22 +7203,26 @@ SpriteIconMorph.prototype.reactToDropOf = function (morph, hand) { }; SpriteIconMorph.prototype.copyStack = function (block) { - var dup = block.fullCopy(), - y = Math.max(this.object.scripts.children.map(function (stack) { + var sprite = this.object, + dup = block.fullCopy(), + y = Math.max(sprite.scripts.children.map(function (stack) { return stack.fullBounds().bottom(); - }).concat([this.object.scripts.top()])); + }).concat([sprite.scripts.top()])); - dup.setPosition(new Point(this.object.scripts.left() + 20, y + 20)); - this.object.scripts.add(dup); + dup.setPosition(new Point(sprite.scripts.left() + 20, y + 20)); + sprite.scripts.add(dup); dup.allComments().forEach(function (comment) { comment.align(dup); }); - this.object.scripts.adjustBounds(); + sprite.scripts.adjustBounds(); - // delete all custom blocks pointing to local definitions - // under construction... + // delete all local custom blocks (methods) that the receiver + // doesn't understand dup.allChildren().forEach(function (morph) { - if (morph.definition && !morph.definition.isGlobal) { + if (morph.isCustomBlock && + !morph.isGlobal && + !sprite.getMethod(morph.blockSpec) + ) { morph.deleteBlock(); } }); diff --git a/history.txt b/history.txt index d97713e4..72d4e80c 100755 --- a/history.txt +++ b/history.txt @@ -3802,3 +3802,7 @@ Fixes: * Blocks: avoid coloring the block-highlight when re-coloring a syntax element, this prevents highlighted blocks inside LAUNCH statements to expand when repeatedly single-stepped. === v4.1.0.4 maintenance release === + +171126 +------ +* GUI: fixed #1933 - avoid creating "obsolete" blocks by not copying method blocks into sprites that don't understand them