-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add context menu items to facilitate editing #132
Comments
@rachel-fenichel: as I noted in the discussion with Kirsty, I think "Insert" should be the primary shortcut for adding blocks, and I'm not sure that if we have insert we need replace. |
We discussed this live today with @cpcallen, @microbit-matt-hillsdon, Lucy, Emma, and Robert. I think our conclusions were:
In #196 I implemented the necessary logic for replacing a reporter block (block with an output) with an appropriate block from the flyout/toolbox. I agree that in your case above, the context menu has an insert/replace action. |
Yes! And I can make it happen in MakeCode too. This feature is called "healing a stack" or "splicing". It's implemented in ExamplesIn the advanced Blockly playground, with our basic blocks: And the same thing in MakeCode: ExplanationSituations that trigger this:
Note that in both cases there is a shadow block D that is initially attached to block C's input. Block D disappears, because block B covers it up. Other infoYou cannot trigger a splice if block C has two value inputs, because the correct operation is ambiguous: Zelos: You can trigger a splice if block B has two value inputs, because the correct operation is unambiguous: Geras: |
Ooh. That is what I had pictured in geras, but a bit surprising in MakeCode. Thanks for the examples! My initial position is that we would expect the same behaviour from a keyboard-triggered "insert/replace" operation as you would get from a mouse drag. Now I understand more I can imagine that sometimes it's going to be a bit awkward if the splicing isn't what was intended. I don't think it changes my views on the core insert/replace flow, just a slightly surprising artefact of existing behaviour. Do you have any intention to give more control over this, or does it change your views at all? |
Same here, especially because it lets us rely on existing (and well-tested) code in core, rather than throwing together a new layer of complex checks. Please give insertion/replacement for inputs and outputs a try using the T key after #196 and let me know if it feels reasonable. That change does not address the issues of when insert/replace should be in the context menu or what the text of the insert/replace option should be. |
I've just tried it. The general feel of inserting with 't' is very reasonable and aligned with what I was hoping for. There's a slight weirdness that you end up with the cursor at the connection (which is usually skipped) after inserting. I don't know if this will lead to any bugs in the context menu etc, or if it's just a cosmetic bug. I can imagine that once copy/paste is working, this will all feel quite powerful. It would be easy to e.g. remove the I still don't quite understand the rules around splicing. There's a 30 second video here showing 2 situations where the splicing behaviour is different but I expected the same. (to clarify - I don't think we should change splicing behaviour for keyboard nav, unless there are bug fixes that apply everywhere - I'm just getting my head around the logic) |
Yes, that behaviour is consistent with the other behaviour but is also confusing in the zelos case. If we change it for keyboard nav we may also want to change it for mouse. (In which case would file that as a separate bug to figure out the exact conditions for a different behaviour.) Explanation: Here's a gif of the same flow with two changes: I turned on the geras renderer and set the theme to the standard Blockly theme, which renders shadow blocks as lighter versions of real blocks, to make it easier to see the differences. The behaviour is confusing because it relies on the distinction between shadow blocks and real blocks, which is minimal in zelos. The The The Changing the value in the number block to When you insert the When you insert the At the end of the gif I navigate to each |
Thanks for the explanation and demo, that makes a lot of sense. I can't help but favour the plugin's behaviour of turning a shadow block into a real block on edit - since that shows intent from the user to make something concrete. Are there situations or applications in which this wouldn't make sense, or previous discussions I can refer back to learn about the competing needs? There are downstream consequences of this behaviour on copy and paste, which don't make up with my expectations. I would have assumed you'd be able to copy and paste the contents of an oval, like the text in a "write with shadow" block I would naively argue that these blocks should be real, and draggable, and copyable. If they are not, then we definitely need some user feedback when they try to copy a block, because currently copy will silently fail and you'll end up surprised by pasting the last thing in the copy buffer. |
The main reason to have shadow blocks is that they are undeletable, so you can never end up with an empty input. Converting it to a real block on change means that the edited block would get bumped out, instead of obscured, by dragging on a new block. The issue with not being able to copy them is due to the precondition checks for copying and should be resolvable, so I've added an issue for that. |
Remaining work not required for testing, so this is now in the "simple editing complete" milestone. |
Add the following items to the context menus for blocks, with the the given keyboard shortcuts:
→
): Moves the cursor (focus) to the first focusable field or input.m
): "Picks up" the block to move it using the dragging workflow (see Make it possible to move blocks on the workspace #106).r
eplace orp
lace?): use the marker workflow to place a new block at this location. #173del
+backspace
): delete the block, as current delete shortcut does.⌘X
etc)⌘X
etc)⌘X
etc): Paste (see Make paste behaviour more intuitive #128).Add the following item to the context menu for unconnected next and input connections, as well as when the cursor is visiting the workspace:
The names given above are not necessarily intended to be the final English names for the given items, merely descriptive.
The text was updated successfully, but these errors were encountered: