C# Class AvalonStudio.TextEditor.Document.TextUtilities

Show file Open project: VitalElement/AvalonStudio

Public Methods

Method Description
ContainsNumber ( string text ) : bool
FindNextNewLine ( ITextSource text, int offset, string &newLineType ) : int

Finds the next new line character starting at offset.

GetControlCharacterName ( char controlCharacter ) : string

Gets the name of the control character. For unknown characters, the unicode codepoint is returned as 4-digit hexadecimal value.

GetNewLineFromDocument ( IDocument document, int lineNumber ) : string

Gets the newline sequence used in the document at the specified line.

GetNextCaretPosition ( ITextSource textSource, int offset, LogicalDirection direction, CaretPositioningMode mode ) : int

Gets the next caret position.

This method is NOT equivalent to the actual caret movement when using VisualLine.GetNextCaretPosition. In real caret movement, there are additional caret stops at line starts and ends. This method treats linefeeds as simple whitespace.

GetSingleIndentationSegment ( ITextSource textSource, int offset, int indentationSize ) : ISegment

Gets a single indentation segment starting at offset - at most one tab or indentationSize spaces.

IsNewLine ( string newLine ) : bool

Gets whether the specified string is a newline sequence.

IsSymbol ( string text ) : bool
NormalizeNewLines ( string input, string newLine ) : string

Normalizes all new lines in input to be newLine.

Private Methods

Method Description
GetCharacterClass ( UnicodeCategory c ) : CharacterClass
GetCharacterClass ( char c ) : CharacterClass
GetCharacterClass ( char highSurrogate, char lowSurrogate ) : CharacterClass
GetLeadingWhitespace ( TextDocument document, DocumentLine documentLine ) : ISegment
GetTrailingWhitespace ( TextDocument document, DocumentLine documentLine ) : ISegment
GetWhitespaceAfter ( ITextSource textSource, int offset ) : ISegment
GetWhitespaceBefore ( ITextSource textSource, int offset ) : ISegment
IsNormal ( CaretPositioningMode mode ) : bool
StopBetweenCharacters ( CaretPositioningMode mode, CharacterClass charBefore, CharacterClass charAfter ) : bool

Method Details

ContainsNumber() public static method

public static ContainsNumber ( string text ) : bool
text string
return bool

FindNextNewLine() public static method

Finds the next new line character starting at offset.
public static FindNextNewLine ( ITextSource text, int offset, string &newLineType ) : int
text ITextSource The text source to search in.
offset int The starting offset for the search.
newLineType string The string representing the new line that was found, or null if no new line was found.
return int

GetControlCharacterName() public static method

Gets the name of the control character. For unknown characters, the unicode codepoint is returned as 4-digit hexadecimal value.
public static GetControlCharacterName ( char controlCharacter ) : string
controlCharacter char
return string

GetNewLineFromDocument() public static method

Gets the newline sequence used in the document at the specified line.
public static GetNewLineFromDocument ( IDocument document, int lineNumber ) : string
document IDocument
lineNumber int
return string

GetNextCaretPosition() public static method

Gets the next caret position.
This method is NOT equivalent to the actual caret movement when using VisualLine.GetNextCaretPosition. In real caret movement, there are additional caret stops at line starts and ends. This method treats linefeeds as simple whitespace.
public static GetNextCaretPosition ( ITextSource textSource, int offset, LogicalDirection direction, CaretPositioningMode mode ) : int
textSource ITextSource The text source.
offset int The start offset inside the text source.
direction LogicalDirection The search direction (forwards or backwards).
mode CaretPositioningMode The mode for caret positioning.
return int

GetSingleIndentationSegment() public static method

Gets a single indentation segment starting at offset - at most one tab or indentationSize spaces.
public static GetSingleIndentationSegment ( ITextSource textSource, int offset, int indentationSize ) : ISegment
textSource ITextSource The text source.
offset int The offset where the indentation segment starts.
indentationSize int The size of an indentation unit. See .
return ISegment

IsNewLine() public static method

Gets whether the specified string is a newline sequence.
public static IsNewLine ( string newLine ) : bool
newLine string
return bool

IsSymbol() public static method

public static IsSymbol ( string text ) : bool
text string
return bool

NormalizeNewLines() public static method

Normalizes all new lines in input to be newLine.
public static NormalizeNewLines ( string input, string newLine ) : string
input string
newLine string
return string