Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed bug: Brace tagging now does nothing if cursor position is in a …

…multi-line.
  • Loading branch information...
commit e41e45284cb5b15d90b6d2df4093a68f2c8e86d6 1 parent 36c6a60
@chrisdunelm authored
Showing with 21 additions and 17 deletions.
  1. +21 −17 CoffeeLite/TaggerBraces.cs
View
38 CoffeeLite/TaggerBraces.cs
@@ -60,25 +60,29 @@ class TaggerBraces : ITagger<TextMarkerTag> {
var ss = span.Snapshot;
var cc = ss == this.currentChar.Value.Snapshot ?
this.currentChar.Value : this.currentChar.Value.TranslateTo(ss, PointTrackingMode.Positive);
- char cNext = cc.GetChar();
- var ccPrev = cc.Position>0?(cc-1):cc;
- char cPrev = ccPrev.GetChar();
- var brace1 = braces.FirstOrDefault(x => x.Item1 == cNext);
- if (brace1 != null) {
- var match = this.FindMatchForwards(ss, brace1.Item1, brace1.Item2, cc.Position);
- if (match != null) {
- var tag = new TextMarkerTag("blue");
- yield return new TagSpan<TextMarkerTag>(new SnapshotSpan(cc, 1), tag);
- yield return new TagSpan<TextMarkerTag>(new SnapshotSpan(ss, match.Value, 1), tag);
+ if (!this.overview.MultiLines.Any(x => x.GetSpan(ss).Contains(cc))) {
+ char cNext = cc.GetChar();
+ var brace1 = braces.FirstOrDefault(x => x.Item1 == cNext);
+ if (brace1 != null) {
+ var match = this.FindMatchForwards(ss, brace1.Item1, brace1.Item2, cc.Position);
+ if (match != null) {
+ var tag = new TextMarkerTag("blue");
+ yield return new TagSpan<TextMarkerTag>(new SnapshotSpan(cc, 1), tag);
+ yield return new TagSpan<TextMarkerTag>(new SnapshotSpan(ss, match.Value, 1), tag);
+ }
}
}
- var brace2 = braces.FirstOrDefault(x => x.Item2 == cPrev);
- if (brace2 != null) {
- var match = this.FindMatchBackwards(ss, brace2.Item2, brace2.Item1, Math.Max(0, cc.Position - 1));
- if (match != null) {
- var tag = new TextMarkerTag("blue");
- yield return new TagSpan<TextMarkerTag>(new SnapshotSpan(ccPrev, 1), tag);
- yield return new TagSpan<TextMarkerTag>(new SnapshotSpan(ss, match.Value, 1), tag);
+ var ccPrev = cc.Position > 0 ? (cc - 1) : cc;
+ if (!this.overview.MultiLines.Any(x => x.GetSpan(ss).Contains(ccPrev))) {
+ char cPrev = ccPrev.GetChar();
+ var brace2 = braces.FirstOrDefault(x => x.Item2 == cPrev);
+ if (brace2 != null) {
+ var match = this.FindMatchBackwards(ss, brace2.Item2, brace2.Item1, Math.Max(0, cc.Position - 1));
+ if (match != null) {
+ var tag = new TextMarkerTag("blue");
+ yield return new TagSpan<TextMarkerTag>(new SnapshotSpan(ccPrev, 1), tag);
+ yield return new TagSpan<TextMarkerTag>(new SnapshotSpan(ss, match.Value, 1), tag);
+ }
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.