Function editor highlights text arbitrarily?

You go back to ace and lose a lot of functionality including the ability to use most ES6 features (it doesn't understand them)

Sorry, but I dont get your point. As far as i can see, it functions like pretty much any multi document editor. In your video, there is highlighted text and the cursor is blinking, and you proceeded to type. It is literally doing what you ask of it.

Here is a demonstration comparing Node-REDs editor to another MDI application - I see no differences (windows 11)


If it is simply a case of the highlight not being clear, chose from one of the many included ones

For example, this is the ACE theme in monaco:
chrome_qUQTviSDps

And here is a thread that shows you how to change the theme: How to use themes with Monaco editor

Essetially set codeEditor -> options -> theme to "ace" or "github-dark" or any one of 59 options other themes included

FWIW I have had exactly the same problem with Monaco, it makes it very easy to accidentally delete code. I'd assumed I was accidentally getting fingers too close to the touchpad.

Having seen similar things not related to node red. Replaced the wireless mouse. Who can tell...

What version of nodejs are you using? Use node -v to find out.

Then I probably don't want to do that, and am back to the asking how to disable automatic highlighting.

What is not apparent in the video is that I don't hold down shift or drag the mouse. I just click, exit the editor, re-open the editor, click somewhere else, and everything in between the forgotten and irrelevant former click is suddenly highlighted.

So it's not doing what I asked. I asked it to put the cursor somewhere and instead from my perspective, it arbitrarily highlighted a bunch of text. I click and start typing because for 30 years, I've clicked in a document whitespace and started typing on faith that where I clicked is the sole place my cursor goes. If I asked it to highlight something, I'd click, hold down shift, then click somewhere else.

So to re-open a function text to edit, I essentially have to perform extra steps of clicking a couple times to get my cursor to a non-highlighted position.
I can do that, but I have to retrain myself to remember there's a new way to function in this editor, and if I can turn that off instead of retraining myself, I'd rather turn it off.

I'll look when I get home, had to go to work...

That was my initial thought...the mouse is in a shop and I figured it was being a turd.
But then it was Valentines day and I figured I couldn't hide in the shop, so I grabbed a laptop and sat on the couch with my wife... :smile: But it showed the same behavior on the laptop. Not connecting it, I did a full reboot on the laptop, with no change. Grabbed my work laptop and tried that, same thing.

Did you solve it, or just deal with it?

I can deal with it if I have to, just am sure my pea brain will forget this in the 3 months between home system NR changes, and I'll stupidly lose content again before remembering it.

This is not something that most of us see, so something odd is going on in both your system and @jbudd's

@jbudd, what version of node red and nodejs are you using?

@Rgrove Nope, I have not fixed it.

@Colin Probably various versions on different devices but an example Node-red 3.1.5, node.js 18.19.1.

I can't pin down the circumstances when the editor misbehaves, just have to remember to check before typing.

It seems that for @Rgrove every time he opens the function editor and then clicks in the code the text between the initial cursor position and where he clicks is selected and highlighted.

@Rgrove ok, with your follow up messages and Colin's clear explanation I now understand. However I don't personally see this on win11 + chrome latest.

If you are willing to raise an issue I'll look into it.

It seems apparent now that this is a malfunction or unintended consequence of some other feature. I was baffled that anyone would want this behavior, but it doesn't seem that anyone actually does, and I probably explained it inadequately.

I'll try to get version numbers tonight when I get home.

Thanks all.

They are losing text because of muscle memory - typing before the brain can react to things not being what is expected.

The unexpected is that the node is pre-selecting text when it shouldn't.

I seem to vaguely remember we had a similar issue previously? Not quite the same though I don't think.

No, I don't think so now. it seems, from Colin's clear explanation when the op clicks in the code editor it is as if a new selection from the current cursor to the click point is made. As if the shift key is stuck down.

If you watch my video you will see (on my machine) it works totally "as expected".

I thought so to, but I can't find it.

Hi All thought I'd jump in here to support Rgrove's situation. I get this too, and it started happening from approx 3.x For what it's worth, I run latest MacOS and Safari when editing code that's served on an RPI on the local LAN. However, I also see this when running the browser (usually Firefox ESR) natively on the RPi itself browsing to its localhost:1880 admin. For what it's worth, it behaves/appears like the restoration of the cursor in-position in the function node's code has 'shift' pressed when the code opens, so that when you click the mouse into the code position, it therefore 'selects' from the last position...

On opening the function and moving the mouse about do you see text highlighting following the mouse as you move it?

Hi Colin, no, not for me.

If you hold down and drag the mouse does it show an extending selection?