C# Класс phdesign.NppToolBucket.PluginCore.Editor

Наследование: PluginBase
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
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

Описание методов

AddBookmark() публичный Метод

Add a bookmark at a specific line.
public AddBookmark ( int lineNumber ) : void
lineNumber int The line number to add a bookmark to.
Результат void

AddFindMark() публичный Метод

Marks a range of text.
public AddFindMark ( int pos, int length ) : void
pos int
length int
Результат void

BeginUndoAction() публичный Метод

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
Результат void

EndUndoAction() публичный Метод

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
Результат void

EnsureRangeVisible() публичный Метод

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
Результат void

FindInTarget() публичный Метод

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.
Результат int

GetActive() публичный статический Метод

public static GetActive ( ) : Editor
Результат Editor

GetCharAt() публичный Метод

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
Результат char

GetCurrentLineNumber() публичный Метод

Get the line number that the cursor is on.
public GetCurrentLineNumber ( ) : int
Результат int

GetDocumentLength() публичный Метод

Returns the length of the document in bytes.
public GetDocumentLength ( ) : int
Результат int

GetDocumentText() публичный Метод

Gets the entire document text.
public GetDocumentText ( ) : string
Результат string

GetIndent() публичный Метод

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
Результат int

GetLineCount() публичный Метод

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
Результат int

GetLineIndentPosition() публичный Метод

This returns the position at the end of indentation of a line.
public GetLineIndentPosition ( int line ) : int
line int
Результат int

GetLineIndentation() публичный Метод

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
Результат int

GetSelectedOrAllText() публичный Метод

Gets the selected text or if nothing is selected, gets whole document text.
public GetSelectedOrAllText ( ) : string
Результат string

GetSelectedText() публичный Метод

Returns the text currently selected (highlighted).
public GetSelectedText ( ) : string
Результат string

GetSelectionLength() публичный Метод

Size in bytes of the selection.
public GetSelectionLength ( ) : int
Результат int

GetSelectionRange() публичный Метод

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
Результат Sci_CharacterRange

GetTabWidth() публичный Метод

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
Результат int

GetTargetRange() публичный Метод

Returns the current target start and end positions from a previous operation.
public GetTargetRange ( ) : Sci_CharacterRange
Результат Sci_CharacterRange

GetTextByRange() публичный Метод

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
Результат string

GetTextByRange() публичный Метод

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
Результат string

GetUseTabs() публичный Метод

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
Результат int

IsBookmarkPresent() публичный Метод

Is there a bookmark set on a line.
public IsBookmarkPresent ( int lineNumber ) : bool
lineNumber int The line number to check.
Результат bool

IsUnicode() публичный Метод

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
Результат bool

LineFromPosition() публичный Метод

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
Результат int

PositionAfter() публичный Метод

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
Результат int

PositionFromLine() публичный Метод

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
Результат int

RemoveAllBookmarks() публичный Метод

Remove all bookmarks from the document.
public RemoveAllBookmarks ( ) : void
Результат void

RemoveFindMarks() публичный Метод

Remove all 'find' marks.
public RemoveFindMarks ( ) : void
Результат void

ReplaceText() публичный Метод

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
Результат int

ReplaceText() публичный Метод

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.
Результат int

SetDocumentText() публичный Метод

Sets the text for the entire document (replacing any existing text).
public SetDocumentText ( string text ) : void
text string The document text to set.
Результат void

SetIndent() публичный Метод

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
Результат void

SetSearchFlags() публичный Метод

public SetSearchFlags ( bool matchWholeWord, bool matchCase, bool useRegularExpression, bool usePosixRegularExpressions ) : void
matchWholeWord bool
matchCase bool
useRegularExpression bool
usePosixRegularExpressions bool
Результат void

SetSelectedText() публичный Метод

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.
Результат void

SetSelection() публичный Метод

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.
Результат void

SetTabWidth() публичный Метод

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
Результат void

SetTargetRange() публичный Метод

Sets the start and end positions for an upcoming operation.
public SetTargetRange ( int start, int end ) : void
start int
end int
Результат void

SetUseTabs() публичный Метод

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
Результат void