// Token: 0x0600847C RID: 33916 RVA: 0x002483B0 File Offset: 0x002465B0 private StaticTextPointer GetStaticPositionInChildContainer(StaticTextPointer textPosition, LogicalDirection direction, StaticTextPointer originalPosition) { StaticTextPointer result = StaticTextPointer.Null; if (!textPosition.IsNull) { DocumentSequenceTextPointer documentSequenceTextPointer = textPosition.CreateDynamicTextPointer(LogicalDirection.Forward) as DocumentSequenceTextPointer; ITextPointer textPointer = documentSequenceTextPointer.ChildPointer; if (textPointer.TextContainer != originalPosition.TextContainer) { if (this.IsContentHighlighted(originalPosition, direction)) { textPointer = ((direction == LogicalDirection.Forward) ? originalPosition.TextContainer.End : originalPosition.TextContainer.Start); result = textPointer.CreateStaticPointer(); } else { result = StaticTextPointer.Null; } } else { result = textPointer.CreateStaticPointer(); } } return(result); }
// Token: 0x060035AF RID: 13743 RVA: 0x000F3B94 File Offset: 0x000F1D94 private void MarkRange(ITextPointer start, ITextPointer end, SpellerStatusTable.RunType runType) { if (start.CompareTo(end) == 0) { return; } Invariant.Assert(runType == SpellerStatusTable.RunType.Clean || runType == SpellerStatusTable.RunType.Dirty); int num = this.FindIndex(start.CreateStaticPointer(), LogicalDirection.Forward); int num2 = this.FindIndex(end.CreateStaticPointer(), LogicalDirection.Backward); Invariant.Assert(num >= 0); Invariant.Assert(num2 >= 0); if (num + 1 < num2) { for (int i = num + 1; i < num2; i++) { this.NotifyHighlightLayerBeforeRunChange(i); } this._runList.RemoveRange(num + 1, num2 - num - 1); num2 = num + 1; } if (num == num2) { this.AddRun(num, start, end, runType); return; } Invariant.Assert(num == num2 - 1); this.AddRun(num, start, end, runType); num2 = this.FindIndex(end.CreateStaticPointer(), LogicalDirection.Backward); Invariant.Assert(num2 >= 0); this.AddRun(num2, start, end, runType); }
// Marks a text run as clean or dirty. private void MarkRange(ITextPointer start, ITextPointer end, RunType runType) { if (start.CompareTo(end) == 0) { return; } int startIndex; int endIndex; Invariant.Assert(runType == RunType.Clean || runType == RunType.Dirty); startIndex = FindIndex(start.CreateStaticPointer(), LogicalDirection.Forward); endIndex = FindIndex(end.CreateStaticPointer(), LogicalDirection.Backward); // We don't expect start/end to ever point off the edge of the document. Invariant.Assert(startIndex >= 0); Invariant.Assert(endIndex >= 0); // Remove wholly covered runs. if (startIndex + 1 < endIndex) { // Tell the HighlightLayer about any error runs that are going away. for (int i = startIndex + 1; i < endIndex; i++) { NotifyHighlightLayerBeforeRunChange(i); } _runList.RemoveRange(startIndex + 1, endIndex - startIndex - 1); endIndex = startIndex + 1; } // Merge the bordering edge runs. if (startIndex == endIndex) { // We're contained in a single run. AddRun(startIndex, start, end, runType); } else { // We cover two runs. Invariant.Assert(startIndex == endIndex - 1); // Handle the first run. AddRun(startIndex, start, end, runType); // Recalc endIndex, since it may have changed in the merge. endIndex = FindIndex(end.CreateStaticPointer(), LogicalDirection.Backward); Invariant.Assert(endIndex >= 0); // Handle the second run. AddRun(endIndex, start, end, runType); } }
/// <summary> /// Sets parentPosition to be a valid TextPointer in the parent document. This could either /// be the textPosition passed in (if its already on the parent document) or a conversion /// of the textPosition passed in. /// </summary> /// <returns>whether or not parentPosition is valid and should be used</returns> private bool EnsureParentPosition(StaticTextPointer textPosition, LogicalDirection direction, out StaticTextPointer parentPosition) { // Simple case - textPosition is already in the parent TextContainer parentPosition = textPosition; // If textPosition is on a child TextContainer, we convert it if (textPosition.TextContainer.Highlights != this) { // This case can't be converted so return false, out parameter should not be used if (textPosition.GetPointerContext(direction) == TextPointerContext.None) { return(false); } // Turn the textPosition (which should be in the scope of a FixedDocument) // into a position in the scope of the DocumentSequence. ITextPointer dynamicTextPointer = textPosition.CreateDynamicTextPointer(LogicalDirection.Forward); ITextPointer parentTextPointer = ((DocumentSequenceTextContainer)this.TextContainer).MapChildPositionToParent(dynamicTextPointer); Debug.Assert(parentTextPointer != null); parentPosition = parentTextPointer.CreateStaticPointer(); } // Returning true - either we started with a parent position or we converted to one return(true); }
/// <summary> /// Conversion from a StaticTextPointer on a DocumentSequence into a StaticTextPointer /// on a specified FixedDocument. If the conversion results in a pointer on a different /// FixedDocument then we return one end of the FixedDocument (based on direction). /// </summary> /// <param name="textPosition">position in a DocumentSequence to convert</param> /// <param name="direction">direction of the desired conversion</param> /// <param name="originalPosition">original pointer from FixedDocument</param> private StaticTextPointer GetStaticPositionInChildContainer(StaticTextPointer textPosition, LogicalDirection direction, StaticTextPointer originalPosition) { StaticTextPointer parentTextPointer = StaticTextPointer.Null; if (!textPosition.IsNull) { DocumentSequenceTextPointer parentChangePosition = textPosition.CreateDynamicTextPointer(LogicalDirection.Forward) as DocumentSequenceTextPointer; Debug.Assert(parentChangePosition != null); // If the DocSequence position translates into a position in a different FixedDocument than // the original request, we return an end of the original FixedDocument (which end depends on direction) ITextPointer childTp = parentChangePosition.ChildPointer; if (childTp.TextContainer != originalPosition.TextContainer) { // If the position we started searching from is highlighted, cut the highlight // at the end of the text container. Otherwise return null (the highlight must // start in the next document). if (IsContentHighlighted(originalPosition, direction)) { childTp = direction == LogicalDirection.Forward ? originalPosition.TextContainer.End : originalPosition.TextContainer.Start; parentTextPointer = childTp.CreateStaticPointer(); } else { parentTextPointer = StaticTextPointer.Null; } } else { parentTextPointer = childTp.CreateStaticPointer(); } } return(parentTextPointer); }
// Token: 0x0600847B RID: 33915 RVA: 0x00248358 File Offset: 0x00246558 private bool EnsureParentPosition(StaticTextPointer textPosition, LogicalDirection direction, out StaticTextPointer parentPosition) { parentPosition = textPosition; if (textPosition.TextContainer.Highlights != this) { if (textPosition.GetPointerContext(direction) == TextPointerContext.None) { return(false); } ITextPointer tp = textPosition.CreateDynamicTextPointer(LogicalDirection.Forward); ITextPointer textPointer = ((DocumentSequenceTextContainer)base.TextContainer).MapChildPositionToParent(tp); parentPosition = textPointer.CreateStaticPointer(); } return(true); }
// 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: 0x06006600 RID: 26112 RVA: 0x001CAB08 File Offset: 0x001C8D08 public override TextSpan <CultureSpecificCharacterBufferRange> GetPrecedingText(int dcp) { int num = 0; CharacterBufferRange empty = CharacterBufferRange.Empty; CultureInfo culture = null; if (dcp > 0) { ITextPointer textPointer = this._owner.TextContainer.CreatePointerAtOffset(dcp, LogicalDirection.Backward); while (textPointer.GetPointerContext(LogicalDirection.Backward) != TextPointerContext.Text && textPointer.CompareTo(this._owner.TextContainer.Start) != 0) { textPointer.MoveByOffset(-1); num++; } string textInRun = textPointer.GetTextInRun(LogicalDirection.Backward); empty = new CharacterBufferRange(textInRun, 0, textInRun.Length); StaticTextPointer staticTextPointer = textPointer.CreateStaticPointer(); DependencyObject element = (staticTextPointer.Parent != null) ? staticTextPointer.Parent : this._owner; culture = DynamicPropertyReader.GetCultureInfo(element); } return(new TextSpan <CultureSpecificCharacterBufferRange>(num + empty.Length, new CultureSpecificCharacterBufferRange(culture, empty))); }
// Tags a run of text as an error. // NB: we expect that the new error range has already been marked clean. internal void MarkErrorRange(ITextPointer start, ITextPointer end) { int runIndex; Run run; runIndex = FindIndex(start.CreateStaticPointer(), LogicalDirection.Forward); run = GetRun(runIndex); // There should be a clean run here, that covers all the error. // We always start analyzing text by cleaning the entire range. Invariant.Assert(run.RunType == RunType.Clean); Invariant.Assert(run.Position.CompareTo(start) <= 0); Invariant.Assert(GetRunEndPosition(runIndex).CompareTo(end) >= 0); if (run.Position.CompareTo(start) == 0) { // The run starts exactly at this error. // Convert it to an error and add a second clean run for the remainder. run.RunType = RunType.Error; } else { // The run starts before this error. // Insert a new error run, and an additional run for the remainder. _runList.Insert(runIndex + 1, new Run(start, RunType.Error)); runIndex++; } // Handle any remainder since we split the original clean run. if (GetRunEndPosition(runIndex).CompareTo(end) > 0) { _runList.Insert(runIndex + 1, new Run(end, RunType.Clean)); } // Tell the HighlightLayer about this change. _highlightLayer.FireChangedEvent(start, end); DebugAssertRunList(); }
/// <summary> /// Get text immediately before specified text source position. Return CharacterBufferRange /// containing this text. /// </summary> /// <param name="dcp"> /// dcp of position relative to start of line /// </param> internal override TextSpan <CultureSpecificCharacterBufferRange> GetPrecedingText(int dcp) { // Parameter validation Invariant.Assert(dcp >= 0); int nonTextLength = 0; CharacterBufferRange precedingText = CharacterBufferRange.Empty; CultureInfo culture = null; if (dcp > 0) { // Create TextPointer at dcp, and pointer at paragraph start to compare ITextPointer startPosition = TextContainerHelper.GetTextPointerFromCP(_paraClient.Paragraph.StructuralCache.TextContainer, _cpPara, LogicalDirection.Forward); ITextPointer position = TextContainerHelper.GetTextPointerFromCP(_paraClient.Paragraph.StructuralCache.TextContainer, _cpPara + dcp, LogicalDirection.Forward); // Move backward until we find a position at the end of a text run, or reach start of TextContainer while (position.GetPointerContext(LogicalDirection.Backward) != TextPointerContext.Text && position.CompareTo(startPosition) != 0) { position.MoveByOffset(-1); nonTextLength++; } // Return text in run. If it is at start of TextContainer this will return an empty string string precedingTextString = position.GetTextInRun(LogicalDirection.Backward); precedingText = new CharacterBufferRange(precedingTextString, 0, precedingTextString.Length); StaticTextPointer pointer = position.CreateStaticPointer(); DependencyObject element = (pointer.Parent != null) ? pointer.Parent : _paraClient.Paragraph.Element; culture = DynamicPropertyReader.GetCultureInfo(element); } return(new TextSpan <CultureSpecificCharacterBufferRange>( nonTextLength + precedingText.Length, new CultureSpecificCharacterBufferRange(culture, precedingText) )); }
// Returns the first dirty run following a specified position in the document. // start/end will be left null if no dirty ranges are found. internal void GetFirstDirtyRange(ITextPointer searchStart, out ITextPointer start, out ITextPointer end) { int index; Run run; start = null; end = null; // If this is ever slow enough to matter, we could cache the value. for (index = FindIndex(searchStart.CreateStaticPointer(), LogicalDirection.Forward); index >= 0 && index < _runList.Count; index++) { run = GetRun(index); if (run.RunType == RunType.Dirty) { // We might get a hit in the first run, in which case start <= searchStart. // Always return searchStart as a minimum. start = TextPointerBase.Max(searchStart, run.Position); end = GetRunEndPositionDynamic(index); break; } } }
// 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(); }
// ------------------------------------------------------------------ // Get text immediately before specified text source position. // ------------------------------------------------------------------ public override TextSpan <CultureSpecificCharacterBufferRange> GetPrecedingText(int dcp) { // Parameter validation Debug.Assert(dcp >= 0); int nonTextLength = 0; CharacterBufferRange precedingText = CharacterBufferRange.Empty; CultureInfo culture = null; if (dcp > 0) { // Create TextPointer at dcp ITextPointer position = _owner.TextContainer.CreatePointerAtOffset(dcp, LogicalDirection.Backward); // Move backward until we find a position at the end of a text run, or reach start of TextContainer while (position.GetPointerContext(LogicalDirection.Backward) != TextPointerContext.Text && position.CompareTo(_owner.TextContainer.Start) != 0) { position.MoveByOffset(-1); nonTextLength++; } // Return text in run. If it is at start of TextContainer this will return an empty string string precedingTextString = position.GetTextInRun(LogicalDirection.Backward); precedingText = new CharacterBufferRange(precedingTextString, 0, precedingTextString.Length); StaticTextPointer pointer = position.CreateStaticPointer(); DependencyObject element = (pointer.Parent != null) ? pointer.Parent : _owner; culture = DynamicPropertyReader.GetCultureInfo(element); } return(new TextSpan <CultureSpecificCharacterBufferRange>( nonTextLength + precedingText.Length, new CultureSpecificCharacterBufferRange(culture, precedingText) )); }
// Token: 0x06006864 RID: 26724 RVA: 0x001D6C0C File Offset: 0x001D4E0C internal override TextSpan <CultureSpecificCharacterBufferRange> GetPrecedingText(int dcp) { Invariant.Assert(dcp >= 0); int num = 0; CharacterBufferRange empty = CharacterBufferRange.Empty; CultureInfo culture = null; if (dcp > 0) { ITextPointer textPointerFromCP = TextContainerHelper.GetTextPointerFromCP(this._paraClient.Paragraph.StructuralCache.TextContainer, this._cpPara, LogicalDirection.Forward); ITextPointer textPointerFromCP2 = TextContainerHelper.GetTextPointerFromCP(this._paraClient.Paragraph.StructuralCache.TextContainer, this._cpPara + dcp, LogicalDirection.Forward); while (textPointerFromCP2.GetPointerContext(LogicalDirection.Backward) != TextPointerContext.Text && textPointerFromCP2.CompareTo(textPointerFromCP) != 0) { textPointerFromCP2.MoveByOffset(-1); num++; } string textInRun = textPointerFromCP2.GetTextInRun(LogicalDirection.Backward); empty = new CharacterBufferRange(textInRun, 0, textInRun.Length); StaticTextPointer staticTextPointer = textPointerFromCP2.CreateStaticPointer(); DependencyObject element = (staticTextPointer.Parent != null) ? staticTextPointer.Parent : this._paraClient.Paragraph.Element; culture = DynamicPropertyReader.GetCultureInfo(element); } return(new TextSpan <CultureSpecificCharacterBufferRange>(num + empty.Length, new CultureSpecificCharacterBufferRange(culture, empty))); }
// Called when content is removed from the document. // Update the run list and notifies the highlight layer. private void OnContentRemoved(ITextPointer position) { int index; int i; Run run; // Get the first bordering run. index = FindIndex(position.CreateStaticPointer(), LogicalDirection.Backward); if (index == -1) { // position is at beginning of document. // Look at the first run. index = 0; } // First run gets reset to dirty. run = GetRun(index); if (run.RunType != RunType.Dirty) { NotifyHighlightLayerBeforeRunChange(index); run.RunType = RunType.Dirty; // if (index > 0 && GetRun(index - 1).RunType == RunType.Dirty) { // Previous run matches the new value, merge with it. _runList.RemoveAt(index); index--; } } // Start looking at the following runs. index += 1; // Middle runs (collapsed to zero width) are removed. for (i = index; i < _runList.Count; i++) { ITextPointer runPosition = GetRun(i).Position; // Stop if we find a non-bordering Run that is not empty. if (runPosition.CompareTo(position) > 0 && runPosition.CompareTo(GetRunEndPosition(i)) != 0) { break; } } // Note we don't worry about announcing anything to the HighlightLayer // here because these are zero-width runs. _runList.RemoveRange(index, i - index); // Reset last run to dirty. // Since we know the first run at index is already dirty, // just remove it. if (index < _runList.Count) { NotifyHighlightLayerBeforeRunChange(index); _runList.RemoveAt(index); // // Finally, merge the following run with the run at index // if it happens to also be dirty. if (index < _runList.Count && GetRun(index).RunType == RunType.Dirty) { _runList.RemoveAt(index); } } }
// Called when content is removed from the document. // Update the run list and notifies the highlight layer. private void OnContentRemoved(ITextPointer position) { int index; int i; Run run; // Get the first bordering run. index = FindIndex(position.CreateStaticPointer(), LogicalDirection.Backward); if (index == -1) { // position is at beginning of document. // Look at the first run. index = 0; } // First run gets reset to dirty. run = GetRun(index); if (run.RunType != RunType.Dirty) { NotifyHighlightLayerBeforeRunChange(index); run.RunType = RunType.Dirty; // if (index > 0 && GetRun(index - 1).RunType == RunType.Dirty) { // Previous run matches the new value, merge with it. _runList.RemoveAt(index); index--; } } // Start looking at the following runs. index += 1; // Middle runs (collapsed to zero width) are removed. for (i = index; i < _runList.Count; i++) { ITextPointer runPosition = GetRun(i).Position; // Stop if we find a non-bordering Run that is not empty. if (runPosition.CompareTo(position) > 0 && runPosition.CompareTo(GetRunEndPosition(i)) != 0) break; } // Note we don't worry about announcing anything to the HighlightLayer // here because these are zero-width runs. _runList.RemoveRange(index, i - index); // Reset last run to dirty. // Since we know the first run at index is already dirty, // just remove it. if (index < _runList.Count) { NotifyHighlightLayerBeforeRunChange(index); _runList.RemoveAt(index); // // Finally, merge the following run with the run at index // if it happens to also be dirty. if (index < _runList.Count && GetRun(index).RunType == RunType.Dirty) { _runList.RemoveAt(index); } } }
private ITextPointer SearchForWordBreaks(ITextPointer position, LogicalDirection direction, XmlLanguage language, int minWordCount, bool stopOnError) { ITextPointer closestErrorPosition; ITextPointer searchPosition; ITextPointer start; ITextPointer end; StaticTextPointer nextErrorTransition; int segmentCount; TextMap textMap; searchPosition = position.CreatePointer(); closestErrorPosition = null; if (stopOnError) { nextErrorTransition = _statusTable.GetNextErrorTransition(position.CreateStaticPointer(), direction); if (!nextErrorTransition.IsNull) { closestErrorPosition = nextErrorTransition.CreateDynamicTextPointer(LogicalDirection.Forward); } } bool hitBreakPoint = false; do { searchPosition.MoveByOffset(direction == LogicalDirection.Backward ? -ContextBlockSize : +ContextBlockSize); // Don't go past closestErrorPosition. if (closestErrorPosition != null) { if (direction == LogicalDirection.Backward && closestErrorPosition.CompareTo(searchPosition) > 0 || direction == LogicalDirection.Forward && closestErrorPosition.CompareTo(searchPosition) < 0) { searchPosition.MoveToPosition(closestErrorPosition); hitBreakPoint = true; } } // Don't venture into text in another language. ITextPointer closestLanguageTransition = GetNextLanguageTransition(position, direction, language, searchPosition); if (direction == LogicalDirection.Backward && closestLanguageTransition.CompareTo(searchPosition) > 0 || direction == LogicalDirection.Forward && closestLanguageTransition.CompareTo(searchPosition) < 0) { searchPosition.MoveToPosition(closestLanguageTransition); hitBreakPoint = true; } if (direction == LogicalDirection.Backward) { start = searchPosition; end = position; } else { start = position; end = searchPosition; } textMap = new TextMap(start, end, start, end); segmentCount = _spellerInterop.EnumTextSegments(textMap.Text, textMap.TextLength, null, null, null); } while (!hitBreakPoint && segmentCount < minWordCount + 1 && searchPosition.GetPointerContext(direction) != TextPointerContext.None); return searchPosition; }
// Worker for TextBox/RichTextBox.GetNextSpellingErrorPosition. // Returns the start position of the next error, or null if no error exists. // // NB: this method will force an evaluation of any dirty regions between // position and the next error, which in the worst case is the rest of // the document. internal ITextPointer GetNextSpellingErrorPosition(ITextPointer position, LogicalDirection direction) { if (!EnsureInitialized()) return null; StaticTextPointer endPosition; SpellerStatusTable.RunType runType; while (_statusTable.GetRun(position.CreateStaticPointer(), direction, out runType, out endPosition)) { if (runType == SpellerStatusTable.RunType.Error) break; if (runType == SpellerStatusTable.RunType.Dirty) { ScanPosition(position, direction); _statusTable.GetRun(position.CreateStaticPointer(), direction, out runType, out endPosition); Invariant.Assert(runType != SpellerStatusTable.RunType.Dirty); if (runType == SpellerStatusTable.RunType.Error) break; } position = endPosition.CreateDynamicTextPointer(direction); } SpellingError spellingError = GetError(position, direction, false /* forceEvaluation */); return spellingError == null ? null : spellingError.Start; }
// Returns an object holding state about an error at the specified // position, or null if no error is present. // // If forceEvaluation is set true, the speller will analyze any dirty region // covered by the position. Otherwise dirty regions will be treated as // non-errors. internal SpellingError GetError(ITextPointer position, LogicalDirection direction, bool forceEvaluation) { ITextPointer start; ITextPointer end; SpellingError error; // Evaluate any pending dirty region. if (forceEvaluation && EnsureInitialized() && _statusTable.IsRunType(position.CreateStaticPointer(), direction, SpellerStatusTable.RunType.Dirty)) { ScanPosition(position, direction); } // Get the error result. if (_statusTable != null && _statusTable.GetError(position.CreateStaticPointer(), direction, out start, out end)) { error = new SpellingError(this, start, end); } else { error = null; } return error; }