C# Class phdesign.NppToolBucket.PluginCore.Editor

Inheritance: PluginBase
Afficher le fichier Open project: phdesign/NppToolBucket Class Usage Examples

Méthodes publiques

Méthode Description
AddBookmark ( int lineNumber ) : void

Add a bookmark at a specific line.

AddFindMark ( int pos, int length ) : void

Marks a range of text.

BeginUndoAction ( ) : void

Mark the beginning of a set of operations that you want to undo all as one operation but that you have to generate as several operations. Alternatively, you can use these to mark a set of operations that you do not want to have combined with the preceding or following operations if they are undone.

EndUndoAction ( ) : void

Mark the end of a set of operations that you want to undo all as one operation but that you have to generate as several operations. Alternatively, you can use these to mark a set of operations that you do not want to have combined with the preceding or following operations if they are undone.

EnsureRangeVisible ( int start, int end ) : void

Make a range visible by scrolling to the last line of the range. A line may be hidden because more than one of its parent lines is contracted. Both these message travels up the fold hierarchy, expanding any contracted folds until they reach the top level. The line will then be visible.

FindInTarget ( string findText, int startPosition, int endPosition ) : int

This searches for the first occurrence of a text string in the target defined by startPosition and endPosition. The text string is not zero terminated; the size is set by length. The search is modified by the search flags set by SCI_SETSEARCHFLAGS. If the search succeeds, the target is set to the found text and the return value is the position of the start of the matching text. If the search fails, the result is -1.

GetActive ( ) : Editor
GetCharAt ( int pos ) : char

This returns the character at pos in the document or 0 if pos is negative or past the end of the document.

GetCurrentLineNumber ( ) : int

Get the line number that the cursor is on.

GetDocumentLength ( ) : int

Returns the length of the document in bytes.

GetDocumentText ( ) : string

Gets the entire document text.

GetIndent ( ) : int

Gets the size of indentation in terms of the width of a space in STYLE_DEFAULT. If you set a width of 0, the indent size is the same as the tab size. There are no limits on indent sizes, but values less than 0 or large values may have undesirable effects.

GetLineCount ( ) : int

This returns the number of lines in the document. An empty document contains 1 line. A document holding only an end of line sequence has 2 lines.

GetLineIndentPosition ( int line ) : int

This returns the position at the end of indentation of a line.

GetLineIndentation ( int line ) : int

Returns the amount of indentation on a line. The indentation is measured in character columns, which correspond to the width of space characters.

GetSelectedOrAllText ( ) : string

Gets the selected text or if nothing is selected, gets whole document text.

GetSelectedText ( ) : string

Returns the text currently selected (highlighted).

GetSelectionLength ( ) : int

Size in bytes of the selection.

GetSelectionRange ( ) : Sci_CharacterRange

Returns the start and end of the selection without regard to which end is the current position and which is the anchor. SCI_GETSELECTIONSTART returns the smaller of the current position or the anchor position.

GetTabWidth ( ) : int

Gets the size of a tab as a multiple of the size of a space character in STYLE_DEFAULT. The default tab width is 8 characters. There are no limits on tab sizes, but values less than 1 or large values may have undesirable effects.

GetTargetRange ( ) : Sci_CharacterRange

Returns the current target start and end positions from a previous operation.

GetTextByRange ( int start, int end ) : string

Returns the text between the positions start and end. If end is -1, text is returned to the end of the document. The text is 0 terminated, so you must supply a buffer that is at least 1 character longer than the number of characters you wish to read. The return value is the length of the returned text not including the terminating 0.

GetTextByRange ( int start, int end, int bufCapacity ) : string

Returns the text between the positions start and end. If end is -1, text is returned to the end of the document. The text is 0 terminated, so you must supply a buffer that is at least 1 character longer than the number of characters you wish to read. The return value is the length of the returned text not including the terminating 0.

GetUseTabs ( ) : int

Determines whether indentation should be created out of a mixture of tabs and spaces or be based purely on spaces. Set useTabs to false (0) to create all tabs and indents out of spaces. The default is true. You can use SCI_GETCOLUMN to get the column of a position taking the width of a tab into account.

IsBookmarkPresent ( int lineNumber ) : bool

Is there a bookmark set on a line.

IsUnicode ( ) : bool

Returns true if the current document is displaying in unicode format or false for ANSI. Note that all strings marshaled to and from Scintilla come in ANSI format so need to be converted if using Unicode.

LineFromPosition ( int pos ) : int

Returns the line that contains the position pos in the document. The return value is 0 if pos <= 0. The return value is the last line if pos is beyond the end of the document.

PositionAfter ( int pos ) : int

return the position after another position in the document taking into account the current code page. The maximum is the last position in the document. If called with a position within a multi byte character will return the position of the end of that character.

PositionFromLine ( int line ) : int

This returns the document position that corresponds with the start of the line. If line is negative, the position of the line holding the start of the selection is returned. If line is greater than the lines in the document, the return value is -1. If line is equal to the number of lines in the document (i.e. 1 line past the last line), the return value is the end of the document.

RemoveAllBookmarks ( ) : void

Remove all bookmarks from the document.

RemoveFindMarks ( ) : void

Remove all 'find' marks.

ReplaceText ( int start, int end, string text ) : int

Replaces a range of text with new text. Note that the recommended way to delete text in the document is to set the target to the text to be removed, and to perform a replace target with an empty string.

ReplaceText ( string text, bool useRegularExpression ) : int

Replaces the current selected target range of text.

SetDocumentText ( string text ) : void

Sets the text for the entire document (replacing any existing text).

SetIndent ( int indentSize ) : void

Sets the size of indentation in terms of the width of a space in STYLE_DEFAULT. If you set a width of 0, the indent size is the same as the tab size. There are no limits on indent sizes, but values less than 0 or large values may have undesirable effects.

SetSearchFlags ( bool matchWholeWord, bool matchCase, bool useRegularExpression, bool usePosixRegularExpressions ) : void
SetSelectedText ( string text ) : void

The currently selected text is replaced with text. If no text is selected the text is inserted at current cursor postion.

SetSelection ( int start, int end ) : void

Sets both the anchor and the current position. If end is negative, it means the end of the document. If start is negative, it means remove any selection (i.e. set the start to the same position as end). The caret is scrolled into view after this operation.

SetTabWidth ( int tabSize ) : void

Sets the size of a tab as a multiple of the size of a space character in STYLE_DEFAULT. The default tab width is 8 characters. There are no limits on tab sizes, but values less than 1 or large values may have undesirable effects.

SetTargetRange ( int start, int end ) : void

Sets the start and end positions for an upcoming operation.

SetUseTabs ( bool useTabs ) : void

Determines whether indentation should be created out of a mixture of tabs and spaces or be based purely on spaces. Set useTabs to false (0) to create all tabs and indents out of spaces. The default is true. You can use SCI_GETCOLUMN to get the column of a position taking the width of a tab into account.

Private Methods

Méthode Description
Call ( SciMsg msg ) : int
Call ( SciMsg msg, int wParam ) : int
Call ( SciMsg msg, int wParam, IntPtr lParam ) : int
Call ( SciMsg msg, int wParam, StringBuilder lParam ) : int
Call ( SciMsg msg, int wParam, int lParam ) : int
Call ( SciMsg msg, int wParam, string lParam ) : int
Editor ( IntPtr activeScintilla ) : System

Method Details

AddBookmark() public méthode

Add a bookmark at a specific line.
public AddBookmark ( int lineNumber ) : void
lineNumber int The line number to add a bookmark to.
Résultat void

AddFindMark() public méthode

Marks a range of text.
public AddFindMark ( int pos, int length ) : void
pos int
length int
Résultat void

BeginUndoAction() public méthode

Mark the beginning of a set of operations that you want to undo all as one operation but that you have to generate as several operations. Alternatively, you can use these to mark a set of operations that you do not want to have combined with the preceding or following operations if they are undone.
public BeginUndoAction ( ) : void
Résultat void

EndUndoAction() public méthode

Mark the end of a set of operations that you want to undo all as one operation but that you have to generate as several operations. Alternatively, you can use these to mark a set of operations that you do not want to have combined with the preceding or following operations if they are undone.
public EndUndoAction ( ) : void
Résultat void

EnsureRangeVisible() public méthode

Make a range visible by scrolling to the last line of the range. A line may be hidden because more than one of its parent lines is contracted. Both these message travels up the fold hierarchy, expanding any contracted folds until they reach the top level. The line will then be visible.
public EnsureRangeVisible ( int start, int end ) : void
start int
end int
Résultat void

FindInTarget() public méthode

This searches for the first occurrence of a text string in the target defined by startPosition and endPosition. The text string is not zero terminated; the size is set by length. The search is modified by the search flags set by SCI_SETSEARCHFLAGS. If the search succeeds, the target is set to the found text and the return value is the position of the start of the matching text. If the search fails, the result is -1.
public FindInTarget ( string findText, int startPosition, int endPosition ) : int
findText string String to search for.
startPosition int Where to start searching from.
endPosition int Where to stop searching.
Résultat int

GetActive() public static méthode

public static GetActive ( ) : Editor
Résultat Editor

GetCharAt() public méthode

This returns the character at pos in the document or 0 if pos is negative or past the end of the document.
public GetCharAt ( int pos ) : char
pos int
Résultat char

GetCurrentLineNumber() public méthode

Get the line number that the cursor is on.
public GetCurrentLineNumber ( ) : int
Résultat int

GetDocumentLength() public méthode

Returns the length of the document in bytes.
public GetDocumentLength ( ) : int
Résultat int

GetDocumentText() public méthode

Gets the entire document text.
public GetDocumentText ( ) : string
Résultat string

GetIndent() public méthode

Gets the size of indentation in terms of the width of a space in STYLE_DEFAULT. If you set a width of 0, the indent size is the same as the tab size. There are no limits on indent sizes, but values less than 0 or large values may have undesirable effects.
public GetIndent ( ) : int
Résultat int

GetLineCount() public méthode

This returns the number of lines in the document. An empty document contains 1 line. A document holding only an end of line sequence has 2 lines.
public GetLineCount ( ) : int
Résultat int

GetLineIndentPosition() public méthode

This returns the position at the end of indentation of a line.
public GetLineIndentPosition ( int line ) : int
line int
Résultat int

GetLineIndentation() public méthode

Returns the amount of indentation on a line. The indentation is measured in character columns, which correspond to the width of space characters.
public GetLineIndentation ( int line ) : int
line int
Résultat int

GetSelectedOrAllText() public méthode

Gets the selected text or if nothing is selected, gets whole document text.
public GetSelectedOrAllText ( ) : string
Résultat string

GetSelectedText() public méthode

Returns the text currently selected (highlighted).
public GetSelectedText ( ) : string
Résultat string

GetSelectionLength() public méthode

Size in bytes of the selection.
public GetSelectionLength ( ) : int
Résultat int

GetSelectionRange() public méthode

Returns the start and end of the selection without regard to which end is the current position and which is the anchor. SCI_GETSELECTIONSTART returns the smaller of the current position or the anchor position.
public GetSelectionRange ( ) : Sci_CharacterRange
Résultat Sci_CharacterRange

GetTabWidth() public méthode

Gets the size of a tab as a multiple of the size of a space character in STYLE_DEFAULT. The default tab width is 8 characters. There are no limits on tab sizes, but values less than 1 or large values may have undesirable effects.
public GetTabWidth ( ) : int
Résultat int

GetTargetRange() public méthode

Returns the current target start and end positions from a previous operation.
public GetTargetRange ( ) : Sci_CharacterRange
Résultat Sci_CharacterRange

GetTextByRange() public méthode

Returns the text between the positions start and end. If end is -1, text is returned to the end of the document. The text is 0 terminated, so you must supply a buffer that is at least 1 character longer than the number of characters you wish to read. The return value is the length of the returned text not including the terminating 0.
public GetTextByRange ( int start, int end ) : string
start int
end int
Résultat string

GetTextByRange() public méthode

Returns the text between the positions start and end. If end is -1, text is returned to the end of the document. The text is 0 terminated, so you must supply a buffer that is at least 1 character longer than the number of characters you wish to read. The return value is the length of the returned text not including the terminating 0.
public GetTextByRange ( int start, int end, int bufCapacity ) : string
start int
end int
bufCapacity int
Résultat string

GetUseTabs() public méthode

Determines whether indentation should be created out of a mixture of tabs and spaces or be based purely on spaces. Set useTabs to false (0) to create all tabs and indents out of spaces. The default is true. You can use SCI_GETCOLUMN to get the column of a position taking the width of a tab into account.
public GetUseTabs ( ) : int
Résultat int

IsBookmarkPresent() public méthode

Is there a bookmark set on a line.
public IsBookmarkPresent ( int lineNumber ) : bool
lineNumber int The line number to check.
Résultat bool

IsUnicode() public méthode

Returns true if the current document is displaying in unicode format or false for ANSI. Note that all strings marshaled to and from Scintilla come in ANSI format so need to be converted if using Unicode.
public IsUnicode ( ) : bool
Résultat bool

LineFromPosition() public méthode

Returns the line that contains the position pos in the document. The return value is 0 if pos <= 0. The return value is the last line if pos is beyond the end of the document.
public LineFromPosition ( int pos ) : int
pos int
Résultat int

PositionAfter() public méthode

return the position after another position in the document taking into account the current code page. The maximum is the last position in the document. If called with a position within a multi byte character will return the position of the end of that character.
public PositionAfter ( int pos ) : int
pos int
Résultat int

PositionFromLine() public méthode

This returns the document position that corresponds with the start of the line. If line is negative, the position of the line holding the start of the selection is returned. If line is greater than the lines in the document, the return value is -1. If line is equal to the number of lines in the document (i.e. 1 line past the last line), the return value is the end of the document.
public PositionFromLine ( int line ) : int
line int
Résultat int

RemoveAllBookmarks() public méthode

Remove all bookmarks from the document.
public RemoveAllBookmarks ( ) : void
Résultat void

RemoveFindMarks() public méthode

Remove all 'find' marks.
public RemoveFindMarks ( ) : void
Résultat void

ReplaceText() public méthode

Replaces a range of text with new text. Note that the recommended way to delete text in the document is to set the target to the text to be removed, and to perform a replace target with an empty string.
public ReplaceText ( int start, int end, string text ) : int
start int
end int
text string
Résultat int

ReplaceText() public méthode

Replaces the current selected target range of text.
public ReplaceText ( string text, bool useRegularExpression ) : int
text string The replacement text.
useRegularExpression bool If true, uses a regular expressions replacement.
Résultat int

SetDocumentText() public méthode

Sets the text for the entire document (replacing any existing text).
public SetDocumentText ( string text ) : void
text string The document text to set.
Résultat void

SetIndent() public méthode

Sets the size of indentation in terms of the width of a space in STYLE_DEFAULT. If you set a width of 0, the indent size is the same as the tab size. There are no limits on indent sizes, but values less than 0 or large values may have undesirable effects.
public SetIndent ( int indentSize ) : void
indentSize int
Résultat void

SetSearchFlags() public méthode

public SetSearchFlags ( bool matchWholeWord, bool matchCase, bool useRegularExpression, bool usePosixRegularExpressions ) : void
matchWholeWord bool
matchCase bool
useRegularExpression bool
usePosixRegularExpressions bool
Résultat void

SetSelectedText() public méthode

The currently selected text is replaced with text. If no text is selected the text is inserted at current cursor postion.
public SetSelectedText ( string text ) : void
text string The document text to set.
Résultat void

SetSelection() public méthode

Sets both the anchor and the current position. If end is negative, it means the end of the document. If start is negative, it means remove any selection (i.e. set the start to the same position as end). The caret is scrolled into view after this operation.
public SetSelection ( int start, int end ) : void
start int The selection start (anchor) position.
end int The selection end (current) position.
Résultat void

SetTabWidth() public méthode

Sets the size of a tab as a multiple of the size of a space character in STYLE_DEFAULT. The default tab width is 8 characters. There are no limits on tab sizes, but values less than 1 or large values may have undesirable effects.
public SetTabWidth ( int tabSize ) : void
tabSize int
Résultat void

SetTargetRange() public méthode

Sets the start and end positions for an upcoming operation.
public SetTargetRange ( int start, int end ) : void
start int
end int
Résultat void

SetUseTabs() public méthode

Determines whether indentation should be created out of a mixture of tabs and spaces or be based purely on spaces. Set useTabs to false (0) to create all tabs and indents out of spaces. The default is true. You can use SCI_GETCOLUMN to get the column of a position taking the width of a tab into account.
public SetUseTabs ( bool useTabs ) : void
useTabs bool
Résultat void