Simply subtracting one character from the line length is a shoddy workaround, but only fails if the line is the last line in the text file.
Thoughts or suggestions?
(Please forgive me for being so rusty in JS!)
Blessings, and thank you!
// Move cursor to end of line
let [loc, len] = editor.getSelectedLineRange(),
str = editor.getTextInRange(loc, len);
editor.setTextInRange(loc, len, str);
// editor.setSelectedRange(loc + str.length, 0); // this includes the carriage return/line feed at the end of lines, and thus going to the start of the next line instead
editor.setSelectedRange(loc + str.length - 1, 0); // the shoddy workaround