I’m trying to write a plugin and I need to get the character that is at the cursor position. I can get the cursor position with
editor.getCursor().getBufferPosition(), which returns a
Point(). I assume I can use this point to get text from the screen with
editor.getTextInBufferRange(), but I just can’t figure exactly how.
The docs say these methods expect a
Range(). I tried creating a range with
new Range([1, 2], [1, 5]) and pass that as an argument to the
.getTextInBufferRange() functions, but they always return an empty string.
Can anyone shed some light over this?