Try out `editor.getCursor().isAtEndOfLine()`.