How do I insert the resulting output from a script at the current caret position?
I figured out how to append by using:
var currentText = editor.getText();
editor.setText(currentText + newText);
but I can’t figure out how to simply insert where the cursor is.
@sylumer, Thanks that works.
@agiletortoise, would be good to mention this in the documentation. It’s not really intuitive since nothing is selected, and selection usually requires setting a range.
I don’t know that nothing is selected exactly. It is just that you have a selection that extends 0 characters - i.e. the start and the end are the same place.