The goal here is I have created a keyboard with the different stores that I shop at. I want to run down my shopping list and tag each item with what store I will get it at. Then, I have a final button which sends the list to reminders.
Currently if I position at the end of each line, I can insert the tag just fine. What I would like to accomplish is to be able to have the cursor anywhere in the line, and still insert the tag at EOL. I would also like to set the cursor position to the next line. Pretty sure I can figure that part out of I can figure out how to set the initial insert position to the end of whatever line I am on.
Here is the existing keyboard action script and thanks to the kind souls.
let loc = editor.getSelectedRange(), store = " #aldi"; editor.setTextInRange(loc, 0, store); editor.setSelectedRange(loc + 6, 0); editor.setSelectedText('');