C# Class _3PA.Npp

This class contains very generic wrappers for basic Notepad++ functionality.
Show file Open project: jcaillon/3P Class Usage Examples

Private Properties

Property Type Description

Public Methods

Method Description
AddSelection ( int caret, int anchor ) : void

Adds an additional selection range to the existing main selection.

A main selection must first have been set by a call to SetSelection.

AnnotationClearAll ( ) : void

Clear all annotations in one go

AutoCCancel ( ) : void

Cancels any displayed autocompletion list.

AutoCStops ( string chars ) : void

Specifies the characters that will automatically cancel autocompletion without the need to call AutoCCancel.

Characters specified should be limited to printable ASCII characters.

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.

BitmapToArgb ( Bitmap image ) : byte[]
BraceBadLight ( int position ) : void

Styles the specified character position with the Style.BraceBad style when there is an unmatched brace.

BraceHighlight ( int position1, int position2 ) : void

Styles the specified character positions with the Style.BraceLight style.

Brace highlighting can be removed by specifying InvalidPosition for position1 and position2.

BraceMatch ( int position ) : int

Finds a corresponding matching brace starting at the position specified. The brace characters handled are '(', ')', '[', ']', '{', '}', '<', and '>'.

A match only occurs if the style of the matching brace is the same as the starting brace. Nested braces are handled correctly.

ByteToCharStyles ( byte styles, byte text, int length, Encoding encoding ) : byte[]
CharPositionFromPointClose ( int x, int y ) : int

Finds the closest character position to the specified display point or returns -1 if the point is outside the window or not close to any characters.

CharToByteStyles ( byte styles, byte text, int length, Encoding encoding ) : byte[]
Clamp ( int value, int min, int max ) : int

Forces a value between a minimum and a maximum

ClampMin ( int value, int min ) : int

Forces a value to a minimum

Clear ( ) : void

Removes the selected text from the document.

ClearAll ( ) : void

Deletes all document text, unless the document is read-only.

ClearDocumentStyle ( ) : void

Removes all styling from the document and resets the folding state.

ClearSelections ( ) : void

Sets a single empty selection at the start of the document.

Colorize ( int startPos, int endPos ) : void

Requests that the current lexer restyle the specified range.

This will also cause fold levels in the range specified to be reset.

ConvertEols ( Eol eolMode ) : void

Changes all end-of-line characters in the document to the format specified.

Copy ( ) : void

Copies the selected text from the document and places it on the clipboard.

CopyAllowLine ( ) : void

Copies the selected text from the document and places it on the clipboard. If the selection is empty the current line is copied.

If the selection is empty and the current line copied, an extra "MSDEVLineSelect" marker is added to the clipboard which is then used in Paste to paste the whole line before the current line.

CopyRange ( int start, int end ) : void

Copies the specified range of text to the clipboard.

Cut ( ) : void

Cuts the selected text from the document and places it on the clipboard.

DeleteTextByRange ( int start, int end ) : void

Deletes the given range of text

DocLineFromVisible ( int displayLine ) : int

Returns the zero-based document line index from the specified display line index.

DropSelection ( int selection ) : void

If there are multiple selections, removes the specified selection.

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.

ExecuteCmd ( System.Windows.Forms.Command sciCommand ) : void

Performs the specified command

Exit ( ) : void

Leaves npp

FoldAll ( FoldAction action ) : void

Performs the specified fold action on the entire document.

When using FoldAction.Toggle the first fold header in the document is examined to decide whether to expand or contract.

GetAblWordAtPosition ( int position ) : string

Returns the ABL word at the given position (read on left and right) (stops at points)

GetBytes ( char text, int length, Encoding encoding, bool zeroTerminated ) : byte[]

Returns char array's bytes array with given encoding

GetBytes ( string text, Encoding encoding, bool zeroTerminated ) : byte[]

Returns a string's bytes array with given encoding

GetCaretScreenLocation ( ) : Point

Gets the current screen location of the caret.

GetColumn ( int position ) : int

Returns the column number of the specified document position, taking the width of tabs into account.

GetConfigDir ( ) : string

Returns the configuration directory path e.g. /plugins/config/{AssemblyProduct}

GetCurrentFileExtension ( ) : string

returns the current file's extension

GetCurrentFileFolder ( ) : string

Returns the current file folder (uses GetDirectoryName)

GetCurrentFileName ( ) : string

Returns the current file base name (uses GetFileName)

GetCurrentFilePath ( ) : string

Gets the path of the current document.

GetEndStyled ( ) : int

Returns the last document position likely to be styled correctly.

GetFirstWordRightAfterPoint ( int curPos ) : string

returns the first keyword right after the point (reading from right to left) it is useful to get a table name when we enter a field, or a database name when we enter a table name, also, if you analyse DATABASE.TABLE.CURFIELD, if returns TABLE and not DATABASE!

GetFocus ( ) : bool

to be tested!!!!

GetIndentString ( ) : string

returns the indent value as a string, can be either a \t or a number of ' '

GetIndicator ( int index ) : Indicator

Returns an indicator object Range of indicator id to use is from 8=INDIC_CONTAINER .. to 31=INDIC_IME-1

GetKeyword ( int curPos = -1 ) : string

Gets the keyword at given position (reading only on the left of the position)

GetLine ( ) : Line

Returns a Line object representing the current line

GetLine ( int index ) : Line

Returns a Line object representing the given line

GetMargin ( int index ) : Margin

Returns a margin object The margins are numbered 0 to 4. Using a margin number outside the valid range has no effect. By default, margin 0 is set to display line numbers, but is given a width of 0, so it is hidden. Margin 1 is set to display non-folding symbols and is given a width of 16 pixels, so it is visible. Margin 2 is set to display the folding symbols, but is given a width of 0, so it is hidden. Of course, you can set the margins to be whatever you wish.

GetMarker ( int index ) : Marker

Returns a marker object There are 32 markers, numbered 0 to MARKER_MAX (31), and you can assign any combination of them to each line in the document Marker numbers 25 to 31 are used by Scintilla in folding margins Marker numbers 0 to 24 have no pre-defined function; you can use them

GetNppDirectory ( ) : string

returns npp's folder path

GetOpenedFiles ( ) : List

Gets the file path of each file currently opened

GetOpenedFilesPrimary ( ) : List

Gets the file path of each file currently opened in the primary view

GetOpenedFilesSecondary ( ) : List

Gets the file path of each file currently opened in the secondary view

GetPointXyFromPosition ( int position ) : Point

returns the x,y point location of the character at the position given

GetPosFromLineColumn ( int line, int column ) : int

This message returns the position of a column on a line taking the width of tabs into account. It treats a multi-byte character as a single column. Column numbers, like lines start at 0.

GetPositionFromMouseLocation ( ) : int

Self explaining

GetScintillaRectangle ( ) : Rectangle

returns a rectangle representing the location and size of the scintilla window

GetSelection ( int index ) : Selection

Returns a selection object

GetSessionFiles ( string sessionFilePath ) : string

Gets the file path of each file in the session file, return the files separated by a new line

GetString ( IntPtr bytes, int length, Encoding encoding ) : string

Get string from pointer

GetStyle ( byte index ) : Style

Returns a style object There are 256 lexer styles that can be set, numbered 0 to STYLE_MAX (255). There are also some predefined numbered styles starting at 32.

GetStyleAt ( int position ) : int

Gets the style of the specified document position.

GetTag ( int tagNumber ) : string

Returns the capture group text of the most recent regular expression search.

GetTextBetween ( Point point ) : string
GetTextByRange ( int start, int end ) : string

Gets a range of text from the document.

GetTextOnLeftOfPos ( int curPos, int maxLenght = KeywordMaxLength ) : string

returns the text on the left of the position... it will always return empty string at minima

GetTextOnRightOfPos ( int curPos, int maxLenght = KeywordMaxLength ) : string

returns the text on the right of the position... it will always return empty string at minima

GetTextRange ( int position, int length ) : string

Gets a range of text from the document.

GoBackFromDefinition ( ) : void

When you use the GoToDefinition method, you stack points of your position before the jump, this method allows you to navigate back to where you were

GoToLine ( int line ) : void

Move the caret and the view to the specified line (lines starts 0!)

Goto ( string document, int line = -1, int column = -1 ) : void

Switch to a document, can be already opended or not

Goto ( string document, int position, int line, int column, bool saveHistoric ) : void

Switch to a document, can be already opended or not, can decide to remember the current position to jump back to it

GotoPos ( string document, int position ) : void

Switch to a document, can be already opended or not

GotoPosition ( int position ) : void

Navigates the caret to the document position specified.

Any selection is discarded.

GrabFocus ( ) : void

allows scintilla to grab focus

HideLines ( int lineStart, int lineEnd ) : void

Hides the range of lines specified.

InsertText ( int position, string text ) : void

Inserts text at the specified position.

No scrolling is performed.

IsCurrentFileHasExtension ( string extension ) : bool

Determines whether the current file has the specified extension (e.g. ".cs").

Note it is case insensitive.

LineFromPosition ( int position ) : int

Returns the line that contains the document position specified.

LineScroll ( int lines, int columns ) : void

Scrolls the display the number of lines and columns specified.

Negative values scroll in the opposite direction. A column is the width in pixels of a space character in the Style.Default style.

LoadCurrentSession ( string file ) : void
ModifyTextAroundCaret ( int offsetStart, int offsetEnd, string text ) : void

Use this method to modify the text around the caret, it's good because :

- it's wrapped around beginundo/endundo which allows the user to CTRL+Z all the actions as one

- it handles the modification around ALL the carets -> good for multiselection

NewDocument ( string text ) : void

displays the input text into a new document

OpenFile ( string file ) : bool

Opens given file in notepad++

Paste ( ) : void

Pastes the contents of the clipboard into the current selection.

PointXFromPosition ( int pos ) : int

Returns the X display pixel location of the specified document position.

PointYFromPosition ( int pos ) : int

Returns the Y display pixel location of the specified document position.

RebuildLinesInfo ( ) : void

Call this to rebuild the lines information from scratch

ReplaceKeywordWrapped ( string keyword, int offset ) : void

Replaces the left part of the keyword found at (CurrentPosition + offset) by the keyword given (all wrapped in an undo action + handles multiselection)

ReplaceSelection ( string text ) : void

Replaces the current selection with the specified text.

If there is not a current selection, the text will be inserted at the current caret position. Following the operation the caret is placed at the end of the inserted text and scrolled into view. Does nothing if string is null or empty?

ReplaceTarget ( string text ) : int

Replaces the target defined by TargetStart and TargetEnd with the specified text.

The TargetStart and TargetEnd properties will be updated to the start and end positions of the replaced text. The recommended way to delete text in the document is to set the target range to be removed and replace the target with an empty string.

ReplaceTargetRe ( string text ) : int

Replaces the target text defined by TargetStart and TargetEnd with the specified value after first substituting "\1" through "\9" macros in the text with the most recent regular expression capture groups.

The "\0" macro will be substituted by the entire matched text from the most recent search. The TargetStart and TargetEnd properties will be updated to the start and end positions of the replaced text.

RotateSelection ( ) : void

Makes the next selection the main selection.

RunCommand ( NppMenuCmd cmd ) : void

Allows to execute one of Npp's command

SaveCurrentDocument ( ) : void

Saves the current document.

SaveCurrentSession ( string file ) : void
SaveSession ( string sessionFilePath ) : bool

Saves the session into a file

ScrollCaret ( ) : void

Scrolls the current position into view, if it is not already visible.

ScrollRange ( int start, int end ) : void

Scrolls the specified range into view.

This may be used to make a search match visible.

SearchInTarget ( string text ) : int

Searches for the first occurrence of the specified text in the target defined by TargetStart and TargetEnd.

If successful, the TargetStart and TargetEnd properties will be updated to the start and end positions of the matched text. Searching can be performed in reverse using a TargetStart greater than the TargetEnd.

SelectAll ( ) : void

Selects all the text in the document.

The current position is not scrolled into view.

SetAdditionalSelectionColor ( bool use, Color bg, Color fg ) : void

Sets a global override to the additional selections background + foreground color.

SetCommand ( int index, string commandName, System.Action functionPointer, ShortcutKey shortcut = newShortcutKey(), bool checkOnInit = false ) : void

Creates entry in the FuncItems list, which list the menu entry displayed in Npp's plugin menu

SetEmptySelection ( int pos ) : void

Removes any selection and places the caret at the specified position.

The caret is not scrolled into view.

SetFoldMarginColors ( bool use, Color bgColor, Color fgColor ) : void

allow changing the colour of the fold margin and fold margin highlight

SetFoldMarginMarkersColor ( Color bgColor, Color fgColor, Color activeColor ) : void

allow changing the colour of the fold margin and fold margin highlight

SetHotSpotActiveColor ( bool use, Color fg, Color bg ) : void

While the cursor hovers over text in a style with the hotspot attribute set, the default colouring can be modified

SetIndentGuideColor ( Color bg, Color fg ) : void

sets the fore/background color of the IndentGuide, overriding the lexer's

SetSel ( int pos ) : void

Sets the current carret position + the current anchor position to the same position

SetSel ( int anchorPos, int currentPos ) : void

Sets the anchor and current position.

A negative value for currentPos signifies the end of the document. A negative value for anchorPos signifies no selection (set the anchorPos to the same as the currentPos). The current position is scrolled into view following this operation.

SetSelection ( int caret ) : void

Set a single selection from anchor to caret as the ONLY selection.

SetSelection ( int caret, int anchor ) : void

Set a single selection from anchor to caret as the ONLY selection.

SetSelectionColor ( bool use, Color bg, Color fg ) : void

Sets a global override to the selection background + foreground color.

SetStatusbarLabel ( string labelText ) : string

Sets the label in the status of npp (bottom right)

WARNING : THIS METHOD IS HIGHLY UNSTABLE, USE ONLY FOR DEBUG!

SetStyling ( int length, int style ) : void

Styles the specified length of characters.

The styling position is advanced by length after each call allowing multiple calls to SetStyling for a single call to StartStyling.

SetTargetRange ( int start, int end ) : void

Sets the TargetStart and TargetEnd properties in a single call.

SetTextByRange ( int start, int end, string text ) : void

Sets the text of a specific range, can and must be used to delete text from range

SetToolbarImage ( Bitmap image, int pluginId ) : void

Helper to add a clickable icon in the toolbar

SetWhiteSpaceColor ( bool use, Color bg, Color fg ) : void

sets the fore/background color of the whitespaces, overriding the lexer's

ShowInactiveTopmost ( Form frm ) : void
ShowLines ( int lineStart, int lineEnd ) : void

Shows the range of lines specified.

StartBytePosOfLine ( int line ) : int

Returns the !! BYTE !! position of the start of given line Don't use THIS unless you know what you are doing with it!!!

StartRecordMacro ( ) : IntPtr
StartStyling ( int position ) : void

Prepares for styling by setting the styling position to start at.

After preparing the document for styling, use successive calls to SetStyling to style the document.

StyleClearAll ( ) : void

Resets all style properties to those currently configured for the Style.Default style.

StyleResetDefault ( ) : void

Resets the Style.Default style to its initial state.

StyleTextEx ( int startPos, byte styleArray ) : void

TODO: UNTESTED set the style of a text from startPos to startPos + styleArray.Length, the styleArray is a array of bytes, each byte is the style number to the corresponding text byte

SwapMainAnchorCaret ( ) : void

Moves the caret to the opposite end of the main selection.

SwitchToDocument ( string doc ) : void

Switch to given document

TargetFromSelection ( ) : void

Sets the TargetStart and TargetEnd to the start and end positions of the selection.

TargetWholeDocument ( ) : void

Sets the TargetStart and TargetEnd to the start and end positions of the document.

TextHeight ( int line ) : int

Retrieve the height of a particular line of text in pixels.

TextWidth ( int style, string text ) : int

Measures the width in pixels of the specified string when rendered in the specified style.

Undo ( ) : void

Undo previous action

UpdateLinesInfo ( SCNotification scn, bool isInsertion ) : void

Call this on SCN_MODIFIED event from scintilla to update the info on lines

UpdateScintilla ( bool reverse = false ) : void

Updates the current scintilla handle for Npp's functions Called when the user changes the current document

ZoomIn ( ) : void

Increases the zoom factor by 1 until it reaches 20 points.

ZoomOut ( ) : void

Decreases the zoom factor by 1 until it reaches -10 points.

Method Details

AddSelection() public static method

Adds an additional selection range to the existing main selection.
A main selection must first have been set by a call to SetSelection.
public static AddSelection ( int caret, int anchor ) : void
caret int The zero-based document position to end the selection.
anchor int The zero-based document position to start the selection.
return void

AnnotationClearAll() public static method

Clear all annotations in one go
public static AnnotationClearAll ( ) : void
return void

AutoCCancel() public static method

Cancels any displayed autocompletion list.
public static AutoCCancel ( ) : void
return void

AutoCStops() public static method

Specifies the characters that will automatically cancel autocompletion without the need to call AutoCCancel.
Characters specified should be limited to printable ASCII characters.
public static AutoCStops ( string chars ) : void
chars string A String of the characters that will cancel autocompletion. The default is empty.
return void

BeginUndoAction() public static 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 static BeginUndoAction ( ) : void
return void

BitmapToArgb() public static method

public static BitmapToArgb ( Bitmap image ) : byte[]
image System.Drawing.Bitmap
return byte[]

BraceBadLight() public static method

Styles the specified character position with the Style.BraceBad style when there is an unmatched brace.
public static BraceBadLight ( int position ) : void
position int /// The zero-based document position of the unmatched brace character or InvalidPosition to remove /// the highlight. ///
return void

BraceHighlight() public static method

Styles the specified character positions with the Style.BraceLight style.
Brace highlighting can be removed by specifying InvalidPosition for position1 and position2.
public static BraceHighlight ( int position1, int position2 ) : void
position1 int The zero-based document position of the open brace character.
position2 int The zero-based document position of the close brace character.
return void

BraceMatch() public static method

Finds a corresponding matching brace starting at the position specified. The brace characters handled are '(', ')', '[', ']', '{', '}', '<', and '>'.
A match only occurs if the style of the matching brace is the same as the starting brace. Nested braces are handled correctly.
public static BraceMatch ( int position ) : int
position int /// The zero-based document position of a brace character to start the search from for a matching /// brace character. ///
return int

ByteToCharStyles() public static method

public static ByteToCharStyles ( byte styles, byte text, int length, Encoding encoding ) : byte[]
styles byte
text byte
length int
encoding System.Text.Encoding
return byte[]

CharPositionFromPointClose() public static method

Finds the closest character position to the specified display point or returns -1 if the point is outside the window or not close to any characters.
public static CharPositionFromPointClose ( int x, int y ) : int
x int The x pixel coordinate within the client rectangle of the control.
y int The y pixel coordinate within the client rectangle of the control.
return int

CharToByteStyles() public static method

public static CharToByteStyles ( byte styles, byte text, int length, Encoding encoding ) : byte[]
styles byte
text byte
length int
encoding System.Text.Encoding
return byte[]

Clamp() public static method

Forces a value between a minimum and a maximum
public static Clamp ( int value, int min, int max ) : int
value int
min int
max int
return int

ClampMin() public static method

Forces a value to a minimum
public static ClampMin ( int value, int min ) : int
value int
min int
return int

Clear() public static method

Removes the selected text from the document.
public static Clear ( ) : void
return void

ClearAll() public static method

Deletes all document text, unless the document is read-only.
public static ClearAll ( ) : void
return void

ClearDocumentStyle() public static method

Removes all styling from the document and resets the folding state.
public static ClearDocumentStyle ( ) : void
return void

ClearSelections() public static method

Sets a single empty selection at the start of the document.
public static ClearSelections ( ) : void
return void

Colorize() public static method

Requests that the current lexer restyle the specified range.
This will also cause fold levels in the range specified to be reset.
public static Colorize ( int startPos, int endPos ) : void
startPos int The zero-based document position at which to start styling.
endPos int The zero-based document position at which to stop styling (exclusive).
return void

ConvertEols() public static method

Changes all end-of-line characters in the document to the format specified.
public static ConvertEols ( Eol eolMode ) : void
eolMode Eol One of the Eol enumeration values.
return void

Copy() public static method

Copies the selected text from the document and places it on the clipboard.
public static Copy ( ) : void
return void

CopyAllowLine() public static method

Copies the selected text from the document and places it on the clipboard. If the selection is empty the current line is copied.
If the selection is empty and the current line copied, an extra "MSDEVLineSelect" marker is added to the clipboard which is then used in Paste to paste the whole line before the current line.
public static CopyAllowLine ( ) : void
return void

CopyRange() public static method

Copies the specified range of text to the clipboard.
public static CopyRange ( int start, int end ) : void
start int The zero-based character position in the document to start copying.
end int The zero-based character position (exclusive) in the document to stop copying.
return void

Cut() public static method

Cuts the selected text from the document and places it on the clipboard.
public static Cut ( ) : void
return void

DeleteTextByRange() public static method

Deletes the given range of text
public static DeleteTextByRange ( int start, int end ) : void
start int
end int
return void

DocLineFromVisible() public static method

Returns the zero-based document line index from the specified display line index.
public static DocLineFromVisible ( int displayLine ) : int
displayLine int The zero-based display line index.
return int

DropSelection() public static method

If there are multiple selections, removes the specified selection.
public static DropSelection ( int selection ) : void
selection int The zero-based selection index.
return void

EndUndoAction() public static 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 static EndUndoAction ( ) : void
return void

ExecuteCmd() public static method

Performs the specified command
public static ExecuteCmd ( System.Windows.Forms.Command sciCommand ) : void
sciCommand System.Windows.Forms.Command The command to perform.
return void

Exit() public static method

Leaves npp
public static Exit ( ) : void
return void

FoldAll() public static method

Performs the specified fold action on the entire document.
When using FoldAction.Toggle the first fold header in the document is examined to decide whether to expand or contract.
public static FoldAll ( FoldAction action ) : void
action FoldAction One of the FoldAction enumeration values.
return void

GetAblWordAtPosition() public static method

Returns the ABL word at the given position (read on left and right) (stops at points)
public static GetAblWordAtPosition ( int position ) : string
position int
return string

GetBytes() public static method

Returns char array's bytes array with given encoding
public static GetBytes ( char text, int length, Encoding encoding, bool zeroTerminated ) : byte[]
text char
length int
encoding System.Text.Encoding
zeroTerminated bool
return byte[]

GetBytes() public static method

Returns a string's bytes array with given encoding
public static GetBytes ( string text, Encoding encoding, bool zeroTerminated ) : byte[]
text string
encoding System.Text.Encoding
zeroTerminated bool
return byte[]

GetCaretScreenLocation() public static method

Gets the current screen location of the caret.
public static GetCaretScreenLocation ( ) : Point
return Point

GetColumn() public static method

Returns the column number of the specified document position, taking the width of tabs into account.
public static GetColumn ( int position ) : int
position int The zero-based document position to get the column for.
return int

GetConfigDir() public static method

Returns the configuration directory path e.g. /plugins/config/{AssemblyProduct}
public static GetConfigDir ( ) : string
return string

GetCurrentFileExtension() public static method

returns the current file's extension
public static GetCurrentFileExtension ( ) : string
return string

GetCurrentFileFolder() public static method

Returns the current file folder (uses GetDirectoryName)
public static GetCurrentFileFolder ( ) : string
return string

GetCurrentFileName() public static method

Returns the current file base name (uses GetFileName)
public static GetCurrentFileName ( ) : string
return string

GetCurrentFilePath() public static method

Gets the path of the current document.
public static GetCurrentFilePath ( ) : string
return string

GetEndStyled() public static method

Returns the last document position likely to be styled correctly.
public static GetEndStyled ( ) : int
return int

GetFirstWordRightAfterPoint() public static method

returns the first keyword right after the point (reading from right to left) it is useful to get a table name when we enter a field, or a database name when we enter a table name, also, if you analyse DATABASE.TABLE.CURFIELD, if returns TABLE and not DATABASE!
public static GetFirstWordRightAfterPoint ( int curPos ) : string
curPos int
return string

GetFocus() public static method

to be tested!!!!
public static GetFocus ( ) : bool
return bool

GetIndentString() public static method

returns the indent value as a string, can be either a \t or a number of ' '
public static GetIndentString ( ) : string
return string

GetIndicator() public static method

Returns an indicator object Range of indicator id to use is from 8=INDIC_CONTAINER .. to 31=INDIC_IME-1
public static GetIndicator ( int index ) : Indicator
index int
return Indicator

GetKeyword() public static method

Gets the keyword at given position (reading only on the left of the position)
public static GetKeyword ( int curPos = -1 ) : string
curPos int
return string

GetLine() public static method

Returns a Line object representing the current line
public static GetLine ( ) : Line
return Line

GetLine() public static method

Returns a Line object representing the given line
public static GetLine ( int index ) : Line
index int
return Line

GetMargin() public static method

Returns a margin object The margins are numbered 0 to 4. Using a margin number outside the valid range has no effect. By default, margin 0 is set to display line numbers, but is given a width of 0, so it is hidden. Margin 1 is set to display non-folding symbols and is given a width of 16 pixels, so it is visible. Margin 2 is set to display the folding symbols, but is given a width of 0, so it is hidden. Of course, you can set the margins to be whatever you wish.
public static GetMargin ( int index ) : Margin
index int
return Margin

GetMarker() public static method

Returns a marker object There are 32 markers, numbered 0 to MARKER_MAX (31), and you can assign any combination of them to each line in the document Marker numbers 25 to 31 are used by Scintilla in folding margins Marker numbers 0 to 24 have no pre-defined function; you can use them
public static GetMarker ( int index ) : Marker
index int
return Marker

GetNppDirectory() public static method

returns npp's folder path
public static GetNppDirectory ( ) : string
return string

GetOpenedFiles() public static method

Gets the file path of each file currently opened
public static GetOpenedFiles ( ) : List
return List

GetOpenedFilesPrimary() public static method

Gets the file path of each file currently opened in the primary view
public static GetOpenedFilesPrimary ( ) : List
return List

GetOpenedFilesSecondary() public static method

Gets the file path of each file currently opened in the secondary view
public static GetOpenedFilesSecondary ( ) : List
return List

GetPointXyFromPosition() public static method

returns the x,y point location of the character at the position given
public static GetPointXyFromPosition ( int position ) : Point
position int
return Point

GetPosFromLineColumn() public static method

This message returns the position of a column on a line taking the width of tabs into account. It treats a multi-byte character as a single column. Column numbers, like lines start at 0.
public static GetPosFromLineColumn ( int line, int column ) : int
line int
column int
return int

GetPositionFromMouseLocation() public static method

Self explaining
public static GetPositionFromMouseLocation ( ) : int
return int

GetScintillaRectangle() public static method

returns a rectangle representing the location and size of the scintilla window
public static GetScintillaRectangle ( ) : Rectangle
return System.Drawing.Rectangle

GetSelection() public static method

Returns a selection object
public static GetSelection ( int index ) : Selection
index int
return Selection

GetSessionFiles() public static method

Gets the file path of each file in the session file, return the files separated by a new line
public static GetSessionFiles ( string sessionFilePath ) : string
sessionFilePath string
return string

GetString() public static method

Get string from pointer
public static GetString ( IntPtr bytes, int length, Encoding encoding ) : string
bytes System.IntPtr
length int
encoding System.Text.Encoding
return string

GetStyle() public static method

Returns a style object There are 256 lexer styles that can be set, numbered 0 to STYLE_MAX (255). There are also some predefined numbered styles starting at 32.
public static GetStyle ( byte index ) : Style
index byte
return _3PA.MainFeatures.Style

GetStyleAt() public static method

Gets the style of the specified document position.
public static GetStyleAt ( int position ) : int
position int The zero-based document position of the character to get the style for.
return int

GetTag() public static method

Returns the capture group text of the most recent regular expression search.
public static GetTag ( int tagNumber ) : string
tagNumber int The capture group (1 through 9) to get the text for.
return string

GetTextBetween() public static method

public static GetTextBetween ( Point point ) : string
point Point
return string

GetTextByRange() public static method

Gets a range of text from the document.
public static GetTextByRange ( int start, int end ) : string
start int The zero-based starting character position of the range to get.
end int The zero-based ending character position of the range to get.
return string

GetTextOnLeftOfPos() public static method

returns the text on the left of the position... it will always return empty string at minima
public static GetTextOnLeftOfPos ( int curPos, int maxLenght = KeywordMaxLength ) : string
curPos int
maxLenght int
return string

GetTextOnRightOfPos() public static method

returns the text on the right of the position... it will always return empty string at minima
public static GetTextOnRightOfPos ( int curPos, int maxLenght = KeywordMaxLength ) : string
curPos int
maxLenght int
return string

GetTextRange() public static method

Gets a range of text from the document.
public static GetTextRange ( int position, int length ) : string
position int The zero-based starting character position of the range to get.
length int The number of characters to get.
return string

GoBackFromDefinition() public static method

When you use the GoToDefinition method, you stack points of your position before the jump, this method allows you to navigate back to where you were
public static GoBackFromDefinition ( ) : void
return void

GoToLine() public static method

Move the caret and the view to the specified line (lines starts 0!)
public static GoToLine ( int line ) : void
line int
return void

Goto() public static method

Switch to a document, can be already opended or not
public static Goto ( string document, int line = -1, int column = -1 ) : void
document string
line int
column int
return void

Goto() public static method

Switch to a document, can be already opended or not, can decide to remember the current position to jump back to it
public static Goto ( string document, int position, int line, int column, bool saveHistoric ) : void
document string
position int
line int
column int
saveHistoric bool
return void

GotoPos() public static method

Switch to a document, can be already opended or not
public static GotoPos ( string document, int position ) : void
document string
position int
return void

GotoPosition() public static method

Navigates the caret to the document position specified.
Any selection is discarded.
public static GotoPosition ( int position ) : void
position int The zero-based document character position to navigate to.
return void

GrabFocus() public static method

allows scintilla to grab focus
public static GrabFocus ( ) : void
return void

HideLines() public static method

Hides the range of lines specified.
public static HideLines ( int lineStart, int lineEnd ) : void
lineStart int The zero-based index of the line range to start hiding.
lineEnd int The zero-based index of the line range to end hiding.
return void

InsertText() public static method

Inserts text at the specified position.
No scrolling is performed.
/// less than zero and not equal to -1. -or- /// is greater than the document length. ///
public static InsertText ( int position, string text ) : void
position int /// The zero-based character position to insert the text. Specify -1 to use the current caret /// position. ///
text string The text to insert into the document.
return void

IsCurrentFileHasExtension() public static method

Determines whether the current file has the specified extension (e.g. ".cs").

Note it is case insensitive.

public static IsCurrentFileHasExtension ( string extension ) : bool
extension string The extension.
return bool

LineFromPosition() public static method

Returns the line that contains the document position specified.
public static LineFromPosition ( int position ) : int
position int The zero-based document character position.
return int

LineScroll() public static method

Scrolls the display the number of lines and columns specified.
Negative values scroll in the opposite direction. A column is the width in pixels of a space character in the Style.Default style.
public static LineScroll ( int lines, int columns ) : void
lines int The number of lines to scroll.
columns int The number of columns to scroll.
return void

LoadCurrentSession() public static method

public static LoadCurrentSession ( string file ) : void
file string
return void

ModifyTextAroundCaret() public static method

Use this method to modify the text around the caret, it's good because :

- it's wrapped around beginundo/endundo which allows the user to CTRL+Z all the actions as one

- it handles the modification around ALL the carets -> good for multiselection
public static ModifyTextAroundCaret ( int offsetStart, int offsetEnd, string text ) : void
offsetStart int offset relative to the current carret position
offsetEnd int offset relative to the current carret position
text string
return void

NewDocument() public static method

displays the input text into a new document
public static NewDocument ( string text ) : void
text string
return void

OpenFile() public static method

Opens given file in notepad++
public static OpenFile ( string file ) : bool
file string
return bool

Paste() public static method

Pastes the contents of the clipboard into the current selection.
public static Paste ( ) : void
return void

PointXFromPosition() public static method

Returns the X display pixel location of the specified document position.
public static PointXFromPosition ( int pos ) : int
pos int The zero-based document character position.
return int

PointYFromPosition() public static method

Returns the Y display pixel location of the specified document position.
public static PointYFromPosition ( int pos ) : int
pos int The zero-based document character position.
return int

RebuildLinesInfo() public static method

Call this to rebuild the lines information from scratch
public static RebuildLinesInfo ( ) : void
return void

ReplaceKeywordWrapped() public static method

Replaces the left part of the keyword found at (CurrentPosition + offset) by the keyword given (all wrapped in an undo action + handles multiselection)
public static ReplaceKeywordWrapped ( string keyword, int offset ) : void
keyword string
offset int offset relative to the current carret position
return void

ReplaceSelection() public static method

Replaces the current selection with the specified text.
If there is not a current selection, the text will be inserted at the current caret position. Following the operation the caret is placed at the end of the inserted text and scrolled into view. Does nothing if string is null or empty?
public static ReplaceSelection ( string text ) : void
text string The text that should replace the current selection.
return void

ReplaceTarget() public static method

Replaces the target defined by TargetStart and TargetEnd with the specified text.
The TargetStart and TargetEnd properties will be updated to the start and end positions of the replaced text. The recommended way to delete text in the document is to set the target range to be removed and replace the target with an empty string.
public static ReplaceTarget ( string text ) : int
text string The text that will replace the current target.
return int

ReplaceTargetRe() public static method

Replaces the target text defined by TargetStart and TargetEnd with the specified value after first substituting "\1" through "\9" macros in the text with the most recent regular expression capture groups.
The "\0" macro will be substituted by the entire matched text from the most recent search. The TargetStart and TargetEnd properties will be updated to the start and end positions of the replaced text.
public static ReplaceTargetRe ( string text ) : int
text string /// The text containing "\n" macros that will be substituted with the most recent regular expression /// capture groups and then replace the current target. ///
return int

RotateSelection() public static method

Makes the next selection the main selection.
public static RotateSelection ( ) : void
return void

RunCommand() public static method

Allows to execute one of Npp's command
public static RunCommand ( NppMenuCmd cmd ) : void
cmd NppMenuCmd
return void

SaveCurrentDocument() public static method

Saves the current document.
public static SaveCurrentDocument ( ) : void
return void

SaveCurrentSession() public static method

public static SaveCurrentSession ( string file ) : void
file string
return void

SaveSession() public static method

Saves the session into a file
public static SaveSession ( string sessionFilePath ) : bool
sessionFilePath string
return bool

ScrollCaret() public static method

Scrolls the current position into view, if it is not already visible.
public static ScrollCaret ( ) : void
return void

ScrollRange() public static method

Scrolls the specified range into view.
This may be used to make a search match visible.
public static ScrollRange ( int start, int end ) : void
start int The zero-based document start position to scroll to.
end int /// The zero-based document end position to scroll to if doing so does not cause the /// position to scroll out of view. ///
return void

SearchInTarget() public static method

Searches for the first occurrence of the specified text in the target defined by TargetStart and TargetEnd.
If successful, the TargetStart and TargetEnd properties will be updated to the start and end positions of the matched text. Searching can be performed in reverse using a TargetStart greater than the TargetEnd.
public static SearchInTarget ( string text ) : int
text string /// The text to search for. The interpretation of the text (i.e. whether it is a regular expression) is /// defined by the SearchFlags property. ///
return int

SelectAll() public static method

Selects all the text in the document.
The current position is not scrolled into view.
public static SelectAll ( ) : void
return void

SetAdditionalSelectionColor() public static method

Sets a global override to the additional selections background + foreground color.
public static SetAdditionalSelectionColor ( bool use, Color bg, Color fg ) : void
use bool
bg Color
fg Color
return void

SetCommand() public static method

Creates entry in the FuncItems list, which list the menu entry displayed in Npp's plugin menu
public static SetCommand ( int index, string commandName, System.Action functionPointer, ShortcutKey shortcut = newShortcutKey(), bool checkOnInit = false ) : void
index int
commandName string
functionPointer System.Action
shortcut _3PA.Interop.ShortcutKey
checkOnInit bool
return void

SetEmptySelection() public static method

Removes any selection and places the caret at the specified position.
The caret is not scrolled into view.
public static SetEmptySelection ( int pos ) : void
pos int The zero-based document position to place the caret at.
return void

SetFoldMarginColors() public static method

allow changing the colour of the fold margin and fold margin highlight
public static SetFoldMarginColors ( bool use, Color bgColor, Color fgColor ) : void
use bool
bgColor Color
fgColor Color
return void

SetFoldMarginMarkersColor() public static method

allow changing the colour of the fold margin and fold margin highlight
public static SetFoldMarginMarkersColor ( Color bgColor, Color fgColor, Color activeColor ) : void
bgColor Color
fgColor Color
activeColor Color
return void

SetHotSpotActiveColor() public static method

While the cursor hovers over text in a style with the hotspot attribute set, the default colouring can be modified
public static SetHotSpotActiveColor ( bool use, Color fg, Color bg ) : void
use bool
fg Color
bg Color
return void

SetIndentGuideColor() public static method

sets the fore/background color of the IndentGuide, overriding the lexer's
public static SetIndentGuideColor ( Color bg, Color fg ) : void
bg Color
fg Color
return void

SetSel() public static method

Sets the current carret position + the current anchor position to the same position
public static SetSel ( int pos ) : void
pos int
return void

SetSel() public static method

Sets the anchor and current position.
A negative value for currentPos signifies the end of the document. A negative value for anchorPos signifies no selection (set the anchorPos to the same as the currentPos). The current position is scrolled into view following this operation.
public static SetSel ( int anchorPos, int currentPos ) : void
anchorPos int The zero-based document position to start the selection.
currentPos int The zero-based document position to end the selection.
return void

SetSelection() public static method

Set a single selection from anchor to caret as the ONLY selection.
public static SetSelection ( int caret ) : void
caret int The zero-based document position to end the selection.
return void

SetSelection() public static method

Set a single selection from anchor to caret as the ONLY selection.
public static SetSelection ( int caret, int anchor ) : void
caret int The zero-based document position to end the selection.
anchor int The zero-based document position to start the selection.
return void

SetSelectionColor() public static method

Sets a global override to the selection background + foreground color.
public static SetSelectionColor ( bool use, Color bg, Color fg ) : void
use bool
bg Color
fg Color
return void

SetStatusbarLabel() public static method

Sets the label in the status of npp (bottom right)
WARNING : THIS METHOD IS HIGHLY UNSTABLE, USE ONLY FOR DEBUG!
public static SetStatusbarLabel ( string labelText ) : string
labelText string
return string

SetStyling() public static method

Styles the specified length of characters.
The styling position is advanced by length after each call allowing multiple calls to SetStyling for a single call to StartStyling.
/// or is less than zero. -or- /// The sum of a preceeding call to StartStyling or and is greater /// than the document length. -or- /// is greater than or equal to the number of style definitions. ///
public static SetStyling ( int length, int style ) : void
length int The number of characters to style.
style int The Style definition index to assign each character.
return void

SetTargetRange() public static method

Sets the TargetStart and TargetEnd properties in a single call.
public static SetTargetRange ( int start, int end ) : void
start int The zero-based character position within the document to start a search or replace operation.
end int The zero-based character position within the document to end a search or replace operation.
return void

SetTextByRange() public static method

Sets the text of a specific range, can and must be used to delete text from range
public static SetTextByRange ( int start, int end, string text ) : void
start int
end int
text string
return void

SetToolbarImage() public static method

Helper to add a clickable icon in the toolbar
public static SetToolbarImage ( Bitmap image, int pluginId ) : void
image System.Drawing.Bitmap
pluginId int
return void

SetWhiteSpaceColor() public static method

sets the fore/background color of the whitespaces, overriding the lexer's
public static SetWhiteSpaceColor ( bool use, Color bg, Color fg ) : void
use bool
bg Color
fg Color
return void

ShowInactiveTopmost() public static method

public static ShowInactiveTopmost ( Form frm ) : void
frm System.Windows.Forms.Form
return void

ShowLines() public static method

Shows the range of lines specified.
public static ShowLines ( int lineStart, int lineEnd ) : void
lineStart int The zero-based index of the line range to start showing.
lineEnd int The zero-based index of the line range to end showing.
return void

StartBytePosOfLine() public static method

Returns the !! BYTE !! position of the start of given line Don't use THIS unless you know what you are doing with it!!!
public static StartBytePosOfLine ( int line ) : int
line int
return int

StartRecordMacro() public static method

public static StartRecordMacro ( ) : IntPtr
return System.IntPtr

StartStyling() public static method

Prepares for styling by setting the styling position to start at.
After preparing the document for styling, use successive calls to SetStyling to style the document.
public static StartStyling ( int position ) : void
position int The zero-based character position in the document to start styling.
return void

StyleClearAll() public static method

Resets all style properties to those currently configured for the Style.Default style.
public static StyleClearAll ( ) : void
return void

StyleResetDefault() public static method

Resets the Style.Default style to its initial state.
public static StyleResetDefault ( ) : void
return void

StyleTextEx() public static method

TODO: UNTESTED set the style of a text from startPos to startPos + styleArray.Length, the styleArray is a array of bytes, each byte is the style number to the corresponding text byte
public static StyleTextEx ( int startPos, byte styleArray ) : void
startPos int
styleArray byte
return void

SwapMainAnchorCaret() public static method

Moves the caret to the opposite end of the main selection.
public static SwapMainAnchorCaret ( ) : void
return void

SwitchToDocument() public static method

Switch to given document
public static SwitchToDocument ( string doc ) : void
doc string
return void

TargetFromSelection() public static method

Sets the TargetStart and TargetEnd to the start and end positions of the selection.
public static TargetFromSelection ( ) : void
return void

TargetWholeDocument() public static method

Sets the TargetStart and TargetEnd to the start and end positions of the document.
public static TargetWholeDocument ( ) : void
return void

TextHeight() public static method

Retrieve the height of a particular line of text in pixels.
public static TextHeight ( int line ) : int
line int
return int

TextWidth() public static method

Measures the width in pixels of the specified string when rendered in the specified style.
public static TextWidth ( int style, string text ) : int
style int The index of the Style to use when rendering the text to measure.
text string The text to measure.
return int

Undo() public static method

Undo previous action
public static Undo ( ) : void
return void

UpdateLinesInfo() public static method

Call this on SCN_MODIFIED event from scintilla to update the info on lines
public static UpdateLinesInfo ( SCNotification scn, bool isInsertion ) : void
scn _3PA.Interop.SCNotification
isInsertion bool
return void

UpdateScintilla() public static method

Updates the current scintilla handle for Npp's functions Called when the user changes the current document
public static UpdateScintilla ( bool reverse = false ) : void
reverse bool
return void

ZoomIn() public static method

Increases the zoom factor by 1 until it reaches 20 points.
public static ZoomIn ( ) : void
return void

ZoomOut() public static method

Decreases the zoom factor by 1 until it reaches -10 points.
public static ZoomOut ( ) : void
return void