void (Document document, int offset) { int line = offset < document.getTextLength() ? document.getLineNumber(offset) : -1; if (line > 0 && DocumentUtil.isLineEmpty(document, line)) { int start = document.getLineStartOffset(line); int end = Math.min(document.getLineEndOffset(line) + 1, document.getTextLength() - 1); if (end == document.getTextLength() - 1) { document.deleteString(start - 1, end); } else if (start < end) { document.deleteString(start, end); } } }