public BracketSearchResult SearchBracket(IDocument document, int offset) { if (offset > 0) { char c = document.GetCharAt(offset - 1); int index = openingBrackets.IndexOf(c); int otherOffset = -1; if (index > -1) { otherOffset = SearchBracketForward(document, offset, openingBrackets[index], closingBrackets[index]); } index = closingBrackets.IndexOf(c); if (index > -1) { otherOffset = SearchBracketBackward(document, offset - 2, openingBrackets[index], closingBrackets[index]); } if (otherOffset > -1) { var result = new BracketSearchResult(Math.Min(offset - 1, otherOffset), 1, Math.Max(offset - 1, otherOffset), 1); SearchDefinition(document, result); return(result); } } return(null); }
public void SetHighlight(BracketSearchResult result) { if (this.result != result) { this.result = result; textView.InvalidateLayer(this.Layer); } }
public void SetHighlight(BracketSearchResult result) { if (this.result != result) { this.result = result; textView.InvalidateLayer(Layer); } }
void SearchDefinition(IDocument document, BracketSearchResult result) { if (document.GetCharAt(result.OpeningBracketOffset) != '{') { return; } var documentLine = document.GetLineByOffset(result.OpeningBracketOffset); while (documentLine != null && IsBracketOnly(document, documentLine)) { documentLine = documentLine.PreviousLine; } if (documentLine != null) { result.DefinitionHeaderOffset = documentLine.Offset; result.DefinitionHeaderLength = documentLine.Length; } }
void SearchDefinition(IDocument document, BracketSearchResult result) { if (document.GetCharAt(result.OpeningBracketOffset) != '{') return; var documentLine = document.GetLineByOffset(result.OpeningBracketOffset); while (documentLine != null && IsBracketOnly(document, documentLine)) documentLine = documentLine.PreviousLine; if (documentLine != null) { result.DefinitionHeaderOffset = documentLine.Offset; result.DefinitionHeaderLength = documentLine.Length; } }
public BracketSearchResult SearchBracket(IDocument document, int offset) { if (offset > 0) { char c = document.GetCharAt(offset - 1); int index = openingBrackets.IndexOf(c); int otherOffset = -1; if (index > -1) otherOffset = SearchBracketForward(document, offset, openingBrackets[index], closingBrackets[index]); index = closingBrackets.IndexOf(c); if (index > -1) otherOffset = SearchBracketBackward(document, offset - 2, openingBrackets[index], closingBrackets[index]); if (otherOffset > -1) { var result = new BracketSearchResult(Math.Min(offset - 1, otherOffset), 1, Math.Max(offset - 1, otherOffset), 1); SearchDefinition(document, result); return result; } } return null; }