int caretLine = area.getCaretLine() + 1; int lineCount = area.getLineCount(); RubyPlugin.log(caretLine + " " + lineCount, getClass()); if (caretLine != lineCount) { area.goToPrevLine(false); }
area.goToPrevLine(false);
    private void handleInsertEnd(RegularExpression re, String line) {        String indent = re.indent(line);        area.insertEnterAndIndent();        area.selectLine();        area.setSelectedText(indent + "end");        if (endsNotBalanced()) {            area.deleteLine();        }        int caretLine = area.getCaretLine() + 1;        int lineCount = area.getLineCount();        RubyPlugin.log(caretLine + " " + lineCount, getClass());        if (caretLine != lineCount) {            area.goToPrevLine(false);        }        area.goToEndOfWhiteSpace(false);        area.insertEnterAndIndent();        area.selectLine();        String text = area.getSelectedText() != null ? area.getSelectedText().trim() : "";        area.setSelectedText(indent + text);        if(!line.endsWith("end")) {            area.shiftIndentRight();        }    }