Add new globally scoped shortcut to clear debug message list

New Node-RED user here. I've been doing a lot of reading in and around Node-RED and I'm extremely excited about using it on upcoming personal projects. Obligatory "nice ****ing work".

I've started wiring together some nodes and using the debug node. My instant reaction was to clear the debug message list with a shortcut but noticed there wasn't one, and couldn't be user-defined in the shortcut pane.

Would you be open to accepting a pull request for this? I've made the changes locally for myself, and would like to contribute it back in the hopes it would be useful to others.

I've read the contributing guidelines which suggested I discuss it here first.

Link to github compare: https://github.com/node-red/node-red/compare/master...kwakwaversal:shortcut-clear-message-list

Add new shortcut to clear debug message list

Clearing the debug message list is globally scoped by default to `ctrl+g
l`. Mnemonic: similar to clearing a terminal shell using ctrl+l.

One thing that's missing from this, however, is how to add it to the list of keyboard shortcuts so a point in the right direction for that'd be super.

Whilst digging through the code I noticed there might be a typo for removing an action. It was core:show-debug instead of it seemingly being core:show-debug-tab. Let me know if you'd prefer that as a separate PR.

Cheers.

1 Like

Hi, all looks reasonable to me.

A couple of changes needed:

  1. The action should be core:clear-debug-messages just to make it clear what messages it applies to.

  2. The default shortcut needs changing. All of the ones beginning ctrl-g are intended as ones to navigate to different bits of the UI (I think of the ctrl-g as go followed by where to go). It is also valid to not assign a shortcut and leave that to users to pick their own.

It should be enough to define the action as you are already doing. That will get added to the list of available actions that can have key shortcuts assigned.

At this stage, stick in a PR and we can discuss further against that.

Thanks!

@kwa, could I be so bold as to ask if it were possible while you are amongst the code, for you to add a shortcut to the ctrl + mouse click for quick add node? I feel this is a big miss. I think this may be slightly tricky as it would probably need coordinates for where to pop up and where to place the node on the work area (perhaps it could be last selected nodes' coords offset y by grid size if available?)

@knolleary do you have any objections or thoughts?

Steve ctrl + click already does that..

and if you do that, then (for example) type in (for inject) - then ctrl enter
it will auto wire to another new node

and note it only shows nodes that you can wire to - so inject is no longer available.

It doesn't work like that. You are asking for something completely unrelated to the very specific thing that @kwa is talking about.

If you think there's a "big miss" then talk to us about it. You'll need to also clarify what you mean. Ctrl-click is already defined for quick add. Do you want to be able to define another keyboard shortcut for it? All interactions that requires the mouse are handled separately to the keyboard shortcuts. As you say, this action requires a position on the canvas. I don't immediately see how it would work without a known position. Any attempt to guess a position is likely to lead to unexpected results.

Hi @knolleary, thanks for the feedback.

Yeah I wasn't happy with the name, I followed the function name rather than a more descriptive name for it. Naughty of me.

I've put in a PR for it against master. I wasn't sure if it should be master or dev so happy to change it if needs be.

You're right, it magically appeared. That's some voodoo right there!

Cheers.

@dceejay perhaps I wasn't clear & was relying on context (@kwa was talking about adding shortcuts)

For clarification...
could I be so bold as to ask if it were possible while you are amongst the code, for you to add a keyboard shortcut to the existing ctrl + mouse click for quick add node?

@knolleary I know I should raise a new topic and discuss however I seen an opportunity...

  1. A guy who (like me) prefers shortcuts & is capable of adding shortcuts, why not ask if he would be willing to consider another
  2. I feel the ctrl + click is almost a hidden feature - I bet many users are unaware of it. However, those interested in shortcuts would spot a shortcut for "quick add node" if it were one of the options.

OK OK OK, so I am an opportunist - I jumped on the band wagon of someone adding a shortcut to ask him (since he was passionate enough to do a PR for a shortcut he wants) if he would consider adding another shortcut that makes an existing great feature a bit more accessible.

Some background...
I did have a real world PLC programming application story about a "crap product" vs a "good product" & how it ultimately came down to less "mouse miles" & shortcuts for pretty much everything (especially adding logic parts to the canvas) but I wont go there. :slight_smile:

OK - slight wrong end of stick... but... as Nick points out - either we have to guess/randomly assign a position for the new node - or use the position of the cursor... which is errrr where you left the mouse pointing - so is it that very different to move the mouse to where you want a new node - then click some key combo (which given we have quite a few could be three keys - or move the mouse and hit ctrl - click while your hand is still on the mouse ? Can't think there are any more mouse-miles involved in that.