From 4c06fe443f2dd9d6235c9cf95d38f7054cfd82b2 Mon Sep 17 00:00:00 2001
From: Neil
○ Text retrieval and modification
- ○ Searching and replacing
- ○ Overtype
+ ○ Information
+ ○ By character or UTF-16 code unit
-
○ Cut, copy and paste
○ Error handling
- ○ Undo and Redo
+ ○ Selection
+ ○ Multiple Selection and Virtual Space
-
○ Change history
- ○ Selection and information
- ○ By character or UTF-16 code unit
+ ○ Overtype
+ ○ Searching and replacing
+ ○ Cut, copy and paste
-
○ Multiple Selection and Virtual Space
+ ○ Undo and Redo
+ ○ Change history
○ Scrolling and automatic scrolling
- ○ White space
+
○ White space
○ Cursor
○ Mouse capture
- ○ Line endings
+
○ Line endings
○ Words
○ Styling
- ○ Style definition
+
○ Style definition
○ Element colours
○ Selection, caret, and hotspot styles
- ○ Character representations
+
○ Character representations
○ Margins
○ Annotations
- ○ Other settings
+
+
+ ○ End of Line Annotations
+ ○ Other settings
○ Brace highlighting
+
○ Tabs and Indentation Guides
○ Markers
+ ○ Indicators
-
○ Indicators
○ Autocompletion
○ User lists
+ ○ Call tips
-
○ Call tips
○ Keyboard commands
○ Key bindings
+ ○ Popup edit menu
-
○ Popup edit menu
○ Macro recording
○ Printing
+ ○ Direct access
-
○ Direct access
○ Multiple views
○ Background loading and saving
+ ○ Folding
-
○ Folding
○ Line wrapping
○ Zooming
+ ○ Long lines
-
○ Long lines
○ Accessibility
○ Lexer
+ ○ Lexer objects
-
○ Lexer objects
○ Notifications
○ Images
+ ○ GTK
-
○ GTK
○ Provisional messages
○ Deprecated messages
+ ○ Edit messages never supported by Scintilla
-
-
- ○ Edit messages never supported by Scintilla
○ Removed features
○ Building Scintilla
-
@@ -548,7 +549,7 @@
SCI_GETTEXT○ End of Line Annotations
-
SCI_REPLACESEL(<unused>, const char *text)
- The currently selected text between the anchor
+ The currently selected text between the anchor
and the current position is replaced by the 0 terminated text string. If the anchor and
current position are the same, the text is inserted at the caret position. The caret is
positioned after the inserted text and the caret is scrolled into view.
- There are methods to search for text and for regular expressions.
- Most applications should use
- SCI_SEARCHINTARGET
- as the basis for their search implementations.
- Other calls augment this or were implemented before SCI_SEARCHINTARGET
.
-
- The base regular expression support
- is limited and should only be used for simple cases and initial development.
- The C++ runtime <regex> library may be used by setting the SCFIND_CXX11REGEX
search flag.
- The C++11 <regex> support may be disabled by
- compiling Scintilla with NO_CXX11_REGEX
defined.
- A different regular expression
- library can be integrated into Scintilla
- or can be called from the container using direct access to the buffer contents through
- SCI_GETCHARACTERPOINTER.
-
SCI_GETLINECOUNT → line
+ This returns the number of lines in the document. An empty document contains 1 line. A
+ document holding only an end of line sequence has 2 lines.
Searching can be performed within the target range with SCI_SEARCHINTARGET
,
- which uses a counted string to allow searching for null characters. It returns the
- position of the start of the matching text range or -1 for failure, in which case the target is not moved. The flags used by
- SCI_SEARCHINTARGET
such as SCFIND_MATCHCASE
,
- SCFIND_WHOLEWORD
, SCFIND_WORDSTART
, and SCFIND_REGEXP
- can be set with SCI_SETSEARCHFLAGS
.
- SCI_SETTARGETSTART(position start)
- SCI_GETTARGETSTART → position
- SCI_SETTARGETSTARTVIRTUALSPACE(position space)
- SCI_GETTARGETSTARTVIRTUALSPACE → position
- SCI_SETTARGETEND(position end)
- SCI_GETTARGETEND → position
- SCI_SETTARGETENDVIRTUALSPACE(position space)
- SCI_GETTARGETENDVIRTUALSPACE → position
- SCI_SETTARGETRANGE(position start, position end)
- SCI_TARGETFROMSELECTION
- SCI_TARGETWHOLEDOCUMENT
- SCI_SETSEARCHFLAGS(int searchFlags)
- SCI_GETSEARCHFLAGS → int
- SCI_SEARCHINTARGET(position length, const char *text) → position
- SCI_GETTARGETTEXT(<unused>, char *text) → position
- SCI_REPLACETARGET(position length, const char *text) → position
- SCI_REPLACETARGETMINIMAL(position length, const char *text) → position
- SCI_REPLACETARGETRE(position length, const char *text) → position
- SCI_GETTAG(int tagNumber, char *tagValue) → int
-
+ SCI_LINESONSCREEN → line
+ This returns the number of complete lines visible on the screen. With a constant line height,
+ this is the vertical space available divided by the line separation. Unless you arrange to size
+ your window to an integral number of lines, there may be a partial line visible at the bottom
+ of the view.
SCI_SETTARGETSTART(position start)
- SCI_GETTARGETSTART → position
- SCI_SETTARGETSTARTVIRTUALSPACE(position space)
- SCI_GETTARGETSTARTVIRTUALSPACE → position
- SCI_SETTARGETEND(position end)
- SCI_GETTARGETEND → position
- SCI_SETTARGETENDVIRTUALSPACE(position space)
- SCI_GETTARGETENDVIRTUALSPACE → position
- SCI_SETTARGETRANGE(position start, position end)
- These functions set and return the start and end of the target. When searching
- you can set start greater than end to find the last matching text in the
- target rather than the first matching text.
- Setting a target position with SCI_SETTARGETSTART
, SCI_SETTARGETEND
, or SCI_SETTARGETRANGE
- sets the virtual space to 0.
- The target is also set by a successful
- SCI_SEARCHINTARGET
.
The virtual space of the target range can be set and retrieved with the corresponding ...VIRTUALSPACE
- methods. This allows text to be inserted in virtual space more easily.
SCI_GETMODIFY → bool
+ This returns non-zero if the document is modified and 0 if it is unmodified. The modified
+ status of a document is determined by the undo position relative to the save point. The save
+ point is set by ,
+ usually when you have saved data to a file.
SCI_TARGETFROMSELECTION
- Set the target start and end to the start and end positions of the selection.
If you need to be notified when the document becomes modified, Scintilla notifies the + container that it has entered or left the save point with the notification messages.
+ + andSCI_LINEFROMPOSITION(position pos) → line
+ This message returns the line that contains the position pos
in the document. The
+ return value is 0 if pos
<= 0. The return value is the last line if
+ pos
is beyond the end of the document.
SCI_TARGETWHOLEDOCUMENT
- Set the target start to the start of the document and target end to the end of the document.
SCI_POSITIONFROMLINE(line line) → position
+ This returns the document position that corresponds with the start of the line. If
+ line
is negative, the position of the line holding the start of the selection is
+ returned. If line
is greater than the lines in the document, the return value is
+ -1. If line
is equal to the number of lines in the document (i.e. 1 line past the
+ last line), the return value is the end of the document.
SCI_SETSEARCHFLAGS(int searchFlags)
- SCI_GETSEARCHFLAGS → int
- These get and set the searchFlags
used by
- SCI_SEARCHINTARGET
. There are several option flags including a simple regular
- expression search.
SCI_GETLINEENDPOSITION(line line) → position
+ This returns the position at the end of the line, before any line end characters. If line
+ is the last line in the document (which does not have any end of line characters) or greater,
+ the result is the size of the document.
+ If line
is negative the result is undefined.
SCI_SEARCHINTARGET(position length, const char *text) → position
- This searches for the first occurrence of a text string in the target defined by
- SCI_SETTARGETSTART
and SCI_SETTARGETEND
. The text string is not zero
- terminated; the size is set by length
. The search is modified by the search flags
- set by SCI_SETSEARCHFLAGS
. If the search succeeds, the target is set to the found
- text and the return value is the position of the start of the matching text. If the search
- fails, the result is -1.
SCI_LINELENGTH(line line) → position
+ This returns the length of the line, including any line end characters. If line
+ is negative or beyond the last line in the document, the result is 0. If you want the length of
+ the line not including any end of line characters, use - .
SCI_GETTARGETTEXT(<unused>, char *text) → position
- Retrieve the value in the target.
SCI_GETCOLUMN(position pos) → position
+ This message returns the column number of a position pos
within the document
+ taking the width of tabs into account. This returns the column number of the last tab on the
+ line before pos
, plus the number of characters between the last tab and
+ pos
. If there are no tab characters on the line, the return value is the number of
+ characters up to the position on the line. In both cases, double byte characters count as a
+ single character. This is probably only useful with monospaced fonts.
SCI_REPLACETARGET(position length, const char *text) → position
- 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.
SCI_FINDCOLUMN(line line, position column) → position
+ This message returns the position of a column
on a line
+ taking the width of tabs into account. It treats a multi-byte character as a single column.
+ Column numbers, like lines start at 0.
SCI_REPLACETARGETMINIMAL(position length, const char *text) → position
- This is similar to
- 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.
SCI_POSITIONBEFORE(position pos) → position
+ SCI_POSITIONAFTER(position pos) → position
+ These messages return the position before and after another position
+ in the document taking into account the current code page. The minimum
+ position returned is 0 and the maximum is the last position in the document.
+ If called with a position within a multi byte character will return the position
+ of the start/end of that character.
SCI_REPLACETARGETRE(position length, const char *text) → position
- This replaces the target using regular expressions. If length
is -1,
- text
is a zero terminated string, otherwise length
is the number of
- characters to use. The replacement string is formed from the text string with any sequences of
- \1
through \9
replaced by tagged matches from the most recent regular
- expression search. \0
is replaced with all the matched text from the most recent search.
- After replacement, the target range refers to the replacement text.
- The return value is the length of the replacement string.
SCI_TEXTWIDTH(int style, const char *text) → int
+ This returns the pixel width of a string drawn in the given style
which can
+ be used, for example, to decide how wide to make the line number margin in order to display a
+ given number of numerals.
SCI_GETTAG(int tagNumber, char *tagValue NUL-terminated) → int
- Discover what text was matched by tagged expressions in a regular expression search.
- This is useful if the application wants to interpret the replacement string itself.
SCI_TEXTHEIGHT(line line) → int
+ This returns the height in pixels of a particular line. Currently all lines are the same
+ height.
See also:
+SCI_POSITIONFROMPOINT(int x, int y) → position
+ SCI_POSITIONFROMPOINTCLOSE(int x, int y) → position
+ SCI_POSITIONFROMPOINT
finds the closest character position to a point and
+ SCI_POSITIONFROMPOINTCLOSE
is similar but returns -1 if the point is outside the
+ window or not close to any characters.
searchFlags
- Several of the search routines use flag options, which include a simple regular expression
- search. Combine the flag options by adding them:
SCI_CHARPOSITIONFROMPOINT(int x, int y) → position
+ SCI_CHARPOSITIONFROMPOINTCLOSE(int x, int y) → position
+ SCI_CHARPOSITIONFROMPOINT
finds the closest character to a point and
+ SCI_CHARPOSITIONFROMPOINTCLOSE
is similar but returns -1 if the point is outside the
+ window or not close to any characters. This is similar to the previous methods but finds characters rather than
+ inter-character positions.
SCFIND_NONE |
+ Default setting is case-insensitive literal match. | -
SCFIND_MATCHCASE |
+ A match only occurs with text that matches the case of the search string. | -
SCFIND_WHOLEWORD |
+ A match only occurs if the characters before and after are not word characters as defined - by | - .
SCFIND_WORDSTART |
+ A match only occurs if the character before is not a word character as defined - by | - .
SCFIND_REGEXP |
+ The search string should be interpreted as a regular expression.
- Uses Scintilla's base implementation unless combined with SCFIND_CXX11REGEX . |
-
SCFIND_POSIX |
+ Treat regular expression in a more POSIX compatible manner
- by interpreting bare ( and ) for tagged sections rather than \( and \).
- Has no effect when SCFIND_CXX11REGEX is set. |
-
SCFIND_CXX11REGEX |
+ This flag may be set to use C++11 <regex> instead of Scintilla's basic regular expressions.
- If the regular expression is invalid then -1 is returned and status is set to
- SC_STATUS_WARN_REGEX .
- The ECMAScript flag is set on the regex object and UTF-8 documents will exhibit Unicode-compliant
- behaviour. For MSVC, where wchar_t is 16-bits, the regular expression ".." will match a single
- astral-plane character. There may be other differences between compilers.
- Must also have SCFIND_REGEXP set. |
-
SCI_SETSTATUS(int status)
+ SCI_GETSTATUS → int
+
- In a regular expression, using Scintilla's base implementation, - special characters interpreted are:
+SCI_SETSTATUS(int status)
+ SCI_GETSTATUS → int
+ If an error occurs, Scintilla may set an internal error number that can be retrieved with
+ SCI_GETSTATUS
.
+ To clear the error status call SCI_SETSTATUS(0)
.
+ Status values from 1 to 999 are errors and status SC_STATUS_WARN_START
(1000)
+ and above are warnings.
+ The currently defined statuses are:
+
. |
-
- Matches any character | +SC_STATUS_OK |
+ 0 | +No failures |
---|---|---|---|---|
\( |
-
- This marks the start of a region for tagging a match. | +SC_STATUS_FAILURE |
+ 1 | +Generic failure |
\) |
-
- This marks the end of a tagged region. | +SC_STATUS_BADALLOC |
+ 2 | +Memory is exhausted |
\n |
-
- Where n is 1 through 9 refers to the first through ninth tagged region
- when replacing. For example, if the search string was Fred\([1-9]\)XXX and
- the replace string was Sam\1YYY , when applied to Fred2XXX this
- would generate Sam2YYY .
- \0 refers to all of the matching text. |
+ SC_STATUS_WARN_REGEX |
+ 1001 | +Regular expression is invalid |
\< |
+
\>
Scintilla maintains a selection that stretches between two points, the anchor and the + current position. If the anchor and the current position are the same, there is no selected + text. Positions in the document range from 0 (before the first character), to the document size + (after the last character). If you use messages, there is nothing to stop you setting a + position that is in the middle of a CRLF pair, or in the middle of a 2 byte character. However, + keyboard commands will not move the caret into such positions.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- SCI_SETSEL(position anchor, position caret)
+ This message sets both the anchor and the current position. If caret
is
+ negative, it means the end of the document. If anchor
is negative, it means
+ remove any selection (i.e. set the anchor to the same position as caret
). The
+ caret is scrolled into view after this operation.
\x
SCI_GOTOPOS(position caret)
+ This removes any selection, sets the caret at caret
and scrolls the view to make
+ the caret visible, if necessary. It is equivalent to
+ SCI_SETSEL(caret, caret)
. The anchor position is set the same as the current
+ position.
SCI_GOTOLINE(line line)
+ This removes any selection and sets the caret at the start of line number line
+ and scrolls the view (if needed) to make it visible. The anchor position is set the same as the
+ current position. If line
is outside the lines in the document (first line is 0),
+ the line set is the first or last.
[...]
SCI_SETCURRENTPOS(position caret)
+ This sets the current position and creates a selection between the anchor and the current
+ position. The caret is not scrolled into view.
See also:
-[^...]
SCI_GETCURRENTPOS → position
+ This returns the current position.
SCI_SETANCHOR(position anchor)
+ This sets the anchor position and creates a selection between the anchor position and the
+ current position. The caret is not scrolled into view.
^
See also:
-SCI_GETANCHOR → position
+ This returns the current anchor position.
SCI_SETSELECTIONSTART(position anchor)
+ SCI_SETSELECTIONEND(position caret)
+ These set the selection based on the assumption that the anchor position is less than the
+ current position. They do not make the caret visible. The table shows the positions of the
+ anchor and the current position after using these messages.
$ |
+ + New value for + | -This matches the end of a line. | +anchor | + +caret |
---|---|---|---|---|
* |
+ SCI_SETSELECTIONSTART |
- This matches 0 or more times. For example, Sa*m matches Sm ,
- Sam , Saam , Saaam and so on. |
+ anchor |
+
+ Max( anchor , current) |
+ |
+ SCI_SETSELECTIONEND |
- This matches 1 or more times. For example, Sa+m matches
- Sam , Saam , Saaam and so on. |
+ Min(anchor, caret ) |
+
+ caret |
Regular expressions will only match ranges within a single line, never matching over multiple lines.
- -When using SCFIND_CXX11REGEX
more features are available,
- generally similar to regular expression support in JavaScript.
- See the documentation of your C++ runtime for details on what is supported.
See also:
-
-
-
-
-
-
+ SCI_GETSELECTIONSTART → position
+ SCI_GETSELECTIONEND → position
+ These return the start and end of the selection without regard to which end is the current
+ position and which is the anchor. SCI_GETSELECTIONSTART
returns the smaller of the
+ current position or the anchor position. SCI_GETSELECTIONEND
returns the larger of
+ the two values.
SCI_FINDTEXT(int searchFlags, Sci_TextToFind *ft) → position
- SCI_FINDTEXTFULL(int searchFlags, Sci_TextToFindFull *ft) → position
- These messages search for text in the document. They do not use or move the current selection.
- The searchFlags
argument controls the
- search type, which includes regular expression searches.
SCI_SETEMPTYSELECTION(position caret)
+ This removes any selection and sets the caret at caret
. The caret is not scrolled into view.
You can - search backwards to find the previous occurrence of a search string by setting the end of the - search range before the start.
+SCI_SELECTALL
+ This selects all the text in the document. The current position is not scrolled into view.
The Sci_TextToFind
and Sci_TextToFindFull
structures are defined in Scintilla.h
; set
- chrg.cpMin
and chrg.cpMax
with the range of positions in the document
- to search. You can search backwards by
- setting chrg.cpMax
less than chrg.cpMin
.
- Set the lpstrText
member of Sci_TextToFind
to point at a zero terminated
- text string holding the search pattern. If your language makes the use of Sci_TextToFind
- difficult, you should consider using SCI_SEARCHINTARGET
instead.
- On 64-bit Win32, SCI_FINDTEXT
is limited to the first 2G of text and SCI_FINDTEXTFULL
removes this limitation.
SCI_HIDESELECTION(bool hide)
+ SCI_GETSELECTIONHIDDEN → bool
+ The normal state is to make the selection visible by drawing it as set by , , and related calls.
+ However, if you hide the selection, it is drawn as normal text.
The return value is -1 if the search fails or the position of the start of the found text if
- it succeeds. The chrgText.cpMin
and chrgText.cpMax
members of
- Sci_TextToFind
are filled in with the start and end positions of the found text.
SCI_GETSELTEXT(<unused>, char *text NUL-terminated) → position
+ This copies the currently selected text and a terminating NUL(0) byte to the text
+ buffer. The buffer size should be determined by calling with a NULL pointer for the text
argument:
+ 1 + SCI_GETSELTEXT(0, NULL)
.
+ This allows for rectangular and discontiguous selections as well as simple selections.
+ See Multiple Selection for information on
+ how multiple and rectangular selections and virtual space are copied.
See also:
See also: SCI_GETCURLINE,
+ SCI_GETLINE,
+ SCI_GETTEXT,
+ SCI_GETSTYLEDTEXT,
+ SCI_GETTEXTRANGE
+
Sci_TextToFind
- This structure is defined to have exactly the same shape as the Win32 structure
- FINDTEXTEX
for old code that treated Scintilla as a RichEdit control.
-struct Sci_TextToFind { - struct Sci_CharacterRange chrg; // range to search - const char *lpstrText; // the search pattern (zero terminated) - struct Sci_CharacterRange chrgText; // returned as position of matching text -}; -+
SCI_GETCURLINE(position length, char *text NUL-terminated) → position
+ This retrieves the text of the line containing the caret and returns the position within the
+ line of the caret. Pass in char* text
pointing at a buffer large enough to hold
+ the text you wish to retrieve and a terminating NUL(0) character.
+ Set length
to the
+ length of the buffer not including the terminating NUL character.
+ If the text argument is NULL(0) then the length that should be allocated
+ to store the entire current line is returned.
Sci_TextToFindFull
- This structure extends Sci_TextToFind
to support huge documents on Win32.
-struct Sci_TextToFindFull { - struct Sci_CharacterRangeFull chrg; // range to search - const char *lpstrText; // the search pattern (zero terminated) - struct Sci_CharacterRangeFull chrgText; // returned as position of matching text -}; -+
See also: SCI_GETSELTEXT,
+ SCI_GETLINE,
+ SCI_GETTEXT,
+ SCI_GETSTYLEDTEXT,
+ SCI_GETTEXTRANGE
SCI_SEARCHANCHOR
- SCI_SEARCHNEXT(int searchFlags, const char *text) → position
- SCI_SEARCHPREV(int searchFlags, const char *text) → position
- These messages provide relocatable search support. This allows multiple incremental
- interactive searches to be macro recorded while still setting the selection to found text so
- the find/select operation is self-contained. These three messages send notifications if macro recording is enabled.
SCI_SELECTIONISRECTANGLE → bool
+ This returns 1 if the current selection is in rectangle mode, 0 if not.
SCI_SEARCHANCHOR
sets the search start point used by
- SCI_SEARCHNEXT
and SCI_SEARCHPREV
to the start of the current
- selection, that is, the end of the selection that is nearer to the start of the document. You
- should always call this before calling either of SCI_SEARCHNEXT
or
- SCI_SEARCHPREV
.
SCI_SETSELECTIONMODE(int selectionMode)
+ SCI_GETSELECTIONMODE → int
+ The two functions set and get the selection mode, which can be
+ stream (SC_SEL_STREAM
=0) or
+ rectangular (SC_SEL_RECTANGLE
=1) or
+ by lines (SC_SEL_LINES
=2)
+ or thin rectangular (SC_SEL_THIN
=3).
+ When set in these modes, regular caret moves will extend or reduce the selection,
+ until the mode is cancelled by a call with same value or with SCI_CANCEL
.
+ The get function returns the current mode even if the selection was made by mouse
+ or with regular extended moves.
+ SC_SEL_THIN
is the mode after a rectangular selection has been typed into and ensures
+ that no characters are selected.
SCI_SEARCHNEXT
and SCI_SEARCHPREV
search for the next and previous
- occurrence of the zero terminated search string pointed at by text. The search is modified by
- the searchFlags
.
SCI_GETMOVEEXTENDSSELECTION → bool
+ This returns 1 if regular caret moves will extend or reduce the selection, 0 if not.
+ SCI_SETSELECTIONMODE
toggles this setting between on and off.
The return value is -1 if nothing is found, otherwise the return value is the start position - of the matching text. The selection is updated to show the matched text, but is not scrolled - into view.
+SCI_GETLINESELSTARTPOSITION(line line) → position
+ SCI_GETLINESELENDPOSITION(line line) → position
+ Retrieve the position of the start and end of the selection at the given line with
+ INVALID_POSITION
returned if no selection on this line.
See also:
+ , -SCI_MOVECARETINSIDEVIEW
+ If the caret is off the top or bottom of the view, it is moved to the nearest line that is
+ visible to its current position. Any selection is lost.
SCI_CHOOSECARETX
+ Scintilla remembers the x value of the last position horizontally moved to explicitly by the
+ user and this value is then used when moving vertically such as by using the up and down keys.
+ This message sets the current x position of the caret as the remembered value.
-
-
+ SCI_MOVESELECTEDLINESUP
+ Move the selected lines up one line, shifting the line above after the selection.
+ The selection will be automatically extended to the beginning of the selection's first line and the end of the selection's last line.
+ If nothing was selected, the line the cursor is currently at will be selected.
SCI_SETOVERTYPE(bool overType)
- SCI_GETOVERTYPE → bool
- When overtype is enabled, each typed character replaces the character to the right of the text
- caret. When overtype is disabled, characters are inserted at the caret.
- SCI_GETOVERTYPE
returns true
(1) if overtyping is active, otherwise
- false
(0) will be returned. Use SCI_SETOVERTYPE
to set the overtype
- mode.
SCI_MOVESELECTEDLINESDOWN
+ Move the selected lines down one line, shifting the line below before the selection.
+ The selection will be automatically extended to the beginning of the selection's first line and the end of the selection's last line.
+ If nothing was selected, the line the cursor is currently at will be selected.
SCI_SETMOUSESELECTIONRECTANGULARSWITCH(bool
+ mouseSelectionRectangularSwitch)
+ SCI_GETMOUSESELECTIONRECTANGULARSWITCH → bool
+ Enable or disable the ability to switch to rectangular selection mode while making a selection with the mouse.
+ When this option is turned on, mouse selections in stream mode can be switched to rectangular mode by pressing
+ the corresponding modifier key. They then stick to rectangular mode even when the modifier key is released again.
+ When this option is turned off, mouse selections will always stick to the mode the selection was started in. It
+ is off by default.
-
-
-
-
-
-
-
-
-
-
-
+ SCI_CUT
- SCI_COPY
- SCI_PASTE
- SCI_CLEAR
- SCI_CANPASTE → bool
- SCI_COPYALLOWLINE
- These commands perform the standard tasks of cutting and copying data to the clipboard,
- pasting from the clipboard into the document, and clearing the document.
- SCI_CANPASTE
returns non-zero if the document isn't read-only and if the selection
- doesn't contain protected text. If you need a "can copy" or "can cut", use
- SCI_GETSELECTIONEMPTY()
, which will be zero if there are any non-empty
- selection ranges implying that a copy or cut to the clipboard should work.
+
+
+
+
+
+
+
+
+
+
+
- GTK does not really support SCI_CANPASTE
and always returns true
- unless the document is read-only.
+
+
+
+
+
+
+
+
+
- On X, the clipboard is asynchronous and may require several messages between
- the destination and source applications. Data from SCI_PASTE will not arrive in the
- document immediately.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- SCI_COPYALLOWLINE
works the same as SCI_COPY except that if the
- selection is empty then the current line is copied. On Windows, an extra "MSDEVLineSelect" marker
- is added to the clipboard which is then used in SCI_PASTE
to paste
- the whole line before the current line.
-
- SCI_COPYRANGE(position start, position end)
- SCI_COPYTEXT(position length, const char *text)
- SCI_COPYRANGE
copies a range of text from the document to
- the system clipboard and SCI_COPYTEXT
copies a supplied piece of
- text to the system clipboard.
-
- SCI_SETPASTECONVERTENDINGS(bool convert)
- SCI_GETPASTECONVERTENDINGS → bool
- If this property is set then when text is pasted any line ends are converted to match the document's
- end of line mode as set with
- SCI_SETEOLMODE.
- Defaults to true.
-
- SCI_REPLACERECTANGULAR(position length, const char *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.
+
+
+
+
+
+
+
+
+
- Error handling
+ SC_ELEMENT_SELECTION_ADDITIONAL_TEXT : colouralpha
+ SC_ELEMENT_SELECTION_ADDITIONAL_BACK : colouralpha
+
+
+
+
+ SC_ELEMENT_CARET_ADDITIONAL : colouralpha
+
+
+
+
+
+
+
-
-
+
+
+
+
- SCI_SETSTATUS(int status)
- SCI_GETSTATUS → int
- If an error occurs, Scintilla may set an internal error number that can be retrieved with
- SCI_GETSTATUS
.
- To clear the error status call SCI_SETSTATUS(0)
.
- Status values from 1 to 999 are errors and status SC_STATUS_WARN_START
(1000)
- and above are warnings.
- The currently defined statuses are:
+
+ There may be multiple selections active at one time.
+ More selections are made by holding down the Ctrl key while dragging with the mouse.
+ The most recent selection is the main selection and determines which part of the document is shown automatically.
+ Any selection apart from the main selection is called an additional selection.
+ The calls in the previous section operate on the main selection.
+ There is always at least one selection.
+ The selection can be simplified down to just the main selection by
+
-
+ which is normally mapped to the Esc key.
-
-
- SC_STATUS_OK
- 0
- No failures
-
-
-
- SC_STATUS_FAILURE
- 1
- Generic failure
-
-
-
- SC_STATUS_BADALLOC
- 2
- Memory is exhausted
-
-
-
- SC_STATUS_WARN_REGEX
- 1001
- Regular expression is invalid
-
-
-
-
-
- Undo and Redo
-
- Scintilla has multiple level undo and redo. It will continue to collect undoable actions
- until memory runs out. Scintilla saves actions that change the document. Scintilla does not
- save caret and selection movements, view scrolling and the like. Sequences of typing or
- deleting are compressed into single transactions to make it easier to undo and redo at a sensible
- level of detail. Sequences of actions can be combined into transactions that are undone as a unit.
- These sequences occur between SCI_BEGINUNDOACTION
and
- SCI_ENDUNDOACTION
messages. These transactions can be nested and only the top-level
- sequences are undone as units.
-
-
-
-
-
-
-
-
-
-
-
-
- SCI_UNDO
- SCI_CANUNDO → bool
- SCI_UNDO
undoes one action, or if the undo buffer has reached a
- SCI_ENDUNDOACTION
point, all the actions back to the corresponding
- SCI_BEGINUNDOACTION
.
-
- SCI_CANUNDO
returns 0 if there is nothing to undo, and 1 if there is. You would
- typically use the result of this message to enable/disable the Edit menu Undo command.
-
- SCI_REDO
- SCI_CANREDO → bool
- SCI_REDO
undoes the effect of the last SCI_UNDO
operation.
-
- SCI_CANREDO
returns 0 if there is no action to redo and 1 if there are undo
- actions to redo. You could typically use the result of this message to enable/disable the Edit
- menu Redo command.
-
- SCI_EMPTYUNDOBUFFER
- This command tells Scintilla to forget any saved undo or redo history. It also sets the save
- point to the start of the undo buffer, so the document will appear to be unmodified. This does
- not cause the
notification to be sent to the
- container.
-
- See also:
-
- SCI_SETUNDOCOLLECTION(bool collectUndo)
- SCI_GETUNDOCOLLECTION → bool
- You can control whether Scintilla collects undo information with
- SCI_SETUNDOCOLLECTION
. Pass in true
(1) to collect information and
- false
(0) to stop collecting. If you stop collection, you should also use
- SCI_EMPTYUNDOBUFFER
to avoid the undo buffer being unsynchronized with the data in
- the buffer.
-
- You might wish to turn off saving undo information if you use the Scintilla to store text
- generated by a program (a Log view) or in a display window where text is often deleted and
- regenerated.
+
+ Rectangular selections are handled as multiple selections although the original rectangular range is remembered so that
+ subsequent operations may be handled differently for rectangular selections. For example, pasting a rectangular selection
+ places each piece in a vertical column.
+
- SCI_BEGINUNDOACTION
- SCI_ENDUNDOACTION
- Send these two messages to Scintilla to mark the beginning and end of a set of operations that
- you want to undo all as one operation but that you have to generate as several operations.
- Alternatively, you can use these to mark a set of operations that you do not want to have
- combined with the preceding or following operations if they are undone.
+
+ Virtual space is space beyond the end of each line. The caret may be moved into virtual space but no real space will be
+ added to the document until there is some text typed or some other text insertion command is used.
+
- SCI_ADDUNDOACTION(int token, int flags)
- The container can add its own actions into the undo stack by calling
- SCI_ADDUNDOACTION
and an SCN_MODIFIED
- notification will be sent to the container with the
-
- flag when it is time to undo (SC_PERFORMED_UNDO
) or
- redo (SC_PERFORMED_REDO
) the action. The token argument supplied is
- returned in the token
field of the notification.
- For example, if the container wanted to allow undo and redo of a 'toggle bookmark' command then
- it could call SCI_ADDUNDOACTION(line, 0)
each time the command is performed.
- Then when it receives a notification to undo or redo it toggles a bookmark on the line given by
- the token field. If there are different types of commands or parameters that need to be stored into the undo
- stack then the container should maintain a stack of its own for the document and use the current
- position in that stack as the argument to SCI_ADDUNDOACTION(line)
.
- SCI_ADDUNDOACTION
commands are not combined together
- into a single undo transaction unless grouped with SCI_BEGINUNDOACTION
- and SCI_ENDUNDOACTION
.
+ When discontiguous selections are copied to the clipboard, each selection is added to the clipboard text
+ in order with no delimiting characters.
+ For rectangular selections the document's line end is added after each line's text. Rectangular selections
+ are always copied from top line to bottom, not in the in order of selection.Virtual space is not copied.
- The flags argument can be UNDO_MAY_COALESCE
(1) if the container action may be
- coalesced along with any insertion and deletion actions into a single compound action, otherwise
- UNDO_NONE
(0).
- Coalescing treats coalescible container actions as transparent so will still only group together insertions that
- look like typing or deletions that look like multiple uses of the Backspace or Delete keys.
-
+
+ SCI_SETMULTIPLESELECTION(bool multipleSelection)
+ SCI_GETMULTIPLESELECTION → bool
+ Enable or disable multiple selection. When multiple selection is disabled, it is not possible to select
+ multiple ranges by holding down the Ctrl key while dragging with the mouse.
- Change history
+
+ SCI_SETADDITIONALSELECTIONTYPING(bool additionalSelectionTyping)
+ SCI_GETADDITIONALSELECTIONTYPING → bool
+ Whether typing, new line, cursor left/right/up/down, backspace, delete, home, and end work
+ with multiple selections simultaneously.
+ Also allows selection and word and line deletion commands.
- Scintilla can display document changes (modified, saved, ...) in the margin or in the text.
+
+ SCI_SETMULTIPASTE(int multiPaste)
+ SCI_GETMULTIPASTE → int
+ When pasting into multiple selections, the pasted text can go into just the main selection with SC_MULTIPASTE_ONCE
=0
+ or into each selection with SC_MULTIPASTE_EACH
=1. SC_MULTIPASTE_ONCE
is the default.
- 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.
+
+ SCI_SETVIRTUALSPACEOPTIONS(int virtualSpaceOptions)
+ SCI_GETVIRTUALSPACEOPTIONS → int
+ Virtual space can be enabled or disabled for rectangular selections or in other circumstances or in both.
+ There are three bit flags SCVS_RECTANGULARSELECTION
=1,
+ SCVS_USERACCESSIBLE
=2, and
+ SCVS_NOWRAPLINESTART
=4 which can be set independently.
+ SCVS_NONE
=0, the default, disables all use of virtual space.
+ SCVS_NOWRAPLINESTART
prevents left arrow movement and selection
+ from wrapping to the previous line.
+ This is most commonly desired in conjunction with virtual space but is an independent
+ setting so works without virtual space.
- 
+
+ SCI_SETRECTANGULARSELECTIONMODIFIER(int modifier)
+ SCI_GETRECTANGULARSELECTIONMODIFIER → int
+ On GTK and Qt, the key used to indicate that a rectangular selection should be created when combined with a mouse drag can be set.
+ The three possible values are SCMOD_CTRL
=2, SCMOD_ALT
=4 (default) or SCMOD_SUPER
=8.
+ Since SCMOD_ALT
may already be used by a window manager, the window manager may need configuring to allow this choice.
+ SCMOD_SUPER
is often a system dependent modifier key such as the Left Windows key on a Windows keyboard or the
+ Command key on a Mac.
- The image shows the default visuals which can be altered by the application.
- In the text, inserted characters appear with coloured underlines and points where characters were deleted are shown with small triangles.
- The margin shows a block indicating the overall state of the line, prioritizing the more consequential modified states.
- The states are
- modified (orange),
- saved (green),
- saved then reverted to modified (green-yellow),
- and saved then reverted to original (cyan).
-
+
+ SCI_GETSELECTIONS → int
+ Return the number of selections currently active. There is always at least one selection.
- 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.
+
+ SCI_GETSELECTIONEMPTY → bool
+ Return 1 if every selected range is empty else 0.
- If the applications wants to display a simplified set of visuals without differentiating between modifications
- that have been reverted then assign the same attributes to multiple markers and indicators.
+
+ SCI_CLEARSELECTIONS
+ Set a single empty selection at 0 as the only selection.
-
-
-
+
+ SCI_SETSELECTION(position caret, position anchor)
+ Set a single selection from anchor
to caret
as the only selection.
- SCI_SETCHANGEHISTORY(int changeHistory)
- SCI_GETCHANGEHISTORY → int
- SCI_SETCHANGEHISTORY
turns this feature on and off and determines whether changes are visible in
- the margin or text or both.
- Change history depends on the undo history and can only be enabled when undo history is enabled and empty.
- It should be enabled once when a file is loaded after calling
- SCI_SETUNDOCOLLECTION(true) and
- SCI_SETSAVEPOINT.
- The changeHistory
argument can be a combination of:
+
+ SCI_ADDSELECTION(position caret, position anchor)
+ Add a new selection from anchor
to caret
as the main selection retaining all other
+ selections as additional selections.
+ Since there is always at least one selection, to set a list of selections, the first selection should be
+ added with SCI_SETSELECTION
and later selections added with SCI_ADDSELECTION
-
-
-
- SC_CHANGE_HISTORY_DISABLED
+
+ SCI_DROPSELECTIONN(int selection)
+ If there are multiple selections, remove the indicated selection.
+ If this was the main selection then make the previous selection the main and if it was the first then the last selection becomes main.
+ If there is only one selection, or there is no selection selection
, then there is no effect.
- 0
+
+ SCI_SETMAINSELECTION(int selection)
+ SCI_GETMAINSELECTION → int
+ One of the selections is the main selection which is used to determine what range of text is automatically visible.
+ The main selection may be displayed in different colours or with a differently styled caret.
+ Only an already existing selection can be made main.
- The default: change history turned off.
-
+
+ SCI_SETSELECTIONNCARET(int selection, position caret)
+ SCI_GETSELECTIONNCARET(int selection) → position
+ SCI_SETSELECTIONNCARETVIRTUALSPACE(int selection, position space)
+ SCI_GETSELECTIONNCARETVIRTUALSPACE(int selection) → position
+ SCI_SETSELECTIONNANCHOR(int selection, position anchor)
+ SCI_GETSELECTIONNANCHOR(int selection) → position
+ SCI_SETSELECTIONNANCHORVIRTUALSPACE(int selection, position space)
+ SCI_GETSELECTIONNANCHORVIRTUALSPACE(int selection) → position
+ Set or query the position and amount of virtual space for the caret and anchor of each already existing selection.
-
- SC_CHANGE_HISTORY_ENABLED
+
+ SCI_SETSELECTIONNSTART(int selection, position anchor)
+ SCI_GETSELECTIONNSTART(int selection) → position
+ SCI_GETSELECTIONNSTARTVIRTUALSPACE(int selection) → position
+ SCI_SETSELECTIONNEND(int selection, position caret)
+ SCI_GETSELECTIONNEND(int selection) → position
+ SCI_GETSELECTIONNENDVIRTUALSPACE(int selection) → position
+ Set or query the start and end position of each already existing selection.
+ Query the virtual space at start and end of each selection.
+ Mostly of use to query each range for its text. The selection
parameter is zero-based.
- 1
+
+ SCI_SETRECTANGULARSELECTIONCARET(position caret)
+ SCI_GETRECTANGULARSELECTIONCARET → position
+ SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE(position space)
+ SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE → position
+ SCI_SETRECTANGULARSELECTIONANCHOR(position anchor)
+ SCI_GETRECTANGULARSELECTIONANCHOR → position
+ SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE(position space)
+ SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE → position
+ Set or query the position and amount of virtual space for the caret and anchor of the rectangular selection.
+ After setting the rectangular selection, this is broken down into multiple selections, one for each line.
- Track changes to the document.
-
+
+ SC_ELEMENT_SELECTION_ADDITIONAL_TEXT : colouralpha
+ SC_ELEMENT_SELECTION_ADDITIONAL_BACK : colouralpha
+ SCI_SETADDITIONALSELALPHA(alpha alpha)
+ SCI_GETADDITIONALSELALPHA → int
+ SCI_SETADDITIONALSELFORE(colour fore)
+ SCI_SETADDITIONALSELBACK(colour back)
+ Modify the appearance of additional selections so that they can be differentiated from the main selection which has its appearance set with
+ SC_ELEMENT_SELECTION_TEXT
,
+ SC_ELEMENT_SELECTION_BACK
,
+ ,
+ ,
+ , and
+ .
+ The element APIs are preferred and the following messages discouraged.
+ The additional selection background is drawn on the layer defined for all selection backgrounds by
+ .
+ SCI_SETADDITIONALSELFORE
and
+ SCI_SETADDITIONALSELBACK
calls have no
+ effect until
+ and are
+ called with useSetting
value set to true. Subsequent calls to
+ ,
+ and will
+ overwrite the values set by SCI_SETADDITIONALSEL*
functions.
-
- SC_CHANGE_HISTORY_MARKERS
+
+ SC_ELEMENT_CARET_ADDITIONAL : colouralpha
+ SCI_SETADDITIONALCARETFORE(colour fore)
+ SCI_GETADDITIONALCARETFORE → colour
+ SCI_SETADDITIONALCARETSBLINK(bool additionalCaretsBlink)
+ SCI_GETADDITIONALCARETSBLINK → bool
+ Modify the appearance of additional carets so that they can be differentiated from the main caret which has its appearance set with
+ SC_ELEMENT_CARET
,
+ ,
+ ,
+ , and
+ .
- 2
+
+ SCI_SETADDITIONALCARETSVISIBLE(bool additionalCaretsVisible)
+ SCI_GETADDITIONALCARETSVISIBLE → bool
+ Determine whether to show additional carets (defaults to true
).
- Display changes in the margin using the SC_MARKNUM_HISTORY
markers.
-
+
+ SCI_SWAPMAINANCHORCARET
+ SCI_ROTATESELECTION
+ SCI_MULTIPLESELECTADDNEXT
+ SCI_MULTIPLESELECTADDEACH
+ These commands may be assigned to keys to make it possible to manipulate multiple selections.
+ SCI_SWAPMAINANCHORCARET
moves the caret to the opposite end of the main selection.
+ SCI_ROTATESELECTION
makes the next selection be the main selection.
+ SCI_MULTIPLESELECTADDNEXT
adds the next occurrence of the main selection
+ within the target to the set of selections as main. If the current selection is empty then select word around caret.
+ The current searchFlags
+ are used so the application may choose case sensitivity and word search options.
+ SCI_MULTIPLESELECTADDEACH
is similar to
+ SCI_MULTIPLESELECTADDNEXT
but adds multiple occurrences instead of just one.
+
-
- SC_CHANGE_HISTORY_INDICATORS
+ Overtype
- 4
+
+
+
- Display changes in the text using the INDICATOR_HISTORY
indicators.
-
-
-
+ SCI_SETOVERTYPE(bool overType)
+ SCI_GETOVERTYPE → bool
+ When overtype is enabled, each typed character replaces the character to the right of the text
+ caret. When overtype is disabled, characters are inserted at the caret.
+ SCI_GETOVERTYPE
returns true
(1) if overtyping is active, otherwise
+ false
(0) will be returned. Use SCI_SETOVERTYPE
to set the overtype
+ mode.
- There are default visuals assigned to each history marker and indicator but these may be overridden by the application.
+ Searching
+
+ There are methods to search for text and for regular expressions.
+ Most applications should use
+ SCI_SEARCHINTARGET
+ as the basis for their search implementations.
+ Other calls augment this or were implemented before SCI_SEARCHINTARGET
.
+
+
+ The base regular expression support
+ is limited and should only be used for simple cases and initial development.
+ The C++ runtime <regex> library may be used by setting the SCFIND_CXX11REGEX
search flag.
+ The C++11 <regex> support may be disabled by
+ compiling Scintilla with NO_CXX11_REGEX
defined.
+ A different regular expression
+ library can be integrated into Scintilla
+ or can be called from the container using direct access to the buffer contents through
+ SCI_GETCHARACTERPOINTER.
+
- Markers:
+ Search and replace using the target
-
-
-
- SC_MARKNUM_HISTORY_REVERTED_TO_ORIGIN
+ Searching can be performed within the target range with SCI_SEARCHINTARGET
,
+ which uses a counted string to allow searching for null characters. It returns the
+ position of the start of the matching text range or -1 for failure, in which case the target is not moved. The flags used by
+ SCI_SEARCHINTARGET
such as SCFIND_MATCHCASE
,
+ SCFIND_WHOLEWORD
, SCFIND_WORDSTART
, and SCFIND_REGEXP
+ can be set with SCI_SETSEARCHFLAGS
.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- 21
+ SCI_SETTARGETSTART(position start)
+ SCI_GETTARGETSTART → position
+ SCI_SETTARGETSTARTVIRTUALSPACE(position space)
+ SCI_GETTARGETSTARTVIRTUALSPACE → position
+ SCI_SETTARGETEND(position end)
+ SCI_GETTARGETEND → position
+ SCI_SETTARGETENDVIRTUALSPACE(position space)
+ SCI_GETTARGETENDVIRTUALSPACE → position
+ SCI_SETTARGETRANGE(position start, position end)
+ These functions set and return the start and end of the target. When searching
+ you can set start greater than end to find the last matching text in the
+ target rather than the first matching text.
+ Setting a target position with SCI_SETTARGETSTART
, SCI_SETTARGETEND
, or SCI_SETTARGETRANGE
+ sets the virtual space to 0.
+ The target is also set by a successful
+ SCI_SEARCHINTARGET
.
+ The virtual space of the target range can be set and retrieved with the corresponding ...VIRTUALSPACE
+ methods. This allows text to be inserted in virtual space more easily.
- A change was made to this line and saved but then reverted to its original state.
- This line is different to its state on disk.
-
+ SCI_TARGETFROMSELECTION
+ Set the target start and end to the start and end positions of the selection.
-
- SC_MARKNUM_HISTORY_SAVED
+ SCI_TARGETWHOLEDOCUMENT
+ Set the target start to the start of the document and target end to the end of the document.
- 22
+ SCI_SETSEARCHFLAGS(int searchFlags)
+ SCI_GETSEARCHFLAGS → int
+ These get and set the searchFlags
used by
+ SCI_SEARCHINTARGET
. There are several option flags including a simple regular
+ expression search.
- This line was modified and saved.
- This line is the same as its state on disk.
-
+ SCI_SEARCHINTARGET(position length, const char *text) → position
+ This searches for the first occurrence of a text string in the target defined by
+ SCI_SETTARGETSTART
and SCI_SETTARGETEND
. The text string is not zero
+ terminated; the size is set by length
. The search is modified by the search flags
+ set by SCI_SETSEARCHFLAGS
. If the search succeeds, the target is set to the found
+ text and the return value is the position of the start of the matching text. If the search
+ fails, the result is -1.
-
- SC_MARKNUM_HISTORY_MODIFIED
+ SCI_GETTARGETTEXT(<unused>, char *text) → position
+ Retrieve the value in the target.
- 23
+ SCI_REPLACETARGET(position length, const char *text) → position
+ 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.
- This line was modified but not yet saved.
- This line is different to its state on disk.
-
+ SCI_REPLACETARGETMINIMAL(position length, const char *text) → position
+ This is similar to
+ 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.
-
- SC_MARKNUM_HISTORY_REVERTED_TO_MODIFIED
+ SCI_REPLACETARGETRE(position length, const char *text) → position
+ This replaces the target using regular expressions. If length
is -1,
+ text
is a zero terminated string, otherwise length
is the number of
+ characters to use. The replacement string is formed from the text string with any sequences of
+ \1
through \9
replaced by tagged matches from the most recent regular
+ expression search. \0
is replaced with all the matched text from the most recent search.
+ After replacement, the target range refers to the replacement text.
+ The return value is the length of the replacement string.
- 24
+ SCI_GETTAG(int tagNumber, char *tagValue NUL-terminated) → int
+ Discover what text was matched by tagged expressions in a regular expression search.
+ This is useful if the application wants to interpret the replacement string itself.
- A change was made to this line and saved but then reverted but not to its original state.
- This line is different to its state on disk.
-
-
-
+ See also:
- Indicators:
+ searchFlags
+ Several of the search routines use flag options, which include a simple regular expression
+ search. Combine the flag options by adding them:
-
-
+
+
- INDICATOR_HISTORY_REVERTED_TO_ORIGIN_INSERTION
- 36
- Text was deleted and saved but then reverted to its original state.
- This text has not been saved to disk.
-
+ SCFIND_NONE
-
- INDICATOR_HISTORY_REVERTED_TO_ORIGIN_DELETION
- 37
- Text was inserted and saved but then reverted to its original state.
- There is text on disk that is missing.
+ Default setting is case-insensitive literal match.
- INDICATOR_HISTORY_SAVED_INSERTION
- 38
- Text was inserted and saved.
- This text is the same as on disk.
+ SCFIND_MATCHCASE
+
+ A match only occurs with text that matches the case of the search string.
+
- INDICATOR_HISTORY_SAVED_DELETION
- 39
- Text was deleted and saved.
- This range is the same as on disk.
+ SCFIND_WHOLEWORD
+
+ A match only occurs if the characters before and after are not word characters as defined
+ by
.
- INDICATOR_HISTORY_MODIFIED_INSERTION
- 40
- Text was inserted but not yet saved.
- This text has not been saved to disk.
+ SCFIND_WORDSTART
+
+ A match only occurs if the character before is not a word character as defined
+ by
.
+
- INDICATOR_HISTORY_MODIFIED_DELETION
- 41
- Text was deleted but not yet saved.
- There is text on disk that is missing.
-
+ SCFIND_REGEXP
+ The search string should be interpreted as a regular expression.
+ Uses Scintilla's base implementation unless combined with SCFIND_CXX11REGEX
.
+
- INDICATOR_HISTORY_REVERTED_TO_MODIFIED_INSERTION
- 42
- Text was deleted and saved but then reverted but not to its original state.
- This text has not been saved to disk.
+ SCFIND_POSIX
+
+ Treat regular expression in a more POSIX compatible manner
+ by interpreting bare ( and ) for tagged sections rather than \( and \).
+ Has no effect when SCFIND_CXX11REGEX
is set.
- INDICATOR_HISTORY_REVERTED_TO_MODIFIED_DELETION
- 43
- Text was inserted and saved but then reverted but not to its original state.
- There is text on disk that is missing.
+ SCFIND_CXX11REGEX
+
+ This flag may be set to use C++11 <regex> instead of Scintilla's basic regular expressions.
+ If the regular expression is invalid then -1 is returned and status is set to
+ SC_STATUS_WARN_REGEX
.
+ The ECMAScript flag is set on the regex object and UTF-8 documents will exhibit Unicode-compliant
+ behaviour. For MSVC, where wchar_t is 16-bits, the regular expression ".." will match a single
+ astral-plane character. There may be other differences between compilers.
+ Must also have SCFIND_REGEXP
set.
- Selection and information
+ In a regular expression, using Scintilla's base implementation,
+ special characters interpreted are:
- Scintilla maintains a selection that stretches between two points, the anchor and the
- current position. If the anchor and the current position are the same, there is no selected
- text. Positions in the document range from 0 (before the first character), to the document size
- (after the last character). If you use messages, there is nothing to stop you setting a
- position that is in the middle of a CRLF pair, or in the middle of a 2 byte character. However,
- keyboard commands will not move the caret into such positions.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ .
- SCI_GETTEXTLENGTH → position
- SCI_GETLENGTH → position
- Both these messages return the length of the document in bytes.
+ Matches any character
+
- SCI_GETLINECOUNT → line
- This returns the number of lines in the document. An empty document contains 1 line. A
- document holding only an end of line sequence has 2 lines.
+
+ \(
- SCI_LINESONSCREEN → line
- This returns the number of complete lines visible on the screen. With a constant line height,
- this is the vertical space available divided by the line separation. Unless you arrange to size
- your window to an integral number of lines, there may be a partial line visible at the bottom
- of the view.
+ This marks the start of a region for tagging a match.
+
- SCI_GETMODIFY → bool
- This returns non-zero if the document is modified and 0 if it is unmodified. The modified
- status of a document is determined by the undo position relative to the save point. The save
- point is set by ,
- usually when you have saved data to a file.
+
+ \)
- If you need to be notified when the document becomes modified, Scintilla notifies the
- container that it has entered or left the save point with the notification messages.
+ and This marks the end of a tagged region.
+
- SCI_SETSEL(position anchor, position caret)
- This message sets both the anchor and the current position. If caret
is
- negative, it means the end of the document. If anchor
is negative, it means
- remove any selection (i.e. set the anchor to the same position as caret
). The
- caret is scrolled into view after this operation.
+
+ \n
- SCI_GOTOPOS(position caret)
- This removes any selection, sets the caret at caret
and scrolls the view to make
- the caret visible, if necessary. It is equivalent to
- SCI_SETSEL(caret, caret)
. The anchor position is set the same as the current
- position.
+ Where n
is 1 through 9 refers to the first through ninth tagged region
+ when replacing. For example, if the search string was Fred\([1-9]\)XXX
and
+ the replace string was Sam\1YYY
, when applied to Fred2XXX
this
+ would generate Sam2YYY
.
+ \0
refers to all of the matching text.
+
- SCI_GOTOLINE(line line)
- This removes any selection and sets the caret at the start of line number line
- and scrolls the view (if needed) to make it visible. The anchor position is set the same as the
- current position. If line
is outside the lines in the document (first line is 0),
- the line set is the first or last.
+
+ \<
- SCI_SETCURRENTPOS(position caret)
- This sets the current position and creates a selection between the anchor and the current
- position. The caret is not scrolled into view.
+ This matches the start of a word using Scintilla's definitions of words.
+
- See also:
+
+ \>
- SCI_GETCURRENTPOS → position
- This returns the current position.
+ This matches the end of a word using Scintilla's definition of words.
+
- SCI_SETANCHOR(position anchor)
- This sets the anchor position and creates a selection between the anchor position and the
- current position. The caret is not scrolled into view.
+
+ \x
- See also:
+ This allows you to use a character x that would otherwise have a special meaning. For
+ example, \[ would be interpreted as [ and not as the start of a character set.
+
- SCI_GETANCHOR → position
- This returns the current anchor position.
+
+ [...]
- SCI_SETSELECTIONSTART(position anchor)
- SCI_SETSELECTIONEND(position caret)
- These set the selection based on the assumption that the anchor position is less than the
- current position. They do not make the caret visible. The table shows the positions of the
- anchor and the current position after using these messages.
+ This indicates a set of characters, for example, [abc] means any of the characters a,
+ b or c. You can also use ranges, for example [a-z] for any lower case character.
+
-
-
-
- New value for
-
+ [^...]
- anchor
+ The complement of the characters in the set. For example, [^A-Za-z] means any
+ character except an alphabetic character.
+
- caret
+
+ ^
+
+ This matches the start of a line (unless used inside a set, see above).
-
-
- SCI_SETSELECTIONSTART
+ $
- anchor
+ This matches the end of a line.
+
- Max(
anchor
, current)
+
+ *
+
+ This matches 0 or more times. For example, Sa*m
matches Sm
,
+ Sam
, Saam
, Saaam
and so on.
- SCI_SETSELECTIONEND
+ +
+
+ This matches 1 or more times. For example, Sa+m
matches
+ Sam
, Saam
, Saaam
and so on.
+
+
+
+
+ Regular expressions will only match ranges within a single line, never matching over multiple lines.
+
+ When using SCFIND_CXX11REGEX
more features are available,
+ generally similar to regular expression support in JavaScript.
+ See the documentation of your C++ runtime for details on what is supported.
+
+
+
+
+
+
+
+
+ SCI_FINDTEXT(int searchFlags, Sci_TextToFind *ft) → position
+ SCI_FINDTEXTFULL(int searchFlags, Sci_TextToFindFull *ft) → position
+ These messages search for text in the document. They do not use or move the current selection.
+ The searchFlags
argument controls the
+ search type, which includes regular expression searches.
+
+ You can
+ search backwards to find the previous occurrence of a search string by setting the end of the
+ search range before the start.
- Min(anchor,
caret
)
+ The Sci_TextToFind
and Sci_TextToFindFull
structures are defined in Scintilla.h
; set
+ chrg.cpMin
and chrg.cpMax
with the range of positions in the document
+ to search. You can search backwards by
+ setting chrg.cpMax
less than chrg.cpMin
.
+ Set the lpstrText
member of Sci_TextToFind
to point at a zero terminated
+ text string holding the search pattern. If your language makes the use of Sci_TextToFind
+ difficult, you should consider using SCI_SEARCHINTARGET
instead.
+ On 64-bit Win32, SCI_FINDTEXT
is limited to the first 2G of text and SCI_FINDTEXTFULL
removes this limitation.
- caret
-
-
-
+ The return value is -1 if the search fails or the position of the start of the found text if
+ it succeeds. The chrgText.cpMin
and chrgText.cpMax
members of
+ Sci_TextToFind
are filled in with the start and end positions of the found text.
- See also:
+ See also:
- SCI_GETSELECTIONSTART → position
- SCI_GETSELECTIONEND → position
- These return the start and end of the selection without regard to which end is the current
- position and which is the anchor. SCI_GETSELECTIONSTART
returns the smaller of the
- current position or the anchor position. SCI_GETSELECTIONEND
returns the larger of
- the two values.
+ Sci_TextToFind
+ This structure is defined to have exactly the same shape as the Win32 structure
+ FINDTEXTEX
for old code that treated Scintilla as a RichEdit control.
+
+struct Sci_TextToFind {
+ struct Sci_CharacterRange chrg; // range to search
+ const char *lpstrText; // the search pattern (zero terminated)
+ struct Sci_CharacterRange chrgText; // returned as position of matching text
+};
+
- SCI_SETEMPTYSELECTION(position caret)
- This removes any selection and sets the caret at caret
. The caret is not scrolled into view.
+ Sci_TextToFindFull
+ This structure extends Sci_TextToFind
to support huge documents on Win32.
+
+struct Sci_TextToFindFull {
+ struct Sci_CharacterRangeFull chrg; // range to search
+ const char *lpstrText; // the search pattern (zero terminated)
+ struct Sci_CharacterRangeFull chrgText; // returned as position of matching text
+};
+
- SCI_SELECTALL
- This selects all the text in the document. The current position is not scrolled into view.
+ SCI_SEARCHANCHOR
+ SCI_SEARCHNEXT(int searchFlags, const char *text) → position
+ SCI_SEARCHPREV(int searchFlags, const char *text) → position
+ These messages provide relocatable search support. This allows multiple incremental
+ interactive searches to be macro recorded while still setting the selection to found text so
+ the find/select operation is self-contained. These three messages send notifications if macro recording is enabled.
- SCI_LINEFROMPOSITION(position pos) → line
- This message returns the line that contains the position pos
in the document. The
- return value is 0 if pos
<= 0. The return value is the last line if
- pos
is beyond the end of the document.
+ SCI_SEARCHANCHOR
sets the search start point used by
+ SCI_SEARCHNEXT
and SCI_SEARCHPREV
to the start of the current
+ selection, that is, the end of the selection that is nearer to the start of the document. You
+ should always call this before calling either of SCI_SEARCHNEXT
or
+ SCI_SEARCHPREV
.
- SCI_POSITIONFROMLINE(line line) → position
- This returns the document position that corresponds with the start of the line. If
- line
is negative, the position of the line holding the start of the selection is
- returned. If line
is greater than the lines in the document, the return value is
- -1. If line
is equal to the number of lines in the document (i.e. 1 line past the
- last line), the return value is the end of the document.
+ SCI_SEARCHNEXT
and SCI_SEARCHPREV
search for the next and previous
+ occurrence of the zero terminated search string pointed at by text. The search is modified by
+ the searchFlags
.
- SCI_GETLINEENDPOSITION(line line) → position
- This returns the position at the end of the line, before any line end characters. If line
- is the last line in the document (which does not have any end of line characters) or greater,
- the result is the size of the document.
- If line
is negative the result is undefined.
+ The return value is -1 if nothing is found, otherwise the return value is the start position
+ of the matching text. The selection is updated to show the matched text, but is not scrolled
+ into view.
- SCI_LINELENGTH(line line) → position
- This returns the length of the line, including any line end characters. If line
- is negative or beyond the last line in the document, the result is 0. If you want the length of
- the line not including any end of line characters, use - .
+ See also:
- ,
+ SCI_GETSELTEXT(<unused>, char *text NUL-terminated) → position
- This copies the currently selected text and a terminating NUL(0) byte to the text
- buffer. The buffer size should be determined by calling with a NULL pointer for the text
argument:
- 1 + SCI_GETSELTEXT(0, NULL)
.
- This allows for rectangular and discontiguous selections as well as simple selections.
- See Multiple Selection for information on
- how multiple and rectangular selections and virtual space are copied.
+ Cut, copy and paste
- See also: SCI_GETCURLINE,
- SCI_GETLINE,
- SCI_GETTEXT,
- SCI_GETSTYLEDTEXT,
- SCI_GETTEXTRANGE
-
+
+
+
+
+
+
+
+
+
+
+
+
- SCI_GETCURLINE(position length, char *text NUL-terminated) → position
- This retrieves the text of the line containing the caret and returns the position within the
- line of the caret. Pass in char* text
pointing at a buffer large enough to hold
- the text you wish to retrieve and a terminating NUL(0) character.
- Set length
to the
- length of the buffer not including the terminating NUL character.
- If the text argument is NULL(0) then the length that should be allocated
- to store the entire current line is returned.
+ SCI_CUT
+ SCI_COPY
+ SCI_PASTE
+ SCI_CLEAR
+ SCI_CANPASTE → bool
+ SCI_COPYALLOWLINE
+ These commands perform the standard tasks of cutting and copying data to the clipboard,
+ pasting from the clipboard into the document, and clearing the document.
+ SCI_CANPASTE
returns non-zero if the document isn't read-only and if the selection
+ doesn't contain protected text. If you need a "can copy" or "can cut", use
+ SCI_GETSELECTIONEMPTY()
, which will be zero if there are any non-empty
+ selection ranges implying that a copy or cut to the clipboard should work.
- See also: SCI_GETSELTEXT,
- SCI_GETLINE,
- SCI_GETTEXT,
- SCI_GETSTYLEDTEXT,
- SCI_GETTEXTRANGE
+ GTK does not really support SCI_CANPASTE
and always returns true
+ unless the document is read-only.
- SCI_SELECTIONISRECTANGLE → bool
- This returns 1 if the current selection is in rectangle mode, 0 if not.
+ On X, the clipboard is asynchronous and may require several messages between
+ the destination and source applications. Data from SCI_PASTE will not arrive in the
+ document immediately.
- SCI_SETSELECTIONMODE(int selectionMode)
- SCI_GETSELECTIONMODE → int
- The two functions set and get the selection mode, which can be
- stream (SC_SEL_STREAM
=0) or
- rectangular (SC_SEL_RECTANGLE
=1) or
- by lines (SC_SEL_LINES
=2)
- or thin rectangular (SC_SEL_THIN
=3).
- When set in these modes, regular caret moves will extend or reduce the selection,
- until the mode is cancelled by a call with same value or with SCI_CANCEL
.
- The get function returns the current mode even if the selection was made by mouse
- or with regular extended moves.
- SC_SEL_THIN
is the mode after a rectangular selection has been typed into and ensures
- that no characters are selected.
+ SCI_COPYALLOWLINE
works the same as SCI_COPY except that if the
+ selection is empty then the current line is copied. On Windows, an extra "MSDEVLineSelect" marker
+ is added to the clipboard which is then used in SCI_PASTE
to paste
+ the whole line before the current line.
- SCI_GETMOVEEXTENDSSELECTION → bool
- This returns 1 if regular caret moves will extend or reduce the selection, 0 if not.
- SCI_SETSELECTIONMODE
toggles this setting between on and off.
+ SCI_COPYRANGE(position start, position end)
+ SCI_COPYTEXT(position length, const char *text)
+ SCI_COPYRANGE
copies a range of text from the document to
+ the system clipboard and SCI_COPYTEXT
copies a supplied piece of
+ text to the system clipboard.
- SCI_GETLINESELSTARTPOSITION(line line) → position
- SCI_GETLINESELENDPOSITION(line line) → position
- Retrieve the position of the start and end of the selection at the given line with
- INVALID_POSITION
returned if no selection on this line.
+ SCI_SETPASTECONVERTENDINGS(bool convert)
+ SCI_GETPASTECONVERTENDINGS → bool
+ If this property is set then when text is pasted any line ends are converted to match the document's
+ end of line mode as set with
+ SCI_SETEOLMODE.
+ Defaults to true.
- SCI_MOVECARETINSIDEVIEW
- If the caret is off the top or bottom of the view, it is moved to the nearest line that is
- visible to its current position. Any selection is lost.
+ SCI_REPLACERECTANGULAR(position length, const char *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.
- SCI_POSITIONBEFORE(position pos) → position
- SCI_POSITIONAFTER(position pos) → position
- These messages return the position before and after another position
- in the document taking into account the current code page. The minimum
- position returned is 0 and the maximum is the last position in the document.
- If called with a position within a multi byte character will return the position
- of the start/end of that character.
+ Undo and Redo
- SCI_TEXTWIDTH(int style, const char *text) → int
- This returns the pixel width of a string drawn in the given style
which can
- be used, for example, to decide how wide to make the line number margin in order to display a
- given number of numerals.
+ Scintilla has multiple level undo and redo. It will continue to collect undoable actions
+ until memory runs out. Scintilla saves actions that change the document. Scintilla does not
+ save caret and selection movements, view scrolling and the like. Sequences of typing or
+ deleting are compressed into single transactions to make it easier to undo and redo at a sensible
+ level of detail. Sequences of actions can be combined into transactions that are undone as a unit.
+ These sequences occur between SCI_BEGINUNDOACTION
and
+ SCI_ENDUNDOACTION
messages. These transactions can be nested and only the top-level
+ sequences are undone as units.
+
+
+
+
+
+
+
+
+
+
+
- SCI_TEXTHEIGHT(line line) → int
- This returns the height in pixels of a particular line. Currently all lines are the same
- height.
+ SCI_UNDO
+ SCI_CANUNDO → bool
+ SCI_UNDO
undoes one action, or if the undo buffer has reached a
+ SCI_ENDUNDOACTION
point, all the actions back to the corresponding
+ SCI_BEGINUNDOACTION
.
- SCI_GETCOLUMN(position pos) → position
- This message returns the column number of a position pos
within the document
- taking the width of tabs into account. This returns the column number of the last tab on the
- line before pos
, plus the number of characters between the last tab and
- pos
. If there are no tab characters on the line, the return value is the number of
- characters up to the position on the line. In both cases, double byte characters count as a
- single character. This is probably only useful with monospaced fonts.
+ SCI_CANUNDO
returns 0 if there is nothing to undo, and 1 if there is. You would
+ typically use the result of this message to enable/disable the Edit menu Undo command.
- SCI_FINDCOLUMN(line line, position column) → position
- This message returns the position of a column
on a line
- taking the width of tabs into account. It treats a multi-byte character as a single column.
- Column numbers, like lines start at 0.
+ SCI_REDO
+ SCI_CANREDO → bool
+ SCI_REDO
undoes the effect of the last SCI_UNDO
operation.
- SCI_POSITIONFROMPOINT(int x, int y) → position
- SCI_POSITIONFROMPOINTCLOSE(int x, int y) → position
- SCI_POSITIONFROMPOINT
finds the closest character position to a point and
- SCI_POSITIONFROMPOINTCLOSE
is similar but returns -1 if the point is outside the
- window or not close to any characters.
+ SCI_CANREDO
returns 0 if there is no action to redo and 1 if there are undo
+ actions to redo. You could typically use the result of this message to enable/disable the Edit
+ menu Redo command.
- SCI_CHARPOSITIONFROMPOINT(int x, int y) → position
- SCI_CHARPOSITIONFROMPOINTCLOSE(int x, int y) → position
- SCI_CHARPOSITIONFROMPOINT
finds the closest character to a point and
- SCI_CHARPOSITIONFROMPOINTCLOSE
is similar but returns -1 if the point is outside the
- window or not close to any characters. This is similar to the previous methods but finds characters rather than
- inter-character positions.
+ SCI_EMPTYUNDOBUFFER
+ This command tells Scintilla to forget any saved undo or redo history. It also sets the save
+ point to the start of the undo buffer, so the document will appear to be unmodified. This does
+ not cause the
notification to be sent to the
+ container.
- SCI_POINTXFROMPOSITION(<unused>, position pos) → int
- SCI_POINTYFROMPOSITION(<unused>, position pos) → int
- These messages return the x and y display pixel location of text at position pos
- in the document.
+ See also:
- SCI_HIDESELECTION(bool hide)
- SCI_GETSELECTIONHIDDEN → bool
- The normal state is to make the selection visible by drawing it as set by , , and related calls.
- However, if you hide the selection, it is drawn as normal text.
+ SCI_SETUNDOCOLLECTION(bool collectUndo)
+ SCI_GETUNDOCOLLECTION → bool
+ You can control whether Scintilla collects undo information with
+ SCI_SETUNDOCOLLECTION
. Pass in true
(1) to collect information and
+ false
(0) to stop collecting. If you stop collection, you should also use
+ SCI_EMPTYUNDOBUFFER
to avoid the undo buffer being unsynchronized with the data in
+ the buffer.
- SCI_CHOOSECARETX
- Scintilla remembers the x value of the last position horizontally moved to explicitly by the
- user and this value is then used when moving vertically such as by using the up and down keys.
- This message sets the current x position of the caret as the remembered value.
+ You might wish to turn off saving undo information if you use the Scintilla to store text
+ generated by a program (a Log view) or in a display window where text is often deleted and
+ regenerated.
- SCI_MOVESELECTEDLINESUP
- Move the selected lines up one line, shifting the line above after the selection.
- The selection will be automatically extended to the beginning of the selection's first line and the end of the selection's last line.
- If nothing was selected, the line the cursor is currently at will be selected.
+ SCI_BEGINUNDOACTION
+ SCI_ENDUNDOACTION
+ Send these two messages to Scintilla to mark the beginning and end of a set of operations that
+ you want to undo all as one operation but that you have to generate as several operations.
+ Alternatively, you can use these to mark a set of operations that you do not want to have
+ combined with the preceding or following operations if they are undone.
- SCI_MOVESELECTEDLINESDOWN
- Move the selected lines down one line, shifting the line below before the selection.
- The selection will be automatically extended to the beginning of the selection's first line and the end of the selection's last line.
- If nothing was selected, the line the cursor is currently at will be selected.
+ SCI_ADDUNDOACTION(int token, int flags)
+ The container can add its own actions into the undo stack by calling
+ SCI_ADDUNDOACTION
and an SCN_MODIFIED
+ notification will be sent to the container with the
+
+ flag when it is time to undo (SC_PERFORMED_UNDO
) or
+ redo (SC_PERFORMED_REDO
) the action. The token argument supplied is
+ returned in the token
field of the notification.
+ For example, if the container wanted to allow undo and redo of a 'toggle bookmark' command then
+ it could call SCI_ADDUNDOACTION(line, 0)
each time the command is performed.
+ Then when it receives a notification to undo or redo it toggles a bookmark on the line given by
+ the token field. If there are different types of commands or parameters that need to be stored into the undo
+ stack then the container should maintain a stack of its own for the document and use the current
+ position in that stack as the argument to SCI_ADDUNDOACTION(line)
.
+ SCI_ADDUNDOACTION
commands are not combined together
+ into a single undo transaction unless grouped with SCI_BEGINUNDOACTION
+ and SCI_ENDUNDOACTION
.
- SCI_SETMOUSESELECTIONRECTANGULARSWITCH(bool
- mouseSelectionRectangularSwitch)
- SCI_GETMOUSESELECTIONRECTANGULARSWITCH → bool
- Enable or disable the ability to switch to rectangular selection mode while making a selection with the mouse.
- When this option is turned on, mouse selections in stream mode can be switched to rectangular mode by pressing
- the corresponding modifier key. They then stick to rectangular mode even when the modifier key is released again.
- When this option is turned off, mouse selections will always stick to the mode the selection was started in. It
- is off by default.
+ The flags argument can be UNDO_MAY_COALESCE
(1) if the container action may be
+ coalesced along with any insertion and deletion actions into a single compound action, otherwise
+ UNDO_NONE
(0).
+ Coalescing treats coalescible container actions as transparent so will still only group together insertions that
+ look like typing or deletions that look like multiple uses of the Backspace or Delete keys.
+
- By character or UTF-16 code unit
+ Change history
- Most Scintilla APIs use byte positions but some applications want to use positions based on counting
- (UTF-32) characters or (UTF-16) code units
- or need to communicate with other code written in terms of characters or code units.
- With only byte positions, this may require examining many bytes to count characters or code units in the document
- but this may be sped up in some cases by indexing the line starts by character or code unit.
+ Scintilla 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.
- SCI_POSITIONRELATIVE(position pos, position relative) → position
- Count a number of whole characters before or after the argument position and return that position.
- The minimum position returned is 0 and the maximum is the last position in the document.
- If the position goes past the document end then 0 is returned.
-
+ 
- SCI_COUNTCHARACTERS(position start, position end) → position
- Returns the number of whole characters between two positions.
+ The image shows the default visuals which can be altered by the application.
+ In the text, inserted characters appear with coloured underlines and points where characters were deleted are shown with small triangles.
+ The margin shows a block indicating the overall state of the line, prioritizing the more consequential modified states.
+ The states are
+ modified (orange),
+ saved (green),
+ saved then reverted to modified (green-yellow),
+ and saved then reverted to original (cyan).
+
- SCI_POSITIONRELATIVECODEUNITS(position pos, position relative) → position
- SCI_COUNTCODEUNITS(position start, position end) → position
- These are the UTF-16 versions of SCI_POSITIONRELATIVE
and SCI_COUNTCHARACTERS
- working in terms of UTF-16 code units.
+ 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.
- SCI_GETLINECHARACTERINDEX → int
- Returns which if any indexes are active. It may be SC_LINECHARACTERINDEX_NONE
(0) or one or more
- of SC_LINECHARACTERINDEX_UTF32
(1) if whole characters are indexed or
- SC_LINECHARACTERINDEX_UTF16
(2) if UTF-16 code units are indexed.
- Character indexes are currently only supported for UTF-8 documents.
+ If the applications wants to display a simplified set of visuals without differentiating between modifications
+ that have been reverted then assign the same attributes to multiple markers and indicators.
- SCI_ALLOCATELINECHARACTERINDEX(int lineCharacterIndex)
- SCI_RELEASELINECHARACTERINDEX(int lineCharacterIndex)
- Allocate or release one or more indexes using same enumeration as SCI_GETLINECHARACTERINDEX
.
- Different aspects of an application may need indexes for different periods and should allocate for those periods.
- Indexes use additional memory so releasing them can help minimize memory but they also take time to recalculate.
- Scintilla may also allocate indexes to support features like accessibility or input method editors.
- Only one index of each type is created for a document at a time.
+
+
+
- SCI_LINEFROMINDEXPOSITION(position pos, int lineCharacterIndex) → line
- SCI_INDEXPOSITIONFROMLINE(line line, int lineCharacterIndex) → position
- The document line of a particular character or code unit may be found by calling SCI_LINEFROMINDEXPOSITION
with one of
- SC_LINECHARACTERINDEX_UTF32
(1) or SC_LINECHARACTERINDEX_UTF16
(2).
- The inverse action, finds the starting position of a document line either in characters or code units from the document start by calling
- SCI_INDEXPOSITIONFROMLINE
with the same lineCharacterIndex
argument.
+ SCI_SETCHANGEHISTORY(int changeHistory)
+ SCI_GETCHANGEHISTORY → int
+ SCI_SETCHANGEHISTORY
turns this feature on and off and determines whether changes are visible in
+ the margin or text or both.
+ Change history depends on the undo history and can only be enabled when undo history is enabled and empty.
+ It should be enabled once when a file is loaded after calling
+ SCI_SETUNDOCOLLECTION(true) and
+ SCI_SETSAVEPOINT.
+ The changeHistory
argument can be a combination of:
- Multiple Selection and Virtual Space
+
+
+
+ SC_CHANGE_HISTORY_DISABLED
-
-
-
-
-
-
-
-
-
-
-
-
+ 0
-
-
-
-
-
-
-
-
-
+ The default: change history turned off.
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ SC_CHANGE_HISTORY_ENABLED
-
-
-
-
-
-
-
-
-
+ 1
- SC_ELEMENT_SELECTION_ADDITIONAL_TEXT : colouralpha
- SC_ELEMENT_SELECTION_ADDITIONAL_BACK : colouralpha
-
-
-
-
- SC_ELEMENT_CARET_ADDITIONAL : colouralpha
-
-
-
-
-
-
-
+ Track changes to the document.
+
-
-
-
-
-
+
+ SC_CHANGE_HISTORY_MARKERS
-
- There may be multiple selections active at one time.
- More selections are made by holding down the Ctrl key while dragging with the mouse.
- The most recent selection is the main selection and determines which part of the document is shown automatically.
- Any selection apart from the main selection is called an additional selection.
- The calls in the previous section operate on the main selection.
- There is always at least one selection.
- The selection can be simplified down to just the main selection by
-
+
- which is normally mapped to the Esc key.
- 2
+
+ Display changes in the margin using the SC_MARKNUM_HISTORY
markers.
+
-
- Rectangular selections are handled as multiple selections although the original rectangular range is remembered so that
- subsequent operations may be handled differently for rectangular selections. For example, pasting a rectangular selection
- places each piece in a vertical column.
-
+
+ SC_CHANGE_HISTORY_INDICATORS
-
- Virtual space is space beyond the end of each line. The caret may be moved into virtual space but no real space will be
- added to the document until there is some text typed or some other text insertion command is used.
-
+ 4
- When discontiguous selections are copied to the clipboard, each selection is added to the clipboard text
- in order with no delimiting characters.
- For rectangular selections the document's line end is added after each line's text. Rectangular selections
- are always copied from top line to bottom, not in the in order of selection.Virtual space is not copied.
+ Display changes in the text using the INDICATOR_HISTORY
indicators.
+
+
+
-
- SCI_SETMULTIPLESELECTION(bool multipleSelection)
- SCI_GETMULTIPLESELECTION → bool
- Enable or disable multiple selection. When multiple selection is disabled, it is not possible to select
- multiple ranges by holding down the Ctrl key while dragging with the mouse.
+ There are default visuals assigned to each history marker and indicator but these may be overridden by the application.
-
- SCI_SETADDITIONALSELECTIONTYPING(bool additionalSelectionTyping)
- SCI_GETADDITIONALSELECTIONTYPING → bool
- Whether typing, new line, cursor left/right/up/down, backspace, delete, home, and end work
- with multiple selections simultaneously.
- Also allows selection and word and line deletion commands.
+ Markers:
-
- SCI_SETMULTIPASTE(int multiPaste)
- SCI_GETMULTIPASTE → int
- When pasting into multiple selections, the pasted text can go into just the main selection with SC_MULTIPASTE_ONCE
=0
- or into each selection with SC_MULTIPASTE_EACH
=1. SC_MULTIPASTE_ONCE
is the default.
+
+
+
+ SC_MARKNUM_HISTORY_REVERTED_TO_ORIGIN
-
- SCI_SETVIRTUALSPACEOPTIONS(int virtualSpaceOptions)
- SCI_GETVIRTUALSPACEOPTIONS → int
- Virtual space can be enabled or disabled for rectangular selections or in other circumstances or in both.
- There are three bit flags SCVS_RECTANGULARSELECTION
=1,
- SCVS_USERACCESSIBLE
=2, and
- SCVS_NOWRAPLINESTART
=4 which can be set independently.
- SCVS_NONE
=0, the default, disables all use of virtual space.
- SCVS_NOWRAPLINESTART
prevents left arrow movement and selection
- from wrapping to the previous line.
- This is most commonly desired in conjunction with virtual space but is an independent
- setting so works without virtual space.
+ 21
-
- SCI_SETRECTANGULARSELECTIONMODIFIER(int modifier)
- SCI_GETRECTANGULARSELECTIONMODIFIER → int
- On GTK and Qt, the key used to indicate that a rectangular selection should be created when combined with a mouse drag can be set.
- The three possible values are SCMOD_CTRL
=2, SCMOD_ALT
=4 (default) or SCMOD_SUPER
=8.
- Since SCMOD_ALT
may already be used by a window manager, the window manager may need configuring to allow this choice.
- SCMOD_SUPER
is often a system dependent modifier key such as the Left Windows key on a Windows keyboard or the
- Command key on a Mac.
+ A change was made to this line and saved but then reverted to its original state.
+ This line is different to its state on disk.
+
-
- SCI_GETSELECTIONS → int
- Return the number of selections currently active. There is always at least one selection.
+
+ SC_MARKNUM_HISTORY_SAVED
-
- SCI_GETSELECTIONEMPTY → bool
- Return 1 if every selected range is empty else 0.
+ 22
-
- SCI_CLEARSELECTIONS
- Set a single empty selection at 0 as the only selection.
+ This line was modified and saved.
+ This line is the same as its state on disk.
+
-
- SCI_SETSELECTION(position caret, position anchor)
- Set a single selection from anchor
to caret
as the only selection.
+
+ SC_MARKNUM_HISTORY_MODIFIED
-
- SCI_ADDSELECTION(position caret, position anchor)
- Add a new selection from anchor
to caret
as the main selection retaining all other
- selections as additional selections.
- Since there is always at least one selection, to set a list of selections, the first selection should be
- added with SCI_SETSELECTION
and later selections added with SCI_ADDSELECTION
+ 23
-
- SCI_DROPSELECTIONN(int selection)
- If there are multiple selections, remove the indicated selection.
- If this was the main selection then make the previous selection the main and if it was the first then the last selection becomes main.
- If there is only one selection, or there is no selection selection
, then there is no effect.
+ This line was modified but not yet saved.
+ This line is different to its state on disk.
+
-
- SCI_SETMAINSELECTION(int selection)
- SCI_GETMAINSELECTION → int
- One of the selections is the main selection which is used to determine what range of text is automatically visible.
- The main selection may be displayed in different colours or with a differently styled caret.
- Only an already existing selection can be made main.
+
+ SC_MARKNUM_HISTORY_REVERTED_TO_MODIFIED
-
- SCI_SETSELECTIONNCARET(int selection, position caret)
- SCI_GETSELECTIONNCARET(int selection) → position
- SCI_SETSELECTIONNCARETVIRTUALSPACE(int selection, position space)
- SCI_GETSELECTIONNCARETVIRTUALSPACE(int selection) → position
- SCI_SETSELECTIONNANCHOR(int selection, position anchor)
- SCI_GETSELECTIONNANCHOR(int selection) → position
- SCI_SETSELECTIONNANCHORVIRTUALSPACE(int selection, position space)
- SCI_GETSELECTIONNANCHORVIRTUALSPACE(int selection) → position
- Set or query the position and amount of virtual space for the caret and anchor of each already existing selection.
+ 24
-
- SCI_SETSELECTIONNSTART(int selection, position anchor)
- SCI_GETSELECTIONNSTART(int selection) → position
- SCI_GETSELECTIONNSTARTVIRTUALSPACE(int selection) → position
- SCI_SETSELECTIONNEND(int selection, position caret)
- SCI_GETSELECTIONNEND(int selection) → position
- SCI_GETSELECTIONNENDVIRTUALSPACE(int selection) → position
- Set or query the start and end position of each already existing selection.
- Query the virtual space at start and end of each selection.
- Mostly of use to query each range for its text. The selection
parameter is zero-based.
+ A change was made to this line and saved but then reverted but not to its original state.
+ This line is different to its state on disk.
+
+
+
-
- SCI_SETRECTANGULARSELECTIONCARET(position caret)
- SCI_GETRECTANGULARSELECTIONCARET → position
- SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE(position space)
- SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE → position
- SCI_SETRECTANGULARSELECTIONANCHOR(position anchor)
- SCI_GETRECTANGULARSELECTIONANCHOR → position
- SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE(position space)
- SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE → position
- Set or query the position and amount of virtual space for the caret and anchor of the rectangular selection.
- After setting the rectangular selection, this is broken down into multiple selections, one for each line.
+ Indicators:
-
- SC_ELEMENT_SELECTION_ADDITIONAL_TEXT : colouralpha
- SC_ELEMENT_SELECTION_ADDITIONAL_BACK : colouralpha
- SCI_SETADDITIONALSELALPHA(alpha alpha)
- SCI_GETADDITIONALSELALPHA → int
- SCI_SETADDITIONALSELFORE(colour fore)
- SCI_SETADDITIONALSELBACK(colour back)
- Modify the appearance of additional selections so that they can be differentiated from the main selection which has its appearance set with
- SC_ELEMENT_SELECTION_TEXT
,
- SC_ELEMENT_SELECTION_BACK
,
- ,
- ,
- , and
- .
- The element APIs are preferred and the following messages discouraged.
- The additional selection background is drawn on the layer defined for all selection backgrounds by
- .
- SCI_SETADDITIONALSELFORE
and
- SCI_SETADDITIONALSELBACK
calls have no
- effect until
- and are
- called with useSetting
value set to true. Subsequent calls to
- ,
- and will
- overwrite the values set by SCI_SETADDITIONALSEL*
functions.
+
+
+
+ INDICATOR_HISTORY_REVERTED_TO_ORIGIN_INSERTION
+ 36
+ Text was deleted and saved but then reverted to its original state.
+ This text has not been saved to disk.
+
-
- SC_ELEMENT_CARET_ADDITIONAL : colouralpha
- SCI_SETADDITIONALCARETFORE(colour fore)
- SCI_GETADDITIONALCARETFORE → colour
- SCI_SETADDITIONALCARETSBLINK(bool additionalCaretsBlink)
- SCI_GETADDITIONALCARETSBLINK → bool
- Modify the appearance of additional carets so that they can be differentiated from the main caret which has its appearance set with
- SC_ELEMENT_CARET
,
- ,
- ,
- , and
- .
+
+ INDICATOR_HISTORY_REVERTED_TO_ORIGIN_DELETION
+ 37
+ Text was inserted and saved but then reverted to its original state.
+ There is text on disk that is missing.
+
-
- SCI_SETADDITIONALCARETSVISIBLE(bool additionalCaretsVisible)
- SCI_GETADDITIONALCARETSVISIBLE → bool
- Determine whether to show additional carets (defaults to true
).
+
+ INDICATOR_HISTORY_SAVED_INSERTION
+ 38
+ Text was inserted and saved.
+ This text is the same as on disk.
+
+
+ INDICATOR_HISTORY_SAVED_DELETION
+ 39
+ Text was deleted and saved.
+ This range is the same as on disk.
+
-
- SCI_SWAPMAINANCHORCARET
- SCI_ROTATESELECTION
- SCI_MULTIPLESELECTADDNEXT
- SCI_MULTIPLESELECTADDEACH
- These commands may be assigned to keys to make it possible to manipulate multiple selections.
- SCI_SWAPMAINANCHORCARET
moves the caret to the opposite end of the main selection.
- SCI_ROTATESELECTION
makes the next selection be the main selection.
- SCI_MULTIPLESELECTADDNEXT
adds the next occurrence of the main selection
- within the target to the set of selections as main. If the current selection is empty then select word around caret.
- The current searchFlags
- are used so the application may choose case sensitivity and word search options.
- SCI_MULTIPLESELECTADDEACH
is similar to
- SCI_MULTIPLESELECTADDNEXT
but adds multiple occurrences instead of just one.
-
+
+ INDICATOR_HISTORY_MODIFIED_INSERTION
+ 40
+ Text was inserted but not yet saved.
+ This text has not been saved to disk.
+
+
+ INDICATOR_HISTORY_MODIFIED_DELETION
+ 41
+ Text was deleted but not yet saved.
+ There is text on disk that is missing.
+
+
+
+ INDICATOR_HISTORY_REVERTED_TO_MODIFIED_INSERTION
+ 42
+ Text was deleted and saved but then reverted but not to its original state.
+ This text has not been saved to disk.
+
+
+ INDICATOR_HISTORY_REVERTED_TO_MODIFIED_DELETION
+ 43
+ Text was inserted and saved but then reverted but not to its original state.
+ There is text on disk that is missing.
+
+
+
Scrolling and automatic scrolling
--
cgit v1.2.3