public void stateChanged() { backParserDelay = true; int curLine = text.getLineAtOffset(text.getCaretOffset()); if (lineHighlighting && text.getSelectionRange().y != 0) { lineHighlighting = false; drawLine(prevLine); pairsHighlighting = false; pairsDraw(null, currentPair); return; } if (text.getSelectionRange().y != 0) return; if (!lineHighlighting) { // drawing current line lineHighlighting = true; drawLine(curLine); } else if (curLine != prevLine) { drawLine(prevLine); drawLine(curLine); prevLine = curLine; } // drawing current pairs if (!pairsHighlighting) { pairsHighlighting = true; pairsDraw(null, currentPair); } else { int lineOffset = text.getOffsetAtLine(curLine); PairMatch newmatch = baseEditor.getPairMatch(curLine, text.getCaretOffset() - lineOffset); if (newmatch != null) baseEditor.searchLocalPair(newmatch); if ((newmatch == null && currentPair != null) || (newmatch != null && !newmatch.equals(currentPair))) { pairsDraw(null, currentPair); pairsDraw(null, newmatch); } currentPair = newmatch; } }