// Token: 0x060035B5 RID: 13749 RVA: 0x000F4040 File Offset: 0x000F2240 private void DebugAssertRunList() { Invariant.Assert(this._runList.Count >= 1, "Run list should never be empty!"); if (Invariant.Strict) { SpellerStatusTable.RunType runType = SpellerStatusTable.RunType.Clean; for (int i = 0; i < this._runList.Count; i++) { SpellerStatusTable.Run run = this.GetRun(i); if (this._runList.Count == 1) { Invariant.Assert(run.Position.CompareTo(run.Position.TextContainer.Start) == 0); } else { Invariant.Assert(run.Position.CompareTo(this.GetRunEndPosition(i)) <= 0, "Found negative width run!"); } Invariant.Assert(i == 0 || this.GetRunEndPosition(i - 1).CompareTo(run.Position) <= 0, "Found overlapping runs!"); if (!this.IsErrorRun(i)) { Invariant.Assert(i == 0 || runType != run.RunType, "Found consecutive dirty/dirt or clean/clean runs!"); } runType = run.RunType; } } }
// Token: 0x060035AE RID: 13742 RVA: 0x000F3B04 File Offset: 0x000F1D04 private int FindIndex(StaticTextPointer position, LogicalDirection direction) { int num = -1; int i = 0; int num2 = this._runList.Count; while (i < num2) { num = (i + num2) / 2; SpellerStatusTable.Run run = this.GetRun(num); if ((direction == LogicalDirection.Forward && position.CompareTo(run.Position) < 0) || (direction == LogicalDirection.Backward && position.CompareTo(run.Position) <= 0)) { num2 = num; } else { if ((direction != LogicalDirection.Forward || position.CompareTo(this.GetRunEndPosition(num)) < 0) && (direction != LogicalDirection.Backward || position.CompareTo(this.GetRunEndPosition(num)) <= 0)) { break; } i = num + 1; } } if (i >= num2) { num = -1; } return(num); }
// Token: 0x060035B0 RID: 13744 RVA: 0x000F3C68 File Offset: 0x000F1E68 private void AddRun(int index, ITextPointer start, ITextPointer end, SpellerStatusTable.RunType runType) { Invariant.Assert(runType == SpellerStatusTable.RunType.Clean || runType == SpellerStatusTable.RunType.Dirty); Invariant.Assert(start.CompareTo(end) < 0); SpellerStatusTable.RunType runType2 = (runType == SpellerStatusTable.RunType.Clean) ? SpellerStatusTable.RunType.Dirty : SpellerStatusTable.RunType.Clean; SpellerStatusTable.Run run = this.GetRun(index); if (run.RunType == runType) { this.TryToMergeRunWithNeighbors(index); return; } if (run.RunType != runType2) { run.RunType = runType; ITextPointer position = run.Position; ITextPointer runEndPositionDynamic = this.GetRunEndPositionDynamic(index); this.TryToMergeRunWithNeighbors(index); this._highlightLayer.FireChangedEvent(position, runEndPositionDynamic); return; } if (run.Position.CompareTo(start) >= 0) { if (this.GetRunEndPosition(index).CompareTo(end) <= 0) { run.RunType = runType; this.TryToMergeRunWithNeighbors(index); return; } if (index > 0 && this.GetRun(index - 1).RunType == runType) { run.Position = end; return; } run.RunType = runType; SpellerStatusTable.Run value = new SpellerStatusTable.Run(end, runType2); this._runList.Insert(index + 1, value); return; } else { SpellerStatusTable.Run value; if (this.GetRunEndPosition(index).CompareTo(end) > 0) { value = new SpellerStatusTable.Run(start, runType); this._runList.Insert(index + 1, value); value = new SpellerStatusTable.Run(end, runType2); this._runList.Insert(index + 2, value); return; } if (index < this._runList.Count - 1 && this.GetRun(index + 1).RunType == runType) { this.GetRun(index + 1).Position = start; return; } value = new SpellerStatusTable.Run(start, runType); this._runList.Insert(index + 1, value); return; } }
// Token: 0x060035B1 RID: 13745 RVA: 0x000F3DF4 File Offset: 0x000F1FF4 private void TryToMergeRunWithNeighbors(int index) { SpellerStatusTable.Run run = this.GetRun(index); if (index > 0 && this.GetRun(index - 1).RunType == run.RunType) { this._runList.RemoveAt(index); index--; } if (index < this._runList.Count - 1 && this.GetRun(index + 1).RunType == run.RunType) { this._runList.RemoveAt(index + 1); } }
// Token: 0x060035AD RID: 13741 RVA: 0x000F3ACC File Offset: 0x000F1CCC private int GetErrorIndex(StaticTextPointer textPosition, LogicalDirection direction) { int num = this.FindIndex(textPosition, direction); if (num >= 0) { SpellerStatusTable.Run run = this.GetRun(num); if (run.RunType == SpellerStatusTable.RunType.Clean || run.RunType == SpellerStatusTable.RunType.Dirty) { num = -1; } } return(num); }
// Token: 0x060035AC RID: 13740 RVA: 0x000F3A70 File Offset: 0x000F1C70 internal bool GetRun(StaticTextPointer position, LogicalDirection direction, out SpellerStatusTable.RunType runType, out StaticTextPointer end) { int num = this.FindIndex(position, direction); runType = SpellerStatusTable.RunType.Clean; end = StaticTextPointer.Null; if (num < 0) { return(false); } SpellerStatusTable.Run run = this.GetRun(num); runType = run.RunType; end = ((direction == LogicalDirection.Forward) ? this.GetRunEndPosition(num) : run.Position.CreateStaticPointer()); return(true); }
// Token: 0x060035B8 RID: 13752 RVA: 0x000F417C File Offset: 0x000F237C private StaticTextPointer GetRunEndPosition(int index) { StaticTextPointer result; if (index + 1 < this._runList.Count) { result = this.GetRun(index + 1).Position.CreateStaticPointer(); } else { SpellerStatusTable.Run run = this.GetRun(index); ITextContainer textContainer = run.Position.TextContainer; result = textContainer.CreateStaticPointerAtOffset(textContainer.SymbolCount); } return(result); }
// Token: 0x060035A5 RID: 13733 RVA: 0x000F37E4 File Offset: 0x000F19E4 internal void GetFirstDirtyRange(ITextPointer searchStart, out ITextPointer start, out ITextPointer end) { start = null; end = null; int num = this.FindIndex(searchStart.CreateStaticPointer(), LogicalDirection.Forward); while (num >= 0 && num < this._runList.Count) { SpellerStatusTable.Run run = this.GetRun(num); if (run.RunType == SpellerStatusTable.RunType.Dirty) { start = TextPointerBase.Max(searchStart, run.Position); end = this.GetRunEndPositionDynamic(num); return; } num++; } }
// Token: 0x060035B3 RID: 13747 RVA: 0x000F3EFC File Offset: 0x000F20FC private void OnContentRemoved(ITextPointer position) { int num = this.FindIndex(position.CreateStaticPointer(), LogicalDirection.Backward); if (num == -1) { num = 0; } SpellerStatusTable.Run run = this.GetRun(num); if (run.RunType != SpellerStatusTable.RunType.Dirty) { this.NotifyHighlightLayerBeforeRunChange(num); run.RunType = SpellerStatusTable.RunType.Dirty; if (num > 0 && this.GetRun(num - 1).RunType == SpellerStatusTable.RunType.Dirty) { this._runList.RemoveAt(num); num--; } } num++; int i; for (i = num; i < this._runList.Count; i++) { ITextPointer position2 = this.GetRun(i).Position; if (position2.CompareTo(position) > 0 && position2.CompareTo(this.GetRunEndPosition(i)) != 0) { break; } } this._runList.RemoveRange(num, i - num); if (num < this._runList.Count) { this.NotifyHighlightLayerBeforeRunChange(num); this._runList.RemoveAt(num); if (num < this._runList.Count && this.GetRun(num).RunType == SpellerStatusTable.RunType.Dirty) { this._runList.RemoveAt(num); } } }
// Token: 0x060035A8 RID: 13736 RVA: 0x000F3868 File Offset: 0x000F1A68 internal void MarkErrorRange(ITextPointer start, ITextPointer end) { int num = this.FindIndex(start.CreateStaticPointer(), LogicalDirection.Forward); SpellerStatusTable.Run run = this.GetRun(num); Invariant.Assert(run.RunType == SpellerStatusTable.RunType.Clean); Invariant.Assert(run.Position.CompareTo(start) <= 0); Invariant.Assert(this.GetRunEndPosition(num).CompareTo(end) >= 0); if (run.Position.CompareTo(start) == 0) { run.RunType = SpellerStatusTable.RunType.Error; } else { this._runList.Insert(num + 1, new SpellerStatusTable.Run(start, SpellerStatusTable.RunType.Error)); num++; } if (this.GetRunEndPosition(num).CompareTo(end) > 0) { this._runList.Insert(num + 1, new SpellerStatusTable.Run(end, SpellerStatusTable.RunType.Clean)); } this._highlightLayer.FireChangedEvent(start, end); this.DebugAssertRunList(); }
// Token: 0x060035B9 RID: 13753 RVA: 0x000F41D4 File Offset: 0x000F23D4 private bool IsErrorRun(int index) { SpellerStatusTable.Run run = this.GetRun(index); return(run.RunType != SpellerStatusTable.RunType.Clean && run.RunType != SpellerStatusTable.RunType.Dirty); }