C# Class _3PA.Npp

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

Private Properties

Свойство Type Description

Méthodes publiques

Méthode 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 méthode

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.
Résultat void

AnnotationClearAll() public static méthode

Clear all annotations in one go
public static AnnotationClearAll ( ) : void
Résultat void

AutoCCancel() public static méthode

Cancels any displayed autocompletion list.
public static AutoCCancel ( ) : void
Résultat void

AutoCStops() public static méthode

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.
Résultat void

BeginUndoAction() public static méthode

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

BitmapToArgb() public static méthode

public static BitmapToArgb ( Bitmap image ) : byte[]
image System.Drawing.Bitmap
Résultat byte[]

BraceBadLight() public static méthode

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. ///
Résultat void

BraceHighlight() public static méthode

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.
Résultat void

BraceMatch() public static méthode

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. ///
Résultat int

ByteToCharStyles() public static méthode

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

CharPositionFromPointClose() public static méthode

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.
Résultat int

CharToByteStyles() public static méthode

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

Clamp() public static méthode

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
Résultat int

ClampMin() public static méthode

Forces a value to a minimum
public static ClampMin ( int value, int min ) : int
value int
min int
Résultat int

Clear() public static méthode

Removes the selected text from the document.
public static Clear ( ) : void
Résultat void

ClearAll() public static méthode

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

ClearDocumentStyle() public static méthode

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

ClearSelections() public static méthode

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

Colorize() public static méthode

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).
Résultat void

ConvertEols() public static méthode

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.
Résultat void

Copy() public static méthode

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

CopyAllowLine() public static méthode

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
Résultat void

CopyRange() public static méthode

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.
Résultat void

Cut() public static méthode

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

DeleteTextByRange() public static méthode

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

DocLineFromVisible() public static méthode

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.
Résultat int

DropSelection() public static méthode

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

EndUndoAction() public static méthode

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

ExecuteCmd() public static méthode

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

Exit() public static méthode

Leaves npp
public static Exit ( ) : void
Résultat void

FoldAll() public static méthode

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.
Résultat void

GetAblWordAtPosition() public static méthode

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

GetBytes() public static méthode

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
Résultat byte[]

GetBytes() public static méthode

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
Résultat byte[]

GetCaretScreenLocation() public static méthode

Gets the current screen location of the caret.
public static GetCaretScreenLocation ( ) : Point
Résultat Point

GetColumn() public static méthode

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.
Résultat int

GetConfigDir() public static méthode

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

GetCurrentFileExtension() public static méthode

returns the current file's extension
public static GetCurrentFileExtension ( ) : string
Résultat string

GetCurrentFileFolder() public static méthode

Returns the current file folder (uses GetDirectoryName)
public static GetCurrentFileFolder ( ) : string
Résultat string

GetCurrentFileName() public static méthode

Returns the current file base name (uses GetFileName)
public static GetCurrentFileName ( ) : string
Résultat string

GetCurrentFilePath() public static méthode

Gets the path of the current document.
public static GetCurrentFilePath ( ) : string
Résultat string

GetEndStyled() public static méthode

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

GetFirstWordRightAfterPoint() public static méthode

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
Résultat string

GetFocus() public static méthode

to be tested!!!!
public static GetFocus ( ) : bool
Résultat bool

GetIndentString() public static méthode

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

GetIndicator() public static méthode

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
Résultat Indicator

GetKeyword() public static méthode

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

GetLine() public static méthode

Returns a Line object representing the current line
public static GetLine ( ) : Line
Résultat Line

GetLine() public static méthode

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

GetMargin() public static méthode

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
Résultat Margin

GetMarker() public static méthode

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
Résultat Marker

GetNppDirectory() public static méthode

returns npp's folder path
public static GetNppDirectory ( ) : string
Résultat string

GetOpenedFiles() public static méthode

Gets the file path of each file currently opened
public static GetOpenedFiles ( ) : List
Résultat List

GetOpenedFilesPrimary() public static méthode

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

GetOpenedFilesSecondary() public static méthode

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

GetPointXyFromPosition() public static méthode

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

GetPosFromLineColumn() public static méthode

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
Résultat int

GetPositionFromMouseLocation() public static méthode

Self explaining
public static GetPositionFromMouseLocation ( ) : int
Résultat int

GetScintillaRectangle() public static méthode

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

GetSelection() public static méthode

Returns a selection object
public static GetSelection ( int index ) : Selection
index int
Résultat Selection

GetSessionFiles() public static méthode

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
Résultat string

GetString() public static méthode

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

GetStyle() public static méthode

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
Résultat _3PA.MainFeatures.Style

GetStyleAt() public static méthode

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.
Résultat int

GetTag() public static méthode

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.
Résultat string

GetTextBetween() public static méthode

public static GetTextBetween ( Point point ) : string
point Point
Résultat string

GetTextByRange() public static méthode

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.
Résultat string

GetTextOnLeftOfPos() public static méthode

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
Résultat string

GetTextOnRightOfPos() public static méthode

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
Résultat string

GetTextRange() public static méthode

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.
Résultat string

GoBackFromDefinition() public static méthode

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
Résultat void

GoToLine() public static méthode

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

Goto() public static méthode

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
Résultat void

Goto() public static méthode

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
Résultat void

GotoPos() public static méthode

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

GotoPosition() public static méthode

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.
Résultat void

GrabFocus() public static méthode

allows scintilla to grab focus
public static GrabFocus ( ) : void
Résultat void

HideLines() public static méthode

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.
Résultat void

InsertText() public static méthode

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.
Résultat void

IsCurrentFileHasExtension() public static méthode

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.
Résultat bool

LineFromPosition() public static méthode

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

LineScroll() public static méthode

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.
Résultat void

LoadCurrentSession() public static méthode

public static LoadCurrentSession ( string file ) : void
file string
Résultat void

ModifyTextAroundCaret() public static méthode

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
Résultat void

NewDocument() public static méthode

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

OpenFile() public static méthode

Opens given file in notepad++
public static OpenFile ( string file ) : bool
file string
Résultat bool

Paste() public static méthode

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

PointXFromPosition() public static méthode

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.
Résultat int

PointYFromPosition() public static méthode

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.
Résultat int

RebuildLinesInfo() public static méthode

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

ReplaceKeywordWrapped() public static méthode

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
Résultat void

ReplaceSelection() public static méthode

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.
Résultat void

ReplaceTarget() public static méthode

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.
Résultat int

ReplaceTargetRe() public static méthode

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. ///
Résultat int

RotateSelection() public static méthode

Makes the next selection the main selection.
public static RotateSelection ( ) : void
Résultat void

RunCommand() public static méthode

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

SaveCurrentDocument() public static méthode

Saves the current document.
public static SaveCurrentDocument ( ) : void
Résultat void

SaveCurrentSession() public static méthode

public static SaveCurrentSession ( string file ) : void
file string
Résultat void

SaveSession() public static méthode

Saves the session into a file
public static SaveSession ( string sessionFilePath ) : bool
sessionFilePath string
Résultat bool

ScrollCaret() public static méthode

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

ScrollRange() public static méthode

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. ///
Résultat void

SearchInTarget() public static méthode

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. ///
Résultat int

SelectAll() public static méthode

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

SetAdditionalSelectionColor() public static méthode

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
Résultat void

SetCommand() public static méthode

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
Résultat void

SetEmptySelection() public static méthode

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.
Résultat void

SetFoldMarginColors() public static méthode

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
Résultat void

SetFoldMarginMarkersColor() public static méthode

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
Résultat void

SetHotSpotActiveColor() public static méthode

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
Résultat void

SetIndentGuideColor() public static méthode

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

SetSel() public static méthode

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

SetSel() public static méthode

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.
Résultat void

SetSelection() public static méthode

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.
Résultat void

SetSelection() public static méthode

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.
Résultat void

SetSelectionColor() public static méthode

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
Résultat void

SetStatusbarLabel() public static méthode

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
Résultat string

SetStyling() public static méthode

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.
Résultat void

SetTargetRange() public static méthode

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.
Résultat void

SetTextByRange() public static méthode

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
Résultat void

SetToolbarImage() public static méthode

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

SetWhiteSpaceColor() public static méthode

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
Résultat void

ShowInactiveTopmost() public static méthode

public static ShowInactiveTopmost ( Form frm ) : void
frm System.Windows.Forms.Form
Résultat void

ShowLines() public static méthode

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.
Résultat void

StartBytePosOfLine() public static méthode

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
Résultat int

StartRecordMacro() public static méthode

public static StartRecordMacro ( ) : IntPtr
Résultat System.IntPtr

StartStyling() public static méthode

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.
Résultat void

StyleClearAll() public static méthode

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

StyleResetDefault() public static méthode

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

StyleTextEx() public static méthode

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
Résultat void

SwapMainAnchorCaret() public static méthode

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

SwitchToDocument() public static méthode

Switch to given document
public static SwitchToDocument ( string doc ) : void
doc string
Résultat void

TargetFromSelection() public static méthode

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

TargetWholeDocument() public static méthode

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

TextHeight() public static méthode

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

TextWidth() public static méthode

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.
Résultat int

Undo() public static méthode

Undo previous action
public static Undo ( ) : void
Résultat void

UpdateLinesInfo() public static méthode

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
Résultat void

UpdateScintilla() public static méthode

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
Résultat void

ZoomIn() public static méthode

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

ZoomOut() public static méthode

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