Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
6242 lines (5035 sloc) 330 KB
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="">
<meta name="generator"
content="HTML Tidy for Windows (vers 1st August 2002), see" />
<meta name="generator" content="SciTE" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Scintilla Documentation</title>
<style type="text/css">
CODE { font-weight: bold; font-family: Consolas,Bitstream Vera Sans Mono,Courier New,monospace; }
A:visited { color: blue; }
A:hover { text-decoration: underline ! important; }
A.message { text-decoration: none; font-weight: bold; font-family: Consolas,Bitstream Vera Sans Mono,Courier New,monospace; }
A.toc { text-decoration: none; }
A.jump { text-decoration: none; }
<body bgcolor="#FFFFFF" text="#000000">
<table bgcolor="#000000" width="100%" cellspacing="0" cellpadding="0" border="0"
<td><img src="SciTEIco.png" border="3" height="64" width="64" alt="Scintilla icon" /></td>
<td><a href="index.html"
<h1>Scintilla Documentation</h1>
<p>Last edited 4/April/2010 NH</p>
<p>There is <a class="jump" href="Design.html">an overview of the internal design of
Scintilla</a>.<br />
<a class="jump" href="ScintillaUsage.html">Some notes on using Scintilla</a>.<br />
<a class="jump" href="Steps.html">How to use the Scintilla Edit Control on Windows</a>.<br />
<a class="jump" href="">A simple sample using Scintilla from
C++ on Windows</a>.<br />
<a class="jump" href="">A simple sample using Scintilla from
Visual Basic</a>.<br />
<a class="jump" href="">Bait is a tiny sample using Scintilla
on GTK+</a>.<br />
<a class="jump" href="Lexer.txt">A detailed description of how to write a lexer, including a
discussion of folding</a>.<br />
<a class="jump" href="">
How to implement a lexer in the container</a>.<br />
<a class="jump" href="">
How to implement folding</a>.<br />
The <a class="jump" href="SciCoding.html">coding style</a> used in Scintilla and SciTE is
worth following if you want to contribute code to Scintilla but is not compulsory.</p>
<p>The Windows version of Scintilla is a Windows Control. As such, its primary programming
interface is through Windows messages. Early versions of Scintilla emulated much of the API
defined by the standard Windows Edit and RichEdit controls but those APIs are now deprecated in
favour of Scintilla's own, more consistent API. In addition to messages performing the actions
of a normal Edit control, Scintilla allows control of syntax styling, folding, markers, autocompletion
and call tips.</p>
<p>The GTK+ version also uses messages in a similar way to the Windows version. This is
different to normal GTK+ practice but made it easier to implement rapidly.</p>
<p>Scintilla does not properly support right-to-left languages like Arabic and Hebrew.
While text in these languages may appear correct, it is not possible to interact with this text
as is normal with other editing components.</p>
<p>This documentation describes the individual messages and notifications used by Scintilla. It
does not describe how to link them together to form a useful editor. For now, the best way to
work out how to develop using Scintilla is to see how SciTE uses it. SciTE exercises most of
Scintilla's facilities.</p>
<p>In the descriptions that follow, the messages are described as function calls with zero, one
or two arguments. These two arguments are the standard <code>wParam</code> and
<code>lParam</code> familiar to Windows programmers. These parameters are integers that
are large enough to hold pointers, and the return value is also an integer large enough to contain a
Although the commands only use the
arguments described, because all messages have two arguments whether Scintilla uses them or
not, it is strongly recommended that any unused arguments are set to 0. This allows future
enhancement of messages without the risk of breaking existing code. Common argument types
<table cellpadding="1" cellspacing="2" border="0" summary="Common argument types">
<tbody valign="top">
<th align="left">bool</th>
<td>Arguments expect the values 0 for <code>false</code> and 1 for
<th align="left">int</th>
<td>Arguments are 32-bit signed integers.</td>
<th align="left">const&nbsp;char&nbsp;*</th>
<td>Arguments point at text that is being passed to Scintilla but not modified. The text
may be zero terminated or another argument may specify the character count, the
description will make this clear.</td>
<th align="left">char *</th>
<td>Arguments point at text buffers that Scintilla will fill with text. In some cases,
another argument will tell Scintilla the buffer size. In others, you must make sure that
the buffer is big enough to hold the requested text. If a NULL pointer (0) is passed
then, for SCI_* calls, the length that should be allocated is returned.</td>
<th align="left" id="colour">colour</th>
<td>Colours are set using the RGB format (Red, Green, Blue). The intensity of each colour
is set in the range 0 to 255. If you have three such intensities, they are combined as:
red | (green &lt;&lt; 8) | (blue &lt;&lt; 16). If you set all intensities to 255, the
colour is white. If you set all intensities to 0, the colour is black. When you set a
colour, you are making a request. What you will get depends on the capabilities of the
system and the current screen mode.</td>
<th align="left" id="alpha">alpha</th>
<td>Translucency is set using an alpha value.
Alpha ranges from 0 (SC_ALPHA_TRANSPARENT) which is completely transparent to
255 (SC_ALPHA_OPAQUE) which is opaque. The value 256 (SC_ALPHA_NOALPHA)
is opaque and uses code that is not alpha-aware and may be faster. Not all platforms support
translucency and only some Scintilla features implement translucency.
The default alpha value for most features is SC_ALPHA_NOALPHA.</td>
<th align="left">&lt;unused&gt;</th>
<td>This is an unused argument. Setting it to 0 will ensure compatibility with future
<h2 id="MessageCategories">Contents</h2>
<table cellpadding="4" cellspacing="2" border="0" summary="Message categories">
<td>o <a class="toc" href="#TextRetrievalAndModification">Text retrieval and
<td>o <a class="toc" href="#Searching">Searching and replacing</a></td>
<td>o <a class="toc" href="#Overtype">Overtype</a></td>
<td>o <a class="toc" href="#CutCopyAndPaste">Cut, copy and paste</a></td>
<td>o <a class="toc" href="#ErrorHandling">Error handling</a></td>
<td>o <a class="toc" href="#UndoAndRedo">Undo and Redo</a></td>
<td>o <a class="toc" href="#SelectionAndInformation">Selection and information</a></td>
<td>o <a class="toc" href="#MultipleSelectionAndVirtualSpace">Multiple Selection and Virtual Space</a></td>
<td>o <a class="toc" href="#ScrollingAndAutomaticScrolling">Scrolling and automatic
<td>o <a class="toc" href="#WhiteSpace">White space</a></td>
<td>o <a class="toc" href="#Cursor">Cursor</a></td>
<td>o <a class="toc" href="#MouseCapture">Mouse capture</a></td>
<td>o <a class="toc" href="#LineEndings">Line endings</a></td>
<td>o <a class="toc" href="#Styling">Styling</a></td>
<td>o <a class="toc" href="#StyleDefinition">Style definition</a></td>
<td>o <a class="toc" href="#CaretAndSelectionStyles">Caret, selection, and hotspot styles</a></td>
<td>o <a class="toc" href="#Margins">Margins</a></td>
<td>o <a class="toc" href="#Annotations">Annotations</a></td>
<td>o <a class="toc" href="#OtherSettings">Other settings</a></td>
<td>o <a class="toc" href="#BraceHighlighting">Brace highlighting</a></td>
<td>o <a class="toc" href="#TabsAndIndentationGuides">Tabs and Indentation
<td>o <a class="toc" href="#Markers">Markers</a></td>
<td>o <a class="toc" href="#Indicators">Indicators</a></td>
<td>o <a class="toc" href="#Autocompletion">Autocompletion</a></td>
<td>o <a class="toc" href="#UserLists">User lists</a></td>
<td>o <a class="toc" href="#CallTips">Call tips</a></td>
<td>o <a class="toc" href="#KeyboardCommands">Keyboard commands</a></td>
<td>o <a class="toc" href="#KeyBindings">Key bindings</a></td>
<td>o <a class="toc" href="#PopupEditMenu">Popup edit menu</a></td>
<td>o <a class="toc" href="#MacroRecording">Macro recording</a></td>
<td>o <a class="toc" href="#Printing">Printing</a></td>
<td>o <a class="toc" href="#DirectAccess">Direct access</a></td>
<td>o <a class="toc" href="#MultipleViews">Multiple views</a></td>
<td>o <a class="toc" href="#Folding">Folding</a></td>
<td>o <a class="toc" href="#LineWrapping">Line wrapping</a></td>
<td>o <a class="toc" href="#Zooming">Zooming</a></td>
<td>o <a class="toc" href="#LongLines">Long lines</a></td>
<td>o <a class="toc" href="#Lexer">Lexer</a></td>
<td>o <a class="toc" href="#Notifications">Notifications</a></td>
<td>o <a class="toc" href="#GTK">GTK+</a></td>
<td>o <a class="toc" href="#DeprecatedMessages">Deprecated messages</a></td>
<td>o <a class="toc" href="#EditMessagesNeverSupportedByScintilla">Edit messages never
supported by Scintilla</a></td>
<td>o <a class="toc" href="#BuildingScintilla">Building Scintilla</a></td>
<p>Messages with names of the form <code>SCI_SETxxxxx</code> often have a companion
<code>SCI_GETxxxxx</code>. To save tedious repetition, if the <code>SCI_GETxxxxx</code> message
returns the value set by the <code>SCI_SETxxxxx</code> message, the <code>SET</code> routine is
described and the <code>GET</code> routine is left to your imagination.</p>
<h2 id="TextRetrievalAndModification">Text retrieval and modification</h2>
<p>Each byte in a Scintilla document is followed by an associated byte of styling
information. The combination of a character byte and a style byte is called a cell. Style bytes
are interpreted an index into an array of styles.
Style bytes may be split into an index and a set of indicator bits
but this use is discouraged and indicators should now use
and related calls.
The default split is with the index in the low 5 bits and 3 high bits as <a class="jump"
href="#Indicators">indicators</a>. This allows 32 fundamental styles, which is enough for most
languages, and three independent indicators so that, for example, syntax errors, deprecated
names and bad indentation could all be displayed at once. The number of bits used for styles
can be altered with <a class="message"
href="#SCI_SETSTYLEBITS"><code>SCI_SETSTYLEBITS</code></a> up to a maximum of 8 bits.
The remaining bits can be used for indicators.</p>
<p>In this document, 'character' normally refers to a byte even when multi-byte characters are used.
Lengths measure the numbers of bytes, not the amount of characters in those bytes.</p>
<p>Positions within the Scintilla document refer to a character or the gap before that
character. The first character in a document is 0, the second 1 and so on. If a document
contains <code>nLen</code> characters, the last character is numbered <code>nLen</code>-1.
The caret exists between character positions and can be located from before the first character (0)
to after the last character (<code>nLen</code>).</p>
<p>There are places where the caret can not go where two character bytes make up one character.
This occurs when a DBCS character from a language like Japanese is included in the document or
when line ends are marked with the CP/M standard of a carriage return followed by a line feed.
The <code>INVALID_POSITION</code> constant (-1) represents an invalid position within the
<p>All lines of text in Scintilla are the same height, and this height is calculated from the
largest font in any current style. This restriction is for performance; if lines differed in
height then calculations involving positioning of text would require the text to be styled
<code><a class="message" href="#SCI_GETTEXT">SCI_GETTEXT(int length, char *text)</a><br />
<a class="message" href="#SCI_SETTEXT">SCI_SETTEXT(&lt;unused&gt;, const char *text)</a><br />
<a class="message" href="#SCI_SETSAVEPOINT">SCI_SETSAVEPOINT</a><br />
<a class="message" href="#SCI_GETLINE">SCI_GETLINE(int line, char *text)</a><br />
<a class="message" href="#SCI_REPLACESEL">SCI_REPLACESEL(&lt;unused&gt;, const char
*text)</a><br />
<a class="message" href="#SCI_SETREADONLY">SCI_SETREADONLY(bool readOnly)</a><br />
<a class="message" href="#SCI_GETREADONLY">SCI_GETREADONLY</a><br />
<a class="message" href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE(&lt;unused&gt;, Sci_TextRange
*tr)</a><br />
<a class="message" href="#SCI_ALLOCATE">SCI_ALLOCATE(int bytes, &lt;unused&gt;)</a><br />
<a class="message" href="#SCI_ADDTEXT">SCI_ADDTEXT(int length, const char *s)</a><br />
<a class="message" href="#SCI_ADDSTYLEDTEXT">SCI_ADDSTYLEDTEXT(int length, cell *s)</a><br />
<a class="message" href="#SCI_APPENDTEXT">SCI_APPENDTEXT(int length, const char *s)</a><br />
<a class="message" href="#SCI_INSERTTEXT">SCI_INSERTTEXT(int pos, const char *text)</a><br />
<a class="message" href="#SCI_CLEARALL">SCI_CLEARALL</a><br />
<a class="message" href="#SCI_GETCHARAT">SCI_GETCHARAT(int position)</a><br />
<a class="message" href="#SCI_GETSTYLEAT">SCI_GETSTYLEAT(int position)</a><br />
<a class="message" href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT(&lt;unused&gt;, Sci_TextRange
*tr)</a><br />
<a class="message" href="#SCI_SETSTYLEBITS">SCI_SETSTYLEBITS(int bits)</a><br />
<a class="message" href="#SCI_GETSTYLEBITS">SCI_GETSTYLEBITS</a><br />
<a class="message" href="#SCI_TARGETASUTF8">SCI_TARGETASUTF8(&lt;unused&gt;, char *s)</a><br />
<a class="message" href="#SCI_ENCODEDFROMUTF8">SCI_ENCODEDFROMUTF8(const char *utf8, char *encoded)</a><br />
<a class="message" href="#SCI_SETLENGTHFORENCODE">SCI_SETLENGTHFORENCODE(int bytes)</a><br />
<p><b id="SCI_GETTEXT">SCI_GETTEXT(int length, char *text)</b><br />
This returns <code>length</code>-1 characters of text from the start of the document plus one
terminating 0 character. To collect all the text in a document, use <code>SCI_GETLENGTH</code>
to get the number of characters in the document (<code>nLen</code>), allocate a character
buffer of length <code>nLen+1</code> bytes, then call <code>SCI_GETTEXT(nLen+1, char
*text)</code>. If the text argument is 0 then the length that should be allocated to store the
entire document is returned.
If you then save the text, you should use <code>SCI_SETSAVEPOINT</code> to mark
the text as unmodified.</p>
<p>See also: <code><a class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>, <a
class="message" href="#SCI_GETCURLINE">SCI_GETCURLINE</a>, <a class="message"
href="#SCI_GETLINE">SCI_GETLINE</a>, <a class="message"
href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>, <a class="message"
<p><b id="SCI_SETTEXT">SCI_SETTEXT(&lt;unused&gt;, const char *text)</b><br />
This replaces all the text in the document with the zero terminated text string you pass
This message tells Scintilla that the current state of the document is unmodified. This is
usually done when the file is saved or loaded, hence the name "save point". As Scintilla
performs undo and redo operations, it notifies the container that it has entered or left the
save point with <code><a class="message"
href="#SCN_SAVEPOINTREACHED">SCN_SAVEPOINTREACHED</a></code> and <code><a class="message"
href="#SCN_SAVEPOINTLEFT">SCN_SAVEPOINTLEFT</a></code> <a class="jump"
href="#Notifications">notification messages</a>, allowing the container to know if the file
should be considered dirty or not.</p>
<p>See also: <code><a class="message" href="#SCI_EMPTYUNDOBUFFER">SCI_EMPTYUNDOBUFFER</a>, <a
class="message" href="#SCI_GETMODIFY">SCI_GETMODIFY</a></code></p>
<p><b id="SCI_GETLINE">SCI_GETLINE(int line, char *text)</b><br />
This fills the buffer defined by text with the contents of the nominated line (lines start at
0). The buffer is not terminated by a 0 character. It is up to you to make sure that the buffer
is long enough for the text, use <a class="message"
href="#SCI_LINELENGTH"><code>SCI_LINELENGTH(int line)</code></a>. The returned value is the
number of characters copied to the buffer. The returned text includes any end of line
characters. If you ask for a line number outside the range of lines in the document, 0
characters are copied. If the text argument is 0 then the length that should be allocated
to store the entire line is returned.</p>
<p>See also: <code><a class="message" href="#SCI_GETCURLINE">SCI_GETCURLINE</a>, <a
class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>, <a class="message"
href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a>, <a class="message"
href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>, <a class="message"
<p><b id="SCI_REPLACESEL">SCI_REPLACESEL(&lt;unused&gt;, const char *text)</b><br />
The currently selected text between the <a class="jump" href="#SelectionAndInformation">anchor
and the current position</a> 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.</p>
<p><b id="SCI_SETREADONLY">SCI_SETREADONLY(bool readOnly)</b><br />
These messages set and get the read-only flag for the document. If you mark a document as read
only, attempts to modify the text cause the <a class="message"
href="#SCN_MODIFYATTEMPTRO"><code>SCN_MODIFYATTEMPTRO</code></a> notification.</p>
<p><b id="SCI_GETTEXTRANGE">SCI_GETTEXTRANGE(&lt;unused&gt;, <a class="jump"
href="#Sci_TextRange">Sci_TextRange</a> *tr)</b><br />
This collects the text between the positions <code>cpMin</code> and <code>cpMax</code> and
copies it to <code>lpstrText</code> (see <code>struct Sci_TextRange</code> in
<code>Scintilla.h</code>). If <code>cpMax</code> is -1, text is returned to the end of the
document. The text is 0 terminated, so you must supply a buffer that is at least 1 character
longer than the number of characters you wish to read. The return value is the length of the
returned text not including the terminating 0.</p>
<p>See also: <code><a class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>, <a
class="message" href="#SCI_GETLINE">SCI_GETLINE</a>, <a class="message"
href="#SCI_GETCURLINE">SCI_GETCURLINE</a>, <a class="message"
href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>, <a class="message"
<p><b id="SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT(&lt;unused&gt;, <a class="jump"
href="#Sci_TextRange">Sci_TextRange</a> *tr)</b><br />
This collects styled text into a buffer using two bytes for each cell, with the character at
the lower address of each pair and the style byte at the upper address. Characters between the
positions <code>cpMin</code> and <code>cpMax</code> are copied to <code>lpstrText</code> (see
<code>struct Sci_TextRange</code> in <code>Scintilla.h</code>). Two 0 bytes are added to the end of
the text, so the buffer that <code>lpstrText</code> points at must be at least
<code>2*(cpMax-cpMin)+2</code> bytes long. No check is made for sensible values of
<code>cpMin</code> or <code>cpMax</code>. Positions outside the document return character codes
and style bytes of 0.</p>
<p>See also: <code><a class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>, <a
class="message" href="#SCI_GETLINE">SCI_GETLINE</a>, <a class="message"
href="#SCI_GETCURLINE">SCI_GETCURLINE</a>, <a class="message"
href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a>, <a class="message"
<p><b id="SCI_ALLOCATE">SCI_ALLOCATE(int bytes, &lt;unused&gt;)</b><br />
Allocate a document buffer large enough to store a given number of bytes.
The document will not be made smaller than its current contents.</p>
<p><b id="SCI_ADDTEXT">SCI_ADDTEXT(int length, const char *s)</b><br />
This inserts the first <code>length</code> characters from the string <code>s</code>
at the current position. This will include any 0's in the string that you might have expected
to stop the insert operation. The current position is set at the end of the inserted text,
but it is not scrolled into view.</p>
<p><b id="SCI_ADDSTYLEDTEXT">SCI_ADDSTYLEDTEXT(int length, cell *s)</b><br />
This behaves just like <code>SCI_ADDTEXT</code>, but inserts styled text.</p>
<p><b id="SCI_APPENDTEXT">SCI_APPENDTEXT(int length, const char *s)</b><br />
This adds the first <code>length</code> characters from the string <code>s</code> to the end
of the document. This will include any 0's in the string that you might have expected to stop
the operation. The current selection is not changed and the new text is not scrolled into
<p><b id="SCI_INSERTTEXT">SCI_INSERTTEXT(int pos, const char *text)</b><br />
This inserts the zero terminated <code>text</code> string at position <code>pos</code> or at
the current position if <code>pos</code> is -1. If the current position is after the insertion point
then it is moved along with its surrounding text but no scrolling is performed.</p>
<p><b id="SCI_CLEARALL">SCI_CLEARALL</b><br />
Unless the document is read-only, this deletes all the text.</p>
When wanting to completely restyle the document, for example after choosing a lexer, the
<code>SCI_CLEARDOCUMENTSTYLE</code> can be used to clear all styling information and reset the
folding state.</p>
<p><b id="SCI_GETCHARAT">SCI_GETCHARAT(int pos)</b><br />
This returns the character at <code>pos</code> in the document or 0 if <code>pos</code> is
negative or past the end of the document.</p>
<p><b id="SCI_GETSTYLEAT">SCI_GETSTYLEAT(int pos)</b><br />
This returns the style at <code>pos</code> in the document, or 0 if <code>pos</code> is
negative or past the end of the document.</p>
<p><b id="SCI_SETSTYLEBITS">SCI_SETSTYLEBITS(int bits)</b><br />
This pair of routines sets and reads back the number of bits in each cell to use for styling,
to a maximum of 8 style bits. The remaining bits can be used as indicators. The standard
setting is <code>SCI_SETSTYLEBITS(5)</code>.
The number of styling bits needed by the current lexer can be found with
<p><b id="Sci_TextRange">Sci_TextRange</b> and <b id="Sci_CharacterRange">Sci_CharacterRange</b><br />
These structures are defined to be exactly the same shape as the Win32 <code>TEXTRANGE</code>
and <code>CHARRANGE</code>, so that older code that treats Scintilla as a RichEdit will
struct Sci_CharacterRange {
long cpMin;
long cpMax;
struct Sci_TextRange {
struct Sci_CharacterRange chrg;
char *lpstrText;
<h3 id="EncodedAccess">GTK+-specific: Access to encoded text</h3>
<p><b id="SCI_TARGETASUTF8">SCI_TARGETASUTF8(&lt;unused&gt;, char *s)</b><br />
This method retrieves the value of the target encoded as UTF-8 which is the default
encoding of GTK+ so is useful for retrieving text for use in other parts of the user interface,
such as find and replace dialogs. The length of the encoded text in bytes is returned.
<p><b id="SCI_ENCODEDFROMUTF8">SCI_ENCODEDFROMUTF8(const char *utf8, char *encoded)</b><br />
<code>SCI_ENCODEDFROMUTF8</code> converts a UTF-8 string into the document's
encoding which is useful for taking the results of a find dialog, for example, and receiving
a string of bytes that can be searched for in the document. Since the text can contain nul bytes,
the <code>SCI_SETLENGTHFORENCODE</code> method can be used to set the
length that will be converted. If set to -1, the length is determined by finding a nul byte.
The length of the converted string is returned.
<h2 id="Searching">Searching</h2>
There are methods to search for text and for regular expressions. The regular expression support
is limited and should only be used for simple cases and initial development. A different regular expression
library can be <a class="jump" href="#AlternativeRegEx">integrated into Scintilla</a>
or can be called from the container using direct access to the buffer contents through
<code><a class="message" href="#SCI_FINDTEXT">SCI_FINDTEXT(int flags, Sci_TextToFind
*ttf)</a><br />
<a class="message" href="#SCI_SEARCHANCHOR">SCI_SEARCHANCHOR</a><br />
<a class="message" href="#SCI_SEARCHNEXT">SCI_SEARCHNEXT(int searchFlags, const char
*text)</a><br />
<a class="message" href="#SCI_SEARCHPREV">SCI_SEARCHPREV(int searchFlags, const char
*text)</a><br />
<a class="jump" href="#SearchAndReplaceUsingTheTarget">Search and replace using the
target</a><br />
<p><b id="searchFlags"><code>searchFlags</code></b><br />
Several of the search routines use flag options, which include a simple regular expression
search. Combine the flag options by adding them:</p>
<table border="0" summary="Search flags">
<td>A match only occurs with text that matches the case of the search string.</td>
<td>A match only occurs if the characters before and after are not word characters.</td>
<td>A match only occurs if the character before is not a word character.</td>
<td>The search string should be interpreted as a regular expression.</td>
<td>Treat regular expression in a more POSIX compatible manner
by interpreting bare ( and ) for tagged sections rather than \( and \).</td>
<p>If <code>SCFIND_REGEXP</code> is not included in the <code>searchFlags</code>, you can
search backwards to find the previous occurrence of a search string by setting the end of the
search range before the start. If <code>SCFIND_REGEXP</code> is included, searches are always
from a lower position to a higher position, even if the search range is backwards.</p>
<p>In a regular expression, special characters interpreted are:</p>
<table border="0" summary="Regular expression synopsis">
<td>Matches any character</td>
<td>This marks the start of a region for tagging a match.</td>
<td>This marks the end of a tagged region.</td>
<td>Where <code>n</code> is 1 through 9 refers to the first through ninth tagged region
when replacing. For example, if the search string was <code>Fred\([1-9]\)XXX</code> and
the replace string was <code>Sam\1YYY</code>, when applied to <code>Fred2XXX</code> this
would generate <code>Sam2YYY</code>.</td>
<td>This matches the start of a word using Scintilla's definitions of words.</td>
<td>This matches the end of a word using Scintilla's definition of words.</td>
<td>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.</td>
<td>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.</td>
<td>The complement of the characters in the set. For example, [^A-Za-z] means any
character except an alphabetic character.</td>
<td>This matches the start of a line (unless used inside a set, see above).</td>
<td>This matches the end of a line.</td>
<td>This matches 0 or more times. For example, <code>Sa*m</code> matches <code>Sm</code>,
<code>Sam</code>, <code>Saam</code>, <code>Saaam</code> and so on.</td>
<td>This matches 1 or more times. For example, <code>Sa+m</code> matches
<code>Sam</code>, <code>Saam</code>, <code>Saaam</code> and so on.</td>
<p><b id="SCI_FINDTEXT">SCI_FINDTEXT(int searchFlags, <a class="jump"
href="#Sci_TextToFind">Sci_TextToFind</a> *ttf)</b><br />
This message searches for text in the document. It does not use or move the current selection.
The <a class="jump" href="#searchFlags"><code>searchFlags</code></a> argument controls the
search type, which includes regular expression searches.</p>
<p>The <code>Sci_TextToFind</code> structure is defined in <code>Scintilla.h</code>; set
<code>chrg.cpMin</code> and <code>chrg.cpMax</code> with the range of positions in the document
to search. If <code>SCFIND_REGEXP</code> is not included in the flags, you can search backwards by
setting <code>chrg.cpMax</code> less than <code>chrg.cpMin</code>. If <code>SCFIND_REGEXP</code>
is included, the search is always forwards (even if <code>chrg.cpMax</code> is less than <code>chrg.cpMin</code>).
Set the <code>lpstrText</code> member of <code>Sci_TextToFind</code> to point at a zero terminated
text string holding the search pattern. If your language makes the use of <code>Sci_TextToFind</code>
difficult, you should consider using <code>SCI_SEARCHINTARGET</code> instead.</p>
<p>The return value is -1 if the search fails or the position of the start of the found text if
it succeeds. The <code>chrgText.cpMin</code> and <code>chrgText.cpMax</code> members of
<code>Sci_TextToFind</code> are filled in with the start and end positions of the found text.</p>
<p>See also: <code><a class="message"
<p><b id="Sci_TextToFind">Sci_TextToFind</b><br />
This structure is defined to have exactly the same shape as the Win32 structure
<code>FINDTEXTEX</code> for old code that treated Scintilla as a RichEdit control.</p>
struct Sci_TextToFind {
struct <a class="jump" href="#Sci_CharacterRange">Sci_CharacterRange</a> chrg; // range to search
char *lpstrText; // the search pattern (zero terminated)
struct Sci_CharacterRange chrgText; // returned as position of matching text
<b id="SCI_SEARCHNEXT">SCI_SEARCHNEXT(int searchFlags, const char *text)</b><br />
<b id="SCI_SEARCHPREV">SCI_SEARCHPREV(int searchFlags, const char *text)</b><br />
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 <a class="message"
href="#SCN_MACRORECORD"><code>SCN_MACRORECORD</code></a> <a class="jump"
href="#Notifications">notifications</a> if macro recording is enabled.</p>
<p><code>SCI_SEARCHANCHOR</code> sets the search start point used by
<code>SCI_SEARCHNEXT</code> and <code>SCI_SEARCHPREV</code> 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 <code>SCI_SEARCHNEXT</code> or
<p><code>SCI_SEARCHNEXT</code> and <code>SCI_SEARCHPREV</code> search for the next and previous
occurrence of the zero terminated search string pointed at by text. The search is modified by
the <a class="jump" href="#searchFlags"><code>searchFlags</code></a>. If you request a regular
expression, <code>SCI_SEARCHPREV</code> finds the first occurrence of the search string in the
document, not the previous one before the anchor point.</p>
<p>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.</p>
<p>See also: <a class="message" href="#SCI_SEARCHINTARGET"><code>SCI_SEARCHINTARGET</code></a>,
<a class="message" href="#SCI_FINDTEXT"><code>SCI_FINDTEXT</code></a></p>
<h3 id="SearchAndReplaceUsingTheTarget">Search and replace using the target</h3>
<p>Using <a class="message" href="#SCI_REPLACESEL"><code>SCI_REPLACESEL</code></a>,
modifications cause scrolling and other visible changes, which may take some time and cause
unwanted display updates. If performing many changes, such as a replace all command, the target
can be used instead. First, set the target, ie. the range to be replaced. Then call
<code>SCI_REPLACETARGET</code> or <code>SCI_REPLACETARGETRE</code>.</p>
<p>Searching can be performed within the target range with <code>SCI_SEARCHINTARGET</code>,
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
<code>SCI_SEARCHINTARGET</code> such as <code>SCFIND_MATCHCASE</code>,
<code>SCFIND_WHOLEWORD</code>, <code>SCFIND_WORDSTART</code>, and <code>SCFIND_REGEXP</code>
can be set with <code>SCI_SETSEARCHFLAGS</code>. <code>SCI_SEARCHINTARGET</code> may be simpler
for some clients to use than <a class="message"
href="#SCI_FINDTEXT"><code>SCI_FINDTEXT</code></a>, as that requires using a pointer to a
<code><a class="message" href="#SCI_SETTARGETSTART">SCI_SETTARGETSTART(int pos)</a><br />
<a class="message" href="#SCI_GETTARGETSTART">SCI_GETTARGETSTART</a><br />
<a class="message" href="#SCI_SETTARGETEND">SCI_SETTARGETEND(int pos)</a><br />
<a class="message" href="#SCI_GETTARGETEND">SCI_GETTARGETEND</a><br />
<a class="message" href="#SCI_SETSEARCHFLAGS">SCI_SETSEARCHFLAGS(int searchFlags)</a><br />
<a class="message" href="#SCI_GETSEARCHFLAGS">SCI_GETSEARCHFLAGS</a><br />
<a class="message" href="#SCI_SEARCHINTARGET">SCI_SEARCHINTARGET(int length, const char
*text)</a><br />
<a class="message" href="#SCI_REPLACETARGET">SCI_REPLACETARGET(int length, const char
*text)</a><br />
<a class="message" href="#SCI_REPLACETARGETRE">SCI_REPLACETARGETRE(int length, const char
*text)</a><br />
<a class="message" href="#SCI_GETTAG">SCI_GETTAG(int tagNumber, char *tagValue)</a><br />
<b id="SCI_SETTARGETEND">SCI_SETTARGETEND(int pos)</b><br />
These functions set and return the start and end of the target. When searching in non-regular
expression mode, you can set start greater than end to find the last matching text in the
target rather than the first matching text. The target is also set by a successful
Set the target start and end to the start and end positions of the selection.</p>
<p><b id="SCI_SETSEARCHFLAGS">SCI_SETSEARCHFLAGS(int searchFlags)</b><br />
These get and set the <a class="jump" href="#searchFlags"><code>searchFlags</code></a> used by
<code>SCI_SEARCHINTARGET</code>. There are several option flags including a simple regular
expression search.</p>
<p><b id="SCI_SEARCHINTARGET">SCI_SEARCHINTARGET(int length, const char *text)</b><br />
This searches for the first occurrence of a text string in the target defined by
<code>SCI_SETTARGETSTART</code> and <code>SCI_SETTARGETEND</code>. The text string is not zero
terminated; the size is set by <code>length</code>. The search is modified by the search flags
set by <code>SCI_SETSEARCHFLAGS</code>. 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.</p>
<p><b id="SCI_REPLACETARGET">SCI_REPLACETARGET(int length, const char *text)</b><br />
If <code>length</code> is -1, <code>text</code> is a zero terminated string, otherwise
<code>length</code> 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.<br />
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.</p>
<p><b id="SCI_REPLACETARGETRE">SCI_REPLACETARGETRE(int length, const char *text)</b><br />
This replaces the target using regular expressions. If <code>length</code> is -1,
<code>text</code> is a zero terminated string, otherwise <code>length</code> is the number of
characters to use. The replacement string is formed from the text string with any sequences of
<code>\1</code> through <code>\9</code> replaced by tagged matches from the most recent regular
expression search.
After replacement, the target range refers to the replacement text.
The return value is the length of the replacement string.</p>
<p><b id="SCI_GETTAG">SCI_GETTAG(int tagNumber, char *tagValue)</b><br />
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.</p>
<p>See also: <a class="message" href="#SCI_FINDTEXT"><code>SCI_FINDTEXT</code></a></p>
<h2 id="Overtype">Overtype</h2>
<p><b id="SCI_SETOVERTYPE">SCI_SETOVERTYPE(bool overType)</b><br />
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.
<code>SCI_GETOVERTYPE</code> returns <code>TRUE</code> (1) if overtyping is active, otherwise
<code>FALSE</code> (0) will be returned. Use <code>SCI_SETOVERTYPE</code> to set the overtype
<h2 id="CutCopyAndPaste">Cut, copy and paste</h2>
<code><a class="message" href="#SCI_CUT">SCI_CUT</a><br />
<a class="message" href="#SCI_COPY">SCI_COPY</a><br />
<a class="message" href="#SCI_PASTE">SCI_PASTE</a><br />
<a class="message" href="#SCI_CLEAR">SCI_CLEAR</a><br />
<a class="message" href="#SCI_CANPASTE">SCI_CANPASTE</a><br />
<a class="message" href="#SCI_COPYRANGE">SCI_COPYRANGE(int start, int end)</a><br />
<a class="message" href="#SCI_COPYTEXT">SCI_COPYTEXT(int length,
const char *text)</a><br />
<a class="message" href="#SCI_COPYALLOWLINE">SCI_COPYALLOWLINE</a><br />
<a class="message" href="#SCI_SETPASTECONVERTENDINGS">SCI_SETPASTECONVERTENDINGS(bool convert)</a><br />
<p><b id="SCI_CUT">SCI_CUT</b><br />
<b id="SCI_COPY">SCI_COPY</b><br />
<b id="SCI_PASTE">SCI_PASTE</b><br />
<b id="SCI_CLEAR">SCI_CLEAR</b><br />
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.
<code>SCI_CANPASTE</code> 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
<code>SCI_GETSELECTIONSTART()-SCI_GETSELECTIONEND()</code>, which will be non-zero if you can
copy or cut to the clipboard.</p>
<p>GTK+ does not really support <code>SCI_CANPASTE</code> and always returns <code>TRUE</code>
unless the document is read-only.</p>
<p>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.</p>
<p><code>SCI_COPYALLOWLINE</code> 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 <code>SCI_PASTE</code> to paste
the whole line before the current line.</p>
<b id="SCI_COPYRANGE">SCI_COPYRANGE(int start, int end)</b><br />
<b id="SCI_COPYTEXT">SCI_COPYTEXT(int length, const char *text)</b><br />
<p><code>SCI_COPYRANGE</code> copies a range of text from the document to
the system clipboard and <code>SCI_COPYTEXT</code> copies a supplied piece of
text to the system clipboard.</p>
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
<a class="message" href="#SCI_SETEOLMODE">SCI_SETEOLMODE</a>.
Currently only changeable on Windows. On GTK+ pasted text is always converted.</p>
<h2 id="ErrorHandling">Error handling</h2>
<p><b id="SCI_SETSTATUS">SCI_SETSTATUS(int status)</b><br />
If an error occurs, Scintilla may set an internal error number that can be retrieved with
To clear the error status call <code>SCI_SETSTATUS(0)</code>.
The currently defined statuses are:
<table cellpadding="1" cellspacing="2" border="0" summary="Status values">
<tbody valign="top">
<th align="left">SC_STATUS_OK</th>
<td>No failures</td>
<th align="left">SC_STATUS_FAILURE</th>
<td>Generic failure</td>
<th align="left">SC_STATUS_BADALLOC</th>
<td>Memory is exhausted</td>
<h2 id="UndoAndRedo">Undo and Redo</h2>
<p>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 <code>SCI_BEGINUNDOACTION</code> and
<code>SCI_ENDUNDOACTION</code> messages. These transactions can be nested and only the top-level
sequences are undone as units.</p>
<code><a class="message" href="#SCI_UNDO">SCI_UNDO</a><br />
<a class="message" href="#SCI_CANUNDO">SCI_CANUNDO</a><br />
<a class="message" href="#SCI_EMPTYUNDOBUFFER">SCI_EMPTYUNDOBUFFER</a><br />
<a class="message" href="#SCI_REDO">SCI_REDO</a><br />
<a class="message" href="#SCI_CANREDO">SCI_CANREDO</a><br />
collectUndo)</a><br />
<a class="message" href="#SCI_GETUNDOCOLLECTION">SCI_GETUNDOCOLLECTION</a><br />
<a class="message" href="#SCI_BEGINUNDOACTION">SCI_BEGINUNDOACTION</a><br />
<a class="message" href="#SCI_ENDUNDOACTION">SCI_ENDUNDOACTION</a><br />
<a class="message" href="#SCI_ADDUNDOACTION">SCI_ADDUNDOACTION(int token, int flags)</a><br />
<p><b id="SCI_UNDO">SCI_UNDO</b><br />
<b id="SCI_CANUNDO">SCI_CANUNDO</b><br />
<code>SCI_UNDO</code> undoes one action, or if the undo buffer has reached a
<code>SCI_ENDUNDOACTION</code> point, all the actions back to the corresponding
<p><code>SCI_CANUNDO</code> 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.</p>
<p><b id="SCI_REDO">SCI_REDO</b><br />
<b id="SCI_CANREDO">SCI_CANREDO</b><br />
<code>SCI_REDO</code> undoes the effect of the last <code>SCI_UNDO</code> operation.</p>
<p><code>SCI_CANREDO</code> 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.</p>
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 <code><a class="message"
href="#SCN_SAVEPOINTREACHED">SCN_SAVEPOINTREACHED</a></code> notification to be sent to the
<p>See also: <a class="message" href="#SCI_SETSAVEPOINT"><code>SCI_SETSAVEPOINT</code></a></p>
<p><b id="SCI_SETUNDOCOLLECTION">SCI_SETUNDOCOLLECTION(bool collectUndo)</b><br />
You can control whether Scintilla collects undo information with
<code>SCI_SETUNDOCOLLECTION</code>. Pass in <code>true</code> (1) to collect information and
<code>false</code> (0) to stop collecting. If you stop collection, you should also use
<code>SCI_EMPTYUNDOBUFFER</code> to avoid the undo buffer being unsynchronized with the data in
the buffer.</p>
<p>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
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.</p>
<p><b id="SCI_ADDUNDOACTION">SCI_ADDUNDOACTION(int token, int flags)</b><br />
The container can add its own actions into the undo stack by calling
<code>SCI_ADDUNDOACTION</code> and an <code>SCN_MODIFIED</code>
notification will be sent to the container with the
<a class="message" href="#SC_MOD_CONTAINER"><code>SC_MOD_CONTAINER</code></a>
flag when it is time to undo (<code>SC_PERFORMED_UNDO</code>) or
redo (<code>SC_PERFORMED_REDO</code>) the action. The token argument supplied is
returned in the <code>token</code> field of the notification.</p>
<p>For example, if the container wanted to allow undo and redo of a 'toggle bookmark' command then
it could call <code>SCI_ADDUNDOACTION(line, 0)</code> 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 <code>SCI_ADDUNDOACTION(line)</code>.
<code>SCI_ADDUNDOACTION</code> commands are not combined together
into a single undo transaction unless grouped with <code>SCI_BEGINUNDOACTION</code>
and <code>SCI_ENDUNDOACTION</code>.</p>
<p>The flags argument can be <code>UNDO_MAY_COALESCE</code> (1) if the container action may be
coalesced along with any insertion and deletion actions into a single compound action, otherwise 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.
<h2 id="SelectionAndInformation">Selection and information</h2>
<p>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.</p>
<code><a class="message" href="#SCI_GETTEXTLENGTH">SCI_GETTEXTLENGTH</a><br />
<a class="message" href="#SCI_GETLENGTH">SCI_GETLENGTH</a><br />
<a class="message" href="#SCI_GETLINECOUNT">SCI_GETLINECOUNT</a><br />
<a class="message" href="#SCI_SETFIRSTVISIBLELINE">SCI_SETFIRSTVISIBLELINE(int lineDisplay)</a><br />
<a class="message" href="#SCI_LINESONSCREEN">SCI_LINESONSCREEN</a><br />
<a class="message" href="#SCI_GETMODIFY">SCI_GETMODIFY</a><br />
<a class="message" href="#SCI_SETSEL">SCI_SETSEL(int anchorPos, int currentPos)</a><br />
<a class="message" href="#SCI_GOTOPOS">SCI_GOTOPOS(int position)</a><br />
<a class="message" href="#SCI_GOTOLINE">SCI_GOTOLINE(int line)</a><br />
<a class="message" href="#SCI_SETCURRENTPOS">SCI_SETCURRENTPOS(int position)</a><br />
<a class="message" href="#SCI_GETCURRENTPOS">SCI_GETCURRENTPOS</a><br />
<a class="message" href="#SCI_SETANCHOR">SCI_SETANCHOR(int position)</a><br />
<a class="message" href="#SCI_GETANCHOR">SCI_GETANCHOR</a><br />
<a class="message" href="#SCI_SETSELECTIONSTART">SCI_SETSELECTIONSTART(int position)</a><br />
<a class="message" href="#SCI_GETSELECTIONSTART">SCI_GETSELECTIONSTART</a><br />
<a class="message" href="#SCI_SETSELECTIONEND">SCI_SETSELECTIONEND(int position)</a><br />
<a class="message" href="#SCI_GETSELECTIONEND">SCI_GETSELECTIONEND</a><br />
<a class="message" href="#SCI_SELECTALL">SCI_SELECTALL</a><br />
<a class="message" href="#SCI_LINEFROMPOSITION">SCI_LINEFROMPOSITION(int position)</a><br />
<a class="message" href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(int line)</a><br />
<a class="message" href="#SCI_GETLINEENDPOSITION">SCI_GETLINEENDPOSITION(int line)</a><br />
<a class="message" href="#SCI_LINELENGTH">SCI_LINELENGTH(int line)</a><br />
<a class="message" href="#SCI_GETCOLUMN">SCI_GETCOLUMN(int position)</a><br />
<a class="message" href="#SCI_FINDCOLUMN">SCI_FINDCOLUMN(int line, int column)</a><br />
<a class="message" href="#SCI_POSITIONFROMPOINT">SCI_POSITIONFROMPOINT(int x, int y)</a><br />
y)</a><br />
<a class="message" href="#SCI_CHARPOSITIONFROMPOINT">SCI_CHARPOSITIONFROMPOINT(int x, int y)</a><br />
y)</a><br />
<a class="message" href="#SCI_POINTXFROMPOSITION">SCI_POINTXFROMPOSITION(&lt;unused&gt;, int
position)</a><br />
<a class="message" href="#SCI_POINTYFROMPOSITION">SCI_POINTYFROMPOSITION(&lt;unused&gt;, int
position)</a><br />
<a class="message" href="#SCI_HIDESELECTION">SCI_HIDESELECTION(bool hide)</a><br />
<a class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT(&lt;unused&gt;, char *text)</a><br />
<a class="message" href="#SCI_GETCURLINE">SCI_GETCURLINE(int textLen, char *text)</a><br />
<a class="message" href="#SCI_SETSELECTIONMODE">SCI_SETSELECTIONMODE(int mode)</a><br />
<a class="message" href="#SCI_GETSELECTIONMODE">SCI_GETSELECTIONMODE</a><br />
<a class="message" href="#SCI_GETLINESELENDPOSITION">SCI_GETLINESELENDPOSITION(int line)</a><br />
<a class="message" href="#SCI_WORDENDPOSITION">SCI_WORDENDPOSITION(int position, bool
onlyWordCharacters)</a><br />
<a class="message" href="#SCI_WORDSTARTPOSITION">SCI_WORDSTARTPOSITION(int position, bool
onlyWordCharacters)</a><br />
<a class="message" href="#SCI_POSITIONBEFORE">SCI_POSITIONBEFORE(int position)</a><br />
<a class="message" href="#SCI_POSITIONAFTER">SCI_POSITIONAFTER(int position)</a><br />
<a class="message" href="#SCI_TEXTWIDTH">SCI_TEXTWIDTH(int styleNumber, const char *text)</a><br />
<a class="message" href="#SCI_TEXTHEIGHT">SCI_TEXTHEIGHT(int line)</a><br />
<a class="message" href="#SCI_CHOOSECARETX">SCI_CHOOSECARETX</a><br />
Both these messages return the length of the document in bytes.</p>
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.</p>
These messages retrieve and set the line number of the first visible line in the Scintilla view. The first line
in the document is numbered 0. The value is a visible line rather than a document line.</p>
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.</p>
<p><b id="SCI_GETMODIFY">SCI_GETMODIFY</b><br />
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 <a class="message" href="#SCI_SETSAVEPOINT"><code>SCI_SETSAVEPOINT</code></a>,
usually when you have saved data to a file.</p>
<p>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 <a class="message"
href="#SCN_SAVEPOINTREACHED"><code>SCN_SAVEPOINTREACHED</code></a> and <a class="message"
href="#SCN_SAVEPOINTLEFT"><code>SCN_SAVEPOINTLEFT</code></a> <a class="jump"
href="#Notifications">notification messages</a>.</p>
<p><b id="SCI_SETSEL">SCI_SETSEL(int anchorPos, int currentPos)</b><br />
This message sets both the anchor and the current position. If <code>currentPos</code> is
negative, it means the end of the document. If <code>anchorPos</code> is negative, it means
remove any selection (i.e. set the anchor to the same position as <code>currentPos</code>). The
caret is scrolled into view after this operation.</p>
<p><b id="SCI_GOTOPOS">SCI_GOTOPOS(int pos)</b><br />
This removes any selection, sets the caret at <code>pos</code> and scrolls the view to make
the caret visible, if necessary. It is equivalent to
<code>SCI_SETSEL(pos, pos)</code>. The anchor position is set the same as the current
<p><b id="SCI_GOTOLINE">SCI_GOTOLINE(int line)</b><br />
This removes any selection and sets the caret at the start of line number <code>line</code>
and scrolls the view (if needed) to make it visible. The anchor position is set the same as the
current position. If <code>line</code> is outside the lines in the document (first line is 0),
the line set is the first or last.</p>
<p><b id="SCI_SETCURRENTPOS">SCI_SETCURRENTPOS(int pos)</b><br />
This sets the current position and creates a selection between the anchor and the current
position. The caret is not scrolled into view.</p>
<p>See also: <a class="message" href="#SCI_SCROLLCARET"><code>SCI_SCROLLCARET</code></a></p>
This returns the current position.</p>
<p><b id="SCI_SETANCHOR">SCI_SETANCHOR(int pos)</b><br />
This sets the anchor position and creates a selection between the anchor position and the
current position. The caret is not scrolled into view.</p>
<p>See also: <a class="message" href="#SCI_SCROLLCARET"><code>SCI_SCROLLCARET</code></a></p>
<p><b id="SCI_GETANCHOR">SCI_GETANCHOR</b><br />
This returns the current anchor position.</p>
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.</p>
<table cellpadding="3" cellspacing="0" border="1" summary="SetSelection caret positioning">
<thead align="center">
<tbody align="center">
<td><code>Max(pos, current)</code></td>
<td><code>Min(anchor, pos)</code></td>
<p>See also: <a class="message" href="#SCI_SCROLLCARET"><code>SCI_SCROLLCARET</code></a></p>
These return the start and end of the selection without regard to which end is the current
position and which is the anchor. <code>SCI_GETSELECTIONSTART</code> returns the smaller of the
current position or the anchor position. <code>SCI_GETSELECTIONEND</code> returns the larger of
the two values.</p>
<p><b id="SCI_SELECTALL">SCI_SELECTALL</b><br />
This selects all the text in the document. The current position is not scrolled into view.</p>
This message returns the line that contains the position <code>pos</code> in the document. The
return value is 0 if <code>pos</code> &lt;= 0. The return value is the last line if
<code>pos</code> is beyond the end of the document.</p>
This returns the document position that corresponds with the start of the line. If
<code>line</code> is negative, the position of the line holding the start of the selection is
returned. If <code>line</code> is greater than the lines in the document, the return value is
-1. If <code>line</code> 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.</p>
This returns the position at the end of the line, before any line end characters. If <code>line</code>
is the last line in the document (which does not have any end of line characters), the result is the size of the
document. If <code>line</code> is negative or <code>line</code> &gt;= <a class="message"
href="#SCI_GETLINECOUNT"><code>SCI_GETLINECOUNT()</code></a>, the result is undefined.</p>
<p><b id="SCI_LINELENGTH">SCI_LINELENGTH(int line)</b><br />
This returns the length of the line, including any line end characters. If <code>line</code>
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 <a class="message"
href="#SCI_GETLINEENDPOSITION"><code>SCI_GETLINEENDPOSITION(line)</code></a> - <a class="message"
<b id="SCI_GETSELTEXT">SCI_GETSELTEXT(&lt;unused&gt;, char *text)</b><br />
This copies the currently selected text and a terminating 0 byte to the <code>text</code>
buffer. The buffer size should be determined by calling with a NULL pointer for the <code>text</code> argument
This allows for rectangular and discontiguous selections as well as simple selections.
See <a class="toc" href="#MultipleSelectionAndVirtualSpace">Multiple Selection</a> for information on
how multiple and rectangular selections and virtual space are copied.</p>
<p>See also: <code><a class="message" href="#SCI_GETCURLINE">SCI_GETCURLINE</a>,
<a class="message" href="#SCI_GETLINE">SCI_GETLINE</a>,
<a class="message" href="#SCI_GETTEXT">SCI_GETTEXT</a>,
<a class="message" href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>,
<a class="message" href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a>
<p><b id="SCI_GETCURLINE">SCI_GETCURLINE(int textLen, char *text)</b><br />
This retrieves the text of the line containing the caret and returns the position within the
line of the caret. Pass in <code>char* text</code> pointing at a buffer large enough to hold
the text you wish to retrieve and a terminating 0 character.
Set <code>textLen</code> to the
length of the buffer which must be at least 1 to hold the terminating 0 character.
If the text argument is 0 then the length that should be allocated
to store the entire current line is returned.</p>
<p>See also: <code><a class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>, <a
class="message" href="#SCI_GETLINE">SCI_GETLINE</a>, <a class="message"
href="#SCI_GETTEXT">SCI_GETTEXT</a>, <a class="message"
href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>, <a class="message"
This returns 1 if the current selection is in rectangle mode, 0 if not.</p>
The two functions set and get the selection mode, which can be
stream (<code>SC_SEL_STREAM</code>=0) or
rectangular (<code>SC_SEL_RECTANGLE</code>=1) or
by lines (<code>SC_SEL_LINES</code>=2)
or thin rectangular (<code>SC_SEL_THIN</code>=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 <code>SCI_CANCEL</code>.
The get function returns the current mode even if the selection was made by mouse
or with regular extended moves.
<code>SC_SEL_THIN</code> is the mode after a rectangular selection has been typed into and ensures
that no characters are selected.</p>
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.</p>
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.</p>
onlyWordCharacters)</b><br />
onlyWordCharacters)</b><br />
These messages return the start and end of words using the same definition of words as used
internally within Scintilla. You can set your own list of characters that count as words with
<a class="message" href="#SCI_SETWORDCHARS"><code>SCI_SETWORDCHARS</code></a>. The position
sets the start or the search, which is forwards when searching for the end and backwards when
searching for the start.</p>
<p>Set <code>onlyWordCharacters</code> to <code>true</code> (1) to stop searching at the first
non-word character in the search direction. If <code>onlyWordCharacters</code> is
<code>false</code> (0), the first character in the search direction sets the type of the search
as word or non-word and the search stops at the first non-matching character. Searches are also
terminated by the start or end of the document.</p>
<p>If "w" represents word characters and "." represents non-word characters and "|" represents
the position and <code>true</code> or <code>false</code> is the state of
<table cellpadding="3" cellspacing="0" border="1" summary="Word start and end positions">
<thead align="center">
<th>Initial state</th>
<th>end, true</th>
<th>end, false</th>
<th>start, true</th>
<th>start, false</th>
<tbody align="center">
<p><b id="SCI_POSITIONBEFORE">SCI_POSITIONBEFORE(int position)</b><br />
<b id="SCI_POSITIONAFTER">SCI_POSITIONAFTER(int position)</b><br />
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.</p>
<p><b id="SCI_TEXTWIDTH">SCI_TEXTWIDTH(int styleNumber, const char *text)</b><br />
This returns the pixel width of a string drawn in the given <code>styleNumber</code> 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.</p>
<p><b id="SCI_TEXTHEIGHT">SCI_TEXTHEIGHT(int line)</b><br />
This returns the height in pixels of a particular line. Currently all lines are the same
<p><b id="SCI_GETCOLUMN">SCI_GETCOLUMN(int pos)</b><br />
This message returns the column number of a position <code>pos</code> within the document
taking the width of tabs into account. This returns the column number of the last tab on the
line before <code>pos</code>, plus the number of characters between the last tab and
<code>pos</code>. 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.</p>
<p><b id="SCI_FINDCOLUMN">SCI_FINDCOLUMN(int line, int column)</b><br />
This message returns the position of a <code>column</code> on a <code>line</code>
taking the width of tabs into account. It treats a multi-byte character as a single column.
Column numbers, like lines start at 0.</p>
<code>SCI_POSITIONFROMPOINT</code> finds the closest character position to a point and
<code>SCI_POSITIONFROMPOINTCLOSE</code> is similar but returns -1 if the point is outside the
window or not close to any characters.</p>
<code>SCI_CHARPOSITIONFROMPOINT</code> finds the closest character to a point and
<code>SCI_CHARPOSITIONFROMPOINTCLOSE</code> 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.</p>
<p><b id="SCI_POINTXFROMPOSITION">SCI_POINTXFROMPOSITION(&lt;unused&gt;, int pos)</b><br />
<b id="SCI_POINTYFROMPOSITION">SCI_POINTYFROMPOSITION(&lt;unused&gt;, int pos)</b><br />
These messages return the x and y display pixel location of text at position <code>pos</code>
in the document.</p>
<p><b id="SCI_HIDESELECTION">SCI_HIDESELECTION(bool hide)</b><br />
The normal state is to make the selection visible by drawing it as set by <a class="message"
href="#SCI_SETSELFORE"><code>SCI_SETSELFORE</code></a> and <a class="message"
href="#SCI_SETSELBACK"><code>SCI_SETSELBACK</code></a>. However, if you hide the selection, it
is drawn as normal text.</p>
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.</p>
<h2 id="MultipleSelectionAndVirtualSpace">Multiple Selection and Virtual Space</h2>
<a class="message" href="#SCI_SETMULTIPLESELECTION">SCI_SETMULTIPLESELECTION(bool multipleSelection)</a><br />
<a class="message" href="#SCI_SETADDITIONALSELECTIONTYPING">SCI_SETADDITIONALSELECTIONTYPING(bool additionalSelectionTyping)</a><br />
<a class="message" href="#SCI_SETMULTIPASTE">SCI_SETMULTIPASTE(int multiPaste)</a><br />
<a class="message" href="#SCI_GETMULTIPASTE">SCI_GETMULTIPASTE</a><br />
<a class="message" href="#SCI_SETVIRTUALSPACEOPTIONS">SCI_SETVIRTUALSPACEOPTIONS(int virtualSpaceOptions)</a><br />
<br />
<a class="message" href="#SCI_GETSELECTIONS">SCI_GETSELECTIONS</a><br />
<a class="message" href="#SCI_CLEARSELECTIONS">SCI_CLEARSELECTIONS</a><br />
<a class="message" href="#SCI_SETSELECTION">SCI_SETSELECTION(int caret, int anchor)</a><br />
<a class="message" href="#SCI_ADDSELECTION">SCI_ADDSELECTION(int caret, int anchor)</a><br />
<a class="message" href="#SCI_SETMAINSELECTION">SCI_SETMAINSELECTION(int selection)</a><br />
<a class="message" href="#SCI_GETMAINSELECTION">SCI_GETMAINSELECTION</a><br />
<br />
<a class="message" href="#SCI_SETSELECTIONNCARET">SCI_SETSELECTIONNCARET(int selection, int pos)</a><br />
<a class="message" href="#SCI_GETSELECTIONNCARET">SCI_GETSELECTIONNCARET(int selection)</a><br />
<a class="message" href="#SCI_SETSELECTIONNCARETVIRTUALSPACE">SCI_SETSELECTIONNCARETVIRTUALSPACE(int selection, int space)</a><br />
<a class="message" href="#SCI_SETSELECTIONNANCHOR">SCI_SETSELECTIONNANCHOR(int selection, int posAnchor)</a><br />
<a class="message" href="#SCI_GETSELECTIONNANCHOR">SCI_GETSELECTIONNANCHOR(int selection)</a><br />
<a class="message" href="#SCI_SETSELECTIONNSTART">SCI_SETSELECTIONNSTART(int selection, int pos)</a><br />
<a class="message" href="#SCI_GETSELECTIONNSTART">SCI_GETSELECTIONNSTART(int selection)</a><br />
<a class="message" href="#SCI_SETSELECTIONNEND">SCI_SETSELECTIONNEND(int selection, int pos)</a><br />
<a class="message" href="#SCI_GETSELECTIONNEND">SCI_GETSELECTIONNEND(int selection)</a><br />
<br />
<br />
<a class="message" href="#SCI_SETADDITIONALSELALPHA">SCI_SETADDITIONALSELALPHA(int alpha)</a><br />
<a class="message" href="#SCI_SETADDITIONALSELFORE">SCI_SETADDITIONALSELFORE(int <a class="jump" href="#colour">colour<a>)</a><br />
<a class="message" href="#SCI_SETADDITIONALSELBACK">SCI_SETADDITIONALSELBACK(int <a class="jump" href="#colour">colour<a>)</a><br />
<a class="message" href="#SCI_SETADDITIONALCARETFORE">SCI_SETADDITIONALCARETFORE(int <a class="jump" href="#colour">colour<a>)</a><br />
<a class="message" href="#SCI_SETADDITIONALCARETSBLINK">SCI_SETADDITIONALCARETSBLINK(bool additionalCaretsBlink)</a><br />
<a class="message" href="#SCI_SETADDITIONALCARETSVISIBLE">SCI_SETADDITIONALCARETSVISIBLE(bool additionalCaretsVisible)</a><br />
<br />
<a class="message" href="#SCI_ROTATESELECTION">SCI_ROTATESELECTION</a><br />
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.
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.
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.
<p>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.</p>
Enable or disable multiple selection.</p>
Whether typing, backspace, or delete works with multiple selections simultaneously.</p>
<b id="SCI_SETMULTIPASTE">SCI_SETMULTIPASTE(int multiPaste)</b><br />
When pasting into multiple selections, the pasted text can go into just the main selection with <code>SC_MULTIPASTE_ONCE</code>=0
or into each selection with <code>SC_MULTIPASTE_EACH</code>=1. <code>SC_MULTIPASTE_ONCE</code> is the default.</p>
Virtual space can be enabled or disabled for rectangular selections or in other circumstances or in both.
There are two bit flags <code>SCVS_RECTANGULARSELECTION</code>=1 and
<code>SCVS_USERACCESSIBLE</code>=2 which can be set independently.
<code>SCVS_NONE</code>=0, the default, disables all use of virtual space.</p>
On GTK+, 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 <code>SCMOD_CTRL</code>=2 (default), <code>SCMOD_ALT</code>=4 or <code>SCMOD_SUPER</code>=8.
Since <code>SCMOD_ALT</code> is often already used by a window manager, the window manager may need configuring to allow this choice.
<code>SCMOD_SUPER</code> is often a system dependent modifier key such as the Left Windows key on a Windows keyboard or the
Command key on a Mac.</p>
Return the number of selections currently active.</p>
Set a single empty selection at 0 as the only selection.</p>
<b id="SCI_SETSELECTION">SCI_SETSELECTION(int caret, int anchor)</b><br />
Set a single selection from <code>anchor</code> to <code>caret</code> as the only selection.</p>
<b id="SCI_ADDSELECTION">SCI_ADDSELECTION(int caret, int anchor)</b><br />
Add a new selection from <code>anchor</code> to <code>caret</code> 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 <code>SCI_SETSELECTION</code> and later selections added with <code>SCI_ADDSELECTION</code></p>
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.</p>
<b id="SCI_SETSELECTIONNCARET">SCI_SETSELECTIONNCARET(int selection, int pos)</b><br />
<b id="SCI_SETSELECTIONNANCHOR">SCI_SETSELECTIONNANCHOR(int selection, int posAnchor)</b><br />
Set or query the position and amount of virtual space for the caret and anchor of each already existing selection.</p>
<b id="SCI_SETSELECTIONNSTART">SCI_SETSELECTIONNSTART(int selection, int pos)</b><br />
<b id="SCI_SETSELECTIONNEND">SCI_SETSELECTIONNEND(int selection, int pos)</b><br />
Set or query the start and end position of each already existing selection.
Mostly of use to query each range for its text.</p>
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.</p>
<b id="SCI_SETADDITIONALSELFORE">SCI_SETADDITIONALSELFORE(int <a class="jump" href="#colour">colour</a>)</b><br />
<b id="SCI_SETADDITIONALSELBACK">SCI_SETADDITIONALSELBACK(int <a class="jump" href="#colour">colour</a>)</b><br />
Modify the appearence of additional selections so that they can be differentiated from the main selection which has its appearence set with
<a class="message" href="#SCI_SETSELALPHA"><code>SCI_SETSELALPHA</code></a>,
<a class="message" href="#SCI_GETSELALPHA"><code>SCI_GETSELALPHA</code></a>,
<a class="message" href="#SCI_SETSELFORE"><code>SCI_SETSELFORE</code></a>, and
<a class="message" href="#SCI_SETSELBACK"><code>SCI_SETSELBACK</code></a>.</p>
<b id="SCI_SETADDITIONALCARETFORE">SCI_SETADDITIONALCARETFORE(int <a class="jump" href="#colour">colour</a>)</b><br />
Modify the appearence of additional carets so that they can be differentiated from the main caret which has its appearence set with
<a class="message" href="#SCI_SETCARETFORE"><code>SCI_SETCARETFORE</code></a>,
<a class="message" href="#SCI_GETCARETFORE"><code>SCI_GETCARETFORE</code></a>,
<a class="message" href="#SCI_SETCARETPERIOD"><code>SCI_SETCARETPERIOD</code></a>, and
<a class="message" href="#SCI_GETCARETPERIOD"><code>SCI_GETCARETPERIOD</code></a>.</p>
Determine whether to show additional carets (defaults to <code>true</code>).
These commands may be assigned to keys to make it possible to manipulate multiple selections.
<code>SCI_SWAPMAINANCHORCARET</code> moves the caret to the opposite end of the main selection.
<code>SCI_ROTATESELECTION</code> makes the next selection be the main selection.
<h2 id="ScrollingAndAutomaticScrolling">Scrolling and automatic scrolling</h2>
<code><a class="message" href="#SCI_LINESCROLL">SCI_LINESCROLL(int column, int line)</a><br />
<a class="message" href="#SCI_SCROLLCARET">SCI_SCROLLCARET</a><br />
<a class="message" href="#SCI_SETXCARETPOLICY">SCI_SETXCARETPOLICY(int caretPolicy, int
caretSlop)</a><br />
<a class="message" href="#SCI_SETYCARETPOLICY">SCI_SETYCARETPOLICY(int caretPolicy, int
caretSlop)</a><br />
<a class="message" href="#SCI_SETVISIBLEPOLICY">SCI_SETVISIBLEPOLICY(int caretPolicy, int
caretSlop)</a><br />
<a class="message" href="#SCI_SETHSCROLLBAR">SCI_SETHSCROLLBAR(bool visible)</a><br />
<a class="message" href="#SCI_GETHSCROLLBAR">SCI_GETHSCROLLBAR</a><br />
<a class="message" href="#SCI_SETVSCROLLBAR">SCI_SETVSCROLLBAR(bool visible)</a><br />
<a class="message" href="#SCI_GETVSCROLLBAR">SCI_GETVSCROLLBAR</a><br />
<a class="message" href="#SCI_GETXOFFSET">SCI_GETXOFFSET</a><br />
<a class="message" href="#SCI_SETXOFFSET">SCI_SETXOFFSET(int xOffset)</a><br />
<a class="message" href="#SCI_SETSCROLLWIDTH">SCI_SETSCROLLWIDTH(int pixelWidth)</a><br />
<a class="message" href="#SCI_GETSCROLLWIDTH">SCI_GETSCROLLWIDTH</a><br />
<a class="message" href="#SCI_SETSCROLLWIDTHTRACKING">SCI_SETSCROLLWIDTHTRACKING(bool tracking)</a><br />
endAtLastLine)</a><br />
<a class="message" href="#SCI_GETENDATLASTLINE">SCI_GETENDATLASTLINE</a><br />
<p><b id="SCI_LINESCROLL">SCI_LINESCROLL(int column, int line)</b><br />
This will attempt to scroll the display by the number of columns and lines that you specify.
Positive line values increase the line number at the top of the screen (i.e. they move the text
upwards as far as the user is concerned), Negative line values do the reverse.</p>
<p>The column measure is the width of a space in the default style. Positive values increase
the column at the left edge of the view (i.e. they move the text leftwards as far as the user
is concerned). Negative values do the reverse.</p>
<p>See also: <a class="message" href="#SCI_SETXOFFSET"><code>SCI_SETXOFFSET</code></a></p>
If the current position (this is the caret if there is no selection) is not visible, the view
is scrolled to make it visible according to the current caret policy.</p>
<p><b id="SCI_SETXCARETPOLICY">SCI_SETXCARETPOLICY(int caretPolicy, int caretSlop)</b><br />
<b id="SCI_SETYCARETPOLICY">SCI_SETYCARETPOLICY(int caretPolicy, int caretSlop)</b><br />
These set the caret policy. The value of <code>caretPolicy</code> is a combination of
<code>CARET_SLOP</code>, <code>CARET_STRICT</code>, <code>CARET_JUMPS</code> and
<table cellpadding="1" cellspacing="2" border="0" summary="Caret policy">
<tbody valign="top">
<th align="left"><code>CARET_SLOP</code></th>
<td>If set, we can define a slop value: <code>caretSlop</code>. This value defines an
unwanted zone (UZ) where the caret is... unwanted. This zone is defined as a number of
pixels near the vertical margins, and as a number of lines near the horizontal margins.
By keeping the caret away from the edges, it is seen within its context. This makes it
likely that the identifier that the caret is on can be completely seen, and that the
current line is seen with some of the lines following it, which are often dependent on
that line.</td>
<th align="left"><code>CARET_STRICT</code></th>
<td>If set, the policy set by <code>CARET_SLOP</code> is enforced... strictly. The caret
is centred on the display if <code>caretSlop</code> is not set, and cannot go in the UZ
if <code>caretSlop</code> is set.</td>
<th align="left"><code>CARET_JUMPS</code></th>
<td>If set, the display is moved more energetically so the caret can move in the same
direction longer before the policy is applied again. '3UZ' notation is used to indicate
three time the size of the UZ as a distance to the margin.</td>
<th align="left"><code>CARET_EVEN</code></th>
<td>If not set, instead of having symmetrical UZs, the left and bottom UZs are extended
up to right and top UZs respectively. This way, we favour the displaying of useful
information: the beginning of lines, where most code reside, and the lines after the
caret, for example, the body of a function.</td>
<table cellpadding="3" cellspacing="0" border="1" summary="Caret positioning">
<thead align="center">
<th>Caret can go to the margin</th>
<th>On reaching limit (going out of visibility<br />
or going into the UZ) display is...</th>
<tbody align="center">
<td>moved to put caret on top/on right</td>
<td>moved by one position</td>
<td>moved to put caret on top/on right</td>
<td>centred on the caret</td>
<td>Caret is always on top/on right of display</td>
<td>No, caret is always centred</td>
<td>moved to put caret out of the asymmetrical UZ</td>
<td>moved to put caret out of the UZ</td>
<td>moved to put caret at 3UZ of the top or right margin</td>
<td>moved to put caret at 3UZ of the margin</td>
<td>Caret is always at UZ of top/right margin</td>
<td>No, kept out of UZ</td>
<td>moved by one position</td>
<td>No, kept out of UZ</td>
<td>moved to put caret at 3UZ of the margin</td>
<p><b id="SCI_SETVISIBLEPOLICY">SCI_SETVISIBLEPOLICY(int caretPolicy, int caretSlop)</b><br />
This determines how the vertical positioning is determined when <a class="message"
called. It takes <code>VISIBLE_SLOP</code> and <code>VISIBLE_STRICT</code> flags for the policy
parameter. It is similar in operation to <a class="message"
href="#SCI_SETYCARETPOLICY"><code>SCI_SETYCARETPOLICY(int caretPolicy, int
<p><b id="SCI_SETHSCROLLBAR">SCI_SETHSCROLLBAR(bool visible)</b><br />
The horizontal scroll bar is only displayed if it is needed for the assumed width.
If you never wish to see it, call
<code>SCI_SETHSCROLLBAR(0)</code>. Use <code>SCI_SETHSCROLLBAR(1)</code> to enable it again.
<code>SCI_GETHSCROLLBAR</code> returns the current state. The default state is to display it
when needed.</p>
<p>See also: <a class="message" href="#SCI_SETSCROLLWIDTH">SCI_SETSCROLLWIDTH</a>.</p>
<p><b id="SCI_SETVSCROLLBAR">SCI_SETVSCROLLBAR(bool visible)</b><br />
By default, the vertical scroll bar is always displayed when required. You can choose to hide
or show it with <code>SCI_SETVSCROLLBAR</code> and get the current state with
<p><b id="SCI_SETXOFFSET">SCI_SETXOFFSET(int xOffset)</b><br />
The <code>xOffset</code> is the horizontal scroll position in pixels of the start of the text
view. A value of 0 is the normal position with the first text column visible at the left of the
<p>See also: <a class="message" href="#SCI_LINESCROLL"><code>SCI_LINESCROLL</code></a></p>
<p><b id="SCI_SETSCROLLWIDTH">SCI_SETSCROLLWIDTH(int pixelWidth)</b><br />
For performance, Scintilla does not measure the display width of the document to determine
the properties of the horizontal scroll bar. Instead, an assumed width is used.
These messages set and get the document width in pixels assumed by Scintilla.
The default value is 2000.
To ensure the width of the currently visible lines can be scrolled use
<a class="message" href="#SCI_SETSCROLLWIDTHTRACKING"><code>SCI_SETSCROLLWIDTHTRACKING</code></a></p>
If scroll width tracking is enabled then the scroll width is adjusted to ensure that all of the lines currently
displayed can be completely scrolled. This mode never adjusts the scroll width to be narrower.</p>
<p><b id="SCI_SETENDATLASTLINE">SCI_SETENDATLASTLINE(bool endAtLastLine)</b><br />
<code>SCI_SETENDATLASTLINE</code> sets the scroll range so that maximum scroll position has
the last line at the bottom of the view (default). Setting this to <code>false</code> allows
scrolling one page below the last line.</p>
<h2 id="WhiteSpace">White space</h2>
<code><a class="message" href="#SCI_SETVIEWWS">SCI_SETVIEWWS(int wsMode)</a><br />
<a class="message" href="#SCI_GETVIEWWS">SCI_GETVIEWWS</a><br />
useWhitespaceForeColour, int colour)</a><br />
useWhitespaceBackColour, int colour)</a><br />
size)</a><br />
<a class="message" href="#SCI_GETWHITESPACESIZE">SCI_GETWHITESPACESIZE</a><br />
<a class="message" href="#SCI_SETEXTRAASCENT">SCI_SETEXTRAASCENT(int extraAscent)</a><br />
<a class="message" href="#SCI_GETEXTRAASCENT">SCI_GETEXTRAASCENT</a><br />
<a class="message" href="#SCI_SETEXTRADESCENT">SCI_SETEXTRADESCENT(int extraDescent)</a><br />
<a class="message" href="#SCI_GETEXTRADESCENT">SCI_GETEXTRADESCENT</a><br />
<p><b id="SCI_SETVIEWWS">SCI_SETVIEWWS(int wsMode)</b><br />
White space can be made visible which may be useful for languages in which white space is
significant, such as Python. Space characters appear as small centred dots and tab characters
as light arrows pointing to the right. There are also ways to control the display of <a
class="jump" href="#LineEndings">end of line characters</a>. The two messages set and get the
white space display mode. The <code>wsMode</code> argument can be one of:</p>
<table cellpadding="1" cellspacing="2" border="0" summary="White space policy">
<tbody valign="top">
<th align="left"><code>SCWS_INVISIBLE</code></th>
<td>The normal display mode with white space displayed as an empty background
<th align="left"><code>SCWS_VISIBLEALWAYS</code></th>
<td>White space characters are drawn as dots and arrows,</td>
<th align="left"><code>SCWS_VISIBLEAFTERINDENT</code></th>
<td>White space used for indentation is displayed normally but after the first visible
character, it is shown as dots and arrows.</td>
<p>The effect of using any other <code>wsMode</code> value is undefined.</p>
<p><b id="SCI_SETWHITESPACEFORE">SCI_SETWHITESPACEFORE(bool useWhitespaceForeColour, int <a
class="jump" href="#colour">colour</a>)</b><br />
<b id="SCI_SETWHITESPACEBACK">SCI_SETWHITESPACEBACK(bool useWhitespaceBackColour, int <a
class="jump" href="#colour">colour</a>)</b><br />
By default, the colour of visible white space is determined by the lexer in use. The
foreground and/or background colour of all visible white space can be set globally, overriding
the lexer's colours with <code>SCI_SETWHITESPACEFORE</code> and
<code>SCI_SETWHITESPACESIZE</code> sets the size of the dots used for mark space characters.
The <code>SCI_GETWHITESPACESIZE</code> message retrieves the current size.
<b id="SCI_SETEXTRAASCENT">SCI_SETEXTRAASCENT(int extraAscent)</b><br />
<b id="SCI_SETEXTRADESCENT">SCI_SETEXTRADESCENT(int extraDescent)</b><br />
Text is drawn with the base of each character on a 'baseline'. The height of a line is found from the maximum
that any style extends above the baseline (its 'ascent'), added to the maximum that any style extends below the
baseline (its 'descent').
Space may be added to the maximum ascent (<code>SCI_SETEXTRAASCENT</code>) and the
maximum descent (<code>SCI_SETEXTRADESCENT</code>) to allow for more space between lines.
This may done to make the text easier to read or to accomodate underlines or highlights.
<h2 id="Cursor">Cursor</h2>
<p><b id="SCI_SETCURSOR">SCI_SETCURSOR(int curType)</b><br />
The cursor is normally chosen in a context sensitive way, so it will be different over the
margin than when over the text. When performing a slow action, you may wish to change to a wait
cursor. You set the cursor type with <code>SCI_SETCURSOR</code>. The <code>curType</code>
argument can be:</p>
<table cellpadding="1" cellspacing="2" border="0" summary="Mouse cursors">
<tbody valign="top">
<th align="left"><code>SC_CURSORNORMAL</code></th>
<td>The normal cursor is displayed.</td>
<th align="left"><code>SC_CURSORWAIT</code></th>
<td>The wait cursor is displayed when the mouse is over or owned by the Scintilla
<p>Cursor values 1 through 7 have defined cursors, but only <code>SC_CURSORWAIT</code> is
usefully controllable. Other values of <code>curType</code> cause a pointer to be displayed.
The <code>SCI_GETCURSOR</code> message returns the last cursor type you set, or
<code>SC_CURSORNORMAL</code> (-1) if you have not set a cursor type.</p>
<h2 id="MouseCapture">Mouse capture</h2>
When the mouse is pressed inside Scintilla, it is captured so future mouse movement events are
sent to Scintilla. This behavior may be turned off with
<h2 id="LineEndings">Line endings</h2>
<p>Scintilla can interpret any of the three major line end conventions, Macintosh (\r), Unix
(\n) and CP/M / DOS / Windows (\r\n). When the user presses the Enter key, one of these line
end strings is inserted into the buffer. The default is \r\n in Windows and \n in Unix, but
this can be changed with the <code>SCI_SETEOLMODE</code> message. You can also convert the
entire document to one of these line endings with <code>SCI_CONVERTEOLS</code>. Finally, you
can choose to display the line endings with <code>SCI_SETVIEWEOL</code>.</p>
<code><a class="message" href="#SCI_SETEOLMODE">SCI_SETEOLMODE(int eolMode)</a><br />
<a class="message" href="#SCI_GETEOLMODE">SCI_GETEOLMODE</a><br />
<a class="message" href="#SCI_CONVERTEOLS">SCI_CONVERTEOLS(int eolMode)</a><br />
<a class="message" href="#SCI_SETVIEWEOL">SCI_SETVIEWEOL(bool visible)</a><br />
<a class="message" href="#SCI_GETVIEWEOL">SCI_GETVIEWEOL</a><br />
<p><b id="SCI_SETEOLMODE">SCI_SETEOLMODE(int eolMode)</b><br />
<code>SCI_SETEOLMODE</code> sets the characters that are added into the document when the user
presses the Enter key. You can set <code>eolMode</code> to one of <code>SC_EOL_CRLF</code> (0),
<code>SC_EOL_CR</code> (1), or <code>SC_EOL_LF</code> (2). The <code>SCI_GETEOLMODE</code>
message retrieves the current state.</p>
<p><b id="SCI_CONVERTEOLS">SCI_CONVERTEOLS(int eolMode)</b><br />
This message changes all the end of line characters in the document to match
<code>eolMode</code>. Valid values are: <code>SC_EOL_CRLF</code> (0), <code>SC_EOL_CR</code>
(1), or <code>SC_EOL_LF</code> (2).</p>
<p><b id="SCI_SETVIEWEOL">SCI_SETVIEWEOL(bool visible)</b><br />
Normally, the end of line characters are hidden, but <code>SCI_SETVIEWEOL</code> allows you to
display (or hide) them by setting <code>visible</code> <code>true</code> (or
<code>false</code>). The visible rendering of the end of line characters is similar to
<code>(CR)</code>, <code>(LF)</code>, or <code>(CR)(LF)</code>. <code>SCI_GETVIEWEOL</code>
returns the current state.</p>
<h2 id="Styling">Styling</h2>
<p>The styling messages allow you to assign styles to text. The standard Scintilla settings
divide the 8 style bits available for each character into 5 bits (0 to 4 = <a class="jump"
href="#StyleDefinition">styles 0 to 31</a>) that set a style and three bits (5 to 7) that
define <a class="jump" href="#Indicators">indicators</a>. You can change the balance between
styles and indicators with <a class="message"
href="#SCI_SETSTYLEBITS"><code>SCI_SETSTYLEBITS</code></a>. If your styling needs can be met by
one of the standard lexers, or if you can write your own, then a lexer is probably the easiest
way to style your document. If you choose to use the container to do the styling you can use
the <a class="message" href="#SCI_SETLEXER"><code>SCI_SETLEXER</code></a> command to select
<code>SCLEX_CONTAINER</code>, in which case the container is sent a <a class="message"
href="#SCN_STYLENEEDED"><code>SCN_STYLENEEDED</code></a> <a class="jump"
href="#Notifications">notification</a> each time text needs styling for display. As another
alternative, you might use idle time to style the document. Even if you use a lexer, you might
use the styling commands to mark errors detected by a compiler. The following commands can be
<code><a class="message" href="#SCI_GETENDSTYLED">SCI_GETENDSTYLED</a><br />
<a class="message" href="#SCI_STARTSTYLING">SCI_STARTSTYLING(int position, int mask)</a><br />
<a class="message" href="#SCI_SETSTYLING">SCI_SETSTYLING(int length, int style)</a><br />
<a class="message" href="#SCI_SETSTYLINGEX">SCI_SETSTYLINGEX(int length, const char
*styles)</a><br />
<a class="message" href="#SCI_SETLINESTATE">SCI_SETLINESTATE(int line, int value)</a><br />
<a class="message" href="#SCI_GETLINESTATE">SCI_GETLINESTATE(int line)</a><br />
<a class="message" href="#SCI_GETMAXLINESTATE">SCI_GETMAXLINESTATE</a><br />
Scintilla keeps a record of the last character that is likely to be styled correctly. This is
moved forwards when characters after it are styled and moved backwards if changes are made to
the text of the document before it. Before drawing text, this position is checked to see if any
styling is needed and, if so, a <code><a class="message"
href="#SCN_STYLENEEDED">SCN_STYLENEEDED</a></code> notification message is sent to the
container. The container can send <code>SCI_GETENDSTYLED</code> to work out where it needs to
start styling. Scintilla will always ask to style whole lines.</p>
<p><b id="SCI_STARTSTYLING">SCI_STARTSTYLING(int pos, int mask)</b><br />
This prepares for styling by setting the styling position <code>pos</code> to start at and a
<code>mask</code> indicating which bits of the style bytes can be set. The mask allows styling
to occur over several passes, with, for example, basic styling done on an initial pass to
ensure that the text of the code is seen quickly and correctly, and then a second slower pass,
detecting syntax errors and using indicators to show where these are. For example, with the
standard settings of 5 style bits and 3 indicator bits, you would use a <code>mask</code> value
of 31 (0x1f) if you were setting text styles and did not want to change the indicators. After
<code>SCI_STARTSTYLING</code>, send multiple <code>SCI_SETSTYLING</code> messages for each
lexical entity to style.</p>
<p><b id="SCI_SETSTYLING">SCI_SETSTYLING(int length, int style)</b><br />
This message sets the style of <code>length</code> characters starting at the styling position
and then increases the styling position by <code>length</code>, ready for the next call. If
<code>sCell</code> is the style byte, the operation is:<br />
<code>if ((sCell &amp; mask) != style) sCell = (sCell &amp; ~mask) | (style &amp;
mask);</code><br />
<p><b id="SCI_SETSTYLINGEX">SCI_SETSTYLINGEX(int length, const char *styles)</b><br />
As an alternative to <code>SCI_SETSTYLING</code>, which applies the same style to each byte,
you can use this message which specifies the styles for each of <code>length</code> bytes from
the styling position and then increases the styling position by <code>length</code>, ready for
the next call. The <code>length</code> styling bytes pointed at by <code>styles</code> should
not contain any bits not set in mask.</p>
<p><b id="SCI_SETLINESTATE">SCI_SETLINESTATE(int line, int value)</b><br />
<b id="SCI_GETLINESTATE">SCI_GETLINESTATE(int line)</b><br />
As well as the 8 bits of lexical state stored for each character there is also an integer
stored for each line. This can be used for longer lived parse states such as what the current
scripting language is in an ASP page. Use <code>SCI_SETLINESTATE</code> to set the integer
value and <code>SCI_GETLINESTATE</code> to get the value.
Changing the value produces a <a class="message" href="#SC_MOD_CHANGELINESTATE">SC_MOD_CHANGELINESTATE</a> notification.
This returns the last line that has any line state.</p>
<h2 id="StyleDefinition">Style definition</h2>
<p>While the style setting messages mentioned above change the style numbers associated with
text, these messages define how those style numbers are interpreted visually. There are 256
lexer styles that can be set, numbered 0 to <code>STYLE_MAX</code> (255). Unless you use <a
class="message" href="#SCI_SETSTYLEBITS"><code>SCI_SETSTYLEBITS</code></a> to change the number
of style bits, styles 0 to 31 are used to set the text attributes. There are also some
predefined numbered styles starting at 32, The following <code>STYLE_</code>* constants are
<table cellpadding="1" cellspacing="2" border="0" summary="Preset styles">
<tbody valign="top">
<th align="left"><code>STYLE_DEFAULT</code></th>
<td>This style defines the attributes that all styles receive when the
<code>SCI_STYLECLEARALL</code> message is used.</td>
<th align="left"><code>STYLE_LINENUMBER</code></th>
<td>This style sets the attributes of the text used to display line numbers in a line
number margin. The background colour set for this style also sets the background colour
for all margins that do not have any folding mask bits set. That is, any margin for which
<code>mask &amp; SC_MASK_FOLDERS</code> is 0. See <a class="message"
href="#SCI_SETMARGINMASKN"><code>SCI_SETMARGINMASKN</code></a> for more about masks.</td>
<th align="left"><code>STYLE_BRACELIGHT</code></th>
<td>This style sets the attributes used when highlighting braces with the <a
class="message" href="#BraceHighlighting"><code>SCI_BRACEHIGHLIGHT</code></a> message and
when highlighting the corresponding indentation with <a class="message"
<th align="left"><code>STYLE_BRACEBAD</code></th>
<td>This style sets the display attributes used when marking an unmatched brace with the
<a class="message" href="#BraceHighlighting"><code>SCI_BRACEBADLIGHT</code></a>
<th align="left"><code>STYLE_CONTROLCHAR</code></th>
<td>This style sets the font used when drawing control characters.
Only the font, size, bold, italics, and character set attributes are used and not
the colour attributes. See
also: <a class="message"
<th align="left"><code>STYLE_INDENTGUIDE</code></th>
<td>This style sets the foreground and background colours used when drawing the
indentation guides.</td>
<th align="left"><code>STYLE_CALLTIP</code></th>
<td> Call tips normally use the font attributes defined by <code>STYLE_DEFAULT</code>.
Use of <a class="message" href="#SCI_CALLTIPUSESTYLE"><code>SCI_CALLTIPUSESTYLE</code></a>
causes call tips to use this style instead. Only the font face name, font size,
foreground and background colours and character set attributes are used.</td>
<th align="left"><code>STYLE_LASTPREDEFINED</code></th>
<td>To make it easier for client code to discover the range of styles that are
predefined, this is set to the style number of the last predefined style. This is
currently set to 39 and the last style with an identifier is 38, which reserves space
for one future predefined style.</td>
<th align="left"><code>STYLE_MAX</code></th>
<td>This is not a style but is the number of the maximum style that can be set. Styles
between <code>STYLE_LASTPREDEFINED</code> and <code>STYLE_MAX</code> would be appropriate
if you used <a class="message" href="#SCI_SETSTYLEBITS"><code>SCI_SETSTYLEBITS</code></a>
to set more than 5 style bits.</td>
<p>For each style you can set the font name, size and use of bold, italic and underline,
foreground and background colour and the character set. You can also choose to hide text with a
given style, display all characters as upper or lower case and fill from the last character on
a line to the end of the line (for embedded languages). There is also an experimental attribute
to make text read-only.</p>
<p>It is entirely up to you how you use styles. If you want to use syntax colouring you might
use style 0 for white space, style 1 for numbers, style 2 for keywords, style 3 for strings,
style 4 for preprocessor, style 5 for operators, and so on.</p>
<code><a class="message" href="#SCI_STYLERESETDEFAULT">SCI_STYLERESETDEFAULT</a><br />
<a class="message" href="#SCI_STYLECLEARALL">SCI_STYLECLEARALL</a><br />
<a class="message" href="#SCI_STYLESETFONT">SCI_STYLESETFONT(int styleNumber, char
*fontName)</a><br />
<a class="message" href="#SCI_STYLEGETFONT">SCI_STYLEGETFONT(int styleNumber, char *fontName)</a><br />
<a class="message" href="#SCI_STYLESETSIZE">SCI_STYLESETSIZE(int styleNumber, int
sizeInPoints)</a><br />
<a class="message" href="#SCI_STYLEGETSIZE">SCI_STYLEGETSIZE(int styleNumber)</a><br />
<a class="message" href="#SCI_STYLESETBOLD">SCI_STYLESETBOLD(int styleNumber, bool
bold)</a><br />
<a class="message" href="#SCI_STYLEGETBOLD">SCI_STYLEGETBOLD(int styleNumber)</a><br />
<a class="message" href="#SCI_STYLESETITALIC">SCI_STYLESETITALIC(int styleNumber, bool
italic)</a><br />
<a class="message" href="#SCI_STYLEGETITALIC">SCI_STYLEGETITALIC(int styleNumber)</a><br />
<a class="message" href="#SCI_STYLESETUNDERLINE">SCI_STYLESETUNDERLINE(int styleNumber, bool
underline)</a><br />
<a class="message" href="#SCI_STYLEGETUNDERLINE">SCI_STYLEGETUNDERLINE(int styleNumber)</a><br />
<a class="message" href="#SCI_STYLESETFORE">SCI_STYLESETFORE(int styleNumber, int
colour)</a><br />
<a class="message" href="#SCI_STYLEGETFORE">SCI_STYLEGETFORE(int styleNumber)</a><br />
<a class="message" href="#SCI_STYLESETBACK">SCI_STYLESETBACK(int styleNumber, int
colour)</a><br />
<a class="message" href="#SCI_STYLEGETBACK">SCI_STYLEGETBACK(int styleNumber)</a><br />
<a class="message" href="#SCI_STYLESETEOLFILLED">SCI_STYLESETEOLFILLED(int styleNumber, bool
eolFilled)</a><br />
<a class="message" href="#SCI_STYLEGETEOLFILLED">SCI_STYLEGETEOLFILLED(int styleNumber)</a><br />
int charSet)</a><br />
<a class="message" href="#SCI_STYLEGETCHARACTERSET">SCI_STYLEGETCHARACTERSET(int styleNumber)</a><br />
<a class="message" href="#SCI_STYLESETCASE">SCI_STYLESETCASE(int styleNumber, int
caseMode)</a><br />
<a class="message" href="#SCI_STYLEGETCASE">SCI_STYLEGETCASE(int styleNumber)</a><br />
<a class="message" href="#SCI_STYLESETVISIBLE">SCI_STYLESETVISIBLE(int styleNumber, bool
visible)</a><br />
<a class="message" href="#SCI_STYLEGETVISIBLE">SCI_STYLEGETVISIBLE(int styleNumber)</a><br />
<a class="message" href="#SCI_STYLESETCHANGEABLE">SCI_STYLESETCHANGEABLE(int styleNumber, bool
changeable)</a><br />
<a class="message" href="#SCI_STYLEGETCHANGEABLE">SCI_STYLEGETCHANGEABLE(int styleNumber)</a><br />
<a class="message" href="#SCI_STYLESETHOTSPOT">SCI_STYLESETHOTSPOT(int styleNumber, bool
hotspot)</a><br />
<a class="message" href="#SCI_STYLEGETHOTSPOT">SCI_STYLEGETHOTSPOT(int styleNumber)</a><br />
This message resets <code>STYLE_DEFAULT</code> to its state when Scintilla was
This message sets all styles to have the same attributes as <code>STYLE_DEFAULT</code>. If you
are setting up Scintilla for syntax colouring, it is likely that the lexical styles you set
will be very similar. One way to set the styles is to:<br />
1. Set <code>STYLE_DEFAULT</code> to the common features of all styles.<br />
2. Use <code>SCI_STYLECLEARALL</code> to copy this to all styles.<br />
3. Set the style attributes that make your lexical styles different.</p>
<p><b id="SCI_STYLESETFONT">SCI_STYLESETFONT(int styleNumber, const char *fontName)</b><br />
<b id="SCI_STYLEGETFONT">SCI_STYLEGETFONT(int styleNumber, char *fontName)</b><br />
<b id="SCI_STYLESETSIZE">SCI_STYLESETSIZE(int styleNumber, int sizeInPoints)</b><br />
<b id="SCI_STYLEGETSIZE">SCI_STYLEGETSIZE(int styleNumber)</b><br />
<b id="SCI_STYLESETBOLD">SCI_STYLESETBOLD(int styleNumber, bool bold)</b><br />
<b id="SCI_STYLEGETBOLD">SCI_STYLEGETBOLD(int styleNumber)</b><br />
<b id="SCI_STYLESETITALIC">SCI_STYLESETITALIC(int styleNumber, bool italic)</b><br />
<b id="SCI_STYLEGETITALIC">SCI_STYLEGETITALIC(int styleNumber)</b><br />
These messages (plus <a class="message"
attributes that are used to match the fonts you request to those available. The
<code>fontName</code> is a zero terminated string holding the name of a font. Under Windows,
only the first 32 characters of the name are used and the name is not case sensitive. For
internal caching, Scintilla tracks fonts by name and does care about the casing of font names,
so please be consistent. On GTK+ 2.x, either GDK or Pango can be used to display text.
Pango antialiases text, works well with Unicode and is better supported in recent versions of GTK+
but GDK is faster.
Prepend a '!' character to the font name to use Pango.</p>
underline)</b><br />
You can set a style to be underlined. The underline is drawn in the foreground colour. All
characters with a style that includes the underline attribute are underlined, even if they are
white space.</p>
<p><b id="SCI_STYLESETFORE">SCI_STYLESETFORE(int styleNumber, int <a class="jump"
href="#colour">colour</a>)</b><br />
<b id="SCI_STYLEGETFORE">SCI_STYLEGETFORE(int styleNumber)</b><br />
<b id="SCI_STYLESETBACK">SCI_STYLESETBACK(int styleNumber, int <a class="jump"
href="#colour">colour</a>)</b><br />
<b id="SCI_STYLEGETBACK">SCI_STYLEGETBACK(int styleNumber)</b><br />
Text is drawn in the foreground colour. The space in each character cell that is not occupied
by the character is drawn in the background colour.</p>
eolFilled)</b><br />
If the last character in the line has a style with this attribute set, the remainder of the
line up to the right edge of the window is filled with the background colour set for the last
character. This is useful when a document contains embedded sections in another language such
as HTML pages with embedded JavaScript. By setting <code>eolFilled</code> to <code>true</code>
and a consistent background colour (different from the background colour set for the HTML
styles) to all JavaScript styles then JavaScript sections will be easily distinguished from
charSet)</b><br />
You can set a style to use a different character set than the default. The places where such
characters sets are likely to be useful are comments and literal strings. For example,
strings in Russian would display correctly in C and C++ (<code>SCE_C_STRING</code> is the style
number used by the C and C++ lexer to display literal strings; it has the value 6). This
feature works differently on Windows and GTK+.</p>
<p>The character sets supported on Windows are:<br />
<code>SC_CHARSET_ANSI</code>, <code>SC_CHARSET_ARABIC</code>, <code>SC_CHARSET_BALTIC</code>,
<code>SC_CHARSET_EASTEUROPE</code>, <code>SC_CHARSET_GB2312</code>,
<code>SC_CHARSET_GREEK</code>, <code>SC_CHARSET_HANGUL</code>, <code>SC_CHARSET_HEBREW</code>,
<code>SC_CHARSET_JOHAB</code>, <code>SC_CHARSET_MAC</code>, <code>SC_CHARSET_OEM</code>,
<code>SC_CHARSET_RUSSIAN</code> (code page 1251),
<code>SC_CHARSET_SHIFTJIS</code>, <code>SC_CHARSET_SYMBOL</code>, <code>SC_CHARSET_THAI</code>,
<code>SC_CHARSET_TURKISH</code>, and <code>SC_CHARSET_VIETNAMESE</code>.</p>
<p>The character sets supported on GTK+ are:<br />
<code>SC_CHARSET_ANSI</code>, <code>SC_CHARSET_CYRILLIC</code> (code page 1251),
<code>SC_CHARSET_GB2312</code>, <code>SC_CHARSET_HANGUL</code>,
<code>SC_CHARSET_RUSSIAN</code> (KOI8-R), <code>SC_CHARSET_SHIFTJIS</code>, and
<p><b id="SCI_STYLESETCASE">SCI_STYLESETCASE(int styleNumber, int caseMode)</b><br />
<b id="SCI_STYLEGETCASE">SCI_STYLEGETCASE(int styleNumber)</b><br />
The value of caseMode determines how text is displayed. You can set upper case
(<code>SC_CASE_UPPER</code>, 1) or lower case (<code>SC_CASE_LOWER</code>, 2) or display
normally (<code>SC_CASE_MIXED</code>, 0). This does not change the stored text, only how it is
<p><b id="SCI_STYLESETVISIBLE">SCI_STYLESETVISIBLE(int styleNumber, bool visible)</b><br />
<b id="SCI_STYLEGETVISIBLE">SCI_STYLEGETVISIBLE(int styleNumber)</b><br />
Text is normally visible. However, you can completely hide it by giving it a style with the
<code>visible</code> set to 0. This could be used to hide embedded formatting instructions or
hypertext keywords in HTML or XML.</p>
changeable)</b><br />
This is an experimental and incompletely implemented style attribute. The default setting is
<code>changeable</code> set <code>true</code> but when set <code>false</code> it makes text
read-only. Currently it only stops the caret from being within not-changeable text and does not
yet stop deleting a range that contains not-changeable text.</p>
hotspot)</b><br />
<b id="SCI_STYLEGETHOTSPOT">SCI_STYLEGETHOTSPOT(int styleNumber)</b><br />
This style is used to mark ranges of text that can detect mouse clicks.
The cursor changes to a hand over hotspots, and the foreground, and background colours
may change and an underline appear to indicate that these areas are sensitive to clicking.
This may be used to allow hyperlinks to other documents.</p>
<h2 id="CaretAndSelectionStyles">Caret, selection, and hotspot styles</h2>
<p>The selection is shown by changing the foreground and/or background colours. If one of these
is not set then that attribute is not changed for the selection. The default is to show the
selection by changing the background to light gray and leaving the foreground the same as when
it was not selected. When there is no selection, the current insertion point is marked by the
text caret. This is a vertical line that is normally blinking on and off to attract the users
<code><a class="message" href="#SCI_SETSELFORE">SCI_SETSELFORE(bool useSelectionForeColour,
int <a class="jump" href="#colour">colour<a>)</a><br />
<a class="message" href="#SCI_SETSELBACK">SCI_SETSELBACK(bool useSelectionBackColour,
int <a class="jump" href="#colour">colour<a>)</a><br />
<a class="message" href="#SCI_SETSELALPHA">SCI_SETSELALPHA(int alpha)</a><br />
<a class="message" href="#SCI_GETSELALPHA">SCI_GETSELALPHA</a><br />
<a class="message" href="#SCI_SETSELEOLFILLED">SCI_SETSELEOLFILLED(bool filled)</a><br />
<a class="message" href="#SCI_GETSELEOLFILLED">SCI_GETSELEOLFILLED</a><br />
<a class="message" href="#SCI_SETCARETFORE">SCI_SETCARETFORE(int colour)</a><br />
<a class="message" href="#SCI_GETCARETFORE">SCI_GETCARETFORE</a><br />
show)</a><br />
<a class="message" href="#SCI_SETCARETLINEBACK">SCI_SETCARETLINEBACK(int colour)</a><br />
<a class="message" href="#SCI_GETCARETLINEBACK">SCI_GETCARETLINEBACK</a><br />
<a class="message" href="#SCI_SETCARETLINEBACKALPHA">SCI_SETCARETLINEBACKALPHA(int alpha)</a><br />
<a class="message" href="#SCI_SETCARETPERIOD">SCI_SETCARETPERIOD(int milliseconds)</a><br />
<a class="message" href="#SCI_GETCARETPERIOD">SCI_GETCARETPERIOD</a><br />
<a class="message" href="#SCI_SETCARETSTYLE">SCI_SETCARETSTYLE(int style)</a><br />
<a class="message" href="#SCI_GETCARETSTYLE">SCI_GETCARETSTYLE</a><br />
<a class="message" href="#SCI_SETCARETWIDTH">SCI_SETCARETWIDTH(int pixels)</a><br />
<a class="message" href="#SCI_GETCARETWIDTH">SCI_GETCARETWIDTH</a><br />
int <a class="jump" href="#colour">colour<a>)</a><br />
int <a class="jump" href="#colour">colour<a>)</a><br />
<a class="message" href="#SCI_SETHOTSPOTACTIVEUNDERLINE">SCI_SETHOTSPOTACTIVEUNDERLINE(bool underline)</a><br />
<a class="message" href="#SCI_SETHOTSPOTSINGLELINE">SCI_SETHOTSPOTSINGLELINE(bool singleLine)</a><br />
symbol)</a><br />
<a class="message" href="#SCI_SETCARETSTICKY">SCI_SETCARETSTICKY(bool useCaretStickyBehaviour)</a><br />
<a class="message" href="#SCI_GETCARETSTICKY">SCI_GETCARETSTICKY</a><br />
<a class="message" href="#SCI_TOGGLECARETSTICKY">SCI_TOGGLECARETSTICKY</a><br />
<p><b id="SCI_SETSELFORE">SCI_SETSELFORE(bool useSelectionForeColour, int <a class="jump"
href="#colour">colour</a>)</b><br />
<b id="SCI_SETSELBACK">SCI_SETSELBACK(bool useSelectionBackColour, int <a class="jump"
href="#colour">colour</a>)</b><br />
You can choose to override the default selection colouring with these two messages. The colour
you provide is used if you set <code>useSelection*Colour</code> to <code>true</code>. If it is
set to <code>false</code>, the default styled colouring is used and the <code>colour</code>
argument has no effect.</p>
<p><b id="SCI_SETSELALPHA">SCI_SETSELALPHA(int <a class="jump" href="#alpha">alpha</a>)</b><br />
The selection can be drawn translucently in the selection background colour by
setting an alpha value.</p>
<p><b id="SCI_SETSELEOLFILLED">SCI_SETSELEOLFILLED(bool filled)</b><br />
The selection can be drawn up to the right hand border by setting this property.</p>
<p><b id="SCI_SETCARETFORE">SCI_SETCARETFORE(int <a class="jump"
href="#colour">colour</a>)</b><br />
The colour of the caret can be set with <code>SCI_SETCARETFORE</code> and retrieved with
href="#colour">colour</a>)</b><br />
<b id="SCI_SETCARETLINEBACKALPHA">SCI_SETCARETLINEBACKALPHA(int <a class="jump" href="#alpha">alpha</a>)</b><br />
You can choose to make the background colour of the line containing the caret different with
these messages. To do this, set the desired background colour with
<code>SCI_SETCARETLINEBACK</code>, then use <code>SCI_SETCARETLINEVISIBLE(true)</code> to
enable the effect. You can cancel the effect with <code>SCI_SETCARETLINEVISIBLE(false)</code>.
The two <code>SCI_GETCARET*</code> functions return the state and the colour. This form of
background colouring has highest priority when a line has markers that would otherwise change
the background colour.
The caret line may also be drawn translucently which allows other background colours to show
through. This is done by setting the alpha (translucency) value by calling
the caret line is drawn after all other features so will affect the colour of all other features.
<p><b id="SCI_SETCARETPERIOD">SCI_SETCARETPERIOD(int milliseconds)</b><br />
The rate at which the caret blinks can be set with <code>SCI_SETCARETPERIOD</code> which
determines the time in milliseconds that the caret is visible or invisible before changing
state. Setting the period to 0 stops the caret blinking. The default value is 500 milliseconds.
<code>SCI_GETCARETPERIOD</code> returns the current setting.</p>
<p><b id="SCI_SETCARETSTYLE">SCI_SETCARETSTYLE(int style)</b><br />
The style of the caret can be set with <code>SCI_SETCARETSTYLE</code> to be a line caret
(CARETSTYLE_LINE=1), a block caret (CARETSTYLE_BLOCK=2) or to not draw at all
(CARETSTYLE_INVISIBLE=0). The default value is the line caret (CARETSTYLE_LINE=1).
You can determine the current caret style setting using <code>SCI_GETCARETSTYLE</code>.</p>
<p>The block character draws most combining and multibyte character sequences successfully,
though some fonts like Thai Fonts (and possibly others) can sometimes appear strange when
the cursor is positioned at these characters, which may result in only drawing a part of the
cursor character sequence. This is most notable on Windows platforms.</p>
<p><b id="SCI_SETCARETWIDTH">SCI_SETCARETWIDTH(int pixels)</b><br />
The width of the line caret can be set with <code>SCI_SETCARETWIDTH</code> to a value of
0, 1, 2 or 3 pixels. The default width is 1 pixel. You can read back the current width with
<code>SCI_GETCARETWIDTH</code>. A width of 0 makes the caret invisible (added at version
1.50), similar to setting the caret style to CARETSTYLE_INVISIBLE (though not interchangable).
This setting only affects the width of the cursor when the cursor style is set to line caret
mode, it does not affect the width for a block caret.</p>
<p><b id="SCI_SETHOTSPOTACTIVEFORE">SCI_SETHOTSPOTACTIVEFORE(bool useHotSpotForeColour, int <a class="jump"
href="#colour">colour</a>)</b><br />
<b id="SCI_SETHOTSPOTACTIVEBACK">SCI_SETHOTSPOTACTIVEBACK(bool useHotSpotBackColour, int <a class="jump"
href="#colour">colour</a>)</b><br />
While the cursor hovers over text in a style with the hotspot attribute set,
the default colouring can be modified and an underline drawn with these settings.
Single line mode stops a hotspot from wrapping onto next line.</p>
By default, Scintilla displays control characters (characters with codes less than 32) in a
rounded rectangle as ASCII mnemonics: "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
"BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", "DLE", "DC1", "DC2", "DC3", "DC4", "NAK",
"SYN", "ETB", "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US". These mnemonics come from the
early days of signaling, though some are still used (LF = Line Feed, BS = Back Space, CR =
Carriage Return, for example).</p>
<p>You can choose to replace these mnemonics by a nominated symbol with an ASCII code in the
range 32 to 255. If you set a symbol value less than 32, all control characters are displayed
as mnemonics. The symbol you set is rendered in the font of the style set for the character.
You can read back the current symbol with the <code>SCI_GETCONTROLCHARSYMBOL</code> message.
The default symbol value is 0.</p>
<p><b id="SCI_SETCARETSTICKY">SCI_SETCARETSTICKY(bool useCaretStickyBehaviour)</b><br />
These messages set, get or toggle the caretSticky flag which controls when the last position
of the caret on the line is saved. When set to true, the position is not saved when you type
a character, a tab, paste the clipboard content or press backspace.</p>
<h2 id="Margins">Margins</h2>
<p>There may be up to five margins to the left of the text display, plus a gap either side of
the text. Each margin can be set to display either symbols or line numbers with <a
class="message" href="#SCI_SETMARGINTYPEN"><code>SCI_SETMARGINTYPEN</code></a>. The markers
that can be displayed in each margin are set with <a class="message"
href="#SCI_SETMARGINMASKN"><code>SCI_SETMARGINMASKN</code></a>. Any markers not associated with
a visible margin will be displayed as changes in background colour in the text. A width in
pixels can be set for each margin. Margins with a zero width are ignored completely. You can
choose if a mouse click in a margin sends a <a class="message"
href="#SCN_MARGINCLICK"><code>SCN_MARGINCLICK</code></a> notification to the container or
selects a line of text.</p>
<p>The margins are numbered 0 to 4. Using a margin number outside the valid range has no
effect. By default, margin 0 is set to display line numbers, but is given a width of 0, so it
is hidden. Margin 1 is set to display non-folding symbols and is given a width of 16 pixels, so
it is visible. Margin 2 is set to display the folding symbols, but is given a width of 0, so it
is hidden. Of course, you can set the margins to be whatever you wish.</p>
<p>Styled text margins used to show revision and blame information:</p>
<p><img src="styledmargin.png" alt="Styled text margins used to show revision and blame information" /></p>
<code><a class="message" href="#SCI_SETMARGINTYPEN">SCI_SETMARGINTYPEN(int margin, int
type)</a><br />
<a class="message" href="#SCI_GETMARGINTYPEN">SCI_GETMARGINTYPEN(int margin)</a><br />
<a class="message" href="#SCI_SETMARGINWIDTHN">SCI_SETMARGINWIDTHN(int margin, int
pixelWidth)</a><br />
<a class="message" href="#SCI_GETMARGINWIDTHN">SCI_GETMARGINWIDTHN(int margin)</a><br />
<a class="message" href="#SCI_SETMARGINMASKN">SCI_SETMARGINMASKN(int margin, int
mask)</a><br />
<a class="message" href="#SCI_GETMARGINMASKN">SCI_GETMARGINMASKN(int margin)</a><br />
<a class="message" href="#SCI_SETMARGINSENSITIVEN">SCI_SETMARGINSENSITIVEN(int margin, bool
sensitive)</a><br />
margin)</a><br />
<a class="message" href="#SCI_SETMARGINLEFT">SCI_SETMARGINLEFT(&lt;unused&gt;, int
pixels)</a><br />
<a class="message" href="#SCI_GETMARGINLEFT">SCI_GETMARGINLEFT</a><br />
<a class="message" href="#SCI_SETMARGINRIGHT">SCI_SETMARGINRIGHT(&lt;unused&gt;, int
pixels)</a><br />
<a class="message" href="#SCI_GETMARGINRIGHT">SCI_GETMARGINRIGHT</a><br />
<a class="message" href="#SCI_SETFOLDMARGINCOLOUR">SCI_SETFOLDMARGINCOLOUR(bool useSetting, int colour)</a><br />
<a class="message" href="#SCI_SETFOLDMARGINHICOLOUR">SCI_SETFOLDMARGINHICOLOUR(bool useSetting, int colour)</a><br />