コード例 #1
0
 // Token: 0x060038DC RID: 14556 RVA: 0x0010101C File Offset: 0x000FF21C
 private static ITextPointer GetNextNonWhiteSpacePosition(ITextPointer position, ITextPointer limit)
 {
     Invariant.Assert(limit != null);
     while (position.CompareTo(limit) != 0)
     {
         char c;
         position = TextEditorSpelling.GetNextTextPosition(position, limit, LogicalDirection.Forward, out c);
         if (position == null || !char.IsWhiteSpace(c))
         {
             return(position);
         }
         position = position.CreatePointer(1);
     }
     return(null);
 }
コード例 #2
0
        // Token: 0x060038D5 RID: 14549 RVA: 0x00100C20 File Offset: 0x000FEE20
        internal static SpellingError GetSpellingErrorAtSelection(TextEditor This)
        {
            if (This.Speller == null)
            {
                return(null);
            }
            if (TextEditorSpelling.IsSelectionIgnoringErrors(This.Selection))
            {
                return(null);
            }
            LogicalDirection logicalDirection = This.Selection.IsEmpty ? This.Selection.Start.LogicalDirection : LogicalDirection.Forward;
            char             c;
            ITextPointer     textPointer = TextEditorSpelling.GetNextTextPosition(This.Selection.Start, null, logicalDirection, out c);

            if (textPointer == null)
            {
                logicalDirection = ((logicalDirection == LogicalDirection.Forward) ? LogicalDirection.Backward : LogicalDirection.Forward);
                textPointer      = TextEditorSpelling.GetNextTextPosition(This.Selection.Start, null, logicalDirection, out c);
            }
            else if (char.IsWhiteSpace(c))
            {
                if (This.Selection.IsEmpty)
                {
                    logicalDirection = ((logicalDirection == LogicalDirection.Forward) ? LogicalDirection.Backward : LogicalDirection.Forward);
                    textPointer      = TextEditorSpelling.GetNextTextPosition(This.Selection.Start, null, logicalDirection, out c);
                }
                else
                {
                    logicalDirection = LogicalDirection.Forward;
                    textPointer      = TextEditorSpelling.GetNextNonWhiteSpacePosition(This.Selection.Start, This.Selection.End);
                    if (textPointer == null)
                    {
                        logicalDirection = LogicalDirection.Backward;
                        textPointer      = TextEditorSpelling.GetNextTextPosition(This.Selection.Start, null, logicalDirection, out c);
                    }
                }
            }
            if (textPointer != null)
            {
                return(This.Speller.GetError(textPointer, logicalDirection, false));
            }
            return(null);
        }