You are reading a single comment by @neshanjo and its replies. Click here to read the full conversation.
  • @JumJum code.replace(selected, ... is dangerous since it may also override other places that, by accident, contain the same code as the selection. There are better ways by using start and end of the selection and replacing only this part - but, again, let us leave this to another PR (that we'd be happy to receive from you!).

    Edit: Have a look at https://codemirror.net/doc/manual.html#a­pi and try using Espruino.Core.EditorJavaScript.getCodeMi­rror().replaceSelection(...). This should do the trick.

About

Avatar for neshanjo @neshanjo started