C# Class phdesign.NppToolBucket.PluginCore.Editor

Inheritance: PluginBase
Show file Open project: phdesign/NppToolBucket Class Usage Examples

Public Methods

Method 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

Method 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 method

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

AddFindMark() public method

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

BeginUndoAction() public method

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
return void

EndUndoAction() public method

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
return void

EnsureRangeVisible() public method

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
return void

FindInTarget() public method

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.
return int

GetActive() public static method

public static GetActive ( ) : Editor
return Editor

GetCharAt() public method

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
return char

GetCurrentLineNumber() public method

Get the line number that the cursor is on.
public GetCurrentLineNumber ( ) : int
return int

GetDocumentLength() public method

Returns the length of the document in bytes.
public GetDocumentLength ( ) : int
return int

GetDocumentText() public method

Gets the entire document text.
public GetDocumentText ( ) : string
return string

GetIndent() public method

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
return int

GetLineCount() public method

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
return int

GetLineIndentPosition() public method

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

GetLineIndentation() public method

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
return int

GetSelectedOrAllText() public method

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

GetSelectedText() public method

Returns the text currently selected (highlighted).
public GetSelectedText ( ) : string
return string

GetSelectionLength() public method

Size in bytes of the selection.
public GetSelectionLength ( ) : int
return int

GetSelectionRange() public method

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
return Sci_CharacterRange

GetTabWidth() public method

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
return int

GetTargetRange() public method

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

GetTextByRange() public method

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
return string

GetTextByRange() public method

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
return string

GetUseTabs() public method

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
return int

IsBookmarkPresent() public method

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

IsUnicode() public method

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
return bool

LineFromPosition() public method

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
return int

PositionAfter() public method

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
return int

PositionFromLine() public method

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
return int

RemoveAllBookmarks() public method

Remove all bookmarks from the document.
public RemoveAllBookmarks ( ) : void
return void

RemoveFindMarks() public method

Remove all 'find' marks.
public RemoveFindMarks ( ) : void
return void

ReplaceText() public method

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
return int

ReplaceText() public method

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.
return int

SetDocumentText() public method

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

SetIndent() public method

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
return void

SetSearchFlags() public method

public SetSearchFlags ( bool matchWholeWord, bool matchCase, bool useRegularExpression, bool usePosixRegularExpressions ) : void
matchWholeWord bool
matchCase bool
useRegularExpression bool
usePosixRegularExpressions bool
return void

SetSelectedText() public method

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.
return void

SetSelection() public method

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.
return void

SetTabWidth() public method

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
return void

SetTargetRange() public method

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

SetUseTabs() public method

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
return void