Block Delete Problem

Please fill out these questions for all feature requests and bug reports. If you're requesting a feature, please let us know why this feature is important or useful, not just what it should do.
Thanks!

  1. What browsers show this problem? ChromeVersion 80.0.3987.149 (Official Build) (64-bit)
  2. Please share an example project (if possible). See Video
  3. Describes the steps to reproduce this issue. As in video
  4. What does Snap! currently do? Does NOT delete block
  5. What should Snap! do instead? Delete the block

Hi Guys,

Running on: WIN10 Home Ed. 64 bit LENOVO Yoga900 Laptop

Cannot DELETE the first block in the FOREVER loop if the following block has a COMMENT attached.

image

Here is the export file:

<sprites app="Snap! 5.4, http://snap.berkeley.edu" version="1"><sprite name="TEST" idx="2" x="78.99999999999983" y="42.00000000000002" heading="90" scale="1" volume="100" pan="0" rotation="1" draggable="true" costume="0" color="48.95999999999997,153,0,1" pen="tip" id="2"><costumes><list struct="atomic" id="3"></list></costumes><sounds><list struct="atomic" id="4"></list></sounds><blocks></blocks><variables></variables><scripts><script x="40" y="61"><block s="doForever"><script><block s="doSetVar"><l>potI</l><l>0.09</l></block><block s="doSetVar"><l>potV</l><block s="reportProduct"><block var="potI"/><block var="potR"/></block><comment w="155" collapsed="true">Any COMMENT</comment></block></script></block></script></scripts></sprite></sprites>

Video Link: https://drive.google.com/open?id=14WbU2T1PC-L0u7HZkSgOxoxn3XW-OCxH

NOTE: For some reason, the video does NOT play when clicked on it. Please download and play on the PC.

That is very strange. (How did you find that out?)

Seek and ye shall find ! :face_with_monocle:

Block with attached comment are non deletable.
BlockMorph.prepareToBeGrabbed() is not guarded from empty "hand" object

Uncaught TypeError: Cannot read property 'world' of undefined
at blocks.js?version=2020-01-06:4476
at Array.forEach ()
at CommandBlockMorph.BlockMorph.prepareToBeGrabbed (blocks.js?version=2020-01-06:4475)
at CommandBlockMorph.prepareToBeGrabbed (blocks.js?version=2020-01-06:4925)
at CommandBlockMorph.userDestroy (blocks.js?version=2020-01-06:4966)
at MenuItemMorph.TriggerMorph.trigger (morphic.js?version=2020-01-04:10115)
at MenuItemMorph.mouseClickLeft (morphic.js?version=2020-01-04:10408)
at TextMorph.Morph.escalateEvent (morphic.js?version=2020-01-04:4512)
at TextMorph.StringMorph.mouseClickLeft (morphic.js?version=2020-01-04:9282)
at HandMorph.processMouseUp (morphic.js?version=2020-01-04:11639).

It's not the one with comment, but the previous one that does not delete.

​​​​

Single block with attached comment is the simplest test case. Refreshing of C shaped blocks triggers the error for others elements.

Thanks @tguneysu for your report,

Fixing this issue I saw that there were three related problems:

  • Deleting the first (only the first) block of a C input when there are other blocks in that C-input with comments.
  • Deleting the whole script (C-block) with comments inside
  • Similar actions done by keyboard edition.

@jens - I submit a PR with the fix.The idea is:

  • There were three prepareToBeGrabbed calls without params, and this (the missing hand param) causes the problem (it is needed when threre are comments, to trigger starFollowing function).
  • Fixing this, appears another problem, because this triggering action starts comments startFollowing. But this action (shadows and more) are stopped by the drop event... and here we have no drop event. So, I've changed these functions adding an allAtOnce param to control this behavior.

More details at the PR

Joan