NAME
Win32::Mechanize::NotepadPlusPlus::Editor - The editor object for Notepad++ automation
SYNOPSIS
use Win32::Mechanize::NotepadPlusPlus qw/:main/;
my $editor = editor();
DESCRIPTION
The editor object for Notepad++ automation using Win32::Mechanize::NotepadPlusPlus: this object will interface with Notepad++'s Scintilla component instances.
Please note that because this module is driving Notepad++'s Scintilla components externally, rather than internally through a plugin or inside the actual Notepad++ source code, some messages will take longer than you might expect before they are fully complete; you may find that a "setText" requires 10ms or more to complete, depending on how long the text is, so don't be surprised if you have to add in delays to get your script to reliably execute.
Also note that Notepad++ itself is sending messages to the Scintilla components, so there may be changes in state that are not related to the running Perl code; there may be times when Notepad++ changes things unexpectedly in the middle of the Perl execution (especially for things like the Target-oriented methods like "getTargetText").
Version Requirements
The module was developed with Notepad++ v7.7 or newer in mind, though some features should still work on older versions of Notepad++. As Notepad++ adds new features, the minimum version for that method will be indicated in the help.
OBJECT CREATION
The Editor objects are created as appropriate, both with the original
use Win32::Mechanize::NotepadPlusPlus;
or, as needed when the Notepad object creates a hidden Scintilla using
my $hidden = notepad()->createScintilla;
Warning: some users of Notepad++'s createScintilla
interface in scripting plugins using the same message-based interface as Win32::Mechanize::NotepadPlusPlus have found that they cannot create more than one extra Scintilla instance from inside their scripts without causing instability in Notepad++. The same might be true using this Perl interface as well, so it is recommended that you reuse the same hidden instance throughout your script, rather than trying to create multiple hidden instances, if at all possible.
Window Handle
- hwnd
-
editor->hwnd(); my $sci_hWnd = editor1->hwnd();
Grabs the window handle of the Scintilla editor.
This is used for sending Windows messages; if you are enhancing the Editor object's functionality (implementing some new Scintilla message that hasn't made its way into this module, for example), you will likely need access to this handle.
SCINTILLA EDITOR API
These are the object-oriented methods for manipulating the Scintilla editor objects inside the Notepad++ application, usually using the editor()
instance for the active editor or editor1()
and editor2()
for direct control of the two default editors available to Notepad++, and also any $hidden Scintilla instances.
Text retrieval and modification
- setText
-
editor->setText($text);
Replace the contents of the document with the argument text.
See Scintilla documentation for SCI_SETTEXT
- getText
-
editor->getText();
Retrieve all the text in the document.
See Scintilla documentation for SCI_GETTEXT
- setSavePoint
-
editor->setSavePoint();
Remember the current position in the undo history as the position at which the document was saved.
See Scintilla documentation for SCI_SETSAVEPOINT
- getLine
-
editor->getLine($line);
Retrieve the contents of a line.
See Scintilla documentation for SCI_GETLINE
- replaceSel
-
editor->replaceSel($text);
Replace the selected text with the argument text.
See Scintilla documentation for SCI_REPLACESEL
- setReadOnly
- getReadOnly
-
editor->setReadOnly($readOnly); editor->getReadOnly();
Set read only or read/write mode.
See Scintilla documentation for SCI_SETREADONLY
See Scintilla documentation for SCI_GETREADONLY
- getTextRange
-
editor->getTextRange($start, $end);
Retrieve a range of text.
See Scintilla documentation for SCI_GETTEXTRANGE
See Scintilla documentation for SCI_GETTEXTRANGEFULL
(The underlying Scintilla library differentiates between SCI_GETTEXTRANGE and SCI_GETTEXTRANGEFULL, but because of the way that Notepad++ defines its header files, I believe the two are equivalent in Notepad++'s instance of Scintilla. If you can show a way that sending SCI_GETTEXTRANGEFULL behaves differently than SCI_GETTEXTRANGE, please open an issue with that example.)
- allocate
-
editor->allocate($bytes);
Enlarge the document to a particular size of text bytes.
See Scintilla documentation for SCI_ALLOCATE
- allocateLines
-
editor->allocate($lines);
Allocate line indices to match the
$lines
argument. This is an optimization that can prevent multiple reallocations of the indices as text is inserted if the application can estimate the number of lines in the document. The number of lines will not be reduced by this call.See Scintilla documentation for SCI_ALLOCATELINES
- addText
-
editor->addText($text);
Add text to the document at current position.
See Scintilla documentation for SCI_ADDTEXT
- addStyledText
-
editor->addStyledText($text, $style); editor->addStyledText($text, \@style_array);
Add text with associated style indices.
The first form applies one style index
$style
to all the characters in$text
:editor->addStyledText("Hello World", 3); # applies style-number-3 to all the characters in the string
The second form requires an array-reference
\@style_array
(or[list of styles]
), with one style index per character in$text
:@style_array = (1,2,3) editor->addStyledText("One", \@style_array ); # applies style 1 to "O", 2 to "n", and 3 to "e" editor->addStyledText("Two", [9,8,7] ); # applies style 9 to "T", 8 to "w", and 7 to "o"
If there is a size mismatch, it will die:
editor->addStyledText("LongWord", [1,2]); # will die, because there are not enough elements in the anonymous array
See Scintilla documentation for SCI_ADDSTYLEDTEXT
- appendText
-
editor->appendText($text);
Append a string to the end of the document without changing the selection.
See Scintilla documentation for SCI_APPENDTEXT
- insertText
-
editor->insertText($pos, $text);
Insert string at a position.
See Scintilla documentation for SCI_INSERTTEXT
- changeInsertion
-
editor->changeInsertion($length, $text);
Change the text that is being inserted in response to SC_MOD_INSERTCHECK.
(This is only meaningful in a notification handler for the SC_MOD_INSERTCHECK notification, and will not be implemented in this module until notifications and callbacks are implemented.)
See Scintilla documentation for SCI_CHANGEINSERTION
- clearAll
-
editor->clearAll();
Delete all text in the document.
See Scintilla documentation for SCI_CLEARALL
- deleteRange
-
editor->deleteRange($pos, $deleteLength);
Delete a range of text in the document.
See Scintilla documentation for SCI_DELETERANGE
- clearDocumentStyle
-
editor->clearDocumentStyle();
Set all style bytes to 0, remove all folding information.
See Scintilla documentation for SCI_CLEARDOCUMENTSTYLE
- getCharAt
-
editor->getCharAt($pos);
Returns the character byte at the position.
See Scintilla documentation for SCI_GETCHARAT
- getStyleAt
- getStyleIndexAt
-
editor->getStyleAt($pos); editor->getStyleIndexAt($pos);
his returns the style at
$pos
in the document, or 0 if <$pos> is negative or past the end of the document.getStyleAt
may return a negative number for styles over 127 whereasgetStyleIndexAt
will only return positive numbers.getStyleIndexAt
should be preferred as it handles styles more consistently and may avoid problems with lexers that define more than 128 styles.See Scintilla documentation for SCI_GETSTYLEAT
See Scintilla documentation for SCI_GETSTYLEINDEXAT
getStyleIndexAt
command requires at least Scintilla v5.2, found in Notepad++ v8.4 and newer. - getStyledText
-
editor->getStyledText($start, $end);
Retrieve a buffer of cells. Returns the number of bytes in the buffer not including terminating NULs.
See Scintilla documentation for SCI_GETSTYLEDTEXT
See Scintilla documentation for SCI_GETSTYLEDTEXTFULL
(The underlying Scintilla library differentiates between SCI_GETSTYLEDTEXT and SCI_GETSTYLEDTEXTFULL, but because of the way that Notepad++ defines its header files, I believe the two are equivalent in Notepad++'s instance of Scintilla. If you can show a way that sending SCI_GETSTYLEDTEXTFULL behaves differently than SCI_GETSTYLEDTEXT, please open an issue with that example.)
- releaseAllExtendedStyles
-
editor->releaseAllExtendedStyles();
Release all extended (>255) style numbers
See Scintilla documentation for SCI_RELEASEALLEXTENDEDSTYLES
- allocateExtendedStyles
-
editor->allocateExtendedStyles($numberStyles);
Allocate some extended (>255) style numbers and return the start of the range
See Scintilla documentation for SCI_ALLOCATEEXTENDEDSTYLES
- targetAsUTF8
-
editor->targetAsUTF8();
Returns the target converted to UTF8. Return the length in bytes.
See Scintilla documentation for SCI_TARGETASUTF8
- encodedFromUTF8
-
editor->encodedFromUTF8();
Translates a UTF8 string into the document encoding. Return the length of the result in bytes. On error return 0.
See Scintilla documentation for SCI_ENCODEDFROMUTF8
- setLengthForEncode
-
editor->setLengthForEncode($bytes);
Set the length of the utf8 argument for calling EncodedFromUTF8. Set to -1 and the string will be measured to the first nul.
See Scintilla documentation for SCI_SETLENGTHFORENCODE
Searching
- setTargetStart
- getTargetStart
- setTargetStartVirtualSpace
- getTargetStartVirtualSpace
-
editor->setTargetStart($pos); editor->getTargetStart(); editor->setTargetStartVirtualSpace($pos); editor->getTargetStartVirtualSpace();
Set the position that starts the target which is used for updating the document without affecting the scroll position.
Use the
...VirtualSpace
variants for targets beyond the end of the line (in virtual space).See Scintilla documentation for SCI_SETTARGETSTART
See Scintilla documentation for SCI_GETTARGETSTART
See Scintilla documentation for SCI_SETTARGETSTARTVIRTUALSPACE
See Scintilla documentation for SCI_GETTARGETSTARTVIRTUALSPACE
- setTargetEnd
- getTargetEnd
- setTargetEndVirtualSpace
- getTargetEndVirtualSpace
-
editor->setTargetEnd($pos); editor->getTargetEnd(); editor->setTargetEndVirtualSpace($pos); editor->getTargetEndVirtualSpace();
Set the position that ends the target which is used for updating the document without affecting the scroll position.
Use the
...VirtualSpace
versions to access a target beyond the end of the line (in virtual space).See Scintilla documentation for SCI_SETTARGETEND
See Scintilla documentation for SCI_GETTARGETEND
See Scintilla documentation for SCI_SETTARGETENDVIRTUALSPACE
See Scintilla documentation for SCI_GETTARGETENDVIRTUALSPACE
- setTargetRange
-
editor->setTargetRange($start, $end);
Sets both the start and end of the target in one call.
See Scintilla documentation for SCI_SETTARGETRANGE
- targetFromSelection
-
editor->targetFromSelection();
Make the target range start and end be the same as the selection range start and end.
See Scintilla documentation for SCI_TARGETFROMSELECTION
- targetWholeDocument
-
editor->targetWholeDocument();
Sets the target to the whole document.
See Scintilla documentation for SCI_TARGETWHOLEDOCUMENT
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
- setSearchFlags
- getSearchFlags
-
editor->setSearchFlags($searchFlags); editor->getSearchFlags();
Set the search flags used by searchInTarget.
The c<$searchFlags> should be a combination of the elements from %SC_FIND
See Scintilla documentation for SCI_SETSEARCHFLAGS
See Scintilla documentation for SCI_GETSEARCHFLAGS
See Scintilla documentation for searchFlags
- searchInTarget
-
editor->searchInTarget($textRE);
Search for a counted string in the target and set the target to the found range. Text is counted so it can contain NULs. Returns length of range or -1 for failure in which case target is not moved.
$textRE
is a Boost regular expression in a string, not a perlqr//
regular expression.See Scintilla documentation for SCI_SEARCHINTARGET
- getTargetText
-
editor->getTargetText();
Retrieve the text in the target.
See Scintilla documentation for SCI_GETTARGETTEXT
- replaceTarget
-
editor->replaceTarget($text);
Replace the target text with the argument text. Text is counted so it can contain NULs. Returns the length of the replacement text.
See Scintilla documentation for SCI_REPLACETARGET
- replaceTargetMinimal
-
editor->replaceTargetMinimal($text);
This is similar to
replaceTarget
but tries to minimize change history when the current target text shares a common prefix or suffix with the replacement. Only the text that is actually different is marked as changed. This might be used when automatically reformatting some text so that the whole area formatted doesn't show change marks. If length is -1, text is a zero terminated string, otherwise length sets the number of character to replace the target with. After replacement, the target range refers to the replacement text. The return value is the length of the replacement string.Note that the recommended way to delete text in the document is to set the target to the text to be removed, and to perform a replace target with an empty string.
See Scintilla documentation for SCI_REPLACETARGETMINIMAL
- replaceTargetRE
-
editor->replaceTargetRE($textRE);
Replace the target text with the argument text after \d processing. Text is counted so it can contain NULs. Looks for \d where d is between 1 and 9 and replaces these with the strings matched in the last search operation which were surrounded by \( and \). Returns the length of the replacement text including any change caused by processing the \d patterns.
Please note: the
$textRE
is a string containing a Boost regular expression replacement string, not a perl regular expressionqr//
. To avoid perl interpolating the\0
and similar in the string, make sure you use perl's single-quote''
orq{}
notation (or properly escape the backslashes in the string.)editor->setText("Hello World"); select undef,undef,undef, 0.01; # after setText, you sometimes need a delay of 10ms or more to ensure the text is there before continuing editor->setTargetRange(0,5); editor->setSearchFlags($SC_FIND{SCFIND_REGEXP}); editor->searchInTarget('([aeiou])'); editor->replaceTargetRE('_\\1_'); print editor->getTargetText(); # "H_e_llo World"
See Scintilla documentation for SCI_REPLACETARGETRE
- getTag
-
editor->getTag($tagNumber);
Retrieve the value of a tag from a regular expression search.
See Scintilla documentation for SCI_GETTAG
- findText
-
editor->findText($searchFlags, $start, $end, $textToFind);
Find some text in the document. (*)
Returns the position of the match, or
undef
if the text is not found.The
$searchFlags
should be a combination of the elements from %SC_FIND$textToFind
is a literal string or a Boost regular expression in a string, not a perlqr//
regular expression.See Scintilla documentation for SCI_FINDTEXT and SCI_FINDTEXTFULL
See Scintilla documentation for searchFlags
*: For 64-bit builds of Win32, Scintilla provides separate messages for finding text in a <2GB file and a "full" version for finding text in a >2GB file. However, even before Scintilla offered that, Notepad++ redefined its headers so that the 64-bit builds of Notepad++ always define the "normal" SCI_FINDTEXT so that it uses 64-bit integers for its positions, so findText should be sufficient. If it's not, please open an issue and provide a test case showing that you can grab specific text with a direct call to SCI_FINDTEXTFULL that you cannot find with this implementation of findText() and Notepad++ v8.2.2 or later.
- searchAnchor
-
editor->searchAnchor();
Sets the current caret position to be the search anchor.
See Scintilla documentation for SCI_SEARCHANCHOR
- searchNext
-
editor->searchNext($flags, $text);
Find some text starting at the search anchor. Does not ensure the selection is visible.
See Scintilla documentation for SCI_SEARCHNEXT
- searchPrev
-
editor->searchPrev($flags, $text);
Find some text starting at the search anchor and moving backwards. Does not ensure the selection is visible.
See Scintilla documentation for SCI_SEARCHPREV
Overtype
- setOvertype
- getOvertype
-
editor->setOvertype($overtype); editor->getOvertype();
Set to overtype (true) or insert mode.
See Scintilla documentation for SCI_SETOVERTYPE
See Scintilla documentation for SCI_GETOVERTYPE
Cut, Copy, and Paste
- cut
-
editor->cut();
Cut the selection to the clipboard.
See Scintilla documentation for SCI_CUT
- copy
-
editor->copy();
Copy the selection to the clipboard.
See Scintilla documentation for SCI_COPY
- paste
-
editor->paste();
Paste the contents of the clipboard into the document replacing the selection.
See Scintilla documentation for SCI_PASTE
- clear
-
editor->clear();
Clear the selection.
See Scintilla documentation for SCI_CLEAR
- canPaste
-
editor->canPaste();
Will a paste succeed?
See Scintilla documentation for SCI_CANPASTE
- copyRange
-
editor->copyRange($start, $end);
Copy a range of text to the clipboard. Positions are clipped into the document.
See Scintilla documentation for SCI_COPYRANGE
- copyText
-
editor->copyText($text);
Copy argument text to the clipboard.
See Scintilla documentation for SCI_COPYTEXT
- copyAllowLine
-
editor->copyAllowLine();
Copy the selection, if selection empty copy the line with the caret
See Scintilla documentation for SCI_COPYALLOWLINE
- setPasteConvertEndings
- getPasteConvertEndings
-
editor->setPasteConvertEndings($convert); editor->getPasteConvertEndings();
Enable/Disable convert-on-paste for line endings
See Scintilla documentation for SCI_SETPASTECONVERTENDINGS
See Scintilla documentation for SCI_GETPASTECONVERTENDINGS
- replaceRectangular
-
editor->replaceRectangular($text);
Replaces the selected text or empty selection with the given
$text
. The insertion is performed similarly to rectangular pastes: new lines in the given text are interpreted as moving to the next line without inserting new lines unless at the end of the document.See Scintilla documentation for SCI_REPLACERECTANGULAR
These commands require at least Scintilla v5.2, found in Notepad++ v8.4 and newer.
Error handling
- setStatus
- getStatus
-
editor->setStatus($statusCode); editor->getStatus();
Change error status. Failures from 1 to 999 are errors, and 1000 and above are warnings. There are predefined errors in %SC_STATUS.
See Scintilla documentation for SCI_SETSTATUS
See Scintilla documentation for SCI_GETSTATUS
Undo and redo
- undo
-
editor->undo();
Undo one action in the undo history.
See Scintilla documentation for SCI_UNDO
- canUndo
-
editor->canUndo();
Are there any undoable actions in the undo history?
See Scintilla documentation for SCI_CANUNDO
- emptyUndoBuffer
-
editor->emptyUndoBuffer();
Delete the undo history.
See Scintilla documentation for SCI_EMPTYUNDOBUFFER
- canRedo
-
editor->canRedo();
Are there any redoable actions in the undo history?
See Scintilla documentation for SCI_CANREDO
- redo
-
editor->redo();
Redoes the next action on the undo history.
See Scintilla documentation for SCI_REDO
- setUndoCollection
- getUndoCollection
-
editor->setUndoCollection($collectUndo); editor->getUndoCollection();
Choose between collecting actions into the undo history and discarding them.
See Scintilla documentation for SCI_SETUNDOCOLLECTION
See Scintilla documentation for SCI_GETUNDOCOLLECTION
- beginUndoAction
-
editor->beginUndoAction();
Start a sequence of actions that is undone and redone as a unit. May be nested.
See Scintilla documentation for SCI_BEGINUNDOACTION
- endUndoAction
-
editor->endUndoAction();
End a sequence of actions that is undone and redone as a unit.
See Scintilla documentation for SCI_ENDUNDOACTION
- addUndoAction
-
editor->addUndoAction($token, $flags);
Add a container action to the undo stack.
Use $flags from %SC_UNDO.
See Scintilla documentation for SCI_ADDUNDOACTION
Change History
Notepad++ can display document changes (modified, saved, ...) in the margin or in the text.
The main states are original text that has not been modified, modified, and modified then saved. As it is possible to undo to before the save point, there are additional states for reverted from save and reverted back to original from save. The reverted states are different to the saved document on disk so some applications may want to display these states just like the main modified state.
This feature uses a moderate amount of memory proportional to the amount of modifications made. On huge documents, this could be significant so could be disabled when it would cause excessive memory use.
By default, Notepad++ follows the Settings > Preferences > Margins/Border/Edge Display Change History
checkbox, but these commands can override Notepad++'s default behavior.
- setChangeHistory
- getChangeHistory
-
editor->setChangeHistory($changeHistory); $changeHistory = editor->getChangeHistory();
setChangeHistory()
turns the Change History feature on and off and determines whether changes are visible in the margin or text or both.getChangeHistory()
gets the current state. The possible$changeHistory
values can be found in the %SC_CHANGE_HISTORY enumeration; those values can be combined (so you could enable it with just markers, with just indicators, or with both).These commands require at least Scintilla v5.2, found in Notepad++ v8.4 and newer.
Selection and information
- getTextLength
-
editor->getTextLength();
Retrieve the number of characters in the document.
See Scintilla documentation for SCI_GETTEXTLENGTH
- getLength
-
editor->getLength();
Returns the number of bytes in the document.
See Scintilla documentation for SCI_GETLENGTH
- getLineCount
-
editor->getLineCount();
Returns the number of lines in the document. There is always at least one.
See Scintilla documentation for SCI_GETLINECOUNT
- linesOnScreen
-
editor->linesOnScreen();
Retrieves the number of lines completely visible.
See Scintilla documentation for SCI_LINESONSCREEN
- getModify
-
editor->getModify();
Is the document different from when it was last saved?
See Scintilla documentation for SCI_GETMODIFY
- setSel
-
editor->setSel($start, $end);
Select a range of text.
See Scintilla documentation for SCI_SETSEL
- gotoPos
-
editor->gotoPos($pos);
Set caret to a position and ensure it is visible.
See Scintilla documentation for SCI_GOTOPOS
- gotoLine
-
editor->gotoLine($line);
Set caret to start of a line and ensure it is visible.
See Scintilla documentation for SCI_GOTOLINE
- setCurrentPos
- getCurrentPos
-
editor->setCurrentPos($pos); editor->getCurrentPos();
Sets the position of the caret.
See Scintilla documentation for SCI_SETCURRENTPOS
See Scintilla documentation for SCI_GETCURRENTPOS
- setAnchor
- getAnchor
-
editor->setAnchor($posAnchor); editor->getAnchor();
Set the selection anchor to a position. The anchor is the opposite end of the selection from the caret.
See Scintilla documentation for SCI_SETANCHOR
See Scintilla documentation for SCI_GETANCHOR
- setSelectionStart
- getSelectionStart
-
editor->setSelectionStart($pos); editor->getSelectionStart();
Sets or gets the position that starts the selection - this becomes the anchor.
See Scintilla documentation for SCI_SETSELECTIONSTART
See Scintilla documentation for SCI_GETSELECTIONSTART
- setSelectionEnd
- getSelectionEnd
-
editor->setSelectionEnd($pos); editor->getSelectionEnd(); Sets the position that ends the selection - this becomes the currentPosition.
See Scintilla documentation for SCI_SETSELECTIONEND
See Scintilla documentation for SCI_GETSELECTIONEND
- setEmptySelection
-
editor->setEmptySelection($pos);
Set caret to a position, while removing any existing selection.
See Scintilla documentation for SCI_SETEMPTYSELECTION
- selectAll
-
editor->selectAll();
Select all the text in the document.
See Scintilla documentation for SCI_SELECTALL
- lineFromPosition
-
editor->lineFromPosition($pos);
Retrieve the line containing a position.
See Scintilla documentation for SCI_LINEFROMPOSITION
- positionFromLine
-
editor->positionFromLine($line);
Retrieve the position at the start of a line.
See Scintilla documentation for SCI_POSITIONFROMLINE
- getLineEndPosition
-
editor->getLineEndPosition($line);
Get the position after the last visible characters on a line.
See Scintilla documentation for SCI_GETLINEENDPOSITION
- lineLength
-
editor->lineLength($line);
How many characters are on a line, including end of line characters?
See Scintilla documentation for SCI_LINELENGTH
- getColumn
-
editor->getColumn($pos);
Retrieve the column number of a position, taking tab width into account.
See Scintilla documentation for SCI_GETCOLUMN
- findColumn
-
editor->findColumn($line, $column);
Find the position of a column on a line taking into account tabs and multi-byte characters. If beyond end of line, return line end position.
See Scintilla documentation for SCI_FINDCOLUMN
- positionFromPoint
-
editor->positionFromPoint($x, $y);
Find the position from a point within the window.
See Scintilla documentation for SCI_POSITIONFROMPOINT
- positionFromPointClose
-
editor->positionFromPointClose($x, $y);
Find the position from a point within the window but return INVALID_POSITION if not close to text.
See Scintilla documentation for SCI_POSITIONFROMPOINTCLOSE
- charPositionFromPoint
-
editor->charPositionFromPoint($x, $y);
Find the position of a character from a point within the window.
See Scintilla documentation for SCI_CHARPOSITIONFROMPOINT
- charPositionFromPointClose
-
editor->charPositionFromPointClose($x, $y);
Find the position of a character from a point within the window. Return INVALID_POSITION if not close to text.
See Scintilla documentation for SCI_CHARPOSITIONFROMPOINTCLOSE
- pointXFromPosition
-
editor->pointXFromPosition($pos);
Retrieve the x value of the point in the window where a position is displayed.
See Scintilla documentation for SCI_POINTXFROMPOSITION
- pointYFromPosition
-
editor->pointYFromPosition($pos);
Retrieve the y value of the point in the window where a position is displayed.
See Scintilla documentation for SCI_POINTYFROMPOSITION
- hideSelection
- getSelectionHidden
-
editor->hideSelection($hide); my $hidden = editor->getSelectionHidden();
Draw the selection in normal style (selection "hidden") or with selection highlighted (default).
See Scintilla documentation for SCI_HIDESELECTION
See Scintilla documentation for SCI_GETSELECTIONHIDDEN
The
getSelectionHidden
command requires at least Scintilla v5.2, found in Notepad++ v8.4 and newer. - getSelText
-
editor->getSelText();
Retrieve the selected text. Return the length of the text.
See Scintilla documentation for SCI_GETSELTEXT
- getCurLine
-
editor->getCurLine();
Retrieve the text of the line containing the caret. Returns the index of the caret on the line.
See Scintilla documentation for SCI_GETCURLINE
- selectionIsRectangle
-
editor->selectionIsRectangle();
Is the selection rectangular? The alternative is the more common stream selection.
See Scintilla documentation for SCI_SELECTIONISRECTANGLE
- setSelectionMode
- getSelectionMode
-
editor->setSelectionMode($mode); editor->getSelectionMode();
Set the selection mode to stream (normal selection) or rectangular or by lines.
Use $mode from %SC_SEL.
See Scintilla documentation for SCI_SETSELECTIONMODE
See Scintilla documentation for SCI_GETSELECTIONMODE
- getMoveExtendsSelection
-
editor->getMoveExtendsSelection;
Get whether or not regular caret moves will extend or reduce the selection.
See Scintilla documentation for SCI_GETMOVEEXTENDSSELECTION
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
- getLineSelStartPosition
-
editor->getLineSelStartPosition($line);
Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line).
See Scintilla documentation for SCI_GETLINESELSTARTPOSITION
- getLineSelEndPosition
-
editor->getLineSelEndPosition($line);
Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line).
See Scintilla documentation for SCI_GETLINESELENDPOSITION
- moveCaretInsideView
-
editor->moveCaretInsideView();
Move the caret inside current view if it’s not there already.
See Scintilla documentation for SCI_MOVECARETINSIDEVIEW
- positionBefore
-
editor->positionBefore($pos);
Given a valid document position, return the previous position taking code page into account. Returns 0 if passed 0.
See Scintilla documentation for SCI_POSITIONBEFORE
- positionAfter
-
editor->positionAfter($pos);
Given a valid document position, return the next position taking code page into account. Maximum value returned is the last position in the document.
See Scintilla documentation for SCI_POSITIONAFTER
- textWidth
-
editor->textWidth($style, $text);
Measure the pixel width of some text in a particular style. NUL terminated text argument. Does not handle tab or control characters.
See Scintilla documentation for SCI_TEXTWIDTH
- textHeight
-
editor->textHeight($line);
Retrieve the height of a particular line of text in pixels.
See Scintilla documentation for SCI_TEXTHEIGHT
- chooseCaretX
-
editor->chooseCaretX();
Set the last x chosen value to be the caret x position.
See Scintilla documentation for SCI_CHOOSECARETX
- moveSelectedLinesUp
-
editor->moveSelectedLinesUp();
Move the selected lines up one line, shifting the line above after the selection
See Scintilla documentation for SCI_MOVESELECTEDLINESUP
- moveSelectedLinesDown
-
editor->moveSelectedLinesDown();
Move the selected lines down one line, shifting the line below before the selection
See Scintilla documentation for SCI_MOVESELECTEDLINESDOWN
- setMouseSelectionRectangularSwitch
- getMouseSelectionRectangularSwitch
-
editor->setMouseSelectionRectangularSwitch($mouseSelectionRectangularSwitch); editor->getMouseSelectionRectangularSwitch();
Set whether switching to rectangular mode while selecting with the mouse is allowed.
See Scintilla documentation for SCI_SETMOUSESELECTIONRECTANGULARSWITCH
See Scintilla documentation for SCI_GETMOUSESELECTIONRECTANGULARSWITCH
By character or UTF-16 code unit
- positionRelative
-
editor->positionRelative($pos, $relative);
Given a valid document position, return a position that differs in a number of characters. Returned value is always between 0 and last position in document.
See Scintilla documentation for SCI_POSITIONRELATIVE
- positionRelativeCodeUnits
-
editor->positionRelativeCodeUnits($pos, $relative);
Given a valid document position, return a position that differs in a number of UTF-16 code units. Returned value is always between 0 and last position in document. The result may point half way (2 bytes) inside a non-BMP character.
See Scintilla documentation for SCI_POSITIONRELATIVECODEUNITS
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
- countCharacters
-
editor->countCharacters($startPos, $endPos);
Count characters between two positions.
See Scintilla documentation for SCI_COUNTCHARACTERS
- countCodeUnits
-
editor->countCodeUnits($start, $end);
Count code units between two positions.
See Scintilla documentation for SCI_COUNTCODEUNITS
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
- getLineCharacterIndex
-
editor->getLineCharacterIndex();
Retrieve line character index state.
Returns a value from %SC_LINECHARACTERINDEX.
See Scintilla documentation for SCI_GETLINECHARACTERINDEX
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
- allocateLineCharacterIndex
-
editor->allocateLineCharacterIndex($lineCharacterIndex);
Request line character index be created or its use count increased.
Use $lineCharacterIndex from %lineCharacterIndex.
See Scintilla documentation for SCI_ALLOCATELINECHARACTERINDEX
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
- releaseLineCharacterIndex
-
editor->releaseLineCharacterIndex($lineCharacterIndex);
Decrease use count of line character index and remove if 0.
Use $lineCharacterIndex from %lineCharacterIndex.
See Scintilla documentation for SCI_RELEASELINECHARACTERINDEX
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
- lineFromIndexPosition
-
editor->lineFromIndexPosition($pos, $lineCharacterIndex);
Retrieve the document line containing a position measured in index units.
Use $lineCharacterIndex from %lineCharacterIndex.
See Scintilla documentation for SCI_LINEFROMINDEXPOSITION
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
- indexPositionFromLine
-
editor->indexPositionFromLine($line, $lineCharacterIndex);
Retrieve the position measured in index units at the start of a document line.
Use $lineCharacterIndex from %lineCharacterIndex.
See Scintilla documentation for SCI_INDEXPOSITIONFROMLINE
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
Multiple Selection and Virtual Space
- setMultipleSelection
- getMultipleSelection
-
editor->setMultipleSelection($multipleSelection); editor->getMultipleSelection();
Set whether multiple selections can be made
See Scintilla documentation for SCI_SETMULTIPLESELECTION
See Scintilla documentation for SCI_GETMULTIPLESELECTION
- setAdditionalSelectionTyping
- getAdditionalSelectionTyping
-
editor->setAdditionalSelectionTyping($additionalSelectionTyping); editor->getAdditionalSelectionTyping();
Set whether typing can be performed into multiple selections
See Scintilla documentation for SCI_SETADDITIONALSELECTIONTYPING
See Scintilla documentation for SCI_GETADDITIONALSELECTIONTYPING
- setMultiPaste
- getMultiPaste
-
editor->setMultiPaste($multiPaste); editor->getMultiPaste();
Change the effect of pasting when there are multiple selections.
Use $multiPaste from %SC_MULTIPASTE.
See Scintilla documentation for SCI_SETMULTIPASTE
See Scintilla documentation for SCI_GETMULTIPASTE
- setVirtualSpaceOptions
- getVirtualSpaceOptions
-
editor->setVirtualSpaceOptions($virtualSpaceOptions); editor->getVirtualSpaceOptions();
Returns the position at the end of the selection.
$virtualSpaceOptions from %SC_VIRTUALSPACE
See Scintilla documentation for SCI_SETVIRTUALSPACEOPTIONS
See Scintilla documentation for SCI_GETVIRTUALSPACEOPTIONS
- setRectangularSelectionModifier
- getRectangularSelectionModifier
-
editor->setRectangularSelectionModifier($modifier); editor->getRectangularSelectionModifier();
On GTK+, allow selecting the modifier key to use for mouse-based rectangular selection. Often the window manager requires Alt+Mouse Drag for moving windows. Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER.
See Scintilla documentation for SCI_SETRECTANGULARSELECTIONMODIFIER
See Scintilla documentation for SCI_GETRECTANGULARSELECTIONMODIFIER
- getSelections
-
editor->getSelections();
How many selections are there?
See Scintilla documentation for SCI_GETSELECTIONS
- getSelectionEmpty
-
editor->getSelectionEmpty();
Is every selected range empty?
See Scintilla documentation for SCI_GETSELECTIONEMPTY
- clearSelections
-
editor->clearSelections();
Clear selections to a single empty stream selection
See Scintilla documentation for SCI_CLEARSELECTIONS
- setSelection
-
editor->setSelection($caret, $anchor);
Set a simple selection
See Scintilla documentation for SCI_SETSELECTION
- addSelection
-
editor->addSelection($caret, $anchor);
Add a selection
See Scintilla documentation for SCI_ADDSELECTION
- dropSelectionN
-
editor->dropSelectionN($selection);
Drop one selection
See Scintilla documentation for SCI_DROPSELECTIONN
- setMainSelection
- getMainSelection
-
editor->setMainSelection($selection); editor->getMainSelection();
Set the main selection
See Scintilla documentation for SCI_SETMAINSELECTION
See Scintilla documentation for SCI_GETMAINSELECTION
- setSelectionNCaret
- getSelectionNCaret
-
editor->setSelectionNCaret($selection, $pos); editor->getSelectionNCaret($selection);
Which selection is the main selection
See Scintilla documentation for SCI_SETSELECTIONNCARET
See Scintilla documentation for SCI_GETSELECTIONNCARET
- setSelectionNCaretVirtualSpace
- getSelectionNCaretVirtualSpace
-
editor->setSelectionNCaretVirtualSpace($selection, $space); editor->getSelectionNCaretVirtualSpace($selection);
Which selection is the main selection
See Scintilla documentation for SCI_SETSELECTIONNCARETVIRTUALSPACE
See Scintilla documentation for SCI_GETSELECTIONNCARETVIRTUALSPACE
- setSelectionNAnchor
- getSelectionNAnchor
-
editor->setSelectionNAnchor($selection, $posAnchor); editor->getSelectionNAnchor($selection);
Which selection is the main selection
See Scintilla documentation for SCI_SETSELECTIONNANCHOR
See Scintilla documentation for SCI_GETSELECTIONNANCHOR
- setSelectionNAnchorVirtualSpace
- getSelectionNAnchorVirtualSpace
-
editor->setSelectionNAnchorVirtualSpace($selection, $space); editor->getSelectionNAnchorVirtualSpace($selection);
Which selection is the main selection
See Scintilla documentation for SCI_SETSELECTIONNANCHORVIRTUALSPACE
See Scintilla documentation for SCI_GETSELECTIONNANCHORVIRTUALSPACE
- setSelectionNStart
- getSelectionNStart
- getSelectionNStartVirtualSpace
-
editor->setSelectionNStart($selection, $pos); editor->getSelectionNStart($selection); editor->getSelectionNStartVirtualSpace($selection);
Sets the position that starts the selection - this becomes the anchor.
Use the
getSelectionNStartVirtualSpace
version for selections beyond the end of the line (in virtual space).See Scintilla documentation for SCI_SETSELECTIONNSTART
See Scintilla documentation for SCI_GETSELECTIONNSTART
See Scintilla documentation for SCI_GETSELECTIONNSTARTVIRTUALSPACE
- setSelectionNEnd
- getSelectionNEnd
- getSelectionNEndVirtualSpace
-
editor->setSelectionNEnd($selection, $pos); editor->getSelectionNEnd($selection); editor->getSelectionNEndVirtualSpace($selection);
Sets the position that ends the selection - this becomes the currentPosition.
Use the
getSelectionNEndVirtualSpace
version for selections beyond the end of the line (in virtual space).See Scintilla documentation for SCI_SETSELECTIONNEND
See Scintilla documentation for SCI_GETSELECTIONNEND
See Scintilla documentation for SCI_GETSELECTIONNENDVIRTUALSPACE
- setRectangularSelectionCaret
- getRectangularSelectionCaret
-
editor->setRectangularSelectionCaret($pos); editor->getRectangularSelectionCaret();
Returns the position at the end of the selection.
See Scintilla documentation for SCI_SETRECTANGULARSELECTIONCARET
See Scintilla documentation for SCI_GETRECTANGULARSELECTIONCARET
- setRectangularSelectionCaretVirtualSpace
- getRectangularSelectionCaretVirtualSpace
-
editor->setRectangularSelectionCaretVirtualSpace($space); editor->getRectangularSelectionCaretVirtualSpace();
Returns the position at the end of the selection.
See Scintilla documentation for SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE
See Scintilla documentation for SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE
- setRectangularSelectionAnchor
- getRectangularSelectionAnchor
-
editor->setRectangularSelectionAnchor($posAnchor); editor->getRectangularSelectionAnchor();
Returns the position at the end of the selection.
See Scintilla documentation for SCI_SETRECTANGULARSELECTIONANCHOR
See Scintilla documentation for SCI_GETRECTANGULARSELECTIONANCHOR
- setRectangularSelectionAnchorVirtualSpace
-
editor->setRectangularSelectionAnchorVirtualSpace($space);
Returns the position at the end of the selection.
See Scintilla documentation for SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE
- getRectangularSelectionAnchorVirtualSpace
-
editor->getRectangularSelectionAnchorVirtualSpace();
Returns the position at the end of the selection.
See Scintilla documentation for SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE
- setAdditionalSelAlpha
- getAdditionalSelAlpha
-
editor->setAdditionalSelAlpha($alpha); editor->getAdditionalSelAlpha();
Set the alpha of the selection.
The value for $alpha must be one of the predefined %SC_ALPHA values, or any integer between
$SC_ALPHA{SC_ALPHA_TRANSPARENT}
and$SC_ALPHA{SC_ALPHA_OPAQUE}
, inclusive.See Scintilla documentation for SCI_SETADDITIONALSELALPHA
See Scintilla documentation for SCI_GETADDITIONALSELALPHA
- setAdditionalSelFore
-
editor->setAdditionalSelFore($fore);
Set the foreground colour of additional selections. Must have previously called SetSelFore with non-zero first argument for this to have an effect.
See Scintilla documentation for SCI_SETADDITIONALSELFORE
- setAdditionalSelBack
-
editor->setAdditionalSelBack($back);
Set the background colour of additional selections. Must have previously called SetSelBack with non-zero first argument for this to have an effect.
See Scintilla documentation for SCI_SETADDITIONALSELBACK
- setAdditionalCaretFore
- getAdditionalCaretFore
-
editor->setAdditionalCaretFore($fore); editor->getAdditionalCaretFore();
Set the foreground colour of additional carets.
See Scintilla documentation for SCI_SETADDITIONALCARETFORE
See Scintilla documentation for SCI_GETADDITIONALCARETFORE
- setAdditionalCaretsBlink
- getAdditionalCaretsBlink
-
editor->setAdditionalCaretsBlink($additionalCaretsBlink); editor->getAdditionalCaretsBlink();
Set whether additional carets will blink
See Scintilla documentation for SCI_SETADDITIONALCARETSBLINK
See Scintilla documentation for SCI_GETADDITIONALCARETSBLINK
- setAdditionalCaretsVisible
- getAdditionalCaretsVisible
-
editor->setAdditionalCaretsVisible($additionalCaretsBlink); editor->getAdditionalCaretsVisible();
Set whether additional carets are visible
See Scintilla documentation for SCI_SETADDITIONALCARETSVISIBLE
See Scintilla documentation for SCI_GETADDITIONALCARETSVISIBLE
- swapMainAnchorCaret
-
editor->swapMainAnchorCaret();
Swap that caret and anchor of the main selection.
See Scintilla documentation for SCI_SWAPMAINANCHORCARET
- rotateSelection
-
editor->rotateSelection();
Set the main selection to the next selection.
See Scintilla documentation for SCI_ROTATESELECTION
- multipleSelectAddNext
-
editor->multipleSelectAddNext;
Adds the next occurrence of the main selection within the target to the multi-selection set.
See Scintilla documentation for SCI_MULTIPLESELECTADDNEXT
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
- multipleSelectAddEach
-
editor->multipleSelectAddEach;
Adds multiple occurrences of the main selection within the target to the multi-selection set.
See Scintilla documentation for SCI_MULTIPLESELECTADDEACH
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
Scrolling and automatic scrolling
- setFirstVisibleLine
- getFirstVisibleLine
-
editor->setFirstVisibleLine($lineDisplay); editor->getFirstVisibleLine();
Scroll so that a display line is at the top of the display.
See Scintilla documentation for SCI_SETFIRSTVISIBLELINE
See Scintilla documentation for SCI_GETFIRSTVISIBLELINE
- setXOffset
- getXOffset
-
editor->setXOffset($newOffset); editor->getXOffset();
Get and Set the xOffset (ie, horizontal scroll position).
See Scintilla documentation for SCI_SETXOFFSET
See Scintilla documentation for SCI_GETXOFFSET
- lineScroll
-
editor->lineScroll($columns, $lines);
Scroll horizontally and vertically.
See Scintilla documentation for SCI_LINESCROLL
- scrollCaret
-
editor->scrollCaret();
Ensure the caret is visible.
See Scintilla documentation for SCI_SCROLLCARET
- scrollRange
-
editor->scrollRange($secondary, $primary);
Scroll the argument positions and the range between them into view giving priority to the primary position then the secondary position. This may be used to make a search match visible.
See Scintilla documentation for SCI_SCROLLRANGE
- setXCaretPolicy
-
editor->setXCaretPolicy($caretPolicy, $caretSlop);
Set the way the caret is kept visible when going sideways. The exclusion zone ($caretSlop) is given in pixels.
$caretPolicy
a combination of %SC_CARETPOLICY values.See Scintilla documentation for SCI_SETXCARETPOLICY
- setYCaretPolicy
-
editor->setYCaretPolicy($caretPolicy, $caretSlop);
Set the way the line the caret is on is kept visible. The exclusion zone ($caretSlop) is given in lines.
$caretPolicy
from %SC_CARETPOLICY.See Scintilla documentation for SCI_SETYCARETPOLICY
- setVisiblePolicy
-
editor->setVisiblePolicy($visiblePolicy, $visibleSlop);
Set the way the display area is determined when a particular line is to be moved to by Find, FindNext, GotoLine, etc. The exclusion zone ($visibleSlop) is given in lines.
Use $visiblePolicy from %SC_VISIBLE.
See Scintilla documentation for SCI_SETVISIBLEPOLICY
- setHScrollBar
- getHScrollBar
-
editor->setHScrollBar($show); editor->getHScrollBar();
Show or hide the horizontal scroll bar.
See Scintilla documentation for SCI_SETHSCROLLBAR
See Scintilla documentation for SCI_GETHSCROLLBAR
- setVScrollBar
- getVScrollBar
-
editor->setVScrollBar($show); editor->getVScrollBar();
Show or hide the vertical scroll bar.
See Scintilla documentation for SCI_SETVSCROLLBAR
See Scintilla documentation for SCI_GETVSCROLLBAR
- setScrollWidth
- getScrollWidth
-
editor->setScrollWidth($pixelWidth); editor->getScrollWidth();
Sets the document width assumed for scrolling.
See Scintilla documentation for SCI_SETSCROLLWIDTH
See Scintilla documentation for SCI_GETSCROLLWIDTH
- setScrollWidthTracking
- getScrollWidthTracking
-
editor->setScrollWidthTracking($tracking); editor->getScrollWidthTracking();
Sets whether the maximum width line displayed is used to set scroll width.
See Scintilla documentation for SCI_SETSCROLLWIDTHTRACKING
See Scintilla documentation for SCI_GETSCROLLWIDTHTRACKING
- setEndAtLastLine
- getEndAtLastLine
-
editor->setEndAtLastLine($endAtLastLine); editor->getEndAtLastLine();
Sets the scroll range so that maximum scroll position has the last line at the bottom of the view (default). Setting this to false allows scrolling one page below the last line.
See Scintilla documentation for SCI_SETENDATLASTLINE
See Scintilla documentation for SCI_GETENDATLASTLINE
White space
- setViewWS
- getViewWS
-
editor->setViewWS($viewWS); editor->getViewWS();
Make white space characters invisible, always visible or visible outside indentation.
$viewWS from %SC_WHITESPACE
See Scintilla documentation for SCI_SETVIEWWS
See Scintilla documentation for SCI_GETVIEWWS
- setWhitespaceFore
-
editor->setWhitespaceFore($useSetting, $fore);
Set the foreground colour of all whitespace and whether to use this setting.
See Scintilla documentation for SCI_SETWHITESPACEFORE
- setWhitespaceBack
-
editor->setWhitespaceBack($useSetting, $back);
Set the background colour of all whitespace and whether to use this setting.
See Scintilla documentation for SCI_SETWHITESPACEBACK
- setWhitespaceSize
- getWhitespaceSize
-
editor->setWhitespaceSize($size); editor->getWhitespaceSize();
Set the size of the dots used to mark space characters.
See Scintilla documentation for SCI_SETWHITESPACESIZE
See Scintilla documentation for SCI_GETWHITESPACESIZE
- setTabDrawMode
- getTabDrawMode
-
editor->setTabDrawMode($tabDrawMode); editor->getTabDrawMode;
Set how tabs are drawn when whitespace is visible.
Use $tabDrawMode from %SC_TABDRAW.
See Scintilla documentation for SCI_SETTABDRAWMODE
See Scintilla documentation for SCI_GETTABDRAWMODE
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
- setExtraAscent
- getExtraAscent
-
editor->setExtraAscent($extraAscent); editor->getExtraAscent();
Set extra ascent for each line
See Scintilla documentation for SCI_SETEXTRAASCENT
See Scintilla documentation for SCI_GETEXTRAASCENT
- setExtraDescent
- getExtraDescent
-
editor->setExtraDescent($extraDescent); editor->getExtraDescent();
Set extra descent for each line
See Scintilla documentation for SCI_SETEXTRADESCENT
See Scintilla documentation for SCI_GETEXTRADESCENT
Cursor
- setCursor
- getCursor
-
editor->setCursor($cursorType); editor->getCursor();
Sets the cursor behavior.
Use $cursor from %SC_CURSOR, either
$SC_CURSOR{SC_CURSORNORMAL}
or$SC_CURSOR{SC_CURSORWAIT}
.See Scintilla documentation for SCI_SETCURSOR
See Scintilla documentation for SCI_GETCURSOR
Mouse capture
- setMouseDownCaptures
- getMouseDownCaptures
-
editor->setMouseDownCaptures($captures); editor->getMouseDownCaptures();
Set whether the mouse is captured when its button is pressed.
See Scintilla documentation for SCI_SETMOUSEDOWNCAPTURES
See Scintilla documentation for SCI_GETMOUSEDOWNCAPTURES
- setMouseWheelCaptures
- getMouseWheelCaptures
-
editor->setMouseWheelCaptures($captures); editor->getMouseWheelCaptures;
Sets whether or not the Scintilla instance will handle all WM_MOUSEWHEEL messages if it has the focus, even if the mouse is nowhere near the Scintilla window.
Defaults to on; set
$captures
to a false value in order to require the mouse cursor to be over the Scintilla window to process those messages.See Scintilla documentation for SCI_SETMOUSEWHEELCAPTURES
See Scintilla documentation for SCI_GETMOUSEWHEELCAPTURES
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
Line endings
- setEOLMode
- getEOLMode
-
editor->setEOLMode($eolMode); editor->getEOLMode();
Set the current end of line mode.
Use $eolMode from %SC_EOL.
See also "getEOLString()" method for getting the correct string.
See Scintilla documentation for SCI_SETEOLMODE
See Scintilla documentation for SCI_GETEOLMODE
- convertEOLs
-
editor->convertEOLs($eolMode);
Convert all line endings in the document to one mode.
Use $eolMode from %SC_EOL.
See Scintilla documentation for SCI_CONVERTEOLS
- setViewEOL
- getViewEOL
-
editor->setViewEOL($visible); editor->getViewEOL();
Make the end of line characters visible or invisible.
See Scintilla documentation for SCI_SETVIEWEOL
See Scintilla documentation for SCI_GETVIEWEOL
- getLineEndTypesSupported
-
editor->getLineEndTypesSupported();
Returns whether line endings beyond the standard (LF, CR, and CRLF) are supported by the lexer. (Unicode has other line-endings defined, so this will tell you if those line endings are supported or not.)
Returns values from %SC_EOLSUPPORT, but effectively, a true value means Unicode's extra line-endings are supported.
See Scintilla documentation for SCI_GETLINEENDTYPESSUPPORTED
- setLineEndTypesAllowed
- getLineEndTypesAllowed
-
editor->setLineEndTypesAllowed($lineEndBitSet); editor->getLineEndTypesAllowed();
Set the line end types that the application wants to use. May not be used if incompatible with lexer or encoding.
Use $lineEndBitSet from %SC_EOLSUPPORT.
See Scintilla documentation for SCI_SETLINEENDTYPESALLOWED
See Scintilla documentation for SCI_GETLINEENDTYPESALLOWED
- getLineEndTypesActive
-
editor->getLineEndTypesActive();
Get the line end types currently recognised. May be a subset of the allowed types due to lexer limitation.
See Scintilla documentation for SCI_GETLINEENDTYPESACTIVE
Words
- wordStartPosition
-
editor->wordStartPosition($pos, $onlyWordCharacters);
Get position of start of word.
See Scintilla documentation for SCI_WORDSTARTPOSITION
- wordEndPosition
-
editor->wordEndPosition($pos, $onlyWordCharacters);
Get position of end of word.
See Scintilla documentation for SCI_WORDENDPOSITION
- isRangeWord
-
editor->isRangeWord($start, $end);
Is the range defined by
$start
..$end
a word or set of words? (It checks for word-boundary at the beginning and ending of the range; if there are intermediate word boundaries, it will still return true.)See Scintilla documentation for SCI_ISRANGEWORD
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
- setWordChars
- getWordChars
-
editor->setWordChars($characters); editor->getWordChars();
Set the set of characters making up words for when moving or selecting by word. First sets defaults like setCharsDefault().
See Scintilla documentation for SCI_SETWORDCHARS
See Scintilla documentation for SCI_GETWORDCHARS
- setWhitespaceChars
- getWhitespaceChars
-
editor->setWhitespaceChars($characters); editor->getWhitespaceChars();
Set the set of characters making up whitespace for when moving or selecting by word. Should be called after SetWordChars.
See Scintilla documentation for SCI_SETWHITESPACECHARS
See Scintilla documentation for SCI_GETWHITESPACECHARS
- setPunctuationChars
- getPunctuationChars
-
editor->setPunctuationChars($characters); editor->getPunctuationChars();
Set the set of characters making up punctuation characters Should be called after SetWordChars.
See Scintilla documentation for SCI_SETPUNCTUATIONCHARS
See Scintilla documentation for SCI_GETPUNCTUATIONCHARS
- setCharsDefault
-
editor->setCharsDefault();
Reset the set of characters for whitespace and word characters to the defaults.
See Scintilla documentation for SCI_SETCHARSDEFAULT
- setCharacterCategoryOptimization
- getCharacterCategoryOptimization
-
editor->setCharacterCategoryOptimization($countCharacters); editor->getCharacterCategoryOptimization;
Optimize speed of character category features like determining whether a character is a space or number at the expense of memory. Mostly used for Unicode documents. The
$countCharacters
parameter determines how many character starting from 0 are added to a look-up table with one byte used for each character. It is reasonable to cover the set of characters likely to be used in a document so 0x100 for simple Roman text, 0x1000 to cover most simple alphabets, 0x10000 to cover most of East Asian languages, and 0x110000 to cover all possible characters.See Scintilla documentation for SCI_SETCHARACTERCATEGORYOPTIMIZATION
See Scintilla documentation for SCI_GETCHARACTERCATEGORYOPTIMIZATION
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
Styling
- getEndStyled
-
editor->getEndStyled();
Retrieve the position of the last correctly styled character.
See Scintilla documentation for SCI_GETENDSTYLED
- startStyling
-
editor->startStyling($pos, $mask);
Set the current styling position to pos and the styling mask to mask. The styling mask can be used to protect some bits in each styling byte from modification.
See Scintilla documentation for SCI_STARTSTYLING
- setStyling
-
editor->setStyling($length, $style);
Change style from current styling position for length characters to a style and move the current styling position to after this newly styled segment.
See Scintilla documentation for SCI_SETSTYLING
- setStylingEx
-
editor->setStylingEx($styles);
Set the styles for a segment of the document.
See Scintilla documentation for SCI_SETSTYLINGEX
- setIdleStyling
- getIdleStyling
-
editor->setIdleStyling($idleStyling); editor->getIdleStyling;
Defines when and how syntax styling is applied. By default, style visible text; the other options allow styling the whole document in the background, or styling the visible first, and then some or all of the rest of the document is styled as a background process during Notepad++ idle time.
Use $idleStyling from %SC_IDLESTYLING.
Since wrapping also needs to perform styling and also uses idle time, this setting has no effect when the document is displayed wrapped.
See Scintilla documentation for SCI_SETIDLESTYLING
See Scintilla documentation for SCI_GETIDLESTYLING
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
- setLineState
- getLineState
-
editor->setLineState($line, $state); editor->getLineState($line);
Used to hold extra styling information for each line.
See Scintilla documentation for SCI_SETLINESTATE
See Scintilla documentation for SCI_GETLINESTATE
- getMaxLineState
-
editor->getMaxLineState();
Retrieve the last line number that has line state.
See Scintilla documentation for SCI_GETMAXLINESTATE
Style definition
There are 256 lexer styles that can be set, numbered 0 to $SC_STYLE{STYLE_MAX} (255). There are also some predefined numbered styles starting at 32, available in %SC_STYLE.
- styleResetDefault
-
editor->styleResetDefault();
Reset the default style to its state at startup
See Scintilla documentation for SCI_STYLERESETDEFAULT
- styleClearAll
-
editor->styleClearAll();
Clear all the styles and make equivalent to the global default style.
See Scintilla documentation for SCI_STYLECLEARALL
- styleSetFont
- styleGetFont
-
editor->styleSetFont($style, $fontName); editor->styleGetFont($style);
Set the font of a style.
See Scintilla documentation for SCI_STYLESETFONT
See Scintilla documentation for SCI_STYLEGETFONT
- styleSetSize
- styleGetSize
-
editor->styleSetSize($style, $sizePoints); editor->styleGetSize($style);
Set the size of characters of a style.
See Scintilla documentation for SCI_STYLESETSIZE
See Scintilla documentation for SCI_STYLEGETSIZE
- styleSetSizeFractional
- styleGetSizeFractional
-
editor->styleSetSizeFractional($style, $caseForce); editor->styleGetSizeFractional($style);
Set the size of characters of a style. Size is in points multiplied by 100.
(Technically, that 100 is from $SC_FONTSIZE{SC_FONT_SIZE_MULTIPLIER}.)
my $style = ...; my $points = 12.5; # want a 12.5pt font editor->styleSetSizeFractional( $style, $points * $SC_FONTSIZE{SC_FONT_SIZE_MULTIPLIER} );
See Scintilla documentation for SCI_STYLESETSIZEFRACTIONAL
See Scintilla documentation for SCI_STYLEGETSIZEFRACTIONAL
- styleSetBold
- styleGetBold
-
editor->styleSetBold($style, $bold); editor->styleGetBold($style);
Set a style to be bold or not.
See Scintilla documentation for SCI_STYLESETBOLD
See Scintilla documentation for SCI_STYLEGETBOLD
- styleSetWeight
- styleGetWeight
-
editor->styleSetWeight($style, $weight); editor->styleGetWeight($style);
Set the weight of characters of a style.
Use $weight as an integer from 1 to 999, where 1 is very light and 999 is quite heavy; predefined values for normal and bold text can be used from %SC_WEIGHT.
See Scintilla documentation for SCI_STYLESETWEIGHT
See Scintilla documentation for SCI_STYLEGETWEIGHT
- styleSetItalic
- styleGetItalic
-
editor->styleSetItalic($style, $italic); editor->styleGetItalic($style);
Set a style to be italic or not.
See Scintilla documentation for SCI_STYLESETITALIC
See Scintilla documentation for SCI_STYLEGETITALIC
- styleSetUnderline
- styleGetUnderline
-
editor->styleSetUnderline($style, $underline); editor->styleGetUnderline($style);
Set a style to be underlined or not.
See Scintilla documentation for SCI_STYLESETUNDERLINE
See Scintilla documentation for SCI_STYLEGETUNDERLINE
- styleSetFore
- styleGetFore
-
editor->styleSetFore($style, $fore); editor->styleGetFore($style);
Set the foreground colour of a style.
See Scintilla documentation for SCI_STYLESETFORE
See Scintilla documentation for SCI_STYLEGETFORE
- styleSetBack
- styleGetBack
-
editor->styleSetBack($style, $back); editor->styleGetBack($style);
Set the background colour of a style.
See Scintilla documentation for SCI_STYLESETBACK
See Scintilla documentation for SCI_STYLEGETBACK
- styleSetEOLFilled
- styleGetEOLFilled
-
editor->styleSetEOLFilled($style, $filled); editor->styleGetEOLFilled($style);
Set a style to have its end of line filled or not.
See Scintilla documentation for SCI_STYLESETEOLFILLED
See Scintilla documentation for SCI_STYLEGETEOLFILLED
- styleSetCharacterSet
- styleGetCharacterSet
-
editor->styleSetCharacterSet($style, $characterSet); editor->styleGetCharacterSet;
You can set a style to use a different character set than the default. The places where such characters sets are likely to be useful are comments and literal strings.
Use $characterSet from %SC_CHARSET.
See Scintilla documentation for SCI_STYLESETCHARACTERSET
See Scintilla documentation for SCI_STYLEGETCHARACTERSET
- styleSetCase
- styleGetCase
-
editor->styleSetCase($style, $caseForce); editor->styleGetCase($style);
Set a style to be mixed case, or to force upper or lower case. (Affects how text is displayed, not how it is stored.)
Use $caseForce from %SC_CASE.
See Scintilla documentation for SCI_STYLESETCASE
See Scintilla documentation for SCI_STYLEGETCASE
- styleSetVisible
- styleGetVisible
-
editor->styleSetVisible($style, $visible); editor->styleGetVisible($style);
Set a style to be visible or not.
See Scintilla documentation for SCI_STYLESETVISIBLE
See Scintilla documentation for SCI_STYLEGETVISIBLE
- styleSetChangeable
- styleGetChangeable
-
editor->styleSetChangeable($style, $changeable); editor->styleGetChangeable($style);
Set a style to be changeable or not (read only). Experimental feature, currently buggy.
See Scintilla documentation for SCI_STYLESETCHANGEABLE
See Scintilla documentation for SCI_STYLEGETCHANGEABLE
- styleSetHotSpot
- styleGetHotSpot
-
editor->styleSetHotSpot($style, $hotspot); editor->styleGetHotSpot($style);
Set a style to be a hotspot or not.
See Scintilla documentation for SCI_STYLESETHOTSPOT
See Scintilla documentation for SCI_STYLEGETHOTSPOT
- styleSetCheckMonospaced
- styleGetCheckMonospaced
-
editor->styleSetCheckMonospaced($style, $hotspot); editor->styleGetCheckMonospaced($style);
This attribute indicates that the font may be monospaced over the ASCII graphics characters (' ' … '~', including letters ('a'…'z', 'A'…'Z') and numbers ('0'…'9')). This allows optimizing speed and memory use for some common scenarios where documents are mostly composed from ASCII characters.
See Scintilla documentation for SCI_STYLESETCHECKMONOSPACED
See Scintilla documentation for SCI_STYLEGETCHECKMONOSPACED
These commands require at least Scintilla v5.2, found in Notepad++ v8.4 and newer.
- styleSetInvisibleRepresentation
- styleGetInvisibleRepresentation
-
editor->styleSetInvisibleRepresentation($style, $representation); $representation = editor->styleGetInvisibleRepresentation($style);
When a style is made invisible with
styleSetVisible()
, text is difficult to edit as the cursor can be at both sides of the invisible text segment. With these messages invisible text segements can be made visible with a single UTF8 characater giving the user an indication if the cursor is left or right of the invisible text. The character is displayed using the current style.The
$representation
parameter is a zero terminated string holding the one character used to represent the invisible text segment. Only the first character is used, the character is decoded as UTF-8.See Scintilla documentation for SCI_STYLESETINVISIBLEREPRESENTATION
See Scintilla documentation for SCI_STYLEGETINVISIBLEREPRESENTATION
These commands require at least Scintilla v5.2, found in Notepad++ v8.4 and newer.
- setFontLocale
- getFontLocale
-
editor->setFontLocale($localeName); $localeName = editor->getFontLocale();
These messages set the locale used for font selection with language-dependent glyphs. It may, depending on platform and other circumstances influence the display of text, so setting "zh-Hant" may result in traditional Chinese display and "zh-Hans" may result in simplified Chinese display. It is currently only implemented for Win32 using DirectWrite where the value is passed as the localeName argument to CreateTextFormat. The default value is US English "en-us".
See Scintilla documentation for SCI_SETFONTLOCALE
See Scintilla documentation for SCI_GETFONTLOCALE
These commands require at least Scintilla v5.2, found in Notepad++ v8.4 and newer.
Element Colours
The colours of some visual elements can be changed with these methods. The available elements often have a defined default colour, sometimes from the system but also from Notepad++. There may be a range of colours and setting an element colour overrides these colours.
This whole group requires at least Scintilla v5.2, found in Notepad++ v8.4 and newer.
- setElementColour
- getElementColour
-
editor->setElementColour($element, $colour); $colour = editor->getElementColour($element);
This changes the colour of the indicated visual element overriding any current colour. If the element supports translucency, then the alpha portion of the value is used. An opaque alpha value (0xff) should always be included when an opaque colour is desired as the value 0 is completely transparent and thus invisible.
The
$element
is one of the values found in %SC_ELEMENT.See Scintilla documentation for SCI_SETELEMENTCOLOUR
See Scintilla documentation for SCI_GETELEMENTCOLOUR
These commands require at least Scintilla v5.2, found in Notepad++ v8.4 and newer.
- resetElementColour
-
editor->resetElementColour($element);
This removes the element colour returning to the default colour or set of colours.
The
$element
is one of the values found in %SC_ELEMENT.See Scintilla documentation for SCI_RESETELEMENTCOLOUR
This command requires at least Scintilla v5.2, found in Notepad++ v8.4 and newer.
- getElementIsSet
-
$bool = editor->getElementIsSet($element);
Returns true when an element colour has been set. Returns false when a default colour or set of colours is displayed.
The
$element
is one of the values found in %SC_ELEMENT.See Scintilla documentation for SCI_GETELEMENTISSET
This command requires at least Scintilla v5.2, found in Notepad++ v8.4 and newer.
- getElementAllowsTranslucent
-
$bool = editor->getElementAllowsTranslucent($element);
Returns true when the element currently allows translucent drawing when an alpha component is included. This may change based on circumstances - different platforms or graphics technologies may implement translucency and newer versions of Scintilla may implement translucency for elements that did not previously support it.
The
$element
is one of the values found in %SC_ELEMENT.See Scintilla documentation for SCI_GETELEMENTALLOWSTRANSLUCENT
This command requires at least Scintilla v5.2, found in Notepad++ v8.4 and newer.
- getElementBaseColour
-
$colour = editor->getElementBaseColour($element);
Returns the default colour of an element. This may be a value defined by Scintilla or it may be derived from the operating system or platform. Which values are set from the operating system may differ between operating systems and operating system versions. When undefined the return value is 0 which is equivalent to completely transparent black. These colours may be useful when defining styles with similarities such as synthesizing dark mode styles that use the same colours as the system
The
$element
is one of the values found in %SC_ELEMENT.See Scintilla documentation for SCI_GETELEMENTBASECOLOUR
This command requires at least Scintilla v5.2, found in Notepad++ v8.4 and newer.
Caret, selection, and hotspot styles
The selection is shown by changing the text and/or background colours. If the selected text colour is not set then that attribute is not changed for the selection. The default is to show the selection by changing the background and leaving the foreground the same as when it was not selected. When there is no selection, the current insertion point is marked by the text caret. This is a vertical line that is normally blinking on and off to attract the users attention.
- setSelFore
-
editor->setSelFore($useSetting, $fore);
Set the foreground colour of the main and additional selections and whether to use this setting.
See Scintilla documentation for SCI_SETSELFORE
- setSelBack
-
editor->setSelBack($useSetting, $back);
Set the background colour of the main and additional selections and whether to use this setting.
See Scintilla documentation for SCI_SETSELBACK
- setSelectionLayer
- getSelectionLayer
-
editor->setSelectionLayer($layer); $layer = editor->getSelectionLayer();
The selection background can be drawn translucently over the text or opaquely on the base layer.
The value for
$layer
must be one of the predefined %SC_LAYER values.See Scintilla documentation for SCI_GETSELECTIONLAYER
See Scintilla documentation for SCI_SETSELECTIONLAYER
These commands require at least Scintilla v5.2, found in Notepad++ v8.4 and newer.
- setSelAlpha
- getSelAlpha
-
editor->setSelAlpha($alpha); editor->getSelAlpha();
Get the alpha of the selection.
The value for $alpha must be one of the predefined %SC_ALPHA values, or any integer between
$SC_ALPHA{SC_ALPHA_TRANSPARENT}
and$SC_ALPHA{SC_ALPHA_OPAQUE}
, inclusive.See Scintilla documentation for SCI_GETSELALPHA
See Scintilla documentation for SCI_SETSELALPHA
- setSelEOLFilled
- getSelEOLFilled
-
editor->setSelEOLFilled($filled); editor->getSelEOLFilled();
Is the selection end of line filled?
See Scintilla documentation for SCI_GETSELEOLFILLED
See Scintilla documentation for SCI_SETSELEOLFILLED
- setCaretFore
- getCaretFore
-
editor->setCaretFore($fore); editor->getCaretFore();
Set and retrieve the foreground colour of the caret.
See Scintilla documentation for SCI_SETCARETFORE
See Scintilla documentation for SCI_GETCARETFORE
- setCaretLineLayer
- getCaretLineLayer
-
editor->setCaretLineLayer($layer); editor->getCaretLineLayer();
You can choose to make the background colour of the line containing the caret different by setting the SC_ELEMENT_CARET_LINE_BACK element with
setElementColour($SC_ELEMENT{SC_ELEMENT_CARET_LINE_BACK})
. This effect may be drawn translucently over the text or opaquely on the base layer withsetCaretLineLayer
. Background colouring has highest priority when a line has markers that would otherwise change the background colour. When drawn translucently other background colours can show through.The layer argument can be one of the %SC_LAYER values.
See Scintilla documentation for SCI_SETCARETLINELAYER
See Scintilla documentation for SCI_GETCARETLINELAYER
- setCaretLineVisible
- getCaretLineVisible
-
editor->setCaretLineVisible($show); editor->getCaretLineVisible();
Display the background of the line containing the caret in a different colour.
See Scintilla documentation for SCI_SETCARETLINEVISIBLE
See Scintilla documentation for SCI_GETCARETLINEVISIBLE
- setCaretLineBack
- getCaretLineBack
-
editor->setCaretLineBack($back); editor->getCaretLineBack();
Set the colour of the background of the line containing the caret.
See Scintilla documentation for SCI_GETCARETLINEBACK
See Scintilla documentation for SCI_SETCARETLINEBACK
- setCaretLineBackAlpha
- getCaretLineBackAlpha
-
editor->setCaretLineBackAlpha($alpha); editor->getCaretLineBackAlpha();
Set and retrieve background alpha of the caret line.
The value for $alpha must be one of the predefined %SC_ALPHA values, or any integer between
$SC_ALPHA{SC_ALPHA_TRANSPARENT}
and$SC_ALPHA{SC_ALPHA_OPAQUE}
, inclusive.See Scintilla documentation for SCI_SETCARETLINEBACKALPHA
See Scintilla documentation for SCI_GETCARETLINEBACKALPHA
- setCaretLineFrame
- getCaretLineFrame
-
editor->setCaretLineFrame($width); editor->getCaretLineFrame;
Set and retrieve the width of the frame around the caret line.
See Scintilla documentation for SCI_SETCARETLINEFRAME
See Scintilla documentation for SCI_GETCARETLINEFRAME
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
- setCaretLineVisibleAlways
- getCaretLineVisibleAlways
-
editor->setCaretLineVisibleAlways($alwaysVisible); editor->getCaretLineVisibleAlways();
Sets the caret line to always visible.
See Scintilla documentation for SCI_SETCARETLINEVISIBLEALWAYS
See Scintilla documentation for SCI_GETCARETLINEVISIBLEALWAYS
- setCaretLineHighlightSubline
- getCaretLineHighlightSubline
-
editor->setCaretLineHighlightSubline($subLine); editor->getCaretLineHighlightSubline();
Choose to highlight only the subline containing the caret instead of the whole line. Under the default condition (
$subLine
is false), the whole caret line is highlighted.See Scintilla documentation for SCI_SETCARETLINEHIGHLIGHTSUBLINE
See Scintilla documentation for SCI_GETCARETLINEHIGHLIGHTSUBLINE
- setCaretPeriod
- getCaretPeriod
-
editor->setCaretPeriod($periodMilliseconds); editor->getCaretPeriod();
Get the time in milliseconds that the caret is on and off. 0 = steady on.
See Scintilla documentation for SCI_SETCARETPERIOD
See Scintilla documentation for SCI_GETCARETPERIOD
- setCaretStyle
- getCaretStyle
-
editor->setCaretStyle($caretStyle); editor->getCaretStyle();
Set the style of the caret to be drawn.
$caretStyle
from %SC_CARETSTYLE.See Scintilla documentation for SCI_SETCARETSTYLE
See Scintilla documentation for SCI_GETCARETSTYLE
- setCaretWidth
- getCaretWidth
-
editor->setCaretWidth($pixelWidth); editor->getCaretWidth();
Set the width of the insert mode caret.
See Scintilla documentation for SCI_SETCARETWIDTH
See Scintilla documentation for SCI_GETCARETWIDTH
- setHotspotActiveFore
- getHotspotActiveFore
-
editor->setHotspotActiveFore($useSetting, $fore); editor->getHotspotActiveFore();
Set a fore colour for active hotspots.
See Scintilla documentation for SCI_SETHOTSPOTACTIVEFORE
See Scintilla documentation for SCI_GETHOTSPOTACTIVEFORE
- setHotspotActiveBack
- getHotspotActiveBack
-
editor->setHotspotActiveBack($useSetting, $back); editor->getHotspotActiveBack();
Set a back colour for active hotspots.
See Scintilla documentation for SCI_SETHOTSPOTACTIVEBACK
See Scintilla documentation for SCI_GETHOTSPOTACTIVEBACK
- setHotspotActiveUnderline
- getHotspotActiveUnderline
-
editor->setHotspotActiveUnderline($underline); editor->getHotspotActiveUnderline();
Enable / Disable underlining active hotspots.
See Scintilla documentation for SCI_SETHOTSPOTACTIVEUNDERLINE
See Scintilla documentation for SCI_GETHOTSPOTACTIVEUNDERLINE
- setHotspotSingleLine
- getHotspotSingleLine
-
editor->setHotspotSingleLine($singleLine); editor->getHotspotSingleLine();
Limit hotspots to single line so hotspots on two lines don’t merge.
See Scintilla documentation for SCI_SETHOTSPOTSINGLELINE
See Scintilla documentation for SCI_GETHOTSPOTSINGLELINE
- setCaretSticky
- getCaretSticky
-
editor->setCaretSticky($useCaretStickyBehaviour); editor->getCaretSticky();
Can the caret preferred x position only be changed by explicit movement commands?
Use $useCaretStickyBehavior from %SC_CARETSTICKY
See Scintilla documentation for SCI_GETCARETSTICKY
See Scintilla documentation for SCI_SETCARETSTICKY
- toggleCaretSticky
-
editor->toggleCaretSticky();
Switch between sticky and non-sticky: meant to be bound to a key.
See Scintilla documentation for SCI_TOGGLECARETSTICKY
Character representations
Some characters, such as control characters and invalid bytes, do not have a visual glyph or use a glyph that is hard to distinguish.
Control characters (characters with codes less than 32, or between 128 and 159 in some encodings) are displayed by Scintilla using their mnemonics inverted in a rounded rectangle. These mnemonics come from the early days of signalling, though some are still used (LF = Line Feed, BS = Back Space, CR = Carriage Return, for example).
For the low 'C0' values: "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US".
For the high 'C1' values: "PAD", "HOP", "BPH", "NBH", "IND", "NEL", "SSA", "ESA", "HTS", "HTJ", "VTS", "PLD", "PLU", "RI", "SS2", "SS3", "DCS", "PU1", "PU2", "STS", "CCH", "MW", "SPA", "EPA", "SOS", "SGCI", "SCI", "CSI", "ST", "OSC", "PM", "APC".
Invalid bytes are shown in a similar way with an 'x' followed by their value in hexadecimal, like "xFE".
Notepad++'s Settings > Preferences > Editing > Non-Printing Characters settings can also set up representations for other non-printing characters, such as "NBSP" for the U+00A0 non-breaking space; this list is shown in the usermanual
- setRepresentation
- getRepresentation
-
editor->setRepresentation($encodedCharacter, $representation); editor->getRepresentation();
Set the way a character is drawn.
See Scintilla documentation for SCI_SETREPRESENTATION
See Scintilla documentation for SCI_GETREPRESENTATION
- clearRepresentation
-
editor->clearRepresentation($encodedCharacter); editor->clearAllRepresentations();
Remove a character representation from
$encodedCharacter
or from all characters.See Scintilla documentation for SCI_CLEARREPRESENTATION
See Scintilla documentation for SCI_CLEARALLREPRESENTATIONS
- setRepresentationAppearance
- getRepresentationAppearance
-
editor->setRepresentationAppearance($encodedCharacter, $appearance); $appearance = editor->getRepresentationAppearance($encodedCharacter);
The appearance may be changed using these flags. If a colour is set and the appearance is set without
$SC_REPRESENTATION{SC_REPRESENTATION_COLOUR}
then the representation will show in the colour of the underlying text.The
$appearance
value comes from the %SC_REPRESENTATION hash.See Scintilla documentation for SCI_SETREPRESENTATIONAPPEARANCE
See Scintilla documentation for SCI_GETREPRESENTATIONAPPEARANCE
These commands require at least Scintilla v5.2, found in Notepad++ v8.4 and newer.
- setRepresentationColour
- getRepresentationColour
-
editor->setRepresentationColour($encodedCharacter, $color); $color = editor->getRepresentationColour($encodedCharacter);
The colour and translucency of a representation may be set.
See Scintilla documentation for SCI_SETREPRESENTATIONCOLOUR
See Scintilla documentation for SCI_GETREPRESENTATIONCOLOUR
These commands require at least Scintilla v5.2, found in Notepad++ v8.4 and newer.
- setControlCharSymbol
- getControlCharSymbol
-
editor->setControlCharSymbol($symbol); editor->getControlCharSymbol();
The mnemonics may be replaced by a chosen symbol with a character codepoint in the range 32 to 255. If you set a symbol value less than 32, all control characters are displayed as mnemonics. The symbol you set is rendered in the font of the style set for the character. The default symbol value is 0.
See Scintilla documentation for SCI_SETCONTROLCHARSYMBOL
See Scintilla documentation for SCI_GETCONTROLCHARSYMBOL
Margins
- setMargins
- getMargins
-
editor->setMargins($numberOfMargins); editor->getMargins;
Allocate the number of margins or find the number of margins currently allocated.
Overrides $SC_MARGIN{SC_MAX_MARGIN}.
See Scintilla documentation for SCI_SETMARGINS
See Scintilla documentation for SCI_GETMARGINS
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
- setMarginTypeN
- getMarginTypeN
-
editor->setMarginTypeN($margin, $marginType); editor->getMarginTypeN($margin);
Set a specific margin to be either numeric or symbolic.
The $margin argument needs to be an index between 0 and $SC_MARGIN{SC_MAX_MARGIN} (inclusive), unless "setMargins" has been called to increase the number of margins available.
Use $marginType value should come from %SC_MARGIN.
See Scintilla documentation for SCI_SETMARGINTYPEN
See Scintilla documentation for SCI_GETMARGINTYPEN
- setMarginWidthN
- getMarginWidthN
-
editor->setMarginWidthN($margin, $pixelWidth); editor->getMarginWidthN($margin);
Set the width of a margin to a width expressed in pixels.
See Scintilla documentation for SCI_SETMARGINWIDTHN
See Scintilla documentation for SCI_GETMARGINWIDTHN
- setMarginMaskN
- getMarginMaskN
-
editor->setMarginMaskN($margin, $mask); editor->getMarginMaskN($margin);
Set a mask that determines which markers are displayed in a margin.
The $mask is a 32-bit number, where each bit represents one of the 32 numbered markers. If the bit is set in the mask, that marker will be enabled for that margin. It can be useful to only include the seven code-folding markers in bits 25-31 using the predefined mask
$SC_MARKNUM{SC_MASK_FOLDER}
; to enable all the markers _except_ those seven, use~$SC_MARKNUM{SC_MASK_FOLDER}
.See Scintilla documentation for SCI_SETMARGINMASKN
See Scintilla documentation for SCI_GETMARGINMASKN
- setMarginSensitiveN
- getMarginSensitiveN
-
editor->setMarginSensitiveN($margin, $sensitive); editor->getMarginSensitiveN($margin);
Make a margin sensitive or insensitive to mouse clicks.
See Scintilla documentation for SCI_SETMARGINSENSITIVEN
See Scintilla documentation for SCI_GETMARGINSENSITIVEN
- setMarginCursorN
- getMarginCursorN
-
editor->setMarginCursorN($margin, $cursor); editor->getMarginCursorN($margin);
Set the cursor shown when the mouse is inside a margin.
Use $cursor from %SC_CURSOR, either
$SC_CURSOR{SC_CURSORARROW}
or$SC_CURSOR{SC_CURSORREVERSEARROW}
See Scintilla documentation for SCI_SETMARGINCURSORN
See Scintilla documentation for SCI_GETMARGINCURSORN
- setMarginBackN
- getMarginBackN
-
editor->setMarginBackN($margin, $backgroundColor); editor->getMarginBackN;
Set and retrieve the background color for the specified margin
See Scintilla documentation for SCI_SETMARGINBACKN
See Scintilla documentation for SCI_GETMARGINBACKN
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
- setMarginLeft
- getMarginLeft
-
editor->setMarginLeft($pixelWidth); editor->getMarginLeft();
Sets the size in pixels of the left margin.
See Scintilla documentation for SCI_SETMARGINLEFT
See Scintilla documentation for SCI_GETMARGINLEFT
- setMarginRight
- getMarginRight
-
editor->setMarginRight($pixelWidth); editor->getMarginRight();
Sets the size in pixels of the right margin.
See Scintilla documentation for SCI_SETMARGINRIGHT
See Scintilla documentation for SCI_GETMARGINRIGHT
- setFoldMarginColour
-
editor->setFoldMarginColour($useSetting, $back);
Set the colours used as a chequerboard pattern in the fold margin
See Scintilla documentation for SCI_SETFOLDMARGINCOLOUR
- setFoldMarginHiColour
-
editor->setFoldMarginHiColour($useSetting, $fore);
Set the colours used as a chequerboard pattern in the fold margin
See Scintilla documentation for SCI_SETFOLDMARGINHICOLOUR
- marginSetText
- marginGetText
-
editor->marginSetText($line, $text); editor->marginGetText($line);
Set the text in the text margin for a line
See Scintilla documentation for SCI_MARGINSETTEXT
See Scintilla documentation for SCI_MARGINGETTEXT
- marginSetStyle
- marginGetStyle
-
editor->marginSetStyle($line, $style); editor->marginGetStyle($line);
Set the style number for the text margin for a line.
Use $style from %SC_MARGIN.
See Scintilla documentation for SCI_MARGINSETSTYLE
See Scintilla documentation for SCI_MARGINGETSTYLE
- marginSetStyles
- marginGetStyles
-
editor->marginSetStyles($line, $styles); editor->marginGetStyles($line);
Set the style in the text margin for a line
See Scintilla documentation for SCI_MARGINSETSTYLES
See Scintilla documentation for SCI_MARGINGETSTYLES
- marginTextClearAll
-
editor->marginTextClearAll();
Clear the margin text on all lines
See Scintilla documentation for SCI_MARGINTEXTCLEARALL
- marginSetStyleOffset
- marginGetStyleOffset
-
editor->marginSetStyleOffset($style); editor->marginGetStyleOffset();
Get the start of the range of style numbers used for margin text
See Scintilla documentation for SCI_MARGINSETSTYLEOFFSET
See Scintilla documentation for SCI_MARGINGETSTYLEOFFSET
- setMarginOptions
- getMarginOptions
-
editor->setMarginOptions($marginOptions); editor->getMarginOptions();
Set the margin options.
See Scintilla documentation for SCI_SETMARGINOPTIONS
See Scintilla documentation for SCI_GETMARGINOPTIONS
Annotations
Annotations are read-only lines of text underneath each line of editable text. An annotation may consist of multiple lines separated by '\n'. Annotations can be used to display an assembler version of code for debugging or to show diagnostic messages inline or to line up different versions of text in a merge tool.
Annotations count as display lines for the methods SCI_VISIBLEFROMDOCLINE and SCI_DOCLINEFROMVISIBLE
- annotationSetText
- annotationGetText
-
editor->annotationSetText($line, $text); editor->annotationGetText($line);
Set the annotation text for a line
See Scintilla documentation for SCI_ANNOTATIONSETTEXT
See Scintilla documentation for SCI_ANNOTATIONGETTEXT
- annotationSetStyle
- annotationGetStyle
-
editor->annotationSetStyle($line, $style); editor->annotationGetStyle($line);
Set the style number for the annotations for a line
See Scintilla documentation for SCI_ANNOTATIONSETSTYLE
See Scintilla documentation for SCI_ANNOTATIONGETSTYLE
- annotationSetStyles
- annotationGetStyles
-
editor->annotationSetStyles($line, $styles); editor->annotationGetStyles($line);
Set the annotation styles for a line
See Scintilla documentation for SCI_ANNOTATIONSETSTYLES
See Scintilla documentation for SCI_ANNOTATIONGETSTYLES
- annotationGetLines
-
editor->annotationGetLines($line);
Get the number of annotation lines for a line
See Scintilla documentation for SCI_ANNOTATIONGETLINES
- annotationClearAll
-
editor->annotationClearAll();
Clear the annotations from all lines
See Scintilla documentation for SCI_ANNOTATIONCLEARALL
- annotationSetVisible
- annotationGetVisible
-
editor->annotationSetVisible($visible); editor->annotationGetVisible();
Set the visibility for the annotations for a view, where
$visible
comes from %SC_ANNOTATION.See Scintilla documentation for SCI_ANNOTATIONSETVISIBLE
See Scintilla documentation for SCI_ANNOTATIONGETVISIBLE
- annotationSetStyleOffset
- annotationGetStyleOffset
-
editor->annotationSetStyleOffset($style); editor->annotationGetStyleOffset();
Get the start of the range of style numbers used for annotations
See Scintilla documentation for SCI_ANNOTATIONSETSTYLEOFFSET
See Scintilla documentation for SCI_ANNOTATIONGETSTYLEOFFSET
End of Line Annotations
End of Line Annotations are read-only lines of text at the end of each line of editable text. End of Line Annotations can be used to display an assembler version of code for debugging or to show diagnostic messages inline or to line up different versions of text in a merge tool.
- eolAnnotationSetText
- eolAnnotationGetText
-
editor->eolAnnotationSetText($line, $text); editor->eolAnnotationGetText($line);
Set the end-of-line annotation text for a line
See Scintilla documentation for SCI_EOLANNOTATIONSETTEXT
See Scintilla documentation for SCI_EOLANNOTATIONGETTEXT
- eolAnnotationSetStyle
- eolAnnotationGetStyle
-
editor->eolAnnotationSetStyle($line, $style); editor->eolAnnotationGetStyle($line);
Set the style number for the end-of-line annotations for a line
See Scintilla documentation for SCI_EOLANNOTATIONSETSTYLE
See Scintilla documentation for SCI_EOLANNOTATIONGETSTYLE
- eolAnnotationClearAll
-
editor->eolAnnotationClearAll();
Clear the end-of-line annotations from all lines
See Scintilla documentation for SCI_EOLANNOTATIONCLEARALL
- eolAnnotationSetVisible
- eolAnnotationGetVisible
-
editor->eolAnnotationSetVisible($visible); editor->eolAnnotationGetVisible();
Set the visibility for the end-of-line annotations for a view, where
$visible
comes from %SC_ANNOTATION.See Scintilla documentation for SCI_EOLANNOTATIONSETVISIBLE
See Scintilla documentation for SCI_EOLANNOTATIONGETVISIBLE
- eolAnnotationSetStyleOffset
- eolAnnotationGetStyleOffset
-
editor->eolAnnotationSetStyleOffset($style); editor->eolAnnotationGetStyleOffset();
Get the start of the range of style numbers used for end-of-line annotations
See Scintilla documentation for SCI_EOLANNOTATIONSETSTYLEOFFSET
See Scintilla documentation for SCI_EOLANNOTATIONGETSTYLEOFFSET
Other settings
- setBufferedDraw
- getBufferedDraw
-
editor->setBufferedDraw($buffered); editor->getBufferedDraw();
Is drawing done first into a buffer or direct to the screen?
See Scintilla documentation for SCI_GETBUFFEREDDRAW
See Scintilla documentation for SCI_SETBUFFEREDDRAW
- setPhasesDraw
- getPhasesDraw
-
editor->setPhasesDraw($phases); editor->getPhasesDraw;
Changes the sequence of drawing a text area, to trade off speed of drawing and allowing all pixels to be seen.
Use $phases from %SC_PHASES.
See Scintilla documentation for SCI_SETPHASESDRAW
See Scintilla documentation for SCI_GETPHASESDRAW
- setTechnology
- getTechnology
-
editor->setTechnology($technology); editor->getTechnology();
Set the video card and driver technology used (whether or not to use DirectDraw API). In Windows XP and earlier, only the default video technology is available.
Use $technology from %SC_TECHNOLOGY.
See Scintilla documentation for SCI_SETTECHNOLOGY
See Scintilla documentation for SCI_GETTECHNOLOGY
- setFontQuality
- getFontQuality
-
editor->setFontQuality($fontQuality); editor->getFontQuality();
Choose the quality level (antialiasing method) for text.
Use $fontQuality from %SC_FONTQUAL.
See Scintilla documentation for SCI_SETFONTQUALITY
See Scintilla documentation for SCI_GETFONTQUALITY
- setCodePage
- getCodePage
-
editor->setCodePage($codePage); editor->getCodePage();
Set the code page used to interpret the bytes of the document as characters.
Scintilla supports UTF-8, Japanese, Chinese and Korean DBCS along with single byte encodings like Latin-1. UTF-8 (SC_CP_UTF8) is the default. Use this message with codePage set to the code page number to set Scintilla to use code page information to ensure multiple byte characters are treated as one character rather than multiple. This also stops the caret from moving between the bytes in a multi-byte character. Do not use this message to choose between different single byte character sets - use "styleSetCharacterSet" for that. Call with $codePage set to zero to disable multi-byte support.
Use $codePage from %SC_CODEPAGE, or use a valid multibyte-codepage value.
See Scintilla documentation for SCI_SETCODEPAGE
See Scintilla documentation for SCI_GETCODEPAGE
- setIMEInteraction
- getIMEInteraction
-
editor->setIMEInteraction($imeInteraction); editor->getIMEInteraction;
Sets or retrieves the Input Method Editor (IME) for Chinese, Japanese, and Korean text.
Use $imeInteraction from %SC_IME.
See Scintilla documentation for SCI_SETIMEINTERACTION
See Scintilla documentation for SCI_GETIMEINTERACTION
- setBirdirectional
-
editor->setBirdirectional($bidirectional);
- getBidirectional
-
editor->getBidirectional;
Per Scintilla, these features are experimental and incomplete. They are used to be able to mix LTR and RTL languages.
Use $bidirectional from %SC_BIDIRECTIONAL.
The default
$SC_BIDIRECTIONAL{SC_BIDIRECTIONAL_DISABLED}
(0) means that only one direction is supported.Enabling
$SC_BIDIRECTIONAL{SC_BIDIRECTIONAL_L2R}
(1) means that left-to-right is the normal active direction, but UTF sequences can change text to right-to-left.Enabling
$SC_BIDIRECTIONAL{SC_BIDIRECTIONAL_R2L}
(2) means that right-to-left is the normal active direction, but UTF sequences can change text to left-to-right.You may also need to use "setTechnology" to a DirectWrite option.
See Scintilla documentation for SCI_SETBIDIRECTIONAL
See Scintilla documentation for SCI_GETBIDIRECTIONAL
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
- grabFocus
-
editor->grabFocus();
Set the focus to this Scintilla widget.
See Scintilla documentation for SCI_GRABFOCUS
- setFocus
- getFocus
-
editor->setFocus($focus); editor->getFocus();
Change internal focus flag.
See Scintilla documentation for SCI_SETFOCUS
See Scintilla documentation for SCI_GETFOCUS
- scintillaSupportsFeature
-
print editor->scintillaSupportsFeature($feature);
Different platforms support different features and
scintillaSupportsFeature
can be used to check which are currently available. This call allows applications to tailor their settings.It uses the values from %SC_SUPPORTS for
$feature
.See Scintilla documentation for SCI_SUPPORTSFEATURE
This command requires at least Scintilla v5.2, found in Notepad++ v8.4 and newer.
Brace highlighting
- braceHighlight
-
editor->braceHighlight($pos1, $pos2);
Highlight the characters at two positions.
See Scintilla documentation for SCI_BRACEHIGHLIGHT
- braceBadLight
-
editor->braceBadLight($pos);
Highlight the character at a position indicating there is no matching brace.
See Scintilla documentation for SCI_BRACEBADLIGHT
- braceHighlightIndicator
-
editor->braceHighlightIndicator($useBraceHighlightIndicator, $indicator);
Use specified indicator to highlight matching braces instead of changing their style.
See Scintilla documentation for SCI_BRACEHIGHLIGHTINDICATOR
- braceBadLightIndicator
-
editor->braceBadLightIndicator($useBraceBadLightIndicator, $indicator);
Use specified indicator to highlight non matching brace instead of changing its style.
See Scintilla documentation for SCI_BRACEBADLIGHTINDICATOR
- braceMatch
-
editor->braceMatch($pos);
Find the position of a matching brace or INVALID_POSITION if no match.
$pos
is the position of the known brace.See Scintilla documentation for SCI_BRACEMATCH
- braceMatchNext
-
editor->braceMatchNext($pos,$startPos);
Find the position of a matching brace or INVALID_POSITION if no match, starting the search at $startPos.
$pos
is the position of the known brace.$startPos
is where to start looking (compared to c<braceMatch>, which starts one left or one right from$pos
).See Scintilla documentation for SCI_BRACEMATCHNEXT
Tabs and Indentation Guides
- setTabMinimumWidth
- getTabMinimumWidth
-
editor->setTabMinimumWidth($pixels); editor->getTabMinimumWidth();
Change the minimum size of a tab in pixels to ensure that the tab can be seen. The default value is 2. This is particularly useful with proportional fonts with fractional widths where the character before the tab may end a fraction of a pixel before a tab stop, causing the tab to only be a fraction of a pixel wide without this setting. Where displaying a miniaturized version of the document, setting this to 0 may make the miniaturized version lay out more like the normal size version.
See Scintilla documentation for SCI_SETTABMINIMUMWIDTH
See Scintilla documentation for SCI_GETTABMINIMUMWIDTH
- setTabWidth
- getTabWidth
-
editor->setTabWidth($tabWidth); editor->getTabWidth();
Change the visible size of a tab to be a multiple of the width of a space character.
See Scintilla documentation for SCI_SETTABWIDTH
See Scintilla documentation for SCI_GETTABWIDTH
- clearTabStops
-
editor->clearTabStops($line);
Clears explicit tab stops on the indicated
$line
.See Scintilla documentation for SCI_CLEARTABSTOPS
- addTabStop
-
editor->addTabStop($line, $pixel);
Adds an explicit tab stop on the indicated
$line
at the indicated column$pixel
.See Scintilla documentation for SCI_ADDTABSTOP
- getNextTabStop
-
editor->getNextTabStop($line, $pixel);
Finds the next explicit tab stop on the indicated
$line
after the indicated column <$pixel>.See Scintilla documentation for SCI_GETNEXTTABSTOP
- setUseTabs
- getUseTabs
-
editor->setUseTabs($useTabs); editor->getUseTabs();
Indentation will only use space characters if useTabs is false, otherwise it will use a combination of tabs and spaces.
See Scintilla documentation for SCI_SETUSETABS
See Scintilla documentation for SCI_GETUSETABS
- setIndent
- getIndent
-
editor->setIndent($indentSize); editor->getIndent();
Set the number of spaces used for one level of indentation.
See Scintilla documentation for SCI_SETINDENT
See Scintilla documentation for SCI_GETINDENT
- setTabIndents
- getTabIndents
-
editor->setTabIndents($tabIndents); editor->getTabIndents();
Sets whether a tab pressed when caret is within indentation indents.
See Scintilla documentation for SCI_SETTABINDENTS
See Scintilla documentation for SCI_GETTABINDENTS
- setBackSpaceUnIndents
- getBackSpaceUnIndents
-
editor->setBackSpaceUnIndents($bsUnIndents); editor->getBackSpaceUnIndents();
Sets whether a backspace pressed when caret is within indentation unindents.
See Scintilla documentation for SCI_SETBACKSPACEUNINDENTS
See Scintilla documentation for SCI_GETBACKSPACEUNINDENTS
- setLineIndentation
- getLineIndentation
-
editor->setLineIndentation($line, $indentSize); editor->getLineIndentation($line);
Change the indentation of a line to a number of columns.
See Scintilla documentation for SCI_SETLINEINDENTATION
See Scintilla documentation for SCI_GETLINEINDENTATION
- getLineIndentPosition
-
editor->getLineIndentPosition($line);
Retrieve the position before the first non indentation character on a line.
See Scintilla documentation for SCI_GETLINEINDENTPOSITION
- setIndentationGuides
- getIndentationGuides
-
editor->setIndentationGuides($indentView); editor->getIndentationGuides();
Show or hide indentation guides.
Use $indentView from %SC_INDENTGUIDE
See Scintilla documentation for SCI_SETINDENTATIONGUIDES
See Scintilla documentation for SCI_GETINDENTATIONGUIDES
- setHighlightGuide
- getHighlightGuide
-
editor->setHighlightGuide($column); editor->getHighlightGuide();
Set the highlighted indentation guide column. 0 = no highlighted guide.
See Scintilla documentation for SCI_SETHIGHLIGHTGUIDE
See Scintilla documentation for SCI_GETHIGHLIGHTGUIDE
Markers
Scintilla allows for 32 markers, numbered 0 to $SC_MARGIN{MARKER_MAX}. Scintilla reserves marker numbers 25 to 31 for use in code-folding; these are the other keys defined in %SC_MARGIN. Numbers 0 to 24 are available for use, though Notepad++ or its plugins may be using some already. The $markerNumber listed in these methods should be in that range, or use one of the predefined values.
- markerDefine
-
editor->markerDefine($markerNumber, $markerSymbol);
Set the symbol used for a particular marker number.
Use $markerSymbol from %SC_MARK.
See Scintilla documentation for SCI_MARKERDEFINE
- markerDefinePixmap
-
editor->markerDefinePixmap($markerNumber, $pixmap);
Define a marker from a pixmap.
See Scintilla documentation for SCI_MARKERDEFINEPIXMAP
- rGBAImageSetWidth
-
editor->rGBAImageSetWidth($width);
Set the width for future RGBA image data.
See Scintilla documentation for SCI_RGBAIMAGESETWIDTH
- rGBAImageSetHeight
-
editor->rGBAImageSetHeight($height);
Set the height for future RGBA image data.
See Scintilla documentation for SCI_RGBAIMAGESETHEIGHT
- rGBAImageSetScale
-
editor->rGBAImageSetScale($scalePercent);
Set the scale factor in percent for future RGBA image data.
See Scintilla documentation for SCI_RGBAIMAGESETSCALE
- markerDefineRGBAImage
-
editor->markerDefineRGBAImage($markerNumber, $pixels);
Define a marker from RGBA data. It has the width and height from RGBAImageSetWidth/Height
See Scintilla documentation for SCI_MARKERDEFINERGBAIMAGE
- markerSymbolDefined
-
editor->markerSymbolDefined($markerNumber);
Which symbol was defined for markerNumber with MarkerDefine
See Scintilla documentation for SCI_MARKERSYMBOLDEFINED
- markerSetFore
- markerSetForeTranslucent
- markerSetBack
- markerSetBackTranslucent
- markerSetBackSelected
- markerSetBackSelectedTranslucent
-
editor->markerSetFore($markerNumber, $fore); editor->markerSetForeTranslucent($markerNumber, $forealpha); editor->markerSetBack($markerNumber, $back); editor->markerSetBackTranslucent($markerNumber, $backalpha); editor->markerSetBackSelected($markerNumber, $back); editor->markerSetBackSelectedTranslucent($markerNumber, $backalpha);
Set the foreground or background colour used for a particular marker number. The "translucent" versions accept colors with alpha (translucency). The "selected" versions set the background for the markers when the folding block is selected.
See Scintilla documentation for SCI_MARKERSETFORE
See Scintilla documentation for SCI_MARKERSETFORETRANSLUCENT
See Scintilla documentation for SCI_MARKERSETBACK
See Scintilla documentation for SCI_MARKERSETBACKTRANSLUCENT
See Scintilla documentation for SCI_MARKERSETBACKSELECTED
See Scintilla documentation for SCI_MARKERSETBACKSELECTEDTRANSLUCENT
The "translucent" versions of these commands require at least Scintilla v5.2, found in Notepad++ v8.4 and newer.
- markerSetStrokeWidth
-
editor->markerSetStrokeWidth($markerNum, $hundredths);
This message sets the stroke width used to draw the marker in hundredths of a pixel. The default value is 100 indicating a single pixel wide line.
See Scintilla documentation for SCI_MARKERSETSTROKEWIDTH
- markerEnableHighlight
-
editor->markerEnableHighlight($enabled);
Enable/disable highlight for current folding bloc (smallest one that contains the caret)
See Scintilla documentation for SCI_MARKERENABLEHIGHLIGHT
- markerSetLayer
- markerGetLayer
-
editor->markerSetLayer($markerNumber, $layer); $layer = editor->markerGetLayer($markerNum);
When markers are drawn in the content area, either because there is no margin for them or they are of SC_MARK_BACKGROUND or SC_MARK_UNDERLINE types, they may be drawn translucently over text or opaquely on the base layer. The layer to draw on is defined by SCI_MARKERSETLAYER. The degree of translucency can be chosen by setting an alpha value. This is only for the content area - in margins, translucency is achieved through the SCI_MARKERSET…TRANSLUCENT methods. The layer argument can be one of the %SC_LAYER values.
See Scintilla documentation for SCI_MARKERSETLAYER
See Scintilla documentation for SCI_MARKERGETLAYER
These commands require at least Scintilla v5.2, found in Notepad++ v8.4 and newer.
- markerSetAlpha
-
editor->markerSetAlpha($markerNumber, $alpha);
Set the alpha used for a marker that is drawn in the text area, not the margin.
The value for $alpha must be one of the predefined %SC_ALPHA values, or any integer between
$SC_ALPHA{SC_ALPHA_TRANSPARENT}
and$SC_ALPHA{SC_ALPHA_OPAQUE}
, inclusive.See Scintilla documentation for SCI_MARKERSETALPHA
- markerAdd
-
editor->markerAdd($line, $markerNumber);
Add a marker to a line, returning an ID which can be used to find or delete the marker.
See Scintilla documentation for SCI_MARKERADD
- markerAddSet
-
editor->markerAddSet($line, $set);
Add a set of markers to a line.
See Scintilla documentation for SCI_MARKERADDSET
- markerDelete
-
editor->markerDelete($line, $markerNumber);
Delete a marker from a line.
See Scintilla documentation for SCI_MARKERDELETE
- markerDeleteAll
-
editor->markerDeleteAll($markerNumber);
Delete all markers with a particular number from all lines.
See Scintilla documentation for SCI_MARKERDELETEALL
- markerGet
-
editor->markerGet($line);
Get a bit mask of all the markers set on a line.
See Scintilla documentation for SCI_MARKERGET
- markerNext
-
editor->markerNext($lineStart, $markerMask);
Find the next line at or after lineStart that includes a marker in mask. Return -1 when no more lines.
See Scintilla documentation for SCI_MARKERNEXT
- markerPrevious
-
editor->markerPrevious($lineStart, $markerMask);
Find the previous line before lineStart that includes a marker in mask.
See Scintilla documentation for SCI_MARKERPREVIOUS
- markerLineFromHandle
-
editor->markerLineFromHandle($handle);
Retrieve the line number at which a particular marker is located.
See Scintilla documentation for SCI_MARKERLINEFROMHANDLE
- markerDeleteHandle
-
editor->markerDeleteHandle($handle);
Delete a marker.
See Scintilla documentation for SCI_MARKERDELETEHANDLE
- markerHandleFromLine
- markerNumberFromLine
-
editor->markerHandleFromLine($line, $which); editor->markerNumberFromLine($line, $which);
These return the Nth marker handle (
$which
) or marker number in a given line ($line
). Handles are returned bymarkerAdd
. If$which
is greater or equal to the number of markers on a line, this returns -1.See Scintilla documentation for SCI_MARKERHANDLEFROMLINE
Indicators
Indicators are used to display additional information over the top of styling. They can be used to show, for example, syntax errors, deprecated names and bad indentation by drawing underlines under text or boxes around text. See more at ScintillaDoc#Indicators.
- indicSetStyle
- indicGetStyle
-
editor->indicSetStyle($indic, $style); editor->indicGetStyle($indic);
Set an indicator to plain, squiggle or TT.
$style from %SC_INDICSTYLE
See Scintilla documentation for SCI_INDICSETSTYLE
See Scintilla documentation for SCI_INDICGETSTYLE
- indicSetFore
- indicGetFore
-
editor->indicSetFore($indic, $fore); editor->indicGetFore($indic);
Set the foreground colour of an indicator.
See Scintilla documentation for SCI_INDICSETFORE
See Scintilla documentation for SCI_INDICGETFORE
- indicSetStrokeWidth
- indicGetStrokeWidth
-
editor->indicSetStrokeWidth($indic, $hundredths); $hundredths = editor->indicGetStrokeWidth($indic);
These two commands set and get the stroke width used to draw an indicator in hundredths of a pixel. The default value is 100 indicating a width of one pixel. Some indicator styles do not support setting stroke width, generally where it makes no sense (INDIC_POINT) or wasn't simple (INDIC_SQUIGGLEPIXMAP). The indicators supporting stroke width are: INDIC_PLAIN, INDIC_SQUIGGLE, INDIC_TT, INDIC_DIAGONAL, INDIC_STRIKE, INDIC_BOX, INDIC_ROUNDBOX, INDIC_STRAIGHTBOX, INDIC_FULLBOX, INDIC_DASH, INDIC_DOTS, INDIC_SQUIGGLELOW.
Fractional pixel widths are possible such as 50 for half a pixel wide. On many systems a half pixel value will appear as a fainter line but it allows drawing very thin lines on systems with multiple physical pixels per logical pixel. Half (logical) pixel lines are available on macOS with 'retina' displays, see "scintillaSupportsFeature" in SCI_SUPPORTSFEATURE(SC_SUPPORTS_PIXEL_DIVISIONS).
See Scintilla documentation for SCI_INDICSETSTROKEWIDTH
See Scintilla documentation for SCI_INDICGETSTROKEWIDTH
These commands require at least Scintilla v5.2, found in Notepad++ v8.4 and newer.
- indicSetAlpha
- indicGetAlpha
-
editor->indicSetAlpha($indicator, $alpha); editor->indicGetAlpha($indicator);
Set the alpha fill colour of the given indicator.
The value for $alpha must be one of the predefined %SC_ALPHA values, or any integer between
$SC_ALPHA{SC_ALPHA_TRANSPARENT}
and$SC_ALPHA{SC_ALPHA_OPAQUE}
, inclusive.See Scintilla documentation for SCI_INDICSETALPHA
See Scintilla documentation for SCI_INDICGETALPHA
- indicSetOutlineAlpha
- indicGetOutlineAlpha
-
editor->indicSetOutlineAlpha($indicator, $alpha); editor->indicGetOutlineAlpha($indicator);
Set the alpha outline colour of the given indicator.
The value for $alpha must be one of the predefined %SC_ALPHA values, or any integer between
$SC_ALPHA{SC_ALPHA_TRANSPARENT}
and$SC_ALPHA{SC_ALPHA_OPAQUE}
, inclusive.See Scintilla documentation for SCI_INDICSETOUTLINEALPHA
See Scintilla documentation for SCI_INDICGETOUTLINEALPHA
- indicSetUnder
- indicGetUnder
-
editor->indicSetUnder($indic, $under); editor->indicGetUnder($indic);
Set an indicator to draw under text or over(default).
See Scintilla documentation for SCI_INDICSETUNDER
See Scintilla documentation for SCI_INDICGETUNDER
- indicSetHoverStyle
- indicGetHoverStyle
-
editor->indicSetHoverStyle($indicator, $indicatorStyle); editor->indicGetHoverStyle($indicator);
- indicSetHoverFore
- indicGetHoverFore
-
editor->indicSetHoverFore($indicator, $foreground); editor->indicGetHoverFore($indicator);
Used to set or get the style or foreground color used when the mouse cursor is hovering over a piece of text.
See Scintilla documentation for SCI_INDICSETHOVERSTYLE
See Scintilla documentation for SCI_INDICGETHOVERSTYLE See Scintilla documentation for SCI_INDICSETHOVERFORE
See Scintilla documentation for SCI_INDICGETHOVERFORE
- indicSetFlags
- indicGetFlags
-
editor->indicSetFlags($indicator, $flags); editor->indicGetFlags($indicator);
Sets or retrieves the flags for a particular indicator.
Use $flags from %SC_INDIC
See Scintilla documentation for SCI_INDICSETFLAGS
See Scintilla documentation for SCI_INDICGETFLAGS
- setIndicatorCurrent
- getIndicatorCurrent
-
editor->setIndicatorCurrent($indicator); editor->getIndicatorCurrent();
Set the indicator used for IndicatorFillRange and IndicatorClearRange
See Scintilla documentation for SCI_SETINDICATORCURRENT
See Scintilla documentation for SCI_GETINDICATORCURRENT
- setIndicatorValue
- getIndicatorValue
-
editor->setIndicatorValue($value); editor->getIndicatorValue();
Set the value used for IndicatorFillRange
Use $value as a 24-bit RGB color, ored with
$SC_INDIC{SC_INDICVALUEBIT}
from %SC_INDIC. To extract just the color from thegetIndicatorValue()
call, mask it with$SC_INDIC{SC_INDICVALUEMASK}
.See Scintilla documentation for SCI_SETINDICATORVALUE
See Scintilla documentation for SCI_GETINDICATORVALUE
- indicatorFillRange
-
editor->indicatorFillRange($position, $fillLength);
Turn a indicator on over a range.
See Scintilla documentation for SCI_INDICATORFILLRANGE
- indicatorClearRange
-
editor->indicatorClearRange($position, $clearLength);
Turn a indicator off over a range.
See Scintilla documentation for SCI_INDICATORCLEARRANGE
- indicatorAllOnFor
-
editor->indicatorAllOnFor($position);
Are any indicators present at position?
See Scintilla documentation for SCI_INDICATORALLONFOR
- indicatorValueAt
-
editor->indicatorValueAt($indicator, $position);
What value does a particular indicator have at at a position?
See Scintilla documentation for SCI_INDICATORVALUEAT
- indicatorStart
-
editor->indicatorStart($indicator, $position);
Where does a particular indicator start?
See Scintilla documentation for SCI_INDICATORSTART
- indicatorEnd
-
editor->indicatorEnd($indicator, $position);
Where does a particular indicator end?
See Scintilla documentation for SCI_INDICATOREND
- findIndicatorShow
-
editor->findIndicatorShow($start, $end);
On OS X, show a find indicator.
See Scintilla documentation for SCI_FINDINDICATORSHOW
- findIndicatorFlash
-
editor->findIndicatorFlash($start, $end);
On OS X, flash a find indicator, then fade out.
See Scintilla documentation for SCI_FINDINDICATORFLASH
- findIndicatorHide
-
editor->findIndicatorHide();
On OS X, hide the find indicator.
See Scintilla documentation for SCI_FINDINDICATORHIDE
Autocompletion
- autoCShow
-
editor->autoCShow($lenEntered, $itemList);
Display a auto-completion list. The lenEntered parameter indicates how many characters before the caret should be used to provide context.
See Scintilla documentation for SCI_AUTOCSHOW
- autoCCancel
-
editor->autoCCancel();
Remove the auto-completion list from the screen.
See Scintilla documentation for SCI_AUTOCCANCEL
- autoCActive
-
editor->autoCActive();
Is there an auto-completion list visible?
See Scintilla documentation for SCI_AUTOCACTIVE
- autoCPosStart
-
editor->autoCPosStart();
Retrieve the position of the caret when the auto-completion list was displayed.
See Scintilla documentation for SCI_AUTOCPOSSTART
- autoCComplete
-
editor->autoCComplete();
User has selected an item so remove the list and insert the selection.
See Scintilla documentation for SCI_AUTOCCOMPLETE
- autoCStops
-
editor->autoCStops($characterSet);
Define a set of character that when typed cancel the auto-completion list.
See Scintilla documentation for SCI_AUTOCSTOPS
- autoCSetSeparator
- autoCGetSeparator
-
editor->autoCSetSeparator($separatorCharacter); editor->autoCGetSeparator();
Change the separator character in the string setting up an auto-completion list. Default is space but can be changed if items contain space.
See Scintilla documentation for SCI_AUTOCSETSEPARATOR
See Scintilla documentation for SCI_AUTOCGETSEPARATOR
- autoCSelect
-
editor->autoCSelect($text);
Select the item in the auto-completion list that starts with a string.
See Scintilla documentation for SCI_AUTOCSELECT
- autoCGetCurrent
-
editor->autoCGetCurrent();
Get currently selected item position in the auto-completion list
See Scintilla documentation for SCI_AUTOCGETCURRENT
- autoCGetCurrentText
-
editor->autoCGetCurrentText();
Get currently selected item text in the auto-completion list Returns the length of the item text
See Scintilla documentation for SCI_AUTOCGETCURRENTTEXT
- autoCSetCancelAtStart
- autoCGetCancelAtStart
-
editor->autoCSetCancelAtStart($cancel); editor->autoCGetCancelAtStart();
Should the auto-completion list be cancelled if the user backspaces to a position before where the box was created.
See Scintilla documentation for SCI_AUTOCSETCANCELATSTART
See Scintilla documentation for SCI_AUTOCGETCANCELATSTART
- autoCSetFillUps
-
editor->autoCSetFillUps($characterSet);
Define a set of characters that when typed will cause the autocompletion to choose the selected item.
See Scintilla documentation for SCI_AUTOCSETFILLUPS
- autoCSetChooseSingle
- autoCGetChooseSingle
-
editor->autoCSetChooseSingle($chooseSingle); editor->autoCGetChooseSingle();
Should a single item auto-completion list automatically choose the item.
See Scintilla documentation for SCI_AUTOCSETCHOOSESINGLE
See Scintilla documentation for SCI_AUTOCGETCHOOSESINGLE
- autoCSetIgnoreCase
- autoCGetIgnoreCase
-
editor->autoCSetIgnoreCase($ignoreCase); editor->autoCGetIgnoreCase();
Set whether case is significant when performing auto-completion searches.
See Scintilla documentation for SCI_AUTOCSETIGNORECASE
See Scintilla documentation for SCI_AUTOCGETIGNORECASE
- autoCSetCaseInsensitiveBehaviour
- autoCGetCaseInsensitiveBehaviour
-
editor->autoCSetCaseInsensitiveBehaviour($behaviour); editor->autoCGetCaseInsensitiveBehaviour();
Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference.
Use $behavior from %SC_CASEINSENSITIVE
See Scintilla documentation for SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR
See Scintilla documentation for SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR
- autoCSetMulti
- autoCGetMulti
-
editor->autoCSetMulti($multi); editor->autoCGetMulti;
Determine whether the autocompletion goes into the first area of a multi-selection or into each area of the multi-selection.
Use $multi from %SC_MULTIAUTOC.
See Scintilla documentation for SCI_AUTOCSETMULTI
See Scintilla documentation for SCI_AUTOCGETMULTI
- autoCSetOrder
- autoCGetOrder
-
editor->autoCSetOrder($order); editor->autoCGetOrder();
Set the way autocompletion lists are ordered.
Use $order from %SC_AUTOC_ORDER.
See Scintilla documentation for SCI_AUTOCSETORDER
See Scintilla documentation for SCI_AUTOCGETORDER
- autoCSetAutoHide
- autoCGetAutoHide
-
editor->autoCSetAutoHide($autoHide); editor->autoCGetAutoHide();
Set whether or not autocompletion is hidden automatically when nothing matches.
See Scintilla documentation for SCI_AUTOCSETAUTOHIDE
See Scintilla documentation for SCI_AUTOCGETAUTOHIDE
- autoCSetDropRestOfWord
- autoCGetDropRestOfWord
-
editor->autoCSetDropRestOfWord($dropRestOfWord); editor->autoCGetDropRestOfWord();
Set whether or not autocompletion deletes any word characters after the inserted text upon completion.
See Scintilla documentation for SCI_AUTOCSETDROPRESTOFWORD
See Scintilla documentation for SCI_AUTOCGETDROPRESTOFWORD
- autoCSetOptions
- autoCGetOptions
-
editor->autoCSetOptions($opt); editor->autoCGetOptions();
Set or get options for autocompletion from the %SC_AUTOCOMPLETE hash values.
- registerImage
-
editor->registerImage($type, $xpmData);
Register an XPM image for use in autocompletion lists.
See Scintilla documentation for SCI_REGISTERIMAGE
- registerRGBAImage
-
editor->registerRGBAImage($type, $pixels);
Register an RGBA image for use in autocompletion lists. It has the width and height from RGBAImageSetWidth/Height
See Scintilla documentation for SCI_REGISTERRGBAIMAGE
- clearRegisteredImages
-
editor->clearRegisteredImages();
Clear all the registered XPM images.
See Scintilla documentation for SCI_CLEARREGISTEREDIMAGES
- autoCSetTypeSeparator
- autoCGetTypeSeparator
-
editor->autoCSetTypeSeparator($separatorCharacter); editor->autoCGetTypeSeparator();
Retrieve the auto-completion list type-separator character.
See Scintilla documentation for SCI_AUTOCGETTYPESEPARATOR
See Scintilla documentation for SCI_AUTOCSETTYPESEPARATOR
- autoCSetMaxHeight
- autoCGetMaxHeight
-
editor->autoCSetMaxHeight($rowCount); editor->autoCGetMaxHeight();
Set the maximum height, in rows, of auto-completion and user lists. The default is 5 rows.
See Scintilla documentation for SCI_AUTOCSETMAXHEIGHT
See Scintilla documentation for SCI_AUTOCGETMAXHEIGHT
- autoCSetMaxWidth
- autoCGetMaxWidth
-
editor->autoCSetMaxWidth($characterCount); editor->autoCGetMaxWidth();
Set the maximum width, in characters, of auto-completion and user lists. Set to 0 to autosize to fit longest item, which is the default.
See Scintilla documentation for SCI_AUTOCSETMAXWIDTH
See Scintilla documentation for SCI_AUTOCGETMAXWIDTH
User lists
- userListShow
-
editor->userListShow($listType, $itemList);
Display a list of strings and send notification when user chooses one.
See Scintilla documentation for SCI_USERLISTSHOW
Call tips
- callTipShow
-
editor->callTipShow($pos, $definition);
Show a call tip containing a definition near position pos.
See Scintilla documentation for SCI_CALLTIPSHOW
- callTipCancel
-
editor->callTipCancel();
Remove the call tip from the screen.
See Scintilla documentation for SCI_CALLTIPCANCEL
- callTipActive
-
editor->callTipActive();
Is there an active call tip?
See Scintilla documentation for SCI_CALLTIPACTIVE
- callTipPosStart
-
editor->callTipPosStart();
Retrieve the position where the caret was before displaying the call tip.
See Scintilla documentation for SCI_CALLTIPPOSSTART
- callTipSetPosStart
-
editor->callTipSetPosStart($posStart);
Set the start position in order to change when backspacing removes the calltip.
See Scintilla documentation for SCI_CALLTIPSETPOSSTART
- callTipSetHlt
-
editor->callTipSetHlt($start, $end);
Highlight a segment of the definition.
See Scintilla documentation for SCI_CALLTIPSETHLT
- callTipSetBack
-
editor->callTipSetBack($back);
Set the background colour for the call tip.
See Scintilla documentation for SCI_CALLTIPSETBACK
- callTipSetFore
-
editor->callTipSetFore($fore);
Set the foreground colour for the call tip.
See Scintilla documentation for SCI_CALLTIPSETFORE
- callTipSetForeHlt
-
editor->callTipSetForeHlt($fore);
Set the foreground colour for the highlighted part of the call tip.
See Scintilla documentation for SCI_CALLTIPSETFOREHLT
- callTipUseStyle
-
editor->callTipUseStyle($tabSize);
Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
See Scintilla documentation for SCI_CALLTIPUSESTYLE
- callTipSetPosition
-
editor->callTipSetPosition($above);
Set position of calltip, above or below text.
See Scintilla documentation for SCI_CALLTIPSETPOSITION
Keyboard commands
- lineDown
-
editor->lineDown();
Move caret down one line.
See Scintilla documentation for SCI_LINEDOWN
- lineDownExtend
-
editor->lineDownExtend();
Move caret down one line extending selection to new caret position.
See Scintilla documentation for SCI_LINEDOWNEXTEND
- lineUp
-
editor->lineUp();
Move caret up one line.
See Scintilla documentation for SCI_LINEUP
- lineUpExtend
-
editor->lineUpExtend();
Move caret up one line extending selection to new caret position.
See Scintilla documentation for SCI_LINEUPEXTEND
- charLeft
-
editor->charLeft();
Move caret left one character.
See Scintilla documentation for SCI_CHARLEFT
- charLeftExtend
-
editor->charLeftExtend();
Move caret left one character extending selection to new caret position.
See Scintilla documentation for SCI_CHARLEFTEXTEND
- charRight
-
editor->charRight();
Move caret right one character.
See Scintilla documentation for SCI_CHARRIGHT
- charRightExtend
-
editor->charRightExtend();
Move caret right one character extending selection to new caret position.
See Scintilla documentation for SCI_CHARRIGHTEXTEND
- wordLeft
-
editor->wordLeft();
Move caret left one word.
See Scintilla documentation for SCI_WORDLEFT
- wordLeftExtend
-
editor->wordLeftExtend();
Move caret left one word extending selection to new caret position.
See Scintilla documentation for SCI_WORDLEFTEXTEND
- wordRight
-
editor->wordRight();
Move caret right one word.
See Scintilla documentation for SCI_WORDRIGHT
- wordRightExtend
-
editor->wordRightExtend();
Move caret right one word extending selection to new caret position.
See Scintilla documentation for SCI_WORDRIGHTEXTEND
- home
-
editor->home();
Move caret to first position on line.
See Scintilla documentation for SCI_HOME
- homeExtend
-
editor->homeExtend();
Move caret to first position on line extending selection to new caret position.
See Scintilla documentation for SCI_HOMEEXTEND
- lineEnd
-
editor->lineEnd();
Move caret to last position on line.
See Scintilla documentation for SCI_LINEEND
- lineEndExtend
-
editor->lineEndExtend();
Move caret to last position on line extending selection to new caret position.
See Scintilla documentation for SCI_LINEENDEXTEND
- documentStart
-
editor->documentStart();
Move caret to first position in document.
See Scintilla documentation for SCI_DOCUMENTSTART
- documentStartExtend
-
editor->documentStartExtend();
Move caret to first position in document extending selection to new caret position.
See Scintilla documentation for SCI_DOCUMENTSTARTEXTEND
- documentEnd
-
editor->documentEnd();
Move caret to last position in document.
See Scintilla documentation for SCI_DOCUMENTEND
- documentEndExtend
-
editor->documentEndExtend();
Move caret to last position in document extending selection to new caret position.
See Scintilla documentation for SCI_DOCUMENTENDEXTEND
- pageUp
-
editor->pageUp();
Move caret one page up.
See Scintilla documentation for SCI_PAGEUP
- pageUpExtend
-
editor->pageUpExtend();
Move caret one page up extending selection to new caret position.
See Scintilla documentation for SCI_PAGEUPEXTEND
- pageDown
-
editor->pageDown();
Move caret one page down.
See Scintilla documentation for SCI_PAGEDOWN
- pageDownExtend
-
editor->pageDownExtend();
Move caret one page down extending selection to new caret position.
See Scintilla documentation for SCI_PAGEDOWNEXTEND
- editToggleOvertype
-
editor->editToggleOvertype();
Switch from insert to overtype mode or the reverse.
See Scintilla documentation for SCI_EDITTOGGLEOVERTYPE
- cancel
-
editor->cancel();
Cancel any modes such as call tip or auto-completion list display.
See Scintilla documentation for SCI_CANCEL
- deleteBack
-
editor->deleteBack();
Delete the selection or if no selection, the character before the caret.
See Scintilla documentation for SCI_DELETEBACK
- tab
-
editor->tab();
If selection is empty or all on one line replace the selection with a tab character. If more than one line selected, indent the lines.
See Scintilla documentation for SCI_TAB
- backTab
-
editor->backTab();
Dedent the selected lines.
See Scintilla documentation for SCI_BACKTAB
- newLine
-
editor->newLine();
Insert a new line, may use a CRLF, CR or LF depending on EOL mode.
See Scintilla documentation for SCI_NEWLINE
- formFeed
-
editor->formFeed();
Insert a Form Feed character.
See Scintilla documentation for SCI_FORMFEED
- vCHome
-
editor->vCHome();
Move caret to before first visible character on line. If already there move to first character on line.
See Scintilla documentation for SCI_VCHOME
- vCHomeExtend
-
editor->vCHomeExtend();
Like VCHome but extending selection to new caret position.
See Scintilla documentation for SCI_VCHOMEEXTEND
- delWordLeft
-
editor->delWordLeft();
Delete the word to the left of the caret.
See Scintilla documentation for SCI_DELWORDLEFT
- delWordRight
-
editor->delWordRight();
Delete the word to the right of the caret.
See Scintilla documentation for SCI_DELWORDRIGHT
- delWordRightEnd
-
editor->delWordRightEnd();
Delete the word to the right of the caret, but not the trailing non-word characters.
See Scintilla documentation for SCI_DELWORDRIGHTEND
- lineCut
-
editor->lineCut();
Cut the line containing the caret.
See Scintilla documentation for SCI_LINECUT
- lineDelete
-
editor->lineDelete();
Delete the line containing the caret.
See Scintilla documentation for SCI_LINEDELETE
- lineTranspose
-
editor->lineTranspose();
Switch the current line with the previous.
See Scintilla documentation for SCI_LINETRANSPOSE
- lineReverse
-
editor->lineReverse();
Reverse the current line.
See Scintilla documentation for SCI_LINEREVERSE
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
- lineDuplicate
-
editor->lineDuplicate();
Duplicate the current line.
See Scintilla documentation for SCI_LINEDUPLICATE
- lowerCase
-
editor->lowerCase();
Transform the selection to lower case.
See Scintilla documentation for SCI_LOWERCASE
- upperCase
-
editor->upperCase();
Transform the selection to upper case.
See Scintilla documentation for SCI_UPPERCASE
- lineScrollDown
-
editor->lineScrollDown();
Scroll the document down, keeping the caret visible.
See Scintilla documentation for SCI_LINESCROLLDOWN
- lineScrollUp
-
editor->lineScrollUp();
Scroll the document up, keeping the caret visible.
See Scintilla documentation for SCI_LINESCROLLUP
- deleteBackNotLine
-
editor->deleteBackNotLine();
Delete the selection or if no selection, the character before the caret. Will not delete the character before at the start of a line.
See Scintilla documentation for SCI_DELETEBACKNOTLINE
- homeDisplay
-
editor->homeDisplay();
Move caret to first position on display line.
See Scintilla documentation for SCI_HOMEDISPLAY
- homeDisplayExtend
-
editor->homeDisplayExtend();
Move caret to first position on display line extending selection to new caret position.
See Scintilla documentation for SCI_HOMEDISPLAYEXTEND
- lineEndDisplay
-
editor->lineEndDisplay();
Move caret to last position on display line.
See Scintilla documentation for SCI_LINEENDDISPLAY
- lineEndDisplayExtend
-
editor->lineEndDisplayExtend();
Move caret to last position on display line extending selection to new caret position.
See Scintilla documentation for SCI_LINEENDDISPLAYEXTEND
- homeWrap
-
editor->homeWrap();
These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? except they behave differently when word-wrap is enabled: They go first to the start / end of the display line, like (Home|LineEnd)Display The difference is that, the cursor is already at the point, it goes on to the start or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
See Scintilla documentation for SCI_HOMEWRAP
- homeWrapExtend
-
editor->homeWrapExtend();
These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? except they behave differently when word-wrap is enabled: They go first to the start / end of the display line, like (Home|LineEnd)Display The difference is that, the cursor is already at the point, it goes on to the start or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
See Scintilla documentation for SCI_HOMEWRAPEXTEND
- lineEndWrap
-
editor->lineEndWrap();
These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? except they behave differently when word-wrap is enabled: They go first to the start / end of the display line, like (Home|LineEnd)Display The difference is that, the cursor is already at the point, it goes on to the start or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
See Scintilla documentation for SCI_LINEENDWRAP
- lineEndWrapExtend
-
editor->lineEndWrapExtend();
These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? except they behave differently when word-wrap is enabled: They go first to the start / end of the display line, like (Home|LineEnd)Display The difference is that, the cursor is already at the point, it goes on to the start or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
See Scintilla documentation for SCI_LINEENDWRAPEXTEND
- vCHomeWrap
-
editor->vCHomeWrap();
These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? except they behave differently when word-wrap is enabled: They go first to the start / end of the display line, like (Home|LineEnd)Display The difference is that, the cursor is already at the point, it goes on to the start or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
See Scintilla documentation for SCI_VCHOMEWRAP
- vCHomeWrapExtend
-
editor->vCHomeWrapExtend();
These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? except they behave differently when word-wrap is enabled: They go first to the start / end of the display line, like (Home|LineEnd)Display The difference is that, the cursor is already at the point, it goes on to the start or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
See Scintilla documentation for SCI_VCHOMEWRAPEXTEND
- lineCopy
-
editor->lineCopy();
Copy the line containing the caret.
See Scintilla documentation for SCI_LINECOPY
- wordPartLeft
-
editor->wordPartLeft();
Move to the previous change in capitalisation.
See Scintilla documentation for SCI_WORDPARTLEFT
- wordPartLeftExtend
-
editor->wordPartLeftExtend();
Move to the previous change in capitalisation extending selection to new caret position.
See Scintilla documentation for SCI_WORDPARTLEFTEXTEND
- wordPartRight
-
editor->wordPartRight();
Move to the change next in capitalisation.
See Scintilla documentation for SCI_WORDPARTRIGHT
- wordPartRightExtend
-
editor->wordPartRightExtend();
Move to the next change in capitalisation extending selection to new caret position.
See Scintilla documentation for SCI_WORDPARTRIGHTEXTEND
- delLineLeft
-
editor->delLineLeft();
Delete back from the current position to the start of the line.
See Scintilla documentation for SCI_DELLINELEFT
- delLineRight
-
editor->delLineRight();
Delete forwards from the current position to the end of the line.
See Scintilla documentation for SCI_DELLINERIGHT
- paraDown
-
editor->paraDown();
Move caret between paragraphs (delimited by empty lines).
See Scintilla documentation for SCI_PARADOWN
- paraDownExtend
-
editor->paraDownExtend();
Move caret between paragraphs (delimited by empty lines).
See Scintilla documentation for SCI_PARADOWNEXTEND
- paraUp
-
editor->paraUp();
Move caret between paragraphs (delimited by empty lines).
See Scintilla documentation for SCI_PARAUP
- paraUpExtend
-
editor->paraUpExtend();
Move caret between paragraphs (delimited by empty lines).
See Scintilla documentation for SCI_PARAUPEXTEND
- lineDownRectExtend
-
editor->lineDownRectExtend();
Move caret down one line, extending rectangular selection to new caret position.
See Scintilla documentation for SCI_LINEDOWNRECTEXTEND
- lineUpRectExtend
-
editor->lineUpRectExtend();
Move caret up one line, extending rectangular selection to new caret position.
See Scintilla documentation for SCI_LINEUPRECTEXTEND
- charLeftRectExtend
-
editor->charLeftRectExtend();
Move caret left one character, extending rectangular selection to new caret position.
See Scintilla documentation for SCI_CHARLEFTRECTEXTEND
- charRightRectExtend
-
editor->charRightRectExtend();
Move caret right one character, extending rectangular selection to new caret position.
See Scintilla documentation for SCI_CHARRIGHTRECTEXTEND
- homeRectExtend
-
editor->homeRectExtend();
Move caret to first position on line, extending rectangular selection to new caret position.
See Scintilla documentation for SCI_HOMERECTEXTEND
- vCHomeRectExtend
-
editor->vCHomeRectExtend();
Move caret to before first visible character on line. If already there move to first character on line. In either case, extend rectangular selection to new caret position.
See Scintilla documentation for SCI_VCHOMERECTEXTEND
- lineEndRectExtend
-
editor->lineEndRectExtend();
Move caret to last position on line, extending rectangular selection to new caret position.
See Scintilla documentation for SCI_LINEENDRECTEXTEND
- pageUpRectExtend
-
editor->pageUpRectExtend();
Move caret one page up, extending rectangular selection to new caret position.
See Scintilla documentation for SCI_PAGEUPRECTEXTEND
- pageDownRectExtend
-
editor->pageDownRectExtend();
Move caret one page down, extending rectangular selection to new caret position.
See Scintilla documentation for SCI_PAGEDOWNRECTEXTEND
- stutteredPageUp
-
editor->stutteredPageUp();
Move caret to top of page, or one page up if already at top of page.
See Scintilla documentation for SCI_STUTTEREDPAGEUP
- stutteredPageUpExtend
-
editor->stutteredPageUpExtend();
Move caret to top of page, or one page up if already at top of page, extending selection to new caret position.
See Scintilla documentation for SCI_STUTTEREDPAGEUPEXTEND
- stutteredPageDown
-
editor->stutteredPageDown();
Move caret to bottom of page, or one page down if already at bottom of page.
See Scintilla documentation for SCI_STUTTEREDPAGEDOWN
- stutteredPageDownExtend
-
editor->stutteredPageDownExtend();
Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position.
See Scintilla documentation for SCI_STUTTEREDPAGEDOWNEXTEND
- wordLeftEnd
-
editor->wordLeftEnd();
Move caret left one word, position cursor at end of word.
See Scintilla documentation for SCI_WORDLEFTEND
- wordLeftEndExtend
-
editor->wordLeftEndExtend();
Move caret left one word, position cursor at end of word, extending selection to new caret position.
See Scintilla documentation for SCI_WORDLEFTENDEXTEND
- wordRightEnd
-
editor->wordRightEnd();
Move caret right one word, position cursor at end of word.
See Scintilla documentation for SCI_WORDRIGHTEND
- wordRightEndExtend
-
editor->wordRightEndExtend();
Move caret right one word, position cursor at end of word, extending selection to new caret position.
See Scintilla documentation for SCI_WORDRIGHTENDEXTEND
- selectionDuplicate
-
editor->selectionDuplicate();
Duplicate the selection. If selection empty duplicate the line containing the caret.
See Scintilla documentation for SCI_SELECTIONDUPLICATE
- verticalCentreCaret
-
editor->verticalCentreCaret();
Centre current line in window.
See Scintilla documentation for SCI_VERTICALCENTRECARET
- scrollToStart
-
editor->scrollToStart();
Scroll to start of document.
See Scintilla documentation for SCI_SCROLLTOSTART
- scrollToEnd
-
editor->scrollToEnd();
Scroll to end of document.
See Scintilla documentation for SCI_SCROLLTOEND
- vCHomeDisplay
-
editor->vCHomeDisplay();
Move caret to before first visible character on display line. If already there move to first character on display line.
See Scintilla documentation for SCI_VCHOMEDISPLAY
- vCHomeDisplayExtend
-
editor->vCHomeDisplayExtend();
Like VCHomeDisplay but extending selection to new caret position.
See Scintilla documentation for SCI_VCHOMEDISPLAYEXTEND
Key bindings
These methods affect keybindings (keyboard shortcuts), and all make use of the from %SC_KEY hash values.
For normal keys (letters, numbers, punctuation), the $km ("key+modifier") code is the codepoint for that character. For special keys (arrows, Escape, and similar), use the $SC_KEY{SCK_*}
entry for that key. If you want to indicate a modified key, add on the $SC_KEY{SCK_*}
shifted 16 bits up.
# Ctrl+HOME being assigned to SCI_HOME
my $km_ctrl_home = $SC_KEY{SCK_HOME} + ($SC_KEY{SCMOD_CTRL}<<16);
notepad->assignCmdKey($km_alt_q, $SCIMSG{SCI_HOME});
# Alt+Q being assigned to SCI_SELECTALL
my $km_alt_q = ord('Q') + ($SC_KEY{SCMOD_ALT}<<16);
notepad->assignCmdKey($km_alt_q, $SCIMSG{SCI_SELECTALL});
- assignCmdKey
-
editor->assignCmdKey($km, $msg);
When key+modifier combination km is pressed perform msg.
See Scintilla documentation for SCI_ASSIGNCMDKEY
- clearCmdKey
-
editor->clearCmdKey($km);
When key+modifier combination km is pressed do nothing.
See Scintilla documentation for SCI_CLEARCMDKEY
- clearAllCmdKeys
-
editor->clearAllCmdKeys();
Drop all key mappings.
See Scintilla documentation for SCI_CLEARALLCMDKEYS
- null
-
editor->null();
Null operation.
See Scintilla documentation for SCI_NULL
Popup edit menu
- usePopUp
-
editor->usePopUp($allowPopUp);
Set whether a pop up menu is displayed automatically when the user presses the wrong mouse button.
Use $allowPopUp from %SC_POPUP.
See Scintilla documentation for SCI_USEPOPUP
Macro recording
- startRecord
-
editor->startRecord();
Start notifying the container of all key presses and commands.
See Scintilla documentation for SCI_STARTRECORD
- stopRecord
-
editor->stopRecord();
Stop notifying the container of all key presses and commands.
See Scintilla documentation for SCI_STOPRECORD
Printing
- TODO: formatRange
- TODO: formatRangeFull
-
NOT YET IMPLEMENTED
See Scintilla documentation for SCI_FORMATRANGE
See Scintilla documentation for SCI_FORMATRANGEFULL
- setPrintMagnification
- getPrintMagnification
-
editor->setPrintMagnification($magnification); editor->getPrintMagnification();
Sets the print magnification added to the point size of each style for printing.
See Scintilla documentation for SCI_SETPRINTMAGNIFICATION
See Scintilla documentation for SCI_GETPRINTMAGNIFICATION
- setPrintColourMode
- getPrintColourMode
-
editor->setPrintColourMode($mode); editor->getPrintColourMode();
Modify colours when printing for clearer printed text.
Use $mode from %SC_PRINTCOLOURMODE.
See Scintilla documentation for SCI_SETPRINTCOLOURMODE
See Scintilla documentation for SCI_GETPRINTCOLOURMODE
- setPrintWrapMode
- getPrintWrapMode
-
editor->setPrintWrapMode($mode); editor->getPrintWrapMode();
Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).
See Scintilla documentation for SCI_SETPRINTWRAPMODE
See Scintilla documentation for SCI_GETPRINTWRAPMODE
Direct access
On Windows, the message-passing scheme used to communicate between the container and Scintilla is mediated by the operating system SendMessage function and can lead to bad performance when calling intensively. To avoid this overhead, Scintilla provides messages that allow you to call the Scintilla message function directly. The code to do this in C/C++ is of the form:
#include "Scintilla.h"
SciFnDirect pSciMsg = (SciFnDirect)SendMessage(hSciWnd, SCI_GETDIRECTFUNCTION, 0, 0);
sptr_t pSciWndData = (sptr_t)SendMessage(hSciWnd, SCI_GETDIRECTPOINTER, 0, 0);
// now a wrapper to call Scintilla directly
sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
return pSciMsg(pSciWndData, iMessage, wParam, lParam);
}
While faster, this direct calling will cause problems if performed from a different thread to the native thread of the Scintilla window in which case SendMessage(hSciWnd, SCI_*, wParam, lParam) should be used to synchronize with the window's thread.
- getDirectFunction
-
editor->getDirectFunction();
This message returns the address of the function to call to handle Scintilla messages without the overhead of passing through the Windows messaging system. You need only call this once, regardless of the number of Scintilla windows you create.
The author of this module does not know how to use this "Direct access" function in pure Perl, but if you can figure it out, feel free to make a Pull Request with example usage. You could also presumably pass the pointer from this call into an Inline::C or XS function, and make use of it there.
See Scintilla documentation for SCI_GETDIRECTFUNCTION
- getDirectStatusFunction
-
editor->getDirectStatusFunction();
This is similar to
getDirectFunction()
, but the returned function is of type SciFnDirectStatus which also returns the status to the caller through a pointer to an int. This saves performing an extra call to retrieve the status in many situations so can be faster.This command requires at least Scintilla v5.2, found in Notepad++ v8.4 and newer.
- getDirectPointer
-
editor->getDirectPointer();
Retrieve a pointer value to use as the first argument when calling the function returned by GetDirectFunction.
See Scintilla documentation for SCI_GETDIRECTPOINTER
- getCharacterPointer
-
editor->getCharacterPointer();
Gets a copy of the text of the document, without first allowing Scintilla to make its copy of it. In practice, that means it does exactly the same as
editor->getText
, however, if you have the possibility of the user interfering with the document _whilst_ getCharacterPointer() is running, then it’s safer to use getText(). On larger documents, getCharacterPointer() could be noticable quicker.See Scintilla documentation for SCI_GETCHARACTERPOINTER
- getRangePointer
-
editor->getRangePointer($start, $lengthRange);
Provides direct access to the range requested.
See Scintilla documentation for SCI_GETRANGEPOINTER
- getGapPosition
-
editor->getGapPosition();
Return a position which, to avoid performance costs, should not be within the range of a call to GetRangePointer.
See Scintilla documentation for SCI_GETGAPPOSITION
Multiple views
- setDocPointer
- getDocPointer
-
editor->setDocPointer($pointer); editor->getDocPointer();
Retrieve a pointer to the document object.
See Scintilla documentation for SCI_GETDOCPOINTER
See Scintilla documentation for SCI_SETDOCPOINTER
- createDocument
-
editor->createDocument();
Create a new document object. Starts with reference count of 1 and not selected into editor.
Use $documentOptions from %SC_DOCUMENTOPTIONS.
See Scintilla documentation for SCI_CREATEDOCUMENT
- addRefDocument
-
editor->addRefDocument($doc);
Extend life of document.
See Scintilla documentation for SCI_ADDREFDOCUMENT
- releaseDocument
-
editor->releaseDocument($doc);
Release a reference to the document, deleting document if it fades to black.
See Scintilla documentation for SCI_RELEASEDOCUMENT
- getDocumentOptions
-
editor->getDocumentOptions;
Returns the options that were used to create the document.
See Scintilla documentation for SCI_GETDOCUMENTOPTIONS
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
Background loading and saving
- createLoader
-
editor->createLoader($bytes);
Create an ILoader*.
See Scintilla documentation for SCI_CREATELOADER
Folding
- visibleFromDocLine
-
editor->visibleFromDocLine($line);
Find the display line of a document line taking hidden lines into account.
See Scintilla documentation for SCI_VISIBLEFROMDOCLINE
- docLineFromVisible
-
editor->docLineFromVisible($lineDisplay);
Find the document line of a display line taking hidden lines into account.
See Scintilla documentation for SCI_DOCLINEFROMVISIBLE
- showLines
-
editor->showLines($lineStart, $lineEnd);
Make a range of lines visible.
See Scintilla documentation for SCI_SHOWLINES
- hideLines
-
editor->hideLines($lineStart, $lineEnd);
Make a range of lines invisible.
See Scintilla documentation for SCI_HIDELINES
- getLineVisible
-
editor->getLineVisible($line);
Is a line visible?
See Scintilla documentation for SCI_GETLINEVISIBLE
- getAllLinesVisible
-
editor->getAllLinesVisible();
Are all lines visible?
See Scintilla documentation for SCI_GETALLLINESVISIBLE
- setFoldLevel
- getFoldLevel
-
editor->setFoldLevel($line, $level); editor->getFoldLevel($line);
Set the fold level of a line. This encodes an integer level along with flags indicating whether the line is a header and whether it is effectively white space.
Use $level as described in %SC_FOLDLEVEL.
See Scintilla documentation for SCI_SETFOLDLEVEL
See Scintilla documentation for SCI_GETFOLDLEVEL
- setAutomaticFold
- getAutomaticFold
-
editor->setAutomaticFold($automaticFold); editor->getAutomaticFold();
Set automatic folding behaviours.
Use $automaticFold from %SC_AUTOMATICFOLD
See Scintilla documentation for SCI_SETAUTOMATICFOLD
See Scintilla documentation for SCI_GETAUTOMATICFOLD
- setFoldFlags
-
editor->setFoldFlags($flags);
Set some style options for folding.
Use $flags from %SC_FOLDFLAG
See Scintilla documentation for SCI_SETFOLDFLAGS
- getLastChild
-
editor->getLastChild($line, $level);
Find the last child line of a header line.
See Scintilla documentation for SCI_GETLASTCHILD
- getFoldParent
-
editor->getFoldParent($line);
Find the parent line of a child line.
See Scintilla documentation for SCI_GETFOLDPARENT
- setFoldExpanded
- getFoldExpanded
-
editor->setFoldExpanded($line, $expanded); editor->getFoldExpanded($line);
Show the children of a header line.
See Scintilla documentation for SCI_SETFOLDEXPANDED
See Scintilla documentation for SCI_GETFOLDEXPANDED
- contractedFoldNext
-
editor->contractedFoldNext($lineStart);
Find the next line at or after lineStart that is a contracted fold header line. Return -1 when no more lines.
See Scintilla documentation for SCI_CONTRACTEDFOLDNEXT
- toggleFold
-
editor->toggleFold($line);
Switch a header line between expanded and contracted.
See Scintilla documentation for SCI_TOGGLEFOLD
- toggleFoldShowText
-
editor->toggleFoldShowText($line, $text);
Similar to "toggleFold", but also shows the
$text
tag to the right of the folded text.See Scintilla documentation for SCI_TOGGLEFOLDSHOWTEXT
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
- foldDisplayTextSetStyle
- foldDisplayTextGetStyle
-
editor->foldDisplayTextSetStyle($style); editor->foldDisplayTextGetStyle;
Changes the appearance of fold text tags.
Use $style from %SC_FOLDDISPLAYTEXT.
See Scintilla documentation for SCI_FOLDDISPLAYTEXTSETSTYLE
See Scintilla documentation for SCI_FOLDDISPLAYTEXTGETSTYLE
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
- setDefaultFoldDisplayText
- getDefaultFoldDisplayText
-
editor->setDefaultFoldDisplayText; editor->getDefaultFoldDisplayText;
Set and get the default text displayed at the right of the folded text.
See Scintilla documentation for SCI_SETDEFAULTFOLDDISPLAYTEXT
See Scintilla documentation for SCI_GETDEFAULTFOLDDISPLAYTEXT
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
- foldLine
-
editor->foldLine($line, $action);
Expand or contract a fold header.
Use $action from %SC_FOLDACTION.
See Scintilla documentation for SCI_FOLDLINE
- foldChildren
-
editor->foldChildren($line, $action);
Expand or contract a fold header and its children.
See Scintilla documentation for SCI_FOLDCHILDREN
- foldAll
-
editor->foldAll($action);
Expand or contract all fold headers.
See Scintilla documentation for SCI_FOLDALL
- expandChildren
-
editor->expandChildren($line, $level);
Expand a fold header and all children. Use the level argument instead of the line’s current level.
See Scintilla documentation for SCI_EXPANDCHILDREN
- ensureVisible
-
editor->ensureVisible($line);
Ensure a particular line is visible by expanding any header line hiding it.
See Scintilla documentation for SCI_ENSUREVISIBLE
- ensureVisibleEnforcePolicy
-
editor->ensureVisibleEnforcePolicy($line);
Ensure a particular line is visible by expanding any header line hiding it. Use the currently set visibility policy to determine which range to display.
See Scintilla documentation for SCI_ENSUREVISIBLEENFORCEPOLICY
Line wrapping
- setWrapMode
- getWrapMode
-
editor->setWrapMode($mode); editor->getWrapMode();
Sets whether text is word wrapped.
Use $mode from %SC_WRAPMODE.
See Scintilla documentation for SCI_SETWRAPMODE
See Scintilla documentation for SCI_GETWRAPMODE
- setWrapVisualFlags
- getWrapVisualFlags
-
editor->setWrapVisualFlags($wrapVisualFlags); editor->getWrapVisualFlags();
Set the display mode of visual flags for wrapped lines.
Use $wrapVisualFlags from %SC_WRAPVISUALFLAG.
See Scintilla documentation for SCI_SETWRAPVISUALFLAGS
See Scintilla documentation for SCI_GETWRAPVISUALFLAGS
- setWrapVisualFlagsLocation
- getWrapVisualFlagsLocation
-
editor->setWrapVisualFlagsLocation($wrapVisualFlagsLocation); editor->getWrapVisualFlagsLocation();
Set the location of visual flags for wrapped lines.
Use $wrapVisualFlagsLocation from %SC_WRAPVISUALFLAGLOC.
See Scintilla documentation for SCI_SETWRAPVISUALFLAGSLOCATION
See Scintilla documentation for SCI_GETWRAPVISUALFLAGSLOCATION
- setWrapIndentMode
- getWrapIndentMode
-
editor->setWrapIndentMode($mode); editor->getWrapIndentMode();
Sets how wrapped sublines are placed. Default is fixed.
Use $mode from %SC_WRAPINDENT.
See Scintilla documentation for SCI_SETWRAPINDENTMODE
See Scintilla documentation for SCI_GETWRAPINDENTMODE
- setWrapStartIndent
- getWrapStartIndent
-
editor->setWrapStartIndent($indent); editor->getWrapStartIndent();
Set the start indent for wrapped lines.
See Scintilla documentation for SCI_SETWRAPSTARTINDENT
See Scintilla documentation for SCI_GETWRAPSTARTINDENT
- setLayoutCache
- getLayoutCache
-
editor->setLayoutCache($mode); editor->getLayoutCache();
Sets the degree of caching of layout information.
Use $mode from %SC_CACHE
See Scintilla documentation for SCI_SETLAYOUTCACHE
See Scintilla documentation for SCI_GETLAYOUTCACHE
- setPositionCache
- getPositionCache
-
editor->setPositionCache($size); editor->getPositionCache();
Set number of entries in position cache
See Scintilla documentation for SCI_SETPOSITIONCACHE
See Scintilla documentation for SCI_GETPOSITIONCACHE
- setLayoutThreads
- getLayoutThreads
-
if(editor->scintillaSupportsFeature($SC_SUPPORTS{SC_SUPPORTS_THREAD_SAFE_MEASURE_WIDTHS})) { editor->setLayoutThreads($size); editor->getLayoutThreads(); }
The time taken to measure text runs on wide lines or when wrapping can be improved by performing the task concurrently on multiple threads when scintillaSupportsFeature($SC_SUPPORTS{SC_SUPPORTS_THREAD_SAFE_MEASURE_WIDTHS}) is available. This can be a dramatic improvement - a 4 core processor is often able to reduce text layout time to just over one quarter of the single-threaded time.
The default is to use just the main thread but applications may call
setLayoutThreads
to specify the maximum number of threads to use. The number of threads is limited to the hardware concurrency of the system - for a 4 core processor with hyper-threading that would be 8. If an application just wants maximum concurrency then call with a large numberSCI_SETLAYOUTTHREADS(1000)
and that will be reduced to a reasonable value.See Scintilla documentation for SCI_SETLAYOUTTHREADS
See Scintilla documentation for SCI_GETLAYOUTTHREADS
These commands require at least Scintilla v5.2, found in Notepad++ v8.4 and newer.
- linesSplit
-
editor->linesSplit($pixelWidth);
Split the lines in the target into lines that are less wide than pixelWidth where possible.
See Scintilla documentation for SCI_LINESSPLIT
- linesJoin
-
editor->linesJoin();
Join the lines in the target.
See Scintilla documentation for SCI_LINESJOIN
- wrapCount
-
editor->wrapCount($line);
The number of display lines needed to wrap a document line
See Scintilla documentation for SCI_WRAPCOUNT
Zooming
- zoomIn
-
editor->zoomIn();
Magnify the displayed text by increasing the sizes by 1 point.
See Scintilla documentation for SCI_ZOOMIN
- zoomOut
-
editor->zoomOut();
Make the displayed text smaller by decreasing the sizes by 1 point.
See Scintilla documentation for SCI_ZOOMOUT
- setZoom
- getZoom
-
editor->setZoom($zoom); editor->getZoom();
Set the zoom level. This number of points is added to the size of all fonts. It may be positive to magnify or negative to reduce.
See Scintilla documentation for SCI_SETZOOM
See Scintilla documentation for SCI_GETZOOM
Long lines
- setEdgeMode
- getEdgeMode
-
editor->setEdgeMode($mode); editor->getEdgeMode();
Retrieve the edge highlight mode.
$mode from %SC_EDGEMODE.
See Scintilla documentation for SCI_GETEDGEMODE
See Scintilla documentation for SCI_SETEDGEMODE
- setEdgeColumn
- getEdgeColumn
-
editor->setEdgeColumn($column); editor->getEdgeColumn();
Retrieve the column number which text should be kept within.
See Scintilla documentation for SCI_GETEDGECOLUMN
See Scintilla documentation for SCI_SETEDGECOLUMN
- setEdgeColour
- getEdgeColour
-
editor->setEdgeColour($edgeColour); editor->getEdgeColour();
Retrieve the colour used in edge indication.
See Scintilla documentation for SCI_GETEDGECOLOUR
See Scintilla documentation for SCI_SETEDGECOLOUR
- multiEdgeAddLine
-
editor->multiEdgeAddLine($column, $edgeColor);
- multiEdgeClearAll
-
editor->multiEdgeClearAll;
multiEdgeAddLine
adds a new vertical edge to the view. The edge will be displayed at the given column number. The resulting edge position depends on the metric of a space character in STYLE_DEFAULT.All the edges can be cleared with
multiEdgeClearAll
.See Scintilla documentation for SCI_MULTIEDGEADDLINE
See Scintilla documentation for SCI_MULTIEDGECLEARALL
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
- getMultiEdgeColumn
-
editor->getMultiEdgeColumn($which);
Grab the Nth edge using
getMultiEdgeColumn
and the zero-based index$which
.See Scintilla documentation for SCI_GETMULTIEDGECOLUMN
Requires at least Scintilla v4.4.6, found in Notepad++ v7.9.4 and newer.
Accessibility
- setAccessibility
- getAccessibility
-
editor->setAccessibility($accessibility); editor->getAccessibility;
These methods may enable or disable accessibility and report its current status. The system caret is manipulated to help screen readers when enabled.
Use $accessibility from %SC_ACCESSIBILITY.
See Scintilla documentation for SCI_SETACCESSIBILITY
See Scintilla documentation for SCI_GETACCESSIBILITY
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
Lexer
- setLexer
- getLexer
-
editor->setLexer($lexer); editor->getLexer();
Set or retrieve the lexing language of the document, as an integer ID.
(The
setLexer
method may be eliminated from the underlying Scintilla library in favor of the ILexer5-based setILexer.)See Scintilla documentation for SCI_SETLEXER
See Scintilla documentation for SCI_GETLEXER
Deprecated in Notepad++ v8.4 with Scintilla 5.2.x.
- setILexer
-
editor->setILexer($pointer);
Set the lexer as an ILexer5. The lexer may be implemented by an application or a shared library such as Lexilla.
To test if your lexer assignment worked, use getLexer before and after setting the new lexer to see if the lexer number changed.
See Scintilla documentation for more on Lexer Objects and the new ILexer5.
See Scintilla documentation for SCI_SETILEXER
- setLexerLanguage
- getLexerLanguage
-
editor->setLexerLanguage($language); editor->getLexerLanguage();
Set the lexing language of the document based on string name.
See Scintilla documentation for SCI_SETLEXERLANGUAGE
See Scintilla documentation for SCI_GETLEXERLANGUAGE
Deprecated in Notepad++ v8.4 with Scintilla 5.2.x.
- loadLexerLibrary
-
editor->loadLexerLibrary($path);
Load a lexer library (dll / so).
See Scintilla documentation for SCI_LOADLEXERLIBRARY
Deprecated with Notepad++ v8.4 & Scintilla 5.2.x.
- colourise
-
editor->colourise($start, $end);
Colourise a segment of the document using the current lexing language.
See Scintilla documentation for SCI_COLOURISE
- changeLexerState
-
editor->changeLexerState($start, $end);
Indicate that the internal state of a lexer has changed over a range and therefore there may be a need to redraw.
See Scintilla documentation for SCI_CHANGELEXERSTATE
- propertyNames
-
editor->propertyNames();
Retrieve a ‘\n’ separated list of properties understood by the current lexer.
See Scintilla documentation for SCI_PROPERTYNAMES
- propertyType
-
editor->propertyType($name);
Retrieve the type of a property (boolean, integer, or string). Returns one of the values in %SC_TYPE.
See Scintilla documentation for SCI_PROPERTYTYPE
- describeProperty
-
editor->describeProperty();
Describe a property
See Scintilla documentation for SCI_DESCRIBEPROPERTY
- setProperty
- getProperty
-
editor->setProperty($key, $value); editor->getProperty($key);
Set up a value that may be used by a lexer for some optional feature.
See Scintilla documentation for SCI_SETPROPERTY
See Scintilla documentation for SCI_GETPROPERTY
- getPropertyExpanded
-
editor->getPropertyExpanded($key);
Retrieve a “property” value previously set with SetProperty, with “$()” variable replacement on returned buffer.
See Scintilla documentation for SCI_GETPROPERTYEXPANDED
- getPropertyInt
-
editor->getPropertyInt($key);
Retrieve a “property” value previously set with SetProperty, interpreted as an int AFTER any “$()” variable replacement.
See Scintilla documentation for SCI_GETPROPERTYINT
- describeKeyWordSets
-
editor->describeKeyWordSets();
Retrieve a ‘\n’ separated list of descriptions of the keyword sets understood by the current lexer.
See Scintilla documentation for SCI_DESCRIBEKEYWORDSETS
- setKeyWords
-
editor->setKeyWords($keywordSet, $keyWords);
Set up the key words used by the lexer.
$keywordSet is an index from 0 to $KEYWORDSET{KEYWORDSET_MAX}, indicating which group of keywords is being defined.
See Scintilla documentation for SCI_SETKEYWORDS
- getSubStyleBases
-
editor->getSubStyleBases();
Get the set of base styles that can be extended with sub styles
See Scintilla documentation for SCI_GETSUBSTYLEBASES
- distanceToSecondaryStyles
-
editor->distanceToSecondaryStyles();
Where styles are duplicated by a feature such as active/inactive code return the distance between the two types.
See Scintilla documentation for SCI_DISTANCETOSECONDARYSTYLES
- allocateSubStyles
-
editor->allocateSubStyles($styleBase, $numberStyles);
Allocate a set of sub styles for a particular base style, returning start of range
See Scintilla documentation for SCI_ALLOCATESUBSTYLES
- freeSubStyles
-
editor->freeSubStyles();
Free allocated sub styles
See Scintilla documentation for SCI_FREESUBSTYLES
- getSubStylesStart
-
editor->getSubStylesStart($styleBase);
The starting style number for the sub styles associated with a base style
See Scintilla documentation for SCI_GETSUBSTYLESSTART
- getSubStylesLength
-
editor->getSubStylesLength($styleBase);
The number of sub styles associated with a base style
See Scintilla documentation for SCI_GETSUBSTYLESLENGTH
- getStyleFromSubStyle
-
editor->getStyleFromSubStyle($subStyle);
For a sub style, return the base style, else return the argument.
See Scintilla documentation for SCI_GETSTYLEFROMSUBSTYLE
- getPrimaryStyleFromStyle
-
editor->getPrimaryStyleFromStyle($style);
For a secondary style, return the primary style, else return the argument.
See Scintilla documentation for SCI_GETPRIMARYSTYLEFROMSTYLE
- setIdentifiers
-
editor->setIdentifiers($style, $identifiers);
Set the identifiers that are shown in a particular style
See Scintilla documentation for SCI_SETIDENTIFIERS
- privateLexerCall
-
editor->privateLexerCall($operation, $pointer);
For private communication between an application and a known lexer.
See Scintilla documentation for SCI_PRIVATELEXERCALL
- getNamedStyles
-
editor->getNamedStyles;
Retrieve the number of named styles for the lexer.
See Scintilla documentation for SCI_GETNAMEDSTYLES
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
- nameOfStyle
-
editor->nameOfStyle($style);
Retrieve the name of a style. The name will look like a constant, such as "SCE_C_COMMENTDOC"
See Scintilla documentation for SCI_NAMEOFSTYLE
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
-
editor->tagsOfStyle($style);
Retrieve the tags of a style. This is a space-separated set of words like "comment documentation".
See Scintilla documentation for SCI_TAGSOFSTYLE
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
- descriptionOfStyle
-
editor->descriptionOfStyle($style);
Retrieve an English-language description of a style which may be suitable for display in a user interface. This looks like "Doc comment: block comments beginning with /** or /*!".
See Scintilla documentation for SCI_DESCRIPTIONOFSTYLE
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
Notifications
- setModEventMask
- getModEventMask
-
editor->setModEventMask($mask); editor->getModEventMask();
Set which document modification events are sent to the container.
Use $mask as a bitwise-or of values from %SC_MOD.
See Scintilla documentation for SCI_SETMODEVENTMASK
See Scintilla documentation for SCI_GETMODEVENTMASK
- setCommandEvents
- getCommandEvents
-
editor->setCommandEvents($commandEvents); editor->getCommandEvents;
These messages set and get whether SCEN_* command events are sent to the container.
$commandEvents
needs to be set to 1 to to send the events, or 0 to disable sending.See Scintilla documentation for SCI_SETCOMMANDEVENTS
See Scintilla documentation for SCI_GETCOMMANDEVENTS
Requires at least Scintilla v4.2.0, found in Notepad++ v7.8 and newer.
- setMouseDwellTime
- getMouseDwellTime
-
editor->setMouseDwellTime($periodMilliseconds); editor->getMouseDwellTime();
Sets the time the mouse must sit still to generate a mouse dwell event, in milliseconds (so a value of 1000 would set a dwell time of 1 second).
Use $periodMilliseconds of $SC_TIMEOUT{SC_TIME_FOREVER} to generate no dwell events.
See Scintilla documentation for SCI_SETMOUSEDWELLTIME
See Scintilla documentation for SCI_GETMOUSEDWELLTIME
- setIdentifier
- getIdentifier
-
editor->setIdentifier($identifier); editor->getIdentifier();
Set the identifier reported as idFrom in notification messages.
See Scintilla documentation for SCI_SETIDENTIFIER
See Scintilla documentation for SCI_GETIDENTIFIER
Other Messages
- notepad()->SendMessage( $msgid, $wparam, $lparam )
-
For any messages not implemented in the API, if you know the appropriate $msgid, and what are needed as $wparam and $lparam, you can send the message to the Notepad GUI directly.
If you have developed a wrapper for a missing message, feel free to send in a Pull Request, or open an issue, including your wrapper code.
Helper Methods
- forEachLine
-
my $coderef = sub { my ($contents, $lineNumber, $totalLines)=@_; ... }; editor->forEachLine( $coderef );
The
$coderef
can be an anonymous subroutine (as shown above) or use\&namedFunc
to run a named function.This helper will run the code found at
$coderef
, once per line in the editor's document. The function gets passed three arguments: the contents of the line (including any newline sequence), the line number (starts at 0), and the total number of lines.If the function returns a number, that number is added to the current line number to determine the next line number; if it returns an undef, it will use the default increment of 1 (effectively,
$lineNumber += $retval//1)
). The function should return a zero to indicate that it should stay on the same line (which is useful if the function deleted a line)For example,
sub testContents { my ($contents, $lineNumber, $totalLines) = @_; chomp($contents); if($contents eq 'rubbish') { editor->deleteLine($lineNumber); return 0; # stay on same line, because it's deleted } elsif($contents eq 'something old') { editor->replaceLine($lineNumber, "something new"); # replaceLine not yet implemented } elsif($contents eq 'little something') { editor->replaceLine($lineNumber, "BIG\r\nSOMETHING"); # replaceLine not yet implemented return 2; # replaced single with two lines, so need to go the extra line } # could return 1 here, but undef works as well; # note in perl, you _could_ just exit without returning, as in the PythonScript example, # but in perl, that would return the last statement value, which isn't what you want return; } editor->forEachLine(\&testContents);
- deleteLine
-
editor->deleteLine($lineNumber);
Deletes the given (zero indexed) line number.
- replaceLine
-
editor->replaceLine($lineNumber, $newContents);
Replaces the given (zero indexed) line number (excluding newline sequence) with the given contents
- replaceWholeLine
-
editor->replaceWholeLine($lineNumber, $newContents);
Replaces the given (zero indexed) line number (including newline sequence) with the given contents: thus, if $newContents does not end with a newline, then it will be on the same line as what was originally line
$lineNumber+1
. - ================================================
-
TODO: need to figure out how to implement the search/replace helper methods described in PythonScript API, as much as is possible.
Until such time as they are implemented, it is recommended you just use the already-existing "Searching" methods; or, if that's not sufficient, use
getText()
andsetText()
to pass the whole file into and out of Perl, and use the power of Perl for your text manipulations. - search
-
editor->search(...);
- research
-
editor->research(...);
- replace
-
editor->replace(...);
- rereplace
-
editor->rereplace(...);
- ================================================
- flash
-
editor->flash(); # 50ms (default) editor->flash($sec); # flashes for $sec seconds editor->flash($sec, $force); # force a time that's longer than 1sec if $sec>=1 and $force is true
Flashes the active editor file by inverting the colors of the active file for a time (in seconds) of
$sec
(or 50ms if no argument passed); after that time has elapsed, it will go back to the normal coloring.Please notice that
$sec
is in seconds, so 50ms would be written as$sec = 0.050;
, not$sec = 50;
.If you supply a
$sec
of 1 or greater, theflash()
method will warn you that there will be a long delay, unless you also set$force
to a true value. - getEOLString
-
editor->getEOLString();
Returns the actual string for the EOL symbol (either
\r\n
,\r
, or\n
). This is derived from "getEOLMode", which just returns the mode number. - getFileEndPosition
-
editor->getFileEndPosition();
Returns the position after the final character in the file.
This is similar to
getLineCount()
, but returns a position rather than a line number.This is similar to
getLineEndPosition($line)
, but returns the position of the last line rather than the specified line.This is similar to
getLength()
, but in multi-byte encodings, they may or may not be different numbers. - getUserLineSelection
- getUserCharSelection
-
my ($startLine, $endLine) = @{ editor->getUserLineSelection() }; my ($startByte, $endByte) = @{ editor->getUserCharSelection() };
Get either the line numbers or byte numbers for the start and end of the currently-active selection (0 indicates the start of the document). If nothing is selected, it will return the start and end positions (lines or bytes) values for the whole file.
These are useful if you want your script to be able to run over a number of lines or characters: if your user selects nothing, the whole file will be processed; if the user selects text, then the actions in your script can be limited to just the active selection.
- getWord
- getCurrentWord
-
editor->getWord($position, $useOnlyWordChars); editor->getWord($position); editor->getWord(undef, $useOnlyWordChars); editor->getWord(); editor->getCurrentWord();
Uses
wordStartPosition
,wordEndPosition
, andgetTextRange
to grab the value of the word at the given $position.If
$position
is not given orundef
, the current caret position is used.$useOnlyWordChars
is a boolean which determines whether to use Scintilla's default definition of "words" (see Scintilla "Words" documentation) or not. If it is not given orundef
, it will default to a true value.The
getCurrentWord
method is an alias forgetWord()
with no arguments (so using the current word and the default "word" definition). - setTarget
-
editor->setTarget($start, $end); # HELPER: alias for setTargetRange
For compatibility reasons,
setTarget()
is an alias forsetTargetRange()
- write
-
editor->write($text); # HELPER: alias for addText
For compatibility reasons,
write()
is an alias foraddText()
EXPORTS
The primary interface is through the "SCINTILLA EDITOR API", implemented through object methods.
However, there are some hash variables that are useful for use with the API. These can be exported individually, or using the :vars
or :all
tags.
- :vars
-
Exports the variables in Win32::Mechanize::NotepadPlusPlus::Editor::Messages. See that sub-module for details on all the variables available.
It's usually used via Win32::Mechanize::NotepadPlusPlus's
:vars
tag, which exports the variables in Win32::Mechanize::NotepadPlusPlus::Notepad::Messages and in Win32::Mechanize::NotepadPlusPlus::Editor::Messages:use Win32::Mechanize::NotepadPlusPlus ':vars';
- :all
-
Exports everything that can be exported.
INSTALLATION
Installed as part of Win32::Mechanize::NotepadPlusPlus
AUTHOR
Peter C. Jones <petercj AT cpan DOT org>
Please report any bugs or feature requests emailing <bug-Win32-Mechanize-NotepadPlusPlus AT rt.cpan.org>
or thru the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Win32-Mechanize-NotepadPlusPlus, or thru the repository's interface at https://github.com/pryrt/Win32-Mechanize-NotepadPlusPlus/issues.
COPYRIGHT
Copyright (C) 2019,2020,2021 Peter C. Jones
LICENSE
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information.