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­pi and try using Espruino.Core.EditorJavaScript.getCodeMi­rror().replaceSelection(...). This should do the trick.


Avatar for neshanjo @neshanjo started