Update Scintilla to version 3.5.7
[TortoiseGit.git] / ext / scintilla / doc / ScintillaDoc.html
blob3f88d2d07901f97e33a6cad8feaf383caca590cf
1 <?xml version="1.0"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5 <html xmlns="http://www.w3.org/1999/xhtml">
6 <head>
7 <meta name="generator"
8 content="HTML Tidy for Windows (vers 1st August 2002), see www.w3.org" />
9 <meta name="generator" content="SciTE" />
10 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
12 <title>Scintilla Documentation</title>
14 <style type="text/css">
15 <!--
16 /*<![CDATA[*/
17 CODE { font-weight: bold; font-family: Consolas,Bitstream Vera Sans Mono,Courier New,monospace; }
18 A:visited { color: blue; }
19 A:hover { text-decoration: underline ! important; }
20 A.message { text-decoration: none; font-weight: bold; font-family: Consolas,Bitstream Vera Sans Mono,Courier New,monospace; }
21 A.toc { text-decoration: none; }
22 A.jump { text-decoration: none; }
23 .S0 {
24 color: #808080;
26 .S2 {
27 font-family: 'Comic Sans MS';
28 color: #007F00;
29 font-size: 9pt;
31 .S3 {
32 font-family: 'Comic Sans MS';
33 color: #3F703F;
34 font-size: 9pt;
36 .S4 {
37 color: #007F7F;
39 .S5 {
40 font-weight: bold;
41 color: #00007F;
43 .S9 {
44 color: #7F7F00;
46 .S10 {
47 font-weight: bold;
48 color: #000000;
50 .S17 {
51 font-family: 'Comic Sans MS';
52 color: #3060A0;
53 font-size: 9pt;
55 DIV.highlighted {
56 background: #F7FCF7;
57 border: 1px solid #C0D7C0;
58 margin: 0.3em 3em;
59 padding: 0.3em 0.6em;
60 font-family: 'Verdana';
61 color: #000000;
62 font-size: 10pt;
64 .provisional {
65 background: #FFB000;
67 /*]]>*/
68 -->
69 </style>
70 </head>
72 <body bgcolor="#FFFFFF" text="#000000">
73 <table bgcolor="#000000" width="100%" cellspacing="0" cellpadding="0" border="0"
74 summary="Banner">
75 <tr>
76 <td><img src="SciTEIco.png" border="3" height="64" width="64" alt="Scintilla icon" /></td>
78 <td><a href="index.html"
79 style="color:white;text-decoration:none;font-size:200%">Scintilla</a></td>
80 </tr>
81 </table>
83 <h1>Scintilla Documentation</h1>
85 <p>Last edited 11 June 2015 NH</p>
87 <p>There is <a class="jump" href="Design.html">an overview of the internal design of
88 Scintilla</a>.<br />
89 <a class="jump" href="ScintillaUsage.html">Some notes on using Scintilla</a>.<br />
90 <a class="jump" href="Steps.html">How to use the Scintilla Edit Control on Windows</a>.<br />
91 <a class="jump" href="http://www.scintilla.org/dmapp.zip">A simple sample using Scintilla from
92 C++ on Windows</a>.<br />
93 <a class="jump" href="http://www.scintilla.org/SciTry.vb">A simple sample using Scintilla from
94 Visual Basic</a>.<br />
95 <a class="jump" href="http://www.scintilla.org/bait.zip">Bait is a tiny sample using Scintilla
96 on GTK+</a>.<br />
97 <a class="jump" href="Lexer.txt">A detailed description of how to write a lexer, including a
98 discussion of folding</a>.<br />
99 <a class="jump" href="http://sphere.sourceforge.net/flik/docs/scintilla-container_lexer.html">
100 How to implement a lexer in the container</a>.<br />
101 <a class="jump" href="http://sphere.sourceforge.net/flik/docs/scintilla-folding.html">
102 How to implement folding</a>.<br />
103 <a class="jump" href="https://bitbucket.org/StarFire/scintilla-doc/downloads/Scintilla-var'aq-Tutorial.pdf">
104 Beginner's Guide to lexing and folding</a>.<br />
105 The <a class="jump" href="SciCoding.html">coding style</a> used in Scintilla and SciTE is
106 worth following if you want to contribute code to Scintilla but is not compulsory.</p>
108 <h2>Introduction</h2>
110 <p>The Windows version of Scintilla is a Windows Control. As such, its primary programming
111 interface is through Windows messages. Early versions of Scintilla emulated much of the API
112 defined by the standard Windows Edit and RichEdit controls but those APIs are now deprecated in
113 favour of Scintilla's own, more consistent API. In addition to messages performing the actions
114 of a normal Edit control, Scintilla allows control of syntax styling, folding, markers, autocompletion
115 and call tips.</p>
117 <p>The GTK+ version also uses messages in a similar way to the Windows version. This is
118 different to normal GTK+ practice but made it easier to implement rapidly.</p>
120 <p>Scintilla also builds with Cocoa on OS X and with Qt, and follows the conventions of
121 those platforms.</p>
123 <p>Scintilla does not properly support right-to-left languages like Arabic and Hebrew.
124 While text in these languages may appear correct, it is not possible to interact with this text
125 as is normal with other editing components.</p>
127 <p>This documentation describes the individual messages and notifications used by Scintilla. It
128 does not describe how to link them together to form a useful editor. For now, the best way to
129 work out how to develop using Scintilla is to see how SciTE uses it. SciTE exercises most of
130 Scintilla's facilities.</p>
132 <p>In the descriptions that follow, the messages are described as function calls with zero, one
133 or two arguments. These two arguments are the standard <code>wParam</code> and
134 <code>lParam</code> familiar to Windows programmers. These parameters are integers that
135 are large enough to hold pointers, and the return value is also an integer large enough to contain a
136 pointer.
137 Although the commands only use the
138 arguments described, because all messages have two arguments whether Scintilla uses them or
139 not, it is strongly recommended that any unused arguments are set to 0. This allows future
140 enhancement of messages without the risk of breaking existing code. Common argument types
141 are:</p>
143 <table cellpadding="1" cellspacing="2" border="0" summary="Common argument types">
144 <tbody valign="top">
145 <tr>
146 <th align="left">bool</th>
148 <td>Arguments expect the values 0 for <code>false</code> and 1 for
149 <code>true</code>.</td>
150 </tr>
152 <tr>
153 <th align="left">int</th>
155 <td>Arguments are 32-bit signed integers.</td>
156 </tr>
158 <tr>
159 <th align="left">const&nbsp;char&nbsp;*</th>
161 <td>Arguments point at text that is being passed to Scintilla but not modified. The text
162 may be zero terminated or another argument may specify the character count, the
163 description will make this clear.</td>
164 </tr>
166 <tr>
167 <th align="left">char *</th>
169 <td>Arguments point at text buffers that Scintilla will fill with text. In some cases,
170 another argument will tell Scintilla the buffer size. In others, you must make sure that
171 the buffer is big enough to hold the requested text. If a NULL pointer (0) is passed
172 then, for SCI_* calls, the length that should be allocated, not including any terminating
173 NUL, is returned. Some calls (marked "NUL-terminated") add a NUL character to the result but other calls do
174 not: to generically handle both types, allocate one more byte than indicated and set it to NUL.</td>
175 </tr>
177 <tr>
178 <th align="left" id="colour">colour</th>
180 <td>Colours are set using the RGB format (Red, Green, Blue). The intensity of each colour
181 is set in the range 0 to 255. If you have three such intensities, they are combined as:
182 red | (green &lt;&lt; 8) | (blue &lt;&lt; 16). If you set all intensities to 255, the
183 colour is white. If you set all intensities to 0, the colour is black. When you set a
184 colour, you are making a request. What you will get depends on the capabilities of the
185 system and the current screen mode.</td>
186 </tr>
188 <tr>
189 <th align="left" id="alpha">alpha</th>
191 <td>Translucency is set using an alpha value.
192 Alpha ranges from 0 (SC_ALPHA_TRANSPARENT) which is completely transparent to
193 255 (SC_ALPHA_OPAQUE) which is opaque. The value 256 (SC_ALPHA_NOALPHA)
194 is opaque and uses code that is not alpha-aware and may be faster. Not all platforms support
195 translucency and only some Scintilla features implement translucency.
196 The default alpha value for most features is SC_ALPHA_NOALPHA.</td>
197 </tr>
199 <tr>
200 <th align="left">&lt;unused&gt;</th>
202 <td>This is an unused argument. Setting it to 0 will ensure compatibility with future
203 enhancements.</td>
204 </tr>
205 </tbody>
206 </table>
208 <h2 id="MessageCategories">Contents</h2>
210 <table cellpadding="4" cellspacing="2" border="0" summary="Message categories">
211 <tbody>
212 <tr>
213 <td>o <a class="toc" href="#TextRetrievalAndModification">Text retrieval and
214 modification</a></td>
216 <td>o <a class="toc" href="#Searching">Searching and replacing</a></td>
218 <td>o <a class="toc" href="#Overtype">Overtype</a></td>
220 </tr>
222 <tr>
223 <td>o <a class="toc" href="#CutCopyAndPaste">Cut, copy and paste</a></td>
225 <td>o <a class="toc" href="#ErrorHandling">Error handling</a></td>
227 <td>o <a class="toc" href="#UndoAndRedo">Undo and Redo</a></td>
229 </tr>
231 <tr>
232 <td>o <a class="toc" href="#SelectionAndInformation">Selection and information</a></td>
234 <td>o <a class="toc" href="#MultipleSelectionAndVirtualSpace">Multiple Selection and Virtual Space</a></td>
236 <td>o <a class="toc" href="#ScrollingAndAutomaticScrolling">Scrolling and automatic
237 scrolling</a></td>
239 </tr>
241 <tr>
242 <td>o <a class="toc" href="#WhiteSpace">White space</a></td>
244 <td>o <a class="toc" href="#Cursor">Cursor</a></td>
246 <td>o <a class="toc" href="#MouseCapture">Mouse capture</a></td>
248 </tr>
250 <tr>
251 <td>o <a class="toc" href="#LineEndings">Line endings</a></td>
253 <td>o <a class="toc" href="#Styling">Styling</a></td>
255 <td>o <a class="toc" href="#StyleDefinition">Style definition</a></td>
257 </tr>
259 <tr>
260 <td>o <a class="toc" href="#CaretAndSelectionStyles">Caret, selection, and hotspot styles</a></td>
262 <td>o <a class="toc" href="#CharacterRepresentations">Character representations</a></td>
264 <td>o <a class="toc" href="#Margins">Margins</a></td>
266 </tr>
268 <tr>
269 <td>o <a class="toc" href="#Annotations">Annotations</a></td>
271 <td>o <a class="toc" href="#OtherSettings">Other settings</a></td>
273 <td>o <a class="toc" href="#BraceHighlighting">Brace highlighting</a></td>
275 </tr>
277 <tr>
278 <td>o <a class="toc" href="#TabsAndIndentationGuides">Tabs and Indentation
279 Guides</a></td>
281 <td>o <a class="toc" href="#Markers">Markers</a></td>
283 <td>o <a class="toc" href="#Indicators">Indicators</a></td>
285 </tr>
287 <tr>
288 <td>o <a class="toc" href="#Autocompletion">Autocompletion</a></td>
290 <td>o <a class="toc" href="#UserLists">User lists</a></td>
292 <td>o <a class="toc" href="#CallTips">Call tips</a></td>
294 </tr>
296 <tr>
297 <td>o <a class="toc" href="#KeyboardCommands">Keyboard commands</a></td>
299 <td>o <a class="toc" href="#KeyBindings">Key bindings</a></td>
301 <td>o <a class="toc" href="#PopupEditMenu">Popup edit menu</a></td>
303 </tr>
305 <tr>
306 <td>o <a class="toc" href="#MacroRecording">Macro recording</a></td>
308 <td>o <a class="toc" href="#Printing">Printing</a></td>
310 <td>o <a class="toc" href="#DirectAccess">Direct access</a></td>
312 </tr>
314 <tr>
315 <td>o <a class="toc" href="#MultipleViews">Multiple views</a></td>
317 <td>o <a class="toc" href="#BackgroundLoadSave">Background loading and saving</a></td>
319 <td>o <a class="toc" href="#Folding">Folding</a></td>
321 </tr>
323 <tr>
324 <td>o <a class="toc" href="#LineWrapping">Line wrapping</a></td>
326 <td>o <a class="toc" href="#Zooming">Zooming</a></td>
328 <td>o <a class="toc" href="#LongLines">Long lines</a></td>
330 </tr>
332 <tr>
333 <td>o <a class="toc" href="#Lexer">Lexer</a></td>
335 <td>o <a class="toc" href="#LexerObjects">Lexer objects</a></td>
337 <td>o <a class="toc" href="#Notifications">Notifications</a></td>
339 </tr>
341 <tr>
342 <td>o <a class="toc" href="#Images">Images</a></td>
344 <td>o <a class="toc" href="#GTK">GTK+</a></td>
346 <td>o <a class="toc" href="#ProvisionalMessages"><span class="provisional">Provisional messages</span></a></td>
348 </tr>
350 <tr>
351 <td>o <a class="toc" href="#DeprecatedMessages">Deprecated messages</a></td>
353 <td>o <a class="toc" href="#EditMessagesNeverSupportedByScintilla">Edit messages never
354 supported by Scintilla</a></td>
356 <td>o <a class="toc" href="#BuildingScintilla">Building Scintilla</a></td>
358 </tr>
359 </tbody>
360 </table>
362 <p>Messages with names of the form <code>SCI_SETxxxxx</code> often have a companion
363 <code>SCI_GETxxxxx</code>. To save tedious repetition, if the <code>SCI_GETxxxxx</code> message
364 returns the value set by the <code>SCI_SETxxxxx</code> message, the <code>SET</code> routine is
365 described and the <code>GET</code> routine is left to your imagination.</p>
367 <h2 id="TextRetrievalAndModification">Text retrieval and modification</h2>
369 <p>Each byte in a Scintilla document is associated with a byte of styling
370 information. The combination of a character byte and a style byte is called a cell. Style bytes
371 are interpreted an index into an array of styles.</p>
373 <p>In this document, 'character' normally refers to a byte even when multi-byte characters are used.
374 Lengths measure the numbers of bytes, not the amount of characters in those bytes.</p>
376 <p>Positions within the Scintilla document refer to a character or the gap before that
377 character. The first character in a document is 0, the second 1 and so on. If a document
378 contains <code>nLen</code> characters, the last character is numbered <code>nLen</code>-1.
379 The caret exists between character positions and can be located from before the first character (0)
380 to after the last character (<code>nLen</code>).</p>
382 <p>There are places where the caret can not go where two character bytes make up one character.
383 This occurs when a DBCS character from a language like Japanese is included in the document or
384 when line ends are marked with the CP/M standard of a carriage return followed by a line feed.
385 The <code>INVALID_POSITION</code> constant (-1) represents an invalid position within the
386 document.</p>
388 <p>All lines of text in Scintilla are the same height, and this height is calculated from the
389 largest font in any current style. This restriction is for performance; if lines differed in
390 height then calculations involving positioning of text would require the text to be styled
391 first.</p>
392 <code><a class="message" href="#SCI_GETTEXT">SCI_GETTEXT(int length, char *text)</a><br />
393 <a class="message" href="#SCI_SETTEXT">SCI_SETTEXT(&lt;unused&gt;, const char *text)</a><br />
394 <a class="message" href="#SCI_SETSAVEPOINT">SCI_SETSAVEPOINT</a><br />
395 <a class="message" href="#SCI_GETLINE">SCI_GETLINE(int line, char *text)</a><br />
396 <a class="message" href="#SCI_REPLACESEL">SCI_REPLACESEL(&lt;unused&gt;, const char
397 *text)</a><br />
398 <a class="message" href="#SCI_SETREADONLY">SCI_SETREADONLY(bool readOnly)</a><br />
399 <a class="message" href="#SCI_GETREADONLY">SCI_GETREADONLY</a><br />
400 <a class="message" href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE(&lt;unused&gt;, Sci_TextRange
401 *tr)</a><br />
402 <a class="message" href="#SCI_ALLOCATE">SCI_ALLOCATE(int bytes, &lt;unused&gt;)</a><br />
403 <a class="message" href="#SCI_ADDTEXT">SCI_ADDTEXT(int length, const char *s)</a><br />
404 <a class="message" href="#SCI_ADDSTYLEDTEXT">SCI_ADDSTYLEDTEXT(int length, cell *s)</a><br />
405 <a class="message" href="#SCI_APPENDTEXT">SCI_APPENDTEXT(int length, const char *s)</a><br />
406 <a class="message" href="#SCI_INSERTTEXT">SCI_INSERTTEXT(int pos, const char *text)</a><br />
407 <a class="message" href="#SCI_CHANGEINSERTION">SCI_CHANGEINSERTION(int length, const char *text)</a><br />
408 <a class="message" href="#SCI_CLEARALL">SCI_CLEARALL</a><br />
409 <a class="message" href="#SCI_DELETERANGE">SCI_DELETERANGE(int pos, int deleteLength)</a><br />
410 <a class="message" href="#SCI_CLEARDOCUMENTSTYLE">SCI_CLEARDOCUMENTSTYLE</a><br />
411 <a class="message" href="#SCI_GETCHARAT">SCI_GETCHARAT(int position)</a><br />
412 <a class="message" href="#SCI_GETSTYLEAT">SCI_GETSTYLEAT(int position)</a><br />
413 <a class="message" href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT(&lt;unused&gt;, Sci_TextRange
414 *tr)</a><br />
415 <a class="message" href="#SCI_RELEASEALLEXTENDEDSTYLES">SCI_RELEASEALLEXTENDEDSTYLES</a><br />
416 <a class="message" href="#SCI_ALLOCATEEXTENDEDSTYLES">SCI_ALLOCATEEXTENDEDSTYLES(int numberStyles)</a><br />
417 <a class="message" href="#SCI_TARGETASUTF8">SCI_TARGETASUTF8(&lt;unused&gt;, char *s)</a><br />
418 <a class="message" href="#SCI_ENCODEDFROMUTF8">SCI_ENCODEDFROMUTF8(const char *utf8, char *encoded)</a><br />
419 <a class="message" href="#SCI_SETLENGTHFORENCODE">SCI_SETLENGTHFORENCODE(int bytes)</a><br />
420 </code>
422 <p><b id="SCI_GETTEXT">SCI_GETTEXT(int length, char *text NUL-terminated)</b><br />
423 This returns <code>length</code>-1 characters of text from the start of the document plus one
424 terminating 0 character. To collect all the text in a document, use <code>SCI_GETLENGTH</code>
425 to get the number of characters in the document (<code>nLen</code>), allocate a character
426 buffer of length <code>nLen+1</code> bytes, then call <code>SCI_GETTEXT(nLen+1, char
427 *text)</code>. If the text argument is 0 then the length that should be allocated to store the
428 entire document is returned.
429 If you then save the text, you should use <code>SCI_SETSAVEPOINT</code> to mark
430 the text as unmodified.</p>
432 <p>See also: <code><a class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>, <a
433 class="message" href="#SCI_GETCURLINE">SCI_GETCURLINE</a>, <a class="message"
434 href="#SCI_GETLINE">SCI_GETLINE</a>, <a class="message"
435 href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>, <a class="message"
436 href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a></code></p>
438 <p><b id="SCI_SETTEXT">SCI_SETTEXT(&lt;unused&gt;, const char *text)</b><br />
439 This replaces all the text in the document with the zero terminated text string you pass
440 in.</p>
442 <p><b id="SCI_SETSAVEPOINT">SCI_SETSAVEPOINT</b><br />
443 This message tells Scintilla that the current state of the document is unmodified. This is
444 usually done when the file is saved or loaded, hence the name "save point". As Scintilla
445 performs undo and redo operations, it notifies the container that it has entered or left the
446 save point with <code><a class="message"
447 href="#SCN_SAVEPOINTREACHED">SCN_SAVEPOINTREACHED</a></code> and <code><a class="message"
448 href="#SCN_SAVEPOINTLEFT">SCN_SAVEPOINTLEFT</a></code> <a class="jump"
449 href="#Notifications">notification messages</a>, allowing the container to know if the file
450 should be considered dirty or not.</p>
452 <p>See also: <code><a class="message" href="#SCI_EMPTYUNDOBUFFER">SCI_EMPTYUNDOBUFFER</a>, <a
453 class="message" href="#SCI_GETMODIFY">SCI_GETMODIFY</a></code></p>
455 <p><b id="SCI_GETLINE">SCI_GETLINE(int line, char *text)</b><br />
456 This fills the buffer defined by text with the contents of the nominated line (lines start at
457 0). The buffer is not terminated by a 0 character. It is up to you to make sure that the buffer
458 is long enough for the text, use <a class="message"
459 href="#SCI_LINELENGTH"><code>SCI_LINELENGTH(int line)</code></a>. The returned value is the
460 number of characters copied to the buffer. The returned text includes any end of line
461 characters. If you ask for a line number outside the range of lines in the document, 0
462 characters are copied. If the text argument is 0 then the length that should be allocated
463 to store the entire line is returned.</p>
465 <p>See also: <code><a class="message" href="#SCI_GETCURLINE">SCI_GETCURLINE</a>, <a
466 class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>, <a class="message"
467 href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a>, <a class="message"
468 href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>, <a class="message"
469 href="#SCI_GETTEXT">SCI_GETTEXT</a></code></p>
471 <p><b id="SCI_REPLACESEL">SCI_REPLACESEL(&lt;unused&gt;, const char *text)</b><br />
472 The currently selected text between the <a class="jump" href="#SelectionAndInformation">anchor
473 and the current position</a> is replaced by the 0 terminated text string. If the anchor and
474 current position are the same, the text is inserted at the caret position. The caret is
475 positioned after the inserted text and the caret is scrolled into view.</p>
477 <p><b id="SCI_SETREADONLY">SCI_SETREADONLY(bool readOnly)</b><br />
478 <b id="SCI_GETREADONLY">SCI_GETREADONLY</b><br />
479 These messages set and get the read-only flag for the document. If you mark a document as read
480 only, attempts to modify the text cause the <a class="message"
481 href="#SCN_MODIFYATTEMPTRO"><code>SCN_MODIFYATTEMPTRO</code></a> notification.</p>
483 <p><b id="SCI_GETTEXTRANGE">SCI_GETTEXTRANGE(&lt;unused&gt;, <a class="jump"
484 href="#Sci_TextRange">Sci_TextRange</a> *tr)</b><br />
485 This collects the text between the positions <code>cpMin</code> and <code>cpMax</code> and
486 copies it to <code>lpstrText</code> (see <code>struct Sci_TextRange</code> in
487 <code>Scintilla.h</code>). If <code>cpMax</code> is -1, text is returned to the end of the
488 document. The text is 0 terminated, so you must supply a buffer that is at least 1 character
489 longer than the number of characters you wish to read. The return value is the length of the
490 returned text not including the terminating 0.</p>
492 <p>See also: <code><a class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>, <a
493 class="message" href="#SCI_GETLINE">SCI_GETLINE</a>, <a class="message"
494 href="#SCI_GETCURLINE">SCI_GETCURLINE</a>, <a class="message"
495 href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>, <a class="message"
496 href="#SCI_GETTEXT">SCI_GETTEXT</a></code></p>
498 <p><b id="SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT(&lt;unused&gt;, <a class="jump"
499 href="#Sci_TextRange">Sci_TextRange</a> *tr)</b><br />
500 This collects styled text into a buffer using two bytes for each cell, with the character at
501 the lower address of each pair and the style byte at the upper address. Characters between the
502 positions <code>cpMin</code> and <code>cpMax</code> are copied to <code>lpstrText</code> (see
503 <code>struct Sci_TextRange</code> in <code>Scintilla.h</code>). Two 0 bytes are added to the end of
504 the text, so the buffer that <code>lpstrText</code> points at must be at least
505 <code>2*(cpMax-cpMin)+2</code> bytes long. No check is made for sensible values of
506 <code>cpMin</code> or <code>cpMax</code>. Positions outside the document return character codes
507 and style bytes of 0.</p>
509 <p>See also: <code><a class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>, <a
510 class="message" href="#SCI_GETLINE">SCI_GETLINE</a>, <a class="message"
511 href="#SCI_GETCURLINE">SCI_GETCURLINE</a>, <a class="message"
512 href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a>, <a class="message"
513 href="#SCI_GETTEXT">SCI_GETTEXT</a></code></p>
515 <p><b id="SCI_ALLOCATE">SCI_ALLOCATE(int bytes, &lt;unused&gt;)</b><br />
516 Allocate a document buffer large enough to store a given number of bytes.
517 The document will not be made smaller than its current contents.</p>
519 <p><b id="SCI_ADDTEXT">SCI_ADDTEXT(int length, const char *s)</b><br />
520 This inserts the first <code>length</code> characters from the string <code>s</code>
521 at the current position. This will include any 0's in the string that you might have expected
522 to stop the insert operation. The current position is set at the end of the inserted text,
523 but it is not scrolled into view.</p>
525 <p><b id="SCI_ADDSTYLEDTEXT">SCI_ADDSTYLEDTEXT(int length, cell *s)</b><br />
526 This behaves just like <code>SCI_ADDTEXT</code>, but inserts styled text.</p>
528 <p><b id="SCI_APPENDTEXT">SCI_APPENDTEXT(int length, const char *s)</b><br />
529 This adds the first <code>length</code> characters from the string <code>s</code> to the end
530 of the document. This will include any 0's in the string that you might have expected to stop
531 the operation. The current selection is not changed and the new text is not scrolled into
532 view.</p>
534 <p><b id="SCI_INSERTTEXT">SCI_INSERTTEXT(int pos, const char *text)</b><br />
535 This inserts the zero terminated <code>text</code> string at position <code>pos</code> or at
536 the current position if <code>pos</code> is -1. If the current position is after the insertion point
537 then it is moved along with its surrounding text but no scrolling is performed.</p>
539 <p><b id="SCI_CHANGEINSERTION">SCI_CHANGEINSERTION(int length, const char *text)</b><br />
540 This may only be called from a <a class="message" href="#SC_MOD_INSERTCHECK">SC_MOD_INSERTCHECK</a>
541 notification handler and will change the text being inserted to that provided.</p>
543 <p><b id="SCI_CLEARALL">SCI_CLEARALL</b><br />
544 Unless the document is read-only, this deletes all the text.</p>
546 <p><b id="SCI_DELETERANGE">SCI_DELETERANGE(int pos, int deleteLength)</b><br />
547 Deletes a range of text in the document.</p>
549 <p><b id="SCI_CLEARDOCUMENTSTYLE">SCI_CLEARDOCUMENTSTYLE</b><br />
550 When wanting to completely restyle the document, for example after choosing a lexer, the
551 <code>SCI_CLEARDOCUMENTSTYLE</code> can be used to clear all styling information and reset the
552 folding state.</p>
554 <p><b id="SCI_GETCHARAT">SCI_GETCHARAT(int pos)</b><br />
555 This returns the character at <code>pos</code> in the document or 0 if <code>pos</code> is
556 negative or past the end of the document.</p>
558 <p><b id="SCI_GETSTYLEAT">SCI_GETSTYLEAT(int pos)</b><br />
559 This returns the style at <code>pos</code> in the document, or 0 if <code>pos</code> is
560 negative or past the end of the document.</p>
562 <p><b id="SCI_RELEASEALLEXTENDEDSTYLES">SCI_RELEASEALLEXTENDEDSTYLES</b><br />
563 <b id="SCI_ALLOCATEEXTENDEDSTYLES">SCI_ALLOCATEEXTENDEDSTYLES(int numberStyles)</b><br />
564 Extended styles are used for features like textual margins and annotations as well as internally by Scintilla.
565 They are outside the range 0..255 used for the styles bytes associated with document bytes.
566 These functions manage the use of extended styles to ensures that components cooperate in defining styles.
567 <code>SCI_RELEASEALLEXTENDEDSTYLES</code> releases any extended styles allocated by the container.
568 <code>SCI_ALLOCATEEXTENDEDSTYLES</code> allocates a range of style numbers after the byte style values and returns
569 the number of the first allocated style.
570 Ranges for margin and annotation styles should be allocated before calling
571 <a class="message" href="#SCI_MARGINSETSTYLEOFFSET">SCI_MARGINSETSTYLEOFFSET</a> or
572 <a class="message" href="#SCI_ANNOTATIONSETSTYLEOFFSET">SCI_ANNOTATIONSETSTYLEOFFSET</a>.</p>
574 <p><b id="Sci_TextRange">Sci_TextRange</b> and <b id="Sci_CharacterRange">Sci_CharacterRange</b><br />
575 These structures are defined to be exactly the same shape as the Win32 <code>TEXTRANGE</code>
576 and <code>CHARRANGE</code>, so that older code that treats Scintilla as a RichEdit will
577 work.</p>
578 <pre>
579 struct Sci_CharacterRange {
580 long cpMin;
581 long cpMax;
584 struct Sci_TextRange {
585 struct Sci_CharacterRange chrg;
586 char *lpstrText;
588 </pre>
590 <h3 id="EncodedAccess">Specific to GTK+, Cocoa and Windows only: Access to encoded text</h3>
592 <p><b id="SCI_TARGETASUTF8">SCI_TARGETASUTF8(&lt;unused&gt;, char *s)</b><br />
593 This method retrieves the value of the target encoded as UTF-8 which is the default
594 encoding of GTK+ so is useful for retrieving text for use in other parts of the user interface,
595 such as find and replace dialogs. The length of the encoded text in bytes is returned.
596 Cocoa uses UTF-16 which is easily converted from UTF-8 so this method can be used to perform the
597 more complex work of transcoding from the various encodings supported.
598 </p>
600 <p><b id="SCI_ENCODEDFROMUTF8">SCI_ENCODEDFROMUTF8(const char *utf8, char *encoded)</b><br />
601 <b id="SCI_SETLENGTHFORENCODE">SCI_SETLENGTHFORENCODE(int bytes)</b><br />
602 <code>SCI_ENCODEDFROMUTF8</code> converts a UTF-8 string into the document's
603 encoding which is useful for taking the results of a find dialog, for example, and receiving
604 a string of bytes that can be searched for in the document. Since the text can contain nul bytes,
605 the <code>SCI_SETLENGTHFORENCODE</code> method can be used to set the
606 length that will be converted. If set to -1, the length is determined by finding a nul byte.
607 The length of the converted string is returned.
608 </p>
611 <h2 id="Searching">Searching</h2>
613 There are methods to search for text and for regular expressions.
614 Most applications should use
615 <a class="message" href="#SCI_SEARCHINTARGET">SCI_SEARCHINTARGET</a>
616 as the basis for their search implementations.
617 Other calls augment this or were implemented before <code>SCI_SEARCHINTARGET</code>.
618 </p>
620 The base regular expression support
621 is limited and should only be used for simple cases and initial development.
622 <span class="provisional">When using a C++11 compliant compiler and runtime, it may be possible to use the
623 runtime's implementation of &lt;regex&gt; by compiling Scintilla with <code>CXX11_REGEX</code> defined.</span>
624 A different regular expression
625 library can be <a class="jump" href="#AlternativeRegEx">integrated into Scintilla</a>
626 or can be called from the container using direct access to the buffer contents through
627 <a class="message" href="#SCI_GETCHARACTERPOINTER">SCI_GETCHARACTERPOINTER</a>.
628 </p>
630 <h3 id="SearchAndReplaceUsingTheTarget">Search and replace using the target</h3>
632 <p>Searching can be performed within the target range with <code>SCI_SEARCHINTARGET</code>,
633 which uses a counted string to allow searching for null characters. It returns the
634 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
635 <code>SCI_SEARCHINTARGET</code> such as <code>SCFIND_MATCHCASE</code>,
636 <code>SCFIND_WHOLEWORD</code>, <code>SCFIND_WORDSTART</code>, and <code>SCFIND_REGEXP</code>
637 can be set with <code>SCI_SETSEARCHFLAGS</code>.</p>
638 <code><a class="message" href="#SCI_SETTARGETSTART">SCI_SETTARGETSTART(int pos)</a><br />
639 <a class="message" href="#SCI_GETTARGETSTART">SCI_GETTARGETSTART</a><br />
640 <a class="message" href="#SCI_SETTARGETEND">SCI_SETTARGETEND(int pos)</a><br />
641 <a class="message" href="#SCI_GETTARGETEND">SCI_GETTARGETEND</a><br />
642 <a class="message" href="#SCI_SETTARGETRANGE">SCI_SETTARGETRANGE(int start, int end)</a><br />
643 <a class="message" href="#SCI_TARGETFROMSELECTION">SCI_TARGETFROMSELECTION</a><br />
644 <a class="message" href="#SCI_TARGETWHOLEDOCUMENT">SCI_TARGETWHOLEDOCUMENT</a><br />
645 <a class="message" href="#SCI_SETSEARCHFLAGS">SCI_SETSEARCHFLAGS(int searchFlags)</a><br />
646 <a class="message" href="#SCI_GETSEARCHFLAGS">SCI_GETSEARCHFLAGS</a><br />
647 <a class="message" href="#SCI_SEARCHINTARGET">SCI_SEARCHINTARGET(int length, const char
648 *text)</a><br />
649 <a class="message" href="#SCI_GETTARGETTEXT">SCI_GETTARGETTEXT(&lt;unused&gt;,
650 char *text)</a><br />
651 <a class="message" href="#SCI_REPLACETARGET">SCI_REPLACETARGET(int length, const char
652 *text)</a><br />
653 <a class="message" href="#SCI_REPLACETARGETRE">SCI_REPLACETARGETRE(int length, const char
654 *text)</a><br />
655 <a class="message" href="#SCI_GETTAG">SCI_GETTAG(int tagNumber, char *tagValue)</a><br />
656 </code>
658 <p><b id="SCI_SETTARGETSTART">SCI_SETTARGETSTART(int pos)</b><br />
659 <b id="SCI_GETTARGETSTART">SCI_GETTARGETSTART</b><br />
660 <b id="SCI_SETTARGETEND">SCI_SETTARGETEND(int pos)</b><br />
661 <b id="SCI_GETTARGETEND">SCI_GETTARGETEND</b><br />
662 <b id="SCI_SETTARGETRANGE">SCI_SETTARGETRANGE(int start, int end)</b><br />
663 These functions set and return the start and end of the target. When searching
664 you can set start greater than end to find the last matching text in the
665 target rather than the first matching text. The target is also set by a successful
666 <code>SCI_SEARCHINTARGET</code>.</p>
668 <p><b id="SCI_TARGETFROMSELECTION">SCI_TARGETFROMSELECTION</b><br />
669 Set the target start and end to the start and end positions of the selection.</p>
671 <p><b id="SCI_TARGETWHOLEDOCUMENT">SCI_TARGETWHOLEDOCUMENT</b><br />
672 Set the target start to the start of the document and target end to the end of the document.</p>
674 <p><b id="SCI_SETSEARCHFLAGS">SCI_SETSEARCHFLAGS(int searchFlags)</b><br />
675 <b id="SCI_GETSEARCHFLAGS">SCI_GETSEARCHFLAGS</b><br />
676 These get and set the <a class="jump" href="#searchFlags"><code>searchFlags</code></a> used by
677 <code>SCI_SEARCHINTARGET</code>. There are several option flags including a simple regular
678 expression search.</p>
680 <p><b id="SCI_SEARCHINTARGET">SCI_SEARCHINTARGET(int length, const char *text)</b><br />
681 This searches for the first occurrence of a text string in the target defined by
682 <code>SCI_SETTARGETSTART</code> and <code>SCI_SETTARGETEND</code>. The text string is not zero
683 terminated; the size is set by <code>length</code>. The search is modified by the search flags
684 set by <code>SCI_SETSEARCHFLAGS</code>. If the search succeeds, the target is set to the found
685 text and the return value is the position of the start of the matching text. If the search
686 fails, the result is -1.</p>
688 <p><b id="SCI_GETTARGETTEXT">SCI_GETTARGETTEXT(&lt;unused&gt;, char *text)</b><br />
689 Retrieve the value in the target.</p>
691 <p><b id="SCI_REPLACETARGET">SCI_REPLACETARGET(int length, const char *text)</b><br />
692 If <code>length</code> is -1, <code>text</code> is a zero terminated string, otherwise
693 <code>length</code> sets the number of character to replace the target with.
694 After replacement, the target range refers to the replacement text.
695 The return value
696 is the length of the replacement string.<br />
697 Note that the recommended way to delete text in the document is to set the target to the text to be removed,
698 and to perform a replace target with an empty string.</p>
700 <p><b id="SCI_REPLACETARGETRE">SCI_REPLACETARGETRE(int length, const char *text)</b><br />
701 This replaces the target using regular expressions. If <code>length</code> is -1,
702 <code>text</code> is a zero terminated string, otherwise <code>length</code> is the number of
703 characters to use. The replacement string is formed from the text string with any sequences of
704 <code>\1</code> through <code>\9</code> replaced by tagged matches from the most recent regular
705 expression search. <code>\0</code> is replaced with all the matched text from the most recent search.
706 After replacement, the target range refers to the replacement text.
707 The return value is the length of the replacement string.</p>
709 <p><b id="SCI_GETTAG">SCI_GETTAG(int tagNumber, char *tagValue NUL-terminated)</b><br />
710 Discover what text was matched by tagged expressions in a regular expression search.
711 This is useful if the application wants to interpret the replacement string itself.</p>
713 <p>See also: <a class="message" href="#SCI_FINDTEXT"><code>SCI_FINDTEXT</code></a></p>
715 <p><b id="searchFlags"><code>searchFlags</code></b><br />
716 Several of the search routines use flag options, which include a simple regular expression
717 search. Combine the flag options by adding them:</p>
719 <table border="0" summary="Search flags">
720 <tbody>
721 <tr>
722 <td><code>SCFIND_MATCHCASE</code></td>
724 <td>A match only occurs with text that matches the case of the search string.</td>
725 </tr>
727 <tr>
728 <td><code>SCFIND_WHOLEWORD</code></td>
730 <td>A match only occurs if the characters before and after are not word characters.</td>
731 </tr>
733 <tr>
734 <td><code>SCFIND_WORDSTART</code></td>
736 <td>A match only occurs if the character before is not a word character.</td>
737 </tr>
739 <tr>
740 <td><code>SCFIND_REGEXP</code></td>
742 <td>The search string should be interpreted as a regular expression.</td>
743 </tr>
744 <tr>
745 <td><code>SCFIND_POSIX</code></td>
747 <td>Treat regular expression in a more POSIX compatible manner
748 by interpreting bare ( and ) for tagged sections rather than \( and \).</td>
749 </tr>
750 <tr class="provisional">
751 <td><code>SCFIND_CXX11REGEX</code></td>
753 <td>When compiled with <code>CXX11_REGEX</code> this flag
754 may be set to use &lt;regex&gt; instead of Scintilla's basic regular expressions.
755 If the regular expression is invalid then -1 is returned and status is set to
756 <code>SC_STATUS_WARN_REGEX</code>.
757 The ECMAScript flag is set on the regex object and UTF-8 documents will exhibit Unicode-compliant
758 behaviour. For MSVC, where wchar_t is 16-bits, the reular expression ".." will match a single
759 astral-plane character. There may be other differences between compilers.</td>
760 </tr>
761 </tbody>
762 </table>
764 <p>In a regular expression, special characters interpreted are:</p>
766 <table border="0" summary="Regular expression synopsis">
767 <tbody>
768 <tr>
769 <td><code>.</code></td>
771 <td>Matches any character</td>
772 </tr>
774 <tr>
775 <td><code>\(</code></td>
777 <td>This marks the start of a region for tagging a match.</td>
778 </tr>
780 <tr>
781 <td><code>\)</code></td>
783 <td>This marks the end of a tagged region.</td>
784 </tr>
786 <tr>
787 <td><code>\n</code></td>
789 <td>Where <code>n</code> is 1 through 9 refers to the first through ninth tagged region
790 when replacing. For example, if the search string was <code>Fred\([1-9]\)XXX</code> and
791 the replace string was <code>Sam\1YYY</code>, when applied to <code>Fred2XXX</code> this
792 would generate <code>Sam2YYY</code>.
793 <code>\0</code> refers to all of the matching text.</td>
794 </tr>
796 <tr>
797 <td><code>\&lt;</code></td>
799 <td>This matches the start of a word using Scintilla's definitions of words.</td>
800 </tr>
802 <tr>
803 <td><code>\&gt;</code></td>
805 <td>This matches the end of a word using Scintilla's definition of words.</td>
806 </tr>
808 <tr>
809 <td><code>\x</code></td>
811 <td>This allows you to use a character x that would otherwise have a special meaning. For
812 example, \[ would be interpreted as [ and not as the start of a character set.</td>
813 </tr>
815 <tr>
816 <td><code>[...]</code></td>
818 <td>This indicates a set of characters, for example, [abc] means any of the characters a,
819 b or c. You can also use ranges, for example [a-z] for any lower case character.</td>
820 </tr>
822 <tr>
823 <td><code>[^...]</code></td>
825 <td>The complement of the characters in the set. For example, [^A-Za-z] means any
826 character except an alphabetic character.</td>
827 </tr>
829 <tr>
830 <td><code>^</code></td>
832 <td>This matches the start of a line (unless used inside a set, see above).</td>
833 </tr>
835 <tr>
836 <td><code>$</code></td>
838 <td>This matches the end of a line.</td>
839 </tr>
841 <tr>
842 <td><code>*</code></td>
844 <td>This matches 0 or more times. For example, <code>Sa*m</code> matches <code>Sm</code>,
845 <code>Sam</code>, <code>Saam</code>, <code>Saaam</code> and so on.</td>
846 </tr>
848 <tr>
849 <td><code>+</code></td>
851 <td>This matches 1 or more times. For example, <code>Sa+m</code> matches
852 <code>Sam</code>, <code>Saam</code>, <code>Saaam</code> and so on.</td>
853 </tr>
854 </tbody>
855 </table>
857 <p>Regular expressions will only match ranges within a single line, never matching over multiple lines.</p>
859 <code><a class="message" href="#SCI_FINDTEXT">SCI_FINDTEXT(int flags, Sci_TextToFind
860 *ttf)</a><br />
861 <a class="message" href="#SCI_SEARCHANCHOR">SCI_SEARCHANCHOR</a><br />
862 <a class="message" href="#SCI_SEARCHNEXT">SCI_SEARCHNEXT(int searchFlags, const char
863 *text)</a><br />
864 <a class="message" href="#SCI_SEARCHPREV">SCI_SEARCHPREV(int searchFlags, const char
865 *text)</a><br />
866 </code>
868 <p><b id="SCI_FINDTEXT">SCI_FINDTEXT(int searchFlags, <a class="jump"
869 href="#Sci_TextToFind">Sci_TextToFind</a> *ttf)</b><br />
870 This message searches for text in the document. It does not use or move the current selection.
871 The <a class="jump" href="#searchFlags"><code>searchFlags</code></a> argument controls the
872 search type, which includes regular expression searches.</p>
874 <p>You can
875 search backwards to find the previous occurrence of a search string by setting the end of the
876 search range before the start.</p>
878 <p>The <code>Sci_TextToFind</code> structure is defined in <code>Scintilla.h</code>; set
879 <code>chrg.cpMin</code> and <code>chrg.cpMax</code> with the range of positions in the document
880 to search. You can search backwards by
881 setting <code>chrg.cpMax</code> less than <code>chrg.cpMin</code>.
882 Set the <code>lpstrText</code> member of <code>Sci_TextToFind</code> to point at a zero terminated
883 text string holding the search pattern. If your language makes the use of <code>Sci_TextToFind</code>
884 difficult, you should consider using <code>SCI_SEARCHINTARGET</code> instead.</p>
886 <p>The return value is -1 if the search fails or the position of the start of the found text if
887 it succeeds. The <code>chrgText.cpMin</code> and <code>chrgText.cpMax</code> members of
888 <code>Sci_TextToFind</code> are filled in with the start and end positions of the found text.</p>
890 <p>See also: <code><a class="message"
891 href="#SCI_SEARCHINTARGET">SCI_SEARCHINTARGET</a></code></p>
893 <p><b id="Sci_TextToFind">Sci_TextToFind</b><br />
894 This structure is defined to have exactly the same shape as the Win32 structure
895 <code>FINDTEXTEX</code> for old code that treated Scintilla as a RichEdit control.</p>
896 <pre>
897 struct Sci_TextToFind {
898 struct <a class="jump" href="#Sci_CharacterRange">Sci_CharacterRange</a> chrg; // range to search
899 const char *lpstrText; // the search pattern (zero terminated)
900 struct Sci_CharacterRange chrgText; // returned as position of matching text
902 </pre>
904 <p><b id="SCI_SEARCHANCHOR">SCI_SEARCHANCHOR</b><br />
905 <b id="SCI_SEARCHNEXT">SCI_SEARCHNEXT(int searchFlags, const char *text)</b><br />
906 <b id="SCI_SEARCHPREV">SCI_SEARCHPREV(int searchFlags, const char *text)</b><br />
907 These messages provide relocatable search support. This allows multiple incremental
908 interactive searches to be macro recorded while still setting the selection to found text so
909 the find/select operation is self-contained. These three messages send <a class="message"
910 href="#SCN_MACRORECORD"><code>SCN_MACRORECORD</code></a> <a class="jump"
911 href="#Notifications">notifications</a> if macro recording is enabled.</p>
913 <p><code>SCI_SEARCHANCHOR</code> sets the search start point used by
914 <code>SCI_SEARCHNEXT</code> and <code>SCI_SEARCHPREV</code> to the start of the current
915 selection, that is, the end of the selection that is nearer to the start of the document. You
916 should always call this before calling either of <code>SCI_SEARCHNEXT</code> or
917 <code>SCI_SEARCHPREV</code>.</p>
919 <p><code>SCI_SEARCHNEXT</code> and <code>SCI_SEARCHPREV</code> search for the next and previous
920 occurrence of the zero terminated search string pointed at by text. The search is modified by
921 the <a class="jump" href="#searchFlags"><code>searchFlags</code></a>. </p>
923 <p>The return value is -1 if nothing is found, otherwise the return value is the start position
924 of the matching text. The selection is updated to show the matched text, but is not scrolled
925 into view.</p>
927 <p>See also: <a class="message" href="#SCI_SEARCHINTARGET"><code>SCI_SEARCHINTARGET</code></a>,
928 <a class="message" href="#SCI_FINDTEXT"><code>SCI_FINDTEXT</code></a></p>
930 <h2 id="Overtype">Overtype</h2>
932 <p><b id="SCI_SETOVERTYPE">SCI_SETOVERTYPE(bool overType)</b><br />
933 <b id="SCI_GETOVERTYPE">SCI_GETOVERTYPE</b><br />
934 When overtype is enabled, each typed character replaces the character to the right of the text
935 caret. When overtype is disabled, characters are inserted at the caret.
936 <code>SCI_GETOVERTYPE</code> returns <code>TRUE</code> (1) if overtyping is active, otherwise
937 <code>FALSE</code> (0) will be returned. Use <code>SCI_SETOVERTYPE</code> to set the overtype
938 mode.</p>
940 <h2 id="CutCopyAndPaste">Cut, copy and paste</h2>
942 <code><a class="message" href="#SCI_CUT">SCI_CUT</a><br />
943 <a class="message" href="#SCI_COPY">SCI_COPY</a><br />
944 <a class="message" href="#SCI_PASTE">SCI_PASTE</a><br />
945 <a class="message" href="#SCI_CLEAR">SCI_CLEAR</a><br />
946 <a class="message" href="#SCI_CANPASTE">SCI_CANPASTE</a><br />
947 <a class="message" href="#SCI_COPYRANGE">SCI_COPYRANGE(int start, int end)</a><br />
948 <a class="message" href="#SCI_COPYTEXT">SCI_COPYTEXT(int length,
949 const char *text)</a><br />
950 <a class="message" href="#SCI_COPYALLOWLINE">SCI_COPYALLOWLINE</a><br />
951 <a class="message" href="#SCI_SETPASTECONVERTENDINGS">SCI_SETPASTECONVERTENDINGS(bool convert)</a><br />
952 <a class="message" href="#SCI_GETPASTECONVERTENDINGS">SCI_GETPASTECONVERTENDINGS</a><br />
953 </code>
955 <p><b id="SCI_CUT">SCI_CUT</b><br />
956 <b id="SCI_COPY">SCI_COPY</b><br />
957 <b id="SCI_PASTE">SCI_PASTE</b><br />
958 <b id="SCI_CLEAR">SCI_CLEAR</b><br />
959 <b id="SCI_CANPASTE">SCI_CANPASTE</b><br />
960 <b id="SCI_COPYALLOWLINE">SCI_COPYALLOWLINE</b><br />
961 These commands perform the standard tasks of cutting and copying data to the clipboard,
962 pasting from the clipboard into the document, and clearing the document.
963 <code>SCI_CANPASTE</code> returns non-zero if the document isn't read-only and if the selection
964 doesn't contain protected text. If you need a "can copy" or "can cut", use
965 <code>SCI_GETSELECTIONEMPTY()</code>, which will be zero if there are any non-empty
966 selection ranges implying that a copy or cut to the clipboard should work.</p>
968 <p>GTK+ does not really support <code>SCI_CANPASTE</code> and always returns <code>TRUE</code>
969 unless the document is read-only.</p>
971 <p>On X, the clipboard is asynchronous and may require several messages between
972 the destination and source applications. Data from SCI_PASTE will not arrive in the
973 document immediately.</p>
975 <p><code>SCI_COPYALLOWLINE</code> works the same as SCI_COPY except that if the
976 selection is empty then the current line is copied. On Windows, an extra "MSDEVLineSelect" marker
977 is added to the clipboard which is then used in <code>SCI_PASTE</code> to paste
978 the whole line before the current line.</p>
980 <b id="SCI_COPYRANGE">SCI_COPYRANGE(int start, int end)</b><br />
981 <b id="SCI_COPYTEXT">SCI_COPYTEXT(int length, const char *text)</b><br />
982 <p><code>SCI_COPYRANGE</code> copies a range of text from the document to
983 the system clipboard and <code>SCI_COPYTEXT</code> copies a supplied piece of
984 text to the system clipboard.</p>
986 <p><b id="SCI_SETPASTECONVERTENDINGS">SCI_SETPASTECONVERTENDINGS(bool convert)</b><br />
987 <b id="SCI_GETPASTECONVERTENDINGS">SCI_GETPASTECONVERTENDINGS</b><br />
988 If this property is set then when text is pasted any line ends are converted to match the document's
989 end of line mode as set with
990 <a class="message" href="#SCI_SETEOLMODE">SCI_SETEOLMODE</a>.
991 Defaults to true.</p>
993 <h2 id="ErrorHandling">Error handling</h2>
995 <p><b id="SCI_SETSTATUS">SCI_SETSTATUS(int status)</b><br />
996 <b id="SCI_GETSTATUS">SCI_GETSTATUS</b><br />
997 If an error occurs, Scintilla may set an internal error number that can be retrieved with
998 <code>SCI_GETSTATUS</code>.
999 To clear the error status call <code>SCI_SETSTATUS(0)</code>.
1000 Status values from 1 to 999 are errors and status <code>SC_STATUS_WARN_START</code> (1000)
1001 and above are warnings.
1002 The currently defined statuses are:
1003 </p>
1005 <table cellpadding="1" cellspacing="2" border="0" summary="Status values">
1006 <tbody valign="top">
1007 <tr>
1008 <th align="left">SC_STATUS_OK</th>
1009 <td>0</td>
1010 <td>No failures</td>
1011 </tr>
1013 <tr>
1014 <th align="left">SC_STATUS_FAILURE</th>
1015 <td>1</td>
1016 <td>Generic failure</td>
1017 </tr>
1019 <tr class="provisional">
1020 <th align="left">SC_STATUS_BADALLOC</th>
1021 <td>2</td>
1022 <td>Memory is exhausted</td>
1023 </tr>
1025 <tr>
1026 <th align="left">SC_STATUS_WARN_REGEX</th>
1027 <td>1001</td>
1028 <td>Regular expression is invalid</td>
1029 </tr>
1031 </tbody>
1032 </table>
1034 <h2 id="UndoAndRedo">Undo and Redo</h2>
1036 <p>Scintilla has multiple level undo and redo. It will continue to collect undoable actions
1037 until memory runs out. Scintilla saves actions that change the document. Scintilla does not
1038 save caret and selection movements, view scrolling and the like. Sequences of typing or
1039 deleting are compressed into single transactions to make it easier to undo and redo at a sensible
1040 level of detail. Sequences of actions can be combined into transactions that are undone as a unit.
1041 These sequences occur between <code>SCI_BEGINUNDOACTION</code> and
1042 <code>SCI_ENDUNDOACTION</code> messages. These transactions can be nested and only the top-level
1043 sequences are undone as units.</p>
1044 <code><a class="message" href="#SCI_UNDO">SCI_UNDO</a><br />
1045 <a class="message" href="#SCI_CANUNDO">SCI_CANUNDO</a><br />
1046 <a class="message" href="#SCI_EMPTYUNDOBUFFER">SCI_EMPTYUNDOBUFFER</a><br />
1047 <a class="message" href="#SCI_REDO">SCI_REDO</a><br />
1048 <a class="message" href="#SCI_CANREDO">SCI_CANREDO</a><br />
1049 <a class="message" href="#SCI_SETUNDOCOLLECTION">SCI_SETUNDOCOLLECTION(bool
1050 collectUndo)</a><br />
1051 <a class="message" href="#SCI_GETUNDOCOLLECTION">SCI_GETUNDOCOLLECTION</a><br />
1052 <a class="message" href="#SCI_BEGINUNDOACTION">SCI_BEGINUNDOACTION</a><br />
1053 <a class="message" href="#SCI_ENDUNDOACTION">SCI_ENDUNDOACTION</a><br />
1054 <a class="message" href="#SCI_ADDUNDOACTION">SCI_ADDUNDOACTION(int token, int flags)</a><br />
1055 </code>
1057 <p><b id="SCI_UNDO">SCI_UNDO</b><br />
1058 <b id="SCI_CANUNDO">SCI_CANUNDO</b><br />
1059 <code>SCI_UNDO</code> undoes one action, or if the undo buffer has reached a
1060 <code>SCI_ENDUNDOACTION</code> point, all the actions back to the corresponding
1061 <code>SCI_BEGINUNDOACTION</code>.</p>
1063 <p><code>SCI_CANUNDO</code> returns 0 if there is nothing to undo, and 1 if there is. You would
1064 typically use the result of this message to enable/disable the Edit menu Undo command.</p>
1066 <p><b id="SCI_REDO">SCI_REDO</b><br />
1067 <b id="SCI_CANREDO">SCI_CANREDO</b><br />
1068 <code>SCI_REDO</code> undoes the effect of the last <code>SCI_UNDO</code> operation.</p>
1070 <p><code>SCI_CANREDO</code> returns 0 if there is no action to redo and 1 if there are undo
1071 actions to redo. You could typically use the result of this message to enable/disable the Edit
1072 menu Redo command.</p>
1074 <p><b id="SCI_EMPTYUNDOBUFFER">SCI_EMPTYUNDOBUFFER</b><br />
1075 This command tells Scintilla to forget any saved undo or redo history. It also sets the save
1076 point to the start of the undo buffer, so the document will appear to be unmodified. This does
1077 not cause the <code><a class="message"
1078 href="#SCN_SAVEPOINTREACHED">SCN_SAVEPOINTREACHED</a></code> notification to be sent to the
1079 container.</p>
1081 <p>See also: <a class="message" href="#SCI_SETSAVEPOINT"><code>SCI_SETSAVEPOINT</code></a></p>
1083 <p><b id="SCI_SETUNDOCOLLECTION">SCI_SETUNDOCOLLECTION(bool collectUndo)</b><br />
1084 <b id="SCI_GETUNDOCOLLECTION">SCI_GETUNDOCOLLECTION</b><br />
1085 You can control whether Scintilla collects undo information with
1086 <code>SCI_SETUNDOCOLLECTION</code>. Pass in <code>true</code> (1) to collect information and
1087 <code>false</code> (0) to stop collecting. If you stop collection, you should also use
1088 <code>SCI_EMPTYUNDOBUFFER</code> to avoid the undo buffer being unsynchronized with the data in
1089 the buffer.</p>
1091 <p>You might wish to turn off saving undo information if you use the Scintilla to store text
1092 generated by a program (a Log view) or in a display window where text is often deleted and
1093 regenerated.</p>
1095 <p><b id="SCI_BEGINUNDOACTION">SCI_BEGINUNDOACTION</b><br />
1096 <b id="SCI_ENDUNDOACTION">SCI_ENDUNDOACTION</b><br />
1097 Send these two messages to Scintilla to mark the beginning and end of a set of operations that
1098 you want to undo all as one operation but that you have to generate as several operations.
1099 Alternatively, you can use these to mark a set of operations that you do not want to have
1100 combined with the preceding or following operations if they are undone.</p>
1102 <p><b id="SCI_ADDUNDOACTION">SCI_ADDUNDOACTION(int token, int flags)</b><br />
1103 The container can add its own actions into the undo stack by calling
1104 <code>SCI_ADDUNDOACTION</code> and an <code>SCN_MODIFIED</code>
1105 notification will be sent to the container with the
1106 <a class="message" href="#SC_MOD_CONTAINER"><code>SC_MOD_CONTAINER</code></a>
1107 flag when it is time to undo (<code>SC_PERFORMED_UNDO</code>) or
1108 redo (<code>SC_PERFORMED_REDO</code>) the action. The token argument supplied is
1109 returned in the <code>token</code> field of the notification.</p>
1110 <p>For example, if the container wanted to allow undo and redo of a 'toggle bookmark' command then
1111 it could call <code>SCI_ADDUNDOACTION(line, 0)</code> each time the command is performed.
1112 Then when it receives a notification to undo or redo it toggles a bookmark on the line given by
1113 the token field. If there are different types of commands or parameters that need to be stored into the undo
1114 stack then the container should maintain a stack of its own for the document and use the current
1115 position in that stack as the argument to <code>SCI_ADDUNDOACTION(line)</code>.
1116 <code>SCI_ADDUNDOACTION</code> commands are not combined together
1117 into a single undo transaction unless grouped with <code>SCI_BEGINUNDOACTION</code>
1118 and <code>SCI_ENDUNDOACTION</code>.</p>
1120 <p>The flags argument can be <code>UNDO_MAY_COALESCE</code> (1) if the container action may be
1121 coalesced along with any insertion and deletion actions into a single compound action, otherwise 0.
1122 Coalescing treats coalescible container actions as transparent so will still only group together insertions that
1123 look like typing or deletions that look like multiple uses of the Backspace or Delete keys.
1124 </p>
1125 <h2 id="SelectionAndInformation">Selection and information</h2>
1127 <p>Scintilla maintains a selection that stretches between two points, the anchor and the
1128 current position. If the anchor and the current position are the same, there is no selected
1129 text. Positions in the document range from 0 (before the first character), to the document size
1130 (after the last character). If you use messages, there is nothing to stop you setting a
1131 position that is in the middle of a CRLF pair, or in the middle of a 2 byte character. However,
1132 keyboard commands will not move the caret into such positions.</p>
1133 <code><a class="message" href="#SCI_GETTEXTLENGTH">SCI_GETTEXTLENGTH</a><br />
1134 <a class="message" href="#SCI_GETLENGTH">SCI_GETLENGTH</a><br />
1135 <a class="message" href="#SCI_GETLINECOUNT">SCI_GETLINECOUNT</a><br />
1136 <a class="message" href="#SCI_SETFIRSTVISIBLELINE">SCI_SETFIRSTVISIBLELINE(int lineDisplay)</a><br />
1137 <a class="message" href="#SCI_GETFIRSTVISIBLELINE">SCI_GETFIRSTVISIBLELINE</a><br />
1138 <a class="message" href="#SCI_LINESONSCREEN">SCI_LINESONSCREEN</a><br />
1139 <a class="message" href="#SCI_GETMODIFY">SCI_GETMODIFY</a><br />
1140 <a class="message" href="#SCI_SETSEL">SCI_SETSEL(int anchorPos, int currentPos)</a><br />
1141 <a class="message" href="#SCI_GOTOPOS">SCI_GOTOPOS(int position)</a><br />
1142 <a class="message" href="#SCI_GOTOLINE">SCI_GOTOLINE(int line)</a><br />
1143 <a class="message" href="#SCI_SETCURRENTPOS">SCI_SETCURRENTPOS(int position)</a><br />
1144 <a class="message" href="#SCI_GETCURRENTPOS">SCI_GETCURRENTPOS</a><br />
1145 <a class="message" href="#SCI_SETANCHOR">SCI_SETANCHOR(int position)</a><br />
1146 <a class="message" href="#SCI_GETANCHOR">SCI_GETANCHOR</a><br />
1147 <a class="message" href="#SCI_SETSELECTIONSTART">SCI_SETSELECTIONSTART(int position)</a><br />
1148 <a class="message" href="#SCI_GETSELECTIONSTART">SCI_GETSELECTIONSTART</a><br />
1149 <a class="message" href="#SCI_SETSELECTIONEND">SCI_SETSELECTIONEND(int position)</a><br />
1150 <a class="message" href="#SCI_GETSELECTIONEND">SCI_GETSELECTIONEND</a><br />
1151 <a class="message" href="#SCI_SETEMPTYSELECTION">SCI_SETEMPTYSELECTION(int pos)</a><br />
1152 <a class="message" href="#SCI_SELECTALL">SCI_SELECTALL</a><br />
1153 <a class="message" href="#SCI_LINEFROMPOSITION">SCI_LINEFROMPOSITION(int position)</a><br />
1154 <a class="message" href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(int line)</a><br />
1155 <a class="message" href="#SCI_GETLINEENDPOSITION">SCI_GETLINEENDPOSITION(int line)</a><br />
1156 <a class="message" href="#SCI_LINELENGTH">SCI_LINELENGTH(int line)</a><br />
1157 <a class="message" href="#SCI_GETCOLUMN">SCI_GETCOLUMN(int position)</a><br />
1158 <a class="message" href="#SCI_FINDCOLUMN">SCI_FINDCOLUMN(int line, int column)</a><br />
1159 <a class="message" href="#SCI_POSITIONFROMPOINT">SCI_POSITIONFROMPOINT(int x, int y)</a><br />
1160 <a class="message" href="#SCI_POSITIONFROMPOINTCLOSE">SCI_POSITIONFROMPOINTCLOSE(int x, int
1161 y)</a><br />
1162 <a class="message" href="#SCI_CHARPOSITIONFROMPOINT">SCI_CHARPOSITIONFROMPOINT(int x, int y)</a><br />
1163 <a class="message" href="#SCI_CHARPOSITIONFROMPOINTCLOSE">SCI_CHARPOSITIONFROMPOINTCLOSE(int x, int
1164 y)</a><br />
1165 <a class="message" href="#SCI_POINTXFROMPOSITION">SCI_POINTXFROMPOSITION(&lt;unused&gt;, int
1166 position)</a><br />
1167 <a class="message" href="#SCI_POINTYFROMPOSITION">SCI_POINTYFROMPOSITION(&lt;unused&gt;, int
1168 position)</a><br />
1169 <a class="message" href="#SCI_HIDESELECTION">SCI_HIDESELECTION(bool hide)</a><br />
1170 <a class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT(&lt;unused&gt;, char *text)</a><br />
1171 <a class="message" href="#SCI_GETCURLINE">SCI_GETCURLINE(int textLen, char *text)</a><br />
1172 <a class="message" href="#SCI_SELECTIONISRECTANGLE">SCI_SELECTIONISRECTANGLE</a><br />
1173 <a class="message" href="#SCI_SETSELECTIONMODE">SCI_SETSELECTIONMODE(int mode)</a><br />
1174 <a class="message" href="#SCI_GETSELECTIONMODE">SCI_GETSELECTIONMODE</a><br />
1175 <a class="message" href="#SCI_GETLINESELSTARTPOSITION">SCI_GETLINESELSTARTPOSITION(int line)</a><br />
1176 <a class="message" href="#SCI_GETLINESELENDPOSITION">SCI_GETLINESELENDPOSITION(int line)</a><br />
1177 <a class="message" href="#SCI_MOVECARETINSIDEVIEW">SCI_MOVECARETINSIDEVIEW</a><br />
1178 <a class="message" href="#SCI_WORDENDPOSITION">SCI_WORDENDPOSITION(int position, bool
1179 onlyWordCharacters)</a><br />
1180 <a class="message" href="#SCI_WORDSTARTPOSITION">SCI_WORDSTARTPOSITION(int position, bool
1181 onlyWordCharacters)</a><br />
1182 <a class="message" href="#SCI_ISRANGEWORD">SCI_ISRANGEWORD(int start, int end)</a><br />
1183 <a class="message" href="#SCI_POSITIONBEFORE">SCI_POSITIONBEFORE(int position)</a><br />
1184 <a class="message" href="#SCI_POSITIONAFTER">SCI_POSITIONAFTER(int position)</a><br />
1185 <a class="message" href="#SCI_POSITIONRELATIVE">SCI_POSITIONRELATIVE(int position, int relative)</a><br />
1186 <a class="message" href="#SCI_COUNTCHARACTERS">SCI_COUNTCHARACTERS(int startPos, int endPos)</a><br />
1187 <a class="message" href="#SCI_TEXTWIDTH">SCI_TEXTWIDTH(int styleNumber, const char *text)</a><br />
1188 <a class="message" href="#SCI_TEXTHEIGHT">SCI_TEXTHEIGHT(int line)</a><br />
1189 <a class="message" href="#SCI_CHOOSECARETX">SCI_CHOOSECARETX</a><br />
1190 <a class="message" href="#SCI_MOVESELECTEDLINESUP">SCI_MOVESELECTEDLINESUP</a><br />
1191 <a class="message" href="#SCI_MOVESELECTEDLINESDOWN">SCI_MOVESELECTEDLINESDOWN</a><br />
1192 <a class="message" href="#SCI_SETMOUSESELECTIONRECTANGULARSWITCH">SCI_SETMOUSESELECTIONRECTANGULARSWITCH(bool
1193 mouseSelectionRectangularSwitch)</a><br />
1194 <a class="message" href="#SCI_GETMOUSESELECTIONRECTANGULARSWITCH">SCI_GETMOUSESELECTIONRECTANGULARSWITCH</a><br />
1195 </code>
1197 <p><b id="SCI_GETTEXTLENGTH">SCI_GETTEXTLENGTH</b><br />
1198 <b id="SCI_GETLENGTH">SCI_GETLENGTH</b><br />
1199 Both these messages return the length of the document in bytes.</p>
1201 <p><b id="SCI_GETLINECOUNT">SCI_GETLINECOUNT</b><br />
1202 This returns the number of lines in the document. An empty document contains 1 line. A
1203 document holding only an end of line sequence has 2 lines.</p>
1205 <p><b id="SCI_SETFIRSTVISIBLELINE">SCI_SETFIRSTVISIBLELINE(int lineDisplay)</b><br />
1206 <b id="SCI_GETFIRSTVISIBLELINE">SCI_GETFIRSTVISIBLELINE</b><br />
1207 These messages retrieve and set the line number of the first visible line in the Scintilla view. The first line
1208 in the document is numbered 0. The value is a visible line rather than a document line.</p>
1210 <p><b id="SCI_LINESONSCREEN">SCI_LINESONSCREEN</b><br />
1211 This returns the number of complete lines visible on the screen. With a constant line height,
1212 this is the vertical space available divided by the line separation. Unless you arrange to size
1213 your window to an integral number of lines, there may be a partial line visible at the bottom
1214 of the view.</p>
1216 <p><b id="SCI_GETMODIFY">SCI_GETMODIFY</b><br />
1217 This returns non-zero if the document is modified and 0 if it is unmodified. The modified
1218 status of a document is determined by the undo position relative to the save point. The save
1219 point is set by <a class="message" href="#SCI_SETSAVEPOINT"><code>SCI_SETSAVEPOINT</code></a>,
1220 usually when you have saved data to a file.</p>
1222 <p>If you need to be notified when the document becomes modified, Scintilla notifies the
1223 container that it has entered or left the save point with the <a class="message"
1224 href="#SCN_SAVEPOINTREACHED"><code>SCN_SAVEPOINTREACHED</code></a> and <a class="message"
1225 href="#SCN_SAVEPOINTLEFT"><code>SCN_SAVEPOINTLEFT</code></a> <a class="jump"
1226 href="#Notifications">notification messages</a>.</p>
1228 <p><b id="SCI_SETSEL">SCI_SETSEL(int anchorPos, int currentPos)</b><br />
1229 This message sets both the anchor and the current position. If <code>currentPos</code> is
1230 negative, it means the end of the document. If <code>anchorPos</code> is negative, it means
1231 remove any selection (i.e. set the anchor to the same position as <code>currentPos</code>). The
1232 caret is scrolled into view after this operation.</p>
1234 <p><b id="SCI_GOTOPOS">SCI_GOTOPOS(int pos)</b><br />
1235 This removes any selection, sets the caret at <code>pos</code> and scrolls the view to make
1236 the caret visible, if necessary. It is equivalent to
1237 <code>SCI_SETSEL(pos, pos)</code>. The anchor position is set the same as the current
1238 position.</p>
1240 <p><b id="SCI_GOTOLINE">SCI_GOTOLINE(int line)</b><br />
1241 This removes any selection and sets the caret at the start of line number <code>line</code>
1242 and scrolls the view (if needed) to make it visible. The anchor position is set the same as the
1243 current position. If <code>line</code> is outside the lines in the document (first line is 0),
1244 the line set is the first or last.</p>
1246 <p><b id="SCI_SETCURRENTPOS">SCI_SETCURRENTPOS(int pos)</b><br />
1247 This sets the current position and creates a selection between the anchor and the current
1248 position. The caret is not scrolled into view.</p>
1250 <p>See also: <a class="message" href="#SCI_SCROLLCARET"><code>SCI_SCROLLCARET</code></a></p>
1252 <p><b id="SCI_GETCURRENTPOS">SCI_GETCURRENTPOS</b><br />
1253 This returns the current position.</p>
1255 <p><b id="SCI_SETANCHOR">SCI_SETANCHOR(int pos)</b><br />
1256 This sets the anchor position and creates a selection between the anchor position and the
1257 current position. The caret is not scrolled into view.</p>
1259 <p>See also: <a class="message" href="#SCI_SCROLLCARET"><code>SCI_SCROLLCARET</code></a></p>
1261 <p><b id="SCI_GETANCHOR">SCI_GETANCHOR</b><br />
1262 This returns the current anchor position.</p>
1264 <p><b id="SCI_SETSELECTIONSTART">SCI_SETSELECTIONSTART(int pos)</b><br />
1265 <b id="SCI_SETSELECTIONEND">SCI_SETSELECTIONEND(int pos)</b><br />
1266 These set the selection based on the assumption that the anchor position is less than the
1267 current position. They do not make the caret visible. The table shows the positions of the
1268 anchor and the current position after using these messages.</p>
1270 <table cellpadding="3" cellspacing="0" border="1" summary="SetSelection caret positioning">
1271 <thead align="center">
1272 <tr>
1273 <th>
1274 </th>
1276 <th>anchor</th>
1278 <th>current</th>
1279 </tr>
1280 </thead>
1282 <tbody align="center">
1283 <tr>
1284 <th><code>SCI_SETSELECTIONSTART</code></th>
1286 <td><code>pos</code></td>
1288 <td><code>Max(pos, current)</code></td>
1289 </tr>
1291 <tr>
1292 <th><code>SCI_SETSELECTIONEND</code></th>
1294 <td><code>Min(anchor, pos)</code></td>
1296 <td><code>pos</code></td>
1297 </tr>
1298 </tbody>
1299 </table>
1301 <p>See also: <a class="message" href="#SCI_SCROLLCARET"><code>SCI_SCROLLCARET</code></a></p>
1303 <p><b id="SCI_GETSELECTIONSTART">SCI_GETSELECTIONSTART</b><br />
1304 <b id="SCI_GETSELECTIONEND">SCI_GETSELECTIONEND</b><br />
1305 These return the start and end of the selection without regard to which end is the current
1306 position and which is the anchor. <code>SCI_GETSELECTIONSTART</code> returns the smaller of the
1307 current position or the anchor position. <code>SCI_GETSELECTIONEND</code> returns the larger of
1308 the two values.</p>
1310 <p><b id="SCI_SETEMPTYSELECTION">SCI_SETEMPTYSELECTION(int pos)</b><br />
1311 This removes any selection and sets the caret at <code>pos</code>. The caret is not scrolled into view.</p>
1313 <p><b id="SCI_SELECTALL">SCI_SELECTALL</b><br />
1314 This selects all the text in the document. The current position is not scrolled into view.</p>
1316 <p><b id="SCI_LINEFROMPOSITION">SCI_LINEFROMPOSITION(int pos)</b><br />
1317 This message returns the line that contains the position <code>pos</code> in the document. The
1318 return value is 0 if <code>pos</code> &lt;= 0. The return value is the last line if
1319 <code>pos</code> is beyond the end of the document.</p>
1321 <p><b id="SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(int line)</b><br />
1322 This returns the document position that corresponds with the start of the line. If
1323 <code>line</code> is negative, the position of the line holding the start of the selection is
1324 returned. If <code>line</code> is greater than the lines in the document, the return value is
1325 -1. If <code>line</code> is equal to the number of lines in the document (i.e. 1 line past the
1326 last line), the return value is the end of the document.</p>
1328 <p><b id="SCI_GETLINEENDPOSITION">SCI_GETLINEENDPOSITION(int line)</b><br />
1329 This returns the position at the end of the line, before any line end characters. If <code>line</code>
1330 is the last line in the document (which does not have any end of line characters) or greater,
1331 the result is the size of the document.
1332 If <code>line</code> is negative the result is undefined.</p>
1334 <p><b id="SCI_LINELENGTH">SCI_LINELENGTH(int line)</b><br />
1335 This returns the length of the line, including any line end characters. If <code>line</code>
1336 is negative or beyond the last line in the document, the result is 0. If you want the length of
1337 the line not including any end of line characters, use <a class="message"
1338 href="#SCI_GETLINEENDPOSITION"><code>SCI_GETLINEENDPOSITION(line)</code></a> - <a class="message"
1339 href="#SCI_POSITIONFROMLINE"><code>SCI_POSITIONFROMLINE(line)</code></a>.</p>
1341 <p><b id="SCI_GETSELTEXT">SCI_GETSELTEXT(&lt;unused&gt;, char *text NUL-terminated)</b><br />
1342 This copies the currently selected text and a terminating 0 byte to the <code>text</code>
1343 buffer. The buffer size should be determined by calling with a NULL pointer for the <code>text</code> argument
1344 <code>SCI_GETSELTEXT(0,0)</code>.
1345 This allows for rectangular and discontiguous selections as well as simple selections.
1346 See <a class="toc" href="#MultipleSelectionAndVirtualSpace">Multiple Selection</a> for information on
1347 how multiple and rectangular selections and virtual space are copied.</p>
1349 <p>See also: <code><a class="message" href="#SCI_GETCURLINE">SCI_GETCURLINE</a>,
1350 <a class="message" href="#SCI_GETLINE">SCI_GETLINE</a>,
1351 <a class="message" href="#SCI_GETTEXT">SCI_GETTEXT</a>,
1352 <a class="message" href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>,
1353 <a class="message" href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a>
1354 </code></p>
1356 <p><b id="SCI_GETCURLINE">SCI_GETCURLINE(int textLen, char *text NUL-terminated)</b><br />
1357 This retrieves the text of the line containing the caret and returns the position within the
1358 line of the caret. Pass in <code>char* text</code> pointing at a buffer large enough to hold
1359 the text you wish to retrieve and a terminating 0 character.
1360 Set <code>textLen</code> to the
1361 length of the buffer which must be at least 1 to hold the terminating 0 character.
1362 If the text argument is 0 then the length that should be allocated
1363 to store the entire current line is returned.</p>
1365 <p>See also: <code><a class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>, <a
1366 class="message" href="#SCI_GETLINE">SCI_GETLINE</a>, <a class="message"
1367 href="#SCI_GETTEXT">SCI_GETTEXT</a>, <a class="message"
1368 href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>, <a class="message"
1369 href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a></code></p>
1371 <p><b id="SCI_SELECTIONISRECTANGLE">SCI_SELECTIONISRECTANGLE</b><br />
1372 This returns 1 if the current selection is in rectangle mode, 0 if not.</p>
1374 <p><b id="SCI_SETSELECTIONMODE">SCI_SETSELECTIONMODE(int mode)</b><br />
1375 <b id="SCI_GETSELECTIONMODE">SCI_GETSELECTIONMODE</b><br />
1376 The two functions set and get the selection mode, which can be
1377 stream (<code>SC_SEL_STREAM</code>=0) or
1378 rectangular (<code>SC_SEL_RECTANGLE</code>=1) or
1379 by lines (<code>SC_SEL_LINES</code>=2)
1380 or thin rectangular (<code>SC_SEL_THIN</code>=3).
1381 When set in these modes, regular caret moves will extend or reduce the selection,
1382 until the mode is cancelled by a call with same value or with <code>SCI_CANCEL</code>.
1383 The get function returns the current mode even if the selection was made by mouse
1384 or with regular extended moves.
1385 <code>SC_SEL_THIN</code> is the mode after a rectangular selection has been typed into and ensures
1386 that no characters are selected.</p>
1388 <p><b id="SCI_GETLINESELSTARTPOSITION">SCI_GETLINESELSTARTPOSITION(int line)</b><br />
1389 <b id="SCI_GETLINESELENDPOSITION">SCI_GETLINESELENDPOSITION(int line)</b><br />
1390 Retrieve the position of the start and end of the selection at the given line with
1391 <code>INVALID_POSITION</code> returned if no selection on this line.</p>
1393 <p><b id="SCI_MOVECARETINSIDEVIEW">SCI_MOVECARETINSIDEVIEW</b><br />
1394 If the caret is off the top or bottom of the view, it is moved to the nearest line that is
1395 visible to its current position. Any selection is lost.</p>
1397 <p><b id="SCI_WORDENDPOSITION">SCI_WORDENDPOSITION(int position, bool
1398 onlyWordCharacters)</b><br />
1399 <b id="SCI_WORDSTARTPOSITION">SCI_WORDSTARTPOSITION(int position, bool
1400 onlyWordCharacters)</b><br />
1401 These messages return the start and end of words using the same definition of words as used
1402 internally within Scintilla. You can set your own list of characters that count as words with
1403 <a class="message" href="#SCI_SETWORDCHARS"><code>SCI_SETWORDCHARS</code></a>. The position
1404 sets the start or the search, which is forwards when searching for the end and backwards when
1405 searching for the start.</p>
1407 <p><b id="SCI_ISRANGEWORD">SCI_ISRANGEWORD(int start, int end)</b><br />
1408 Is the range start..end a word or set of words? This message checks that start is at a word start transition and that
1409 end is at a word end transition. It does not check whether there are any spaces inside the range.</p>
1411 <a class="message" href="#SCI_ISRANGEWORD">SCI_ISRANGEWORD(int start, int end)</a><br />
1413 <p>Set <code>onlyWordCharacters</code> to <code>true</code> (1) to stop searching at the first
1414 non-word character in the search direction. If <code>onlyWordCharacters</code> is
1415 <code>false</code> (0), the first character in the search direction sets the type of the search
1416 as word or non-word and the search stops at the first non-matching character. Searches are also
1417 terminated by the start or end of the document.</p>
1419 <p>If "w" represents word characters and "." represents non-word characters and "|" represents
1420 the position and <code>true</code> or <code>false</code> is the state of
1421 <code>onlyWordCharacters</code>:</p>
1423 <table cellpadding="3" cellspacing="0" border="1" summary="Word start and end positions">
1424 <thead align="center">
1425 <tr>
1426 <th>Initial state</th>
1428 <th>end, true</th>
1430 <th>end, false</th>
1432 <th>start, true</th>
1434 <th>start, false</th>
1435 </tr>
1436 </thead>
1438 <tbody align="center">
1439 <tr>
1440 <td>..ww..|..ww..</td>
1442 <td>..ww..|..ww..</td>
1444 <td>..ww....|ww..</td>
1446 <td>..ww..|..ww..</td>
1448 <td>..ww|....ww..</td>
1449 </tr>
1451 <tr>
1452 <td>....ww|ww....</td>
1454 <td>....wwww|....</td>
1456 <td>....wwww|....</td>
1458 <td>....|wwww....</td>
1460 <td>....|wwww....</td>
1461 </tr>
1463 <tr>
1464 <td>..ww|....ww..</td>
1466 <td>..ww|....ww..</td>
1468 <td>..ww....|ww..</td>
1470 <td>..|ww....ww..</td>
1472 <td>..|ww....ww..</td>
1473 </tr>
1475 <tr>
1476 <td>..ww....|ww..</td>
1478 <td>..ww....ww|..</td>
1480 <td>..ww....ww|..</td>
1482 <td>..ww....|ww..</td>
1484 <td>..ww|....ww..</td>
1485 </tr>
1486 </tbody>
1487 </table>
1489 <p><b id="SCI_POSITIONBEFORE">SCI_POSITIONBEFORE(int position)</b><br />
1490 <b id="SCI_POSITIONAFTER">SCI_POSITIONAFTER(int position)</b><br />
1491 These messages return the position before and after another position
1492 in the document taking into account the current code page. The minimum
1493 position returned is 0 and the maximum is the last position in the document.
1494 If called with a position within a multi byte character will return the position
1495 of the start/end of that character.</p>
1497 <p><b id="SCI_POSITIONRELATIVE">SCI_POSITIONRELATIVE(int position, int relative)</b><br />
1498 Count a number of whole characters before or after the argument position and return that position.
1499 The minimum position returned is 0 and the maximum is the last position in the document.
1500 </p>
1502 <p><b id="SCI_COUNTCHARACTERS">SCI_COUNTCHARACTERS(int startPos, int endPos)</b><br />
1503 Returns the number of whole characters between two positions..</p>
1505 <p><b id="SCI_TEXTWIDTH">SCI_TEXTWIDTH(int styleNumber, const char *text)</b><br />
1506 This returns the pixel width of a string drawn in the given <code>styleNumber</code> which can
1507 be used, for example, to decide how wide to make the line number margin in order to display a
1508 given number of numerals.</p>
1510 <p><b id="SCI_TEXTHEIGHT">SCI_TEXTHEIGHT(int line)</b><br />
1511 This returns the height in pixels of a particular line. Currently all lines are the same
1512 height.</p>
1514 <p><b id="SCI_GETCOLUMN">SCI_GETCOLUMN(int pos)</b><br />
1515 This message returns the column number of a position <code>pos</code> within the document
1516 taking the width of tabs into account. This returns the column number of the last tab on the
1517 line before <code>pos</code>, plus the number of characters between the last tab and
1518 <code>pos</code>. If there are no tab characters on the line, the return value is the number of
1519 characters up to the position on the line. In both cases, double byte characters count as a
1520 single character. This is probably only useful with monospaced fonts.</p>
1522 <p><b id="SCI_FINDCOLUMN">SCI_FINDCOLUMN(int line, int column)</b><br />
1523 This message returns the position of a <code>column</code> on a <code>line</code>
1524 taking the width of tabs into account. It treats a multi-byte character as a single column.
1525 Column numbers, like lines start at 0.</p>
1527 <p><b id="SCI_POSITIONFROMPOINT">SCI_POSITIONFROMPOINT(int x, int y)</b><br />
1528 <b id="SCI_POSITIONFROMPOINTCLOSE">SCI_POSITIONFROMPOINTCLOSE(int x, int y)</b><br />
1529 <code>SCI_POSITIONFROMPOINT</code> finds the closest character position to a point and
1530 <code>SCI_POSITIONFROMPOINTCLOSE</code> is similar but returns -1 if the point is outside the
1531 window or not close to any characters.</p>
1533 <p><b id="SCI_CHARPOSITIONFROMPOINT">SCI_CHARPOSITIONFROMPOINT(int x, int y)</b><br />
1534 <b id="SCI_CHARPOSITIONFROMPOINTCLOSE">SCI_CHARPOSITIONFROMPOINTCLOSE(int x, int y)</b><br />
1535 <code>SCI_CHARPOSITIONFROMPOINT</code> finds the closest character to a point and
1536 <code>SCI_CHARPOSITIONFROMPOINTCLOSE</code> is similar but returns -1 if the point is outside the
1537 window or not close to any characters. This is similar to the previous methods but finds characters rather than
1538 inter-character positions.</p>
1540 <p><b id="SCI_POINTXFROMPOSITION">SCI_POINTXFROMPOSITION(&lt;unused&gt;, int pos)</b><br />
1541 <b id="SCI_POINTYFROMPOSITION">SCI_POINTYFROMPOSITION(&lt;unused&gt;, int pos)</b><br />
1542 These messages return the x and y display pixel location of text at position <code>pos</code>
1543 in the document.</p>
1545 <p><b id="SCI_HIDESELECTION">SCI_HIDESELECTION(bool hide)</b><br />
1546 The normal state is to make the selection visible by drawing it as set by <a class="message"
1547 href="#SCI_SETSELFORE"><code>SCI_SETSELFORE</code></a> and <a class="message"
1548 href="#SCI_SETSELBACK"><code>SCI_SETSELBACK</code></a>. However, if you hide the selection, it
1549 is drawn as normal text.</p>
1551 <p><b id="SCI_CHOOSECARETX">SCI_CHOOSECARETX</b><br />
1552 Scintilla remembers the x value of the last position horizontally moved to explicitly by the
1553 user and this value is then used when moving vertically such as by using the up and down keys.
1554 This message sets the current x position of the caret as the remembered value.</p>
1556 <p><b id="SCI_MOVESELECTEDLINESUP">SCI_MOVESELECTEDLINESUP</b><br />
1557 Move the selected lines up one line, shifting the line above after the selection.
1558 The selection will be automatically extended to the beginning of the selection's first line and the end of the selection's last line.
1559 If nothing was selected, the line the cursor is currently at will be selected.</p>
1561 <p><b id="SCI_MOVESELECTEDLINESDOWN">SCI_MOVESELECTEDLINESDOWN</b><br />
1562 Move the selected lines down one line, shifting the line below before the selection.
1563 The selection will be automatically extended to the beginning of the selection's first line and the end of the selection's last line.
1564 If nothing was selected, the line the cursor is currently at will be selected.</p>
1566 <p><b id="SCI_SETMOUSESELECTIONRECTANGULARSWITCH">SCI_SETMOUSESELECTIONRECTANGULARSWITCH(bool
1567 mouseSelectionRectangularSwitch)</b><br />
1568 <b id="SCI_GETMOUSESELECTIONRECTANGULARSWITCH">SCI_GETMOUSESELECTIONRECTANGULARSWITCH</b><br />
1569 Enable or disable the ability to switch to rectangular selection mode while making a selection with the mouse.
1570 When this option is turned on, mouse selections in stream mode can be switched to rectangular mode by pressing
1571 the corresponding modifier key. They then stick to rectangular mode even when the modifier key is released again.
1572 When this option is turned off, mouse selections will always stick to the mode the selection was started in. It
1573 is off by default.</p>
1575 <h2 id="MultipleSelectionAndVirtualSpace">Multiple Selection and Virtual Space</h2>
1577 <code>
1578 <a class="message" href="#SCI_SETMULTIPLESELECTION">SCI_SETMULTIPLESELECTION(bool multipleSelection)</a><br />
1579 <a class="message" href="#SCI_GETMULTIPLESELECTION">SCI_GETMULTIPLESELECTION</a><br />
1580 <a class="message" href="#SCI_SETADDITIONALSELECTIONTYPING">SCI_SETADDITIONALSELECTIONTYPING(bool additionalSelectionTyping)</a><br />
1581 <a class="message" href="#SCI_GETADDITIONALSELECTIONTYPING">SCI_GETADDITIONALSELECTIONTYPING</a><br />
1582 <a class="message" href="#SCI_SETMULTIPASTE">SCI_SETMULTIPASTE(int multiPaste)</a><br />
1583 <a class="message" href="#SCI_GETMULTIPASTE">SCI_GETMULTIPASTE</a><br />
1584 <a class="message" href="#SCI_SETVIRTUALSPACEOPTIONS">SCI_SETVIRTUALSPACEOPTIONS(int virtualSpaceOptions)</a><br />
1585 <a class="message" href="#SCI_GETVIRTUALSPACEOPTIONS">SCI_GETVIRTUALSPACEOPTIONS</a><br />
1586 <a class="message" href="#SCI_SETRECTANGULARSELECTIONMODIFIER">SCI_SETRECTANGULARSELECTIONMODIFIER(int modifier)</a><br />
1587 <a class="message" href="#SCI_GETRECTANGULARSELECTIONMODIFIER">SCI_GETRECTANGULARSELECTIONMODIFIER</a><br />
1588 <br />
1590 <a class="message" href="#SCI_GETSELECTIONS">SCI_GETSELECTIONS</a><br />
1591 <a class="message" href="#SCI_GETSELECTIONEMPTY">SCI_GETSELECTIONEMPTY</a><br />
1592 <a class="message" href="#SCI_CLEARSELECTIONS">SCI_CLEARSELECTIONS</a><br />
1593 <a class="message" href="#SCI_SETSELECTION">SCI_SETSELECTION(int caret, int anchor)</a><br />
1594 <a class="message" href="#SCI_ADDSELECTION">SCI_ADDSELECTION(int caret, int anchor)</a><br />
1595 <a class="message" href="#SCI_DROPSELECTIONN">SCI_DROPSELECTIONN(int selection)</a><br />
1596 <a class="message" href="#SCI_SETMAINSELECTION">SCI_SETMAINSELECTION(int selection)</a><br />
1597 <a class="message" href="#SCI_GETMAINSELECTION">SCI_GETMAINSELECTION</a><br />
1598 <br />
1600 <a class="message" href="#SCI_SETSELECTIONNCARET">SCI_SETSELECTIONNCARET(int selection, int pos)</a><br />
1601 <a class="message" href="#SCI_GETSELECTIONNCARET">SCI_GETSELECTIONNCARET(int selection)</a><br />
1602 <a class="message" href="#SCI_SETSELECTIONNCARETVIRTUALSPACE">SCI_SETSELECTIONNCARETVIRTUALSPACE(int selection, int space)</a><br />
1603 <a class="message" href="#SCI_GETSELECTIONNCARETVIRTUALSPACE">SCI_GETSELECTIONNCARETVIRTUALSPACE(int selection)</a><br />
1604 <a class="message" href="#SCI_SETSELECTIONNANCHOR">SCI_SETSELECTIONNANCHOR(int selection, int posAnchor)</a><br />
1605 <a class="message" href="#SCI_GETSELECTIONNANCHOR">SCI_GETSELECTIONNANCHOR(int selection)</a><br />
1606 <a class="message" href="#SCI_SETSELECTIONNANCHORVIRTUALSPACE">SCI_SETSELECTIONNANCHORVIRTUALSPACE(int selection, int space)</a><br />
1607 <a class="message" href="#SCI_GETSELECTIONNANCHORVIRTUALSPACE">SCI_GETSELECTIONNANCHORVIRTUALSPACE(int selection)</a><br />
1608 <a class="message" href="#SCI_SETSELECTIONNSTART">SCI_SETSELECTIONNSTART(int selection, int pos)</a><br />
1609 <a class="message" href="#SCI_GETSELECTIONNSTART">SCI_GETSELECTIONNSTART(int selection)</a><br />
1610 <a class="message" href="#SCI_SETSELECTIONNEND">SCI_SETSELECTIONNEND(int selection, int pos)</a><br />
1611 <a class="message" href="#SCI_GETSELECTIONNEND">SCI_GETSELECTIONNEND(int selection)</a><br />
1612 <br />
1614 <a class="message" href="#SCI_SETRECTANGULARSELECTIONCARET">SCI_SETRECTANGULARSELECTIONCARET(int pos)</a><br />
1615 <a class="message" href="#SCI_GETRECTANGULARSELECTIONCARET">SCI_GETRECTANGULARSELECTIONCARET</a><br />
1616 <a class="message" href="#SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE">SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE(int space)</a><br />
1617 <a class="message" href="#SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE">SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE</a><br />
1618 <a class="message" href="#SCI_SETRECTANGULARSELECTIONANCHOR">SCI_SETRECTANGULARSELECTIONANCHOR(int posAnchor)</a><br />
1619 <a class="message" href="#SCI_GETRECTANGULARSELECTIONANCHOR">SCI_GETRECTANGULARSELECTIONANCHOR</a><br />
1620 <a class="message" href="#SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE">SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE(int space)</a><br />
1621 <a class="message" href="#SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE">SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE</a><br />
1622 <br />
1624 <a class="message" href="#SCI_SETADDITIONALSELALPHA">SCI_SETADDITIONALSELALPHA(int alpha)</a><br />
1625 <a class="message" href="#SCI_GETADDITIONALSELALPHA">SCI_GETADDITIONALSELALPHA</a><br />
1626 <a class="message" href="#SCI_SETADDITIONALSELFORE">SCI_SETADDITIONALSELFORE(int colour)</a><br />
1627 <a class="message" href="#SCI_SETADDITIONALSELBACK">SCI_SETADDITIONALSELBACK(int colour)</a><br />
1628 <a class="message" href="#SCI_SETADDITIONALCARETFORE">SCI_SETADDITIONALCARETFORE(int colour)</a><br />
1629 <a class="message" href="#SCI_GETADDITIONALCARETFORE">SCI_GETADDITIONALCARETFORE</a><br />
1630 <a class="message" href="#SCI_SETADDITIONALCARETSBLINK">SCI_SETADDITIONALCARETSBLINK(bool additionalCaretsBlink)</a><br />
1631 <a class="message" href="#SCI_GETADDITIONALCARETSBLINK">SCI_GETADDITIONALCARETSBLINK</a><br />
1632 <a class="message" href="#SCI_SETADDITIONALCARETSVISIBLE">SCI_SETADDITIONALCARETSVISIBLE(bool additionalCaretsVisible)</a><br />
1633 <a class="message" href="#SCI_GETADDITIONALCARETSVISIBLE">SCI_GETADDITIONALCARETSVISIBLE</a><br />
1634 <br />
1636 <a class="message" href="#SCI_SWAPMAINANCHORCARET">SCI_SWAPMAINANCHORCARET</a><br />
1637 <a class="message" href="#SCI_ROTATESELECTION">SCI_ROTATESELECTION</a><br />
1638 <a class="message" href="#SCI_MULTIPLESELECTADDNEXT">SCI_MULTIPLESELECTADDNEXT</a><br />
1639 <a class="message" href="#SCI_MULTIPLESELECTADDEACH">SCI_MULTIPLESELECTADDEACH</a><br />
1640 </code>
1643 There may be multiple selections active at one time.
1644 More selections are made by holding down the Ctrl key while dragging with the mouse.
1645 The most recent selection is the main selection and determines which part of the document is shown automatically.
1646 Any selection apart from the main selection is called an additional selection.
1647 The calls in the previous section operate on the main selection.
1648 There is always at least one selection.
1649 </p>
1652 Rectangular selections are handled as multiple selections although the original rectangular range is remembered so that
1653 subsequent operations may be handled differently for rectangular selections. For example, pasting a rectangular selection
1654 places each piece in a vertical column.
1655 </p>
1658 Virtual space is space beyond the end of each line. The caret may be moved into virtual space but no real space will be
1659 added to the document until there is some text typed or some other text insertion command is used.
1660 </p>
1662 <p>When discontiguous selections are copied to the clipboard, each selection is added to the clipboard text
1663 in order with no delimiting characters.
1664 For rectangular selections the document's line end is added after each line's text. Rectangular selections
1665 are always copied from top line to bottom, not in the in order of selection.Virtual space is not copied.</p>
1668 <b id="SCI_SETMULTIPLESELECTION">SCI_SETMULTIPLESELECTION(bool multipleSelection)</b><br />
1669 <b id="SCI_GETMULTIPLESELECTION">SCI_GETMULTIPLESELECTION</b><br />
1670 Enable or disable multiple selection. When multiple selection is disabled, it is not possible to select
1671 multiple ranges by holding down the Ctrl key while dragging with the mouse.</p>
1674 <b id="SCI_SETADDITIONALSELECTIONTYPING">SCI_SETADDITIONALSELECTIONTYPING(bool additionalSelectionTyping)</b><br />
1675 <b id="SCI_GETADDITIONALSELECTIONTYPING">SCI_GETADDITIONALSELECTIONTYPING</b><br />
1676 Whether typing, backspace, or delete works with multiple selections simultaneously.</p>
1679 <b id="SCI_SETMULTIPASTE">SCI_SETMULTIPASTE(int multiPaste)</b><br />
1680 <b id="SCI_GETMULTIPASTE">SCI_GETMULTIPASTE</b><br />
1681 When pasting into multiple selections, the pasted text can go into just the main selection with <code>SC_MULTIPASTE_ONCE</code>=0
1682 or into each selection with <code>SC_MULTIPASTE_EACH</code>=1. <code>SC_MULTIPASTE_ONCE</code> is the default.</p>
1685 <b id="SCI_SETVIRTUALSPACEOPTIONS">SCI_SETVIRTUALSPACEOPTIONS(int virtualSpace)</b><br />
1686 <b id="SCI_GETVIRTUALSPACEOPTIONS">SCI_GETVIRTUALSPACEOPTIONS</b><br />
1687 Virtual space can be enabled or disabled for rectangular selections or in other circumstances or in both.
1688 There are two bit flags <code>SCVS_RECTANGULARSELECTION</code>=1 and
1689 <code>SCVS_USERACCESSIBLE</code>=2 which can be set independently.
1690 <code>SCVS_NONE</code>=0, the default, disables all use of virtual space.</p>
1693 <b id="SCI_SETRECTANGULARSELECTIONMODIFIER">SCI_SETRECTANGULARSELECTIONMODIFIER(int modifier)</b><br />
1694 <b id="SCI_GETRECTANGULARSELECTIONMODIFIER">SCI_GETRECTANGULARSELECTIONMODIFIER</b><br />
1695 On GTK+, the key used to indicate that a rectangular selection should be created when combined with a mouse drag can be set.
1696 The three possible values are <code>SCMOD_CTRL</code>=2 (default), <code>SCMOD_ALT</code>=4 or <code>SCMOD_SUPER</code>=8.
1697 Since <code>SCMOD_ALT</code> is often already used by a window manager, the window manager may need configuring to allow this choice.
1698 <code>SCMOD_SUPER</code> is often a system dependent modifier key such as the Left Windows key on a Windows keyboard or the
1699 Command key on a Mac.</p>
1702 <b id="SCI_GETSELECTIONS">SCI_GETSELECTIONS</b><br />
1703 Return the number of selections currently active. There is always at least one selection.</p>
1706 <b id="SCI_GETSELECTIONEMPTY">SCI_GETSELECTIONEMPTY</b><br />
1707 Return 1 if every selected range is empty else 0.</p>
1710 <b id="SCI_CLEARSELECTIONS">SCI_CLEARSELECTIONS</b><br />
1711 Set a single empty selection at 0 as the only selection.</p>
1714 <b id="SCI_SETSELECTION">SCI_SETSELECTION(int caret, int anchor)</b><br />
1715 Set a single selection from <code>anchor</code> to <code>caret</code> as the only selection.</p>
1718 <b id="SCI_ADDSELECTION">SCI_ADDSELECTION(int caret, int anchor)</b><br />
1719 Add a new selection from <code>anchor</code> to <code>caret</code> as the main selection retaining all other
1720 selections as additional selections.
1721 Since there is always at least one selection, to set a list of selections, the first selection should be
1722 added with <code>SCI_SETSELECTION</code> and later selections added with <code>SCI_ADDSELECTION</code></p>
1725 <b id="SCI_DROPSELECTIONN">SCI_DROPSELECTIONN(int selection)</b><br />
1726 If there are multiple selections, remove the indicated selection.
1727 If this was the main selection then make the previous selection the main and if it was the first then the last selection becomes main.
1728 If there is only one selection, or there is no selection <code>selection</code>, then there is no effect.</p>
1731 <b id="SCI_SETMAINSELECTION">SCI_SETMAINSELECTION(int selection)</b><br />
1732 <b id="SCI_GETMAINSELECTION">SCI_GETMAINSELECTION</b><br />
1733 One of the selections is the main selection which is used to determine what range of text is automatically visible.
1734 The main selection may be displayed in different colours or with a differently styled caret.
1735 Only an already existing selection can be made main.</p>
1738 <b id="SCI_SETSELECTIONNCARET">SCI_SETSELECTIONNCARET(int selection, int pos)</b><br />
1739 <b id="SCI_GETSELECTIONNCARET">SCI_GETSELECTIONNCARET(int selection)</b><br />
1740 <b id="SCI_SETSELECTIONNCARETVIRTUALSPACE">SCI_SETSELECTIONNCARETVIRTUALSPACE(int selection, int space)</b><br />
1741 <b id="SCI_GETSELECTIONNCARETVIRTUALSPACE">SCI_GETSELECTIONNCARETVIRTUALSPACE(int selection)</b><br />
1742 <b id="SCI_SETSELECTIONNANCHOR">SCI_SETSELECTIONNANCHOR(int selection, int posAnchor)</b><br />
1743 <b id="SCI_GETSELECTIONNANCHOR">SCI_GETSELECTIONNANCHOR(int selection)</b><br />
1744 <b id="SCI_SETSELECTIONNANCHORVIRTUALSPACE">SCI_SETSELECTIONNANCHORVIRTUALSPACE(int selection, int space)</b><br />
1745 <b id="SCI_GETSELECTIONNANCHORVIRTUALSPACE">SCI_GETSELECTIONNANCHORVIRTUALSPACE(int selection)</b><br />
1746 Set or query the position and amount of virtual space for the caret and anchor of each already existing selection.</p>
1749 <b id="SCI_SETSELECTIONNSTART">SCI_SETSELECTIONNSTART(int selection, int pos)</b><br />
1750 <b id="SCI_GETSELECTIONNSTART">SCI_GETSELECTIONNSTART(int selection)</b><br />
1751 <b id="SCI_SETSELECTIONNEND">SCI_SETSELECTIONNEND(int selection, int pos)</b><br />
1752 <b id="SCI_GETSELECTIONNEND">SCI_GETSELECTIONNEND(int selection)</b><br />
1753 Set or query the start and end position of each already existing selection.
1754 Mostly of use to query each range for its text. The selection parameter is zero-based. </p>
1757 <b id="SCI_SETRECTANGULARSELECTIONCARET">SCI_SETRECTANGULARSELECTIONCARET(int pos)</b><br />
1758 <b id="SCI_GETRECTANGULARSELECTIONCARET">SCI_GETRECTANGULARSELECTIONCARET</b><br />
1759 <b id="SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE">SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE(int space)</b><br />
1760 <b id="SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE">SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE</b><br />
1761 <b id="SCI_SETRECTANGULARSELECTIONANCHOR">SCI_SETRECTANGULARSELECTIONANCHOR(int posAnchor)</b><br />
1762 <b id="SCI_GETRECTANGULARSELECTIONANCHOR">SCI_GETRECTANGULARSELECTIONANCHOR</b><br />
1763 <b id="SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE">SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE(int space)</b><br />
1764 <b id="SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE">SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE</b><br />
1765 Set or query the position and amount of virtual space for the caret and anchor of the rectangular selection.
1766 After setting the rectangular selection, this is broken down into multiple selections, one for each line.</p>
1769 <b id="SCI_SETADDITIONALSELALPHA">SCI_SETADDITIONALSELALPHA(int alpha)</b><br />
1770 <b id="SCI_GETADDITIONALSELALPHA">SCI_GETADDITIONALSELALPHA</b><br />
1771 <b id="SCI_SETADDITIONALSELFORE">SCI_SETADDITIONALSELFORE(int <a class="jump" href="#colour">colour</a>)</b><br />
1772 <b id="SCI_SETADDITIONALSELBACK">SCI_SETADDITIONALSELBACK(int <a class="jump" href="#colour">colour</a>)</b><br />
1773 Modify the appearance of additional selections so that they can be differentiated from the main selection which has its appearance set with
1774 <a class="message" href="#SCI_SETSELALPHA"><code>SCI_SETSELALPHA</code></a>,
1775 <a class="message" href="#SCI_GETSELALPHA"><code>SCI_GETSELALPHA</code></a>,
1776 <a class="message" href="#SCI_SETSELFORE"><code>SCI_SETSELFORE</code></a>, and
1777 <a class="message" href="#SCI_SETSELBACK"><code>SCI_SETSELBACK</code></a>.
1778 <code>SCI_SETADDITIONALSELFORE</code> and
1779 <code>SCI_SETADDITIONALSELBACK</code> calls have no
1780 effect until <a class="message" href="#SCI_SETSELFORE"><code>SCI_SETSELFORE</code></a>
1781 and <a class="message" href="#SCI_SETSELBACK"><code>SCI_SETSELBACK</code></a> are
1782 called with useSelection*Colour value set to true. Subsequent calls to
1783 <a class="message" href="#SCI_SETSELFORE"><code>SCI_SETSELFORE</code></a>,
1784 and <a class="message" href="#SCI_SETSELBACK"><code>SCI_SETSELBACK</code></a> will
1785 overwrite the values set by <code>SCI_SETADDITIONALSEL*</code> functions.</p>
1787 <b id="SCI_SETADDITIONALCARETFORE">SCI_SETADDITIONALCARETFORE(int <a class="jump" href="#colour">colour</a>)</b><br />
1788 <b id="SCI_GETADDITIONALCARETFORE">SCI_GETADDITIONALCARETFORE</b><br />
1789 <b id="SCI_SETADDITIONALCARETSBLINK">SCI_SETADDITIONALCARETSBLINK(bool additionalCaretsBlink)</b><br />
1790 <b id="SCI_GETADDITIONALCARETSBLINK">SCI_GETADDITIONALCARETSBLINK</b><br />
1791 Modify the appearance of additional carets so that they can be differentiated from the main caret which has its appearance set with
1792 <a class="message" href="#SCI_SETCARETFORE"><code>SCI_SETCARETFORE</code></a>,
1793 <a class="message" href="#SCI_GETCARETFORE"><code>SCI_GETCARETFORE</code></a>,
1794 <a class="message" href="#SCI_SETCARETPERIOD"><code>SCI_SETCARETPERIOD</code></a>, and
1795 <a class="message" href="#SCI_GETCARETPERIOD"><code>SCI_GETCARETPERIOD</code></a>.</p>
1798 <b id="SCI_SETADDITIONALCARETSVISIBLE">SCI_SETADDITIONALCARETSVISIBLE(bool additionalCaretsVisible)</b><br />
1799 <b id="SCI_GETADDITIONALCARETSVISIBLE">SCI_GETADDITIONALCARETSVISIBLE</b><br />
1800 Determine whether to show additional carets (defaults to <code>true</code>).</p>
1803 <b id="SCI_SWAPMAINANCHORCARET">SCI_SWAPMAINANCHORCARET</b><br />
1804 <b id="SCI_ROTATESELECTION">SCI_ROTATESELECTION</b><br />
1805 <b id="SCI_MULTIPLESELECTADDNEXT">SCI_MULTIPLESELECTADDNEXT</b><br />
1806 <b id="SCI_MULTIPLESELECTADDEACH">SCI_MULTIPLESELECTADDEACH</b><br />
1807 These commands may be assigned to keys to make it possible to manipulate multiple selections.
1808 <code>SCI_SWAPMAINANCHORCARET</code> moves the caret to the opposite end of the main selection.
1809 <code>SCI_ROTATESELECTION</code> makes the next selection be the main selection.<br />
1810 <code>SCI_MULTIPLESELECTADDNEXT</code> adds the next occurrence of the main selection
1811 within the target to the set of selections as main. If the current selection is empty then select word around caret.
1812 The current <a class="jump" href="#searchFlags"><code>searchFlags</code></a>
1813 are used so the application may choose case sensitivity and word search options.<br />
1814 <code>SCI_MULTIPLESELECTADDEACH</code> is similar to
1815 <code>SCI_MULTIPLESELECTADDNEXT</code> but adds multiple occurrences instead of just one.
1816 </p>
1818 <h2 id="ScrollingAndAutomaticScrolling">Scrolling and automatic scrolling</h2>
1819 <code><a class="message" href="#SCI_LINESCROLL">SCI_LINESCROLL(int column, int line)</a><br />
1820 <a class="message" href="#SCI_SCROLLCARET">SCI_SCROLLCARET</a><br />
1821 <a class="message" href="#SCI_SCROLLRANGE">SCI_SCROLLRANGE(int secondary, int primary)</a><br />
1822 <a class="message" href="#SCI_SETXCARETPOLICY">SCI_SETXCARETPOLICY(int caretPolicy, int
1823 caretSlop)</a><br />
1824 <a class="message" href="#SCI_SETYCARETPOLICY">SCI_SETYCARETPOLICY(int caretPolicy, int
1825 caretSlop)</a><br />
1826 <a class="message" href="#SCI_SETVISIBLEPOLICY">SCI_SETVISIBLEPOLICY(int caretPolicy, int
1827 caretSlop)</a><br />
1828 <a class="message" href="#SCI_SETHSCROLLBAR">SCI_SETHSCROLLBAR(bool visible)</a><br />
1829 <a class="message" href="#SCI_GETHSCROLLBAR">SCI_GETHSCROLLBAR</a><br />
1830 <a class="message" href="#SCI_SETVSCROLLBAR">SCI_SETVSCROLLBAR(bool visible)</a><br />
1831 <a class="message" href="#SCI_GETVSCROLLBAR">SCI_GETVSCROLLBAR</a><br />
1832 <a class="message" href="#SCI_GETXOFFSET">SCI_GETXOFFSET</a><br />
1833 <a class="message" href="#SCI_SETXOFFSET">SCI_SETXOFFSET(int xOffset)</a><br />
1834 <a class="message" href="#SCI_SETSCROLLWIDTH">SCI_SETSCROLLWIDTH(int pixelWidth)</a><br />
1835 <a class="message" href="#SCI_GETSCROLLWIDTH">SCI_GETSCROLLWIDTH</a><br />
1836 <a class="message" href="#SCI_SETSCROLLWIDTHTRACKING">SCI_SETSCROLLWIDTHTRACKING(bool tracking)</a><br />
1837 <a class="message" href="#SCI_GETSCROLLWIDTHTRACKING">SCI_GETSCROLLWIDTHTRACKING</a><br />
1838 <a class="message" href="#SCI_SETENDATLASTLINE">SCI_SETENDATLASTLINE(bool
1839 endAtLastLine)</a><br />
1840 <a class="message" href="#SCI_GETENDATLASTLINE">SCI_GETENDATLASTLINE</a><br />
1841 </code>
1843 <p><b id="SCI_LINESCROLL">SCI_LINESCROLL(int column, int line)</b><br />
1844 This will attempt to scroll the display by the number of columns and lines that you specify.
1845 Positive line values increase the line number at the top of the screen (i.e. they move the text
1846 upwards as far as the user is concerned), Negative line values do the reverse.</p>
1848 <p>The column measure is the width of a space in the default style. Positive values increase
1849 the column at the left edge of the view (i.e. they move the text leftwards as far as the user
1850 is concerned). Negative values do the reverse.</p>
1852 <p>See also: <a class="message" href="#SCI_SETXOFFSET"><code>SCI_SETXOFFSET</code></a></p>
1854 <p><b id="SCI_SCROLLCARET">SCI_SCROLLCARET</b><br />
1855 If the current position (this is the caret if there is no selection) is not visible, the view
1856 is scrolled to make it visible according to the current caret policy.</p>
1858 <p><b id="SCI_SCROLLRANGE">SCI_SCROLLRANGE(int secondary, int primary)</b><br />
1859 Scroll the argument positions and the range between them into view giving
1860 priority to the primary position then the secondary position.
1861 The behaviour is similar to <a class="message" href="#SCI_SCROLLCARET"><code>SCI_SCROLLCARET</code></a>
1862 with the primary position used instead of the caret. An effort is then made to ensure that the secondary
1863 position and range between are also visible.
1864 This may be used to make a search match visible.</p>
1866 <p><b id="SCI_SETXCARETPOLICY">SCI_SETXCARETPOLICY(int caretPolicy, int caretSlop)</b><br />
1867 <b id="SCI_SETYCARETPOLICY">SCI_SETYCARETPOLICY(int caretPolicy, int caretSlop)</b><br />
1868 These set the caret policy. The value of <code>caretPolicy</code> is a combination of
1869 <code>CARET_SLOP</code>, <code>CARET_STRICT</code>, <code>CARET_JUMPS</code> and
1870 <code>CARET_EVEN</code>.</p>
1872 <table cellpadding="1" cellspacing="2" border="0" summary="Caret policy">
1873 <tbody valign="top">
1874 <tr>
1875 <th align="left"><code>CARET_SLOP</code></th>
1877 <td>If set, we can define a slop value: <code>caretSlop</code>. This value defines an
1878 unwanted zone (UZ) where the caret is... unwanted. This zone is defined as a number of
1879 pixels near the vertical margins, and as a number of lines near the horizontal margins.
1880 By keeping the caret away from the edges, it is seen within its context. This makes it
1881 likely that the identifier that the caret is on can be completely seen, and that the
1882 current line is seen with some of the lines following it, which are often dependent on
1883 that line.</td>
1884 </tr>
1886 <tr>
1887 <th align="left"><code>CARET_STRICT</code></th>
1889 <td>If set, the policy set by <code>CARET_SLOP</code> is enforced... strictly. The caret
1890 is centred on the display if <code>caretSlop</code> is not set, and cannot go in the UZ
1891 if <code>caretSlop</code> is set.</td>
1892 </tr>
1894 <tr>
1895 <th align="left"><code>CARET_JUMPS</code></th>
1897 <td>If set, the display is moved more energetically so the caret can move in the same
1898 direction longer before the policy is applied again. '3UZ' notation is used to indicate
1899 three time the size of the UZ as a distance to the margin.</td>
1900 </tr>
1902 <tr>
1903 <th align="left"><code>CARET_EVEN</code></th>
1905 <td>If not set, instead of having symmetrical UZs, the left and bottom UZs are extended
1906 up to right and top UZs respectively. This way, we favour the displaying of useful
1907 information: the beginning of lines, where most code reside, and the lines after the
1908 caret, for example, the body of a function.</td>
1909 </tr>
1910 </tbody>
1911 </table>
1913 <table cellpadding="3" cellspacing="0" border="1" summary="Caret positioning">
1914 <thead align="center">
1915 <tr>
1916 <th>slop</th>
1918 <th>strict</th>
1920 <th>jumps</th>
1922 <th>even</th>
1924 <th>Caret can go to the margin</th>
1926 <th>On reaching limit (going out of visibility<br />
1927 or going into the UZ) display is...</th>
1928 </tr>
1929 </thead>
1931 <tbody align="center">
1932 <tr>
1933 <td>0</td>
1935 <td>0</td>
1937 <td>0</td>
1939 <td>0</td>
1941 <td>Yes</td>
1943 <td>moved to put caret on top/on right</td>
1944 </tr>
1946 <tr>
1947 <td>0</td>
1949 <td>0</td>
1951 <td>0</td>
1953 <td>1</td>
1955 <td>Yes</td>
1957 <td>moved by one position</td>
1958 </tr>
1960 <tr>
1961 <td>0</td>
1963 <td>0</td>
1965 <td>1</td>
1967 <td>0</td>
1969 <td>Yes</td>
1971 <td>moved to put caret on top/on right</td>
1972 </tr>
1974 <tr>
1975 <td>0</td>
1977 <td>0</td>
1979 <td>1</td>
1981 <td>1</td>
1983 <td>Yes</td>
1985 <td>centred on the caret</td>
1986 </tr>
1988 <tr>
1989 <td>0</td>
1991 <td>1</td>
1993 <td>-</td>
1995 <td>0</td>
1997 <td>Caret is always on top/on right of display</td>
1999 <td>-</td>
2000 </tr>
2002 <tr>
2003 <td>0</td>
2005 <td>1</td>
2007 <td>-</td>
2009 <td>1</td>
2011 <td>No, caret is always centred</td>
2013 <td>-</td>
2014 </tr>
2016 <tr>
2017 <td>1</td>
2019 <td>0</td>
2021 <td>0</td>
2023 <td>0</td>
2025 <td>Yes</td>
2027 <td>moved to put caret out of the asymmetrical UZ</td>
2028 </tr>
2030 <tr>
2031 <td>1</td>
2033 <td>0</td>
2035 <td>0</td>
2037 <td>1</td>
2039 <td>Yes</td>
2041 <td>moved to put caret out of the UZ</td>
2042 </tr>
2044 <tr>
2045 <td>1</td>
2047 <td>0</td>
2049 <td>1</td>
2051 <td>0</td>
2053 <td>Yes</td>
2055 <td>moved to put caret at 3UZ of the top or right margin</td>
2056 </tr>
2058 <tr>
2059 <td>1</td>
2061 <td>0</td>
2063 <td>1</td>
2065 <td>1</td>
2067 <td>Yes</td>
2069 <td>moved to put caret at 3UZ of the margin</td>
2070 </tr>
2072 <tr>
2073 <td>1</td>
2075 <td>1</td>
2077 <td>-</td>
2079 <td>0</td>
2081 <td>Caret is always at UZ of top/right margin</td>
2083 <td>-</td>
2084 </tr>
2086 <tr>
2087 <td>1</td>
2089 <td>1</td>
2091 <td>0</td>
2093 <td>1</td>
2095 <td>No, kept out of UZ</td>
2097 <td>moved by one position</td>
2098 </tr>
2100 <tr>
2101 <td>1</td>
2103 <td>1</td>
2105 <td>1</td>
2107 <td>0</td>
2109 <td>No, kept out of UZ</td>
2111 <td>moved to put caret at 3UZ of the margin</td>
2112 </tr>
2113 </tbody>
2114 </table>
2116 <p><b id="SCI_SETVISIBLEPOLICY">SCI_SETVISIBLEPOLICY(int caretPolicy, int caretSlop)</b><br />
2117 This determines how the vertical positioning is determined when <a class="message"
2118 href="#SCI_ENSUREVISIBLEENFORCEPOLICY"><code>SCI_ENSUREVISIBLEENFORCEPOLICY</code></a> is
2119 called. It takes <code>VISIBLE_SLOP</code> and <code>VISIBLE_STRICT</code> flags for the policy
2120 parameter. It is similar in operation to <a class="message"
2121 href="#SCI_SETYCARETPOLICY"><code>SCI_SETYCARETPOLICY(int caretPolicy, int
2122 caretSlop)</code></a>.</p>
2124 <p><b id="SCI_SETHSCROLLBAR">SCI_SETHSCROLLBAR(bool visible)</b><br />
2125 <b id="SCI_GETHSCROLLBAR">SCI_GETHSCROLLBAR</b><br />
2126 The horizontal scroll bar is only displayed if it is needed for the assumed width.
2127 If you never wish to see it, call
2128 <code>SCI_SETHSCROLLBAR(0)</code>. Use <code>SCI_SETHSCROLLBAR(1)</code> to enable it again.
2129 <code>SCI_GETHSCROLLBAR</code> returns the current state. The default state is to display it
2130 when needed.</p>
2131 <p>See also: <a class="message" href="#SCI_SETSCROLLWIDTH">SCI_SETSCROLLWIDTH</a>.</p>
2133 <p><b id="SCI_SETVSCROLLBAR">SCI_SETVSCROLLBAR(bool visible)</b><br />
2134 <b id="SCI_GETVSCROLLBAR">SCI_GETVSCROLLBAR</b><br />
2135 By default, the vertical scroll bar is always displayed when required. You can choose to hide
2136 or show it with <code>SCI_SETVSCROLLBAR</code> and get the current state with
2137 <code>SCI_GETVSCROLLBAR</code>.</p>
2139 <p><b id="SCI_SETXOFFSET">SCI_SETXOFFSET(int xOffset)</b><br />
2140 <b id="SCI_GETXOFFSET">SCI_GETXOFFSET</b><br />
2141 The <code>xOffset</code> is the horizontal scroll position in pixels of the start of the text
2142 view. A value of 0 is the normal position with the first text column visible at the left of the
2143 view.</p>
2145 <p>See also: <a class="message" href="#SCI_LINESCROLL"><code>SCI_LINESCROLL</code></a></p>
2147 <p><b id="SCI_SETSCROLLWIDTH">SCI_SETSCROLLWIDTH(int pixelWidth)</b><br />
2148 <b id="SCI_GETSCROLLWIDTH">SCI_GETSCROLLWIDTH</b><br />
2149 For performance, Scintilla does not measure the display width of the document to determine
2150 the properties of the horizontal scroll bar. Instead, an assumed width is used.
2151 These messages set and get the document width in pixels assumed by Scintilla.
2152 The default value is 2000.
2153 To ensure the width of the currently visible lines can be scrolled use
2154 <a class="message" href="#SCI_SETSCROLLWIDTHTRACKING"><code>SCI_SETSCROLLWIDTHTRACKING</code></a></p>
2156 <p><b id="SCI_SETSCROLLWIDTHTRACKING">SCI_SETSCROLLWIDTHTRACKING(bool tracking)</b><br />
2157 <b id="SCI_GETSCROLLWIDTHTRACKING">SCI_GETSCROLLWIDTHTRACKING</b><br />
2158 If scroll width tracking is enabled then the scroll width is adjusted to ensure that all of the lines currently
2159 displayed can be completely scrolled. This mode never adjusts the scroll width to be narrower.</p>
2161 <p><b id="SCI_SETENDATLASTLINE">SCI_SETENDATLASTLINE(bool endAtLastLine)</b><br />
2162 <b id="SCI_GETENDATLASTLINE">SCI_GETENDATLASTLINE</b><br />
2163 <code>SCI_SETENDATLASTLINE</code> sets the scroll range so that maximum scroll position has
2164 the last line at the bottom of the view (default). Setting this to <code>false</code> allows
2165 scrolling one page below the last line.</p>
2167 <h2 id="WhiteSpace">White space</h2>
2168 <code><a class="message" href="#SCI_SETVIEWWS">SCI_SETVIEWWS(int wsMode)</a><br />
2169 <a class="message" href="#SCI_GETVIEWWS">SCI_GETVIEWWS</a><br />
2170 <a class="message" href="#SCI_SETWHITESPACEFORE">SCI_SETWHITESPACEFORE(bool
2171 useWhitespaceForeColour, int colour)</a><br />
2172 <a class="message" href="#SCI_SETWHITESPACEBACK">SCI_SETWHITESPACEBACK(bool
2173 useWhitespaceBackColour, int colour)</a><br />
2174 <a class="message" href="#SCI_SETWHITESPACESIZE">SCI_SETWHITESPACESIZE(int
2175 size)</a><br />
2176 <a class="message" href="#SCI_GETWHITESPACESIZE">SCI_GETWHITESPACESIZE</a><br />
2177 <a class="message" href="#SCI_SETEXTRAASCENT">SCI_SETEXTRAASCENT(int extraAscent)</a><br />
2178 <a class="message" href="#SCI_GETEXTRAASCENT">SCI_GETEXTRAASCENT</a><br />
2179 <a class="message" href="#SCI_SETEXTRADESCENT">SCI_SETEXTRADESCENT(int extraDescent)</a><br />
2180 <a class="message" href="#SCI_GETEXTRADESCENT">SCI_GETEXTRADESCENT</a><br />
2181 </code>
2183 <p><b id="SCI_SETVIEWWS">SCI_SETVIEWWS(int wsMode)</b><br />
2184 <b id="SCI_GETVIEWWS">SCI_GETVIEWWS</b><br />
2185 White space can be made visible which may be useful for languages in which white space is
2186 significant, such as Python. Space characters appear as small centred dots and tab characters
2187 as light arrows pointing to the right. There are also ways to control the display of <a
2188 class="jump" href="#LineEndings">end of line characters</a>. The two messages set and get the
2189 white space display mode. The <code>wsMode</code> argument can be one of:</p>
2191 <table cellpadding="1" cellspacing="2" border="0" summary="White space policy">
2192 <tbody valign="top">
2193 <tr>
2194 <th align="left"><code>SCWS_INVISIBLE</code></th>
2196 <td>0</td>
2198 <td>The normal display mode with white space displayed as an empty background
2199 colour.</td>
2200 </tr>
2202 <tr>
2203 <th align="left"><code>SCWS_VISIBLEALWAYS</code></th>
2205 <td>1</td>
2207 <td>White space characters are drawn as dots and arrows,</td>
2208 </tr>
2210 <tr>
2211 <th align="left"><code>SCWS_VISIBLEAFTERINDENT</code></th>
2213 <td>2</td>
2215 <td>White space used for indentation is displayed normally but after the first visible
2216 character, it is shown as dots and arrows.</td>
2217 </tr>
2218 </tbody>
2219 </table>
2221 <p>The effect of using any other <code>wsMode</code> value is undefined.</p>
2223 <p><b id="SCI_SETWHITESPACEFORE">SCI_SETWHITESPACEFORE(bool useWhitespaceForeColour, int <a
2224 class="jump" href="#colour">colour</a>)</b><br />
2225 <b id="SCI_SETWHITESPACEBACK">SCI_SETWHITESPACEBACK(bool useWhitespaceBackColour, int <a
2226 class="jump" href="#colour">colour</a>)</b><br />
2227 By default, the colour of visible white space is determined by the lexer in use. The
2228 foreground and/or background colour of all visible white space can be set globally, overriding
2229 the lexer's colours with <code>SCI_SETWHITESPACEFORE</code> and
2230 <code>SCI_SETWHITESPACEBACK</code>.</p>
2232 <p><b id="SCI_SETWHITESPACESIZE">SCI_SETWHITESPACESIZE(int size)</b><br />
2233 <b id="SCI_GETWHITESPACESIZE">SCI_GETWHITESPACESIZE</b><br />
2234 <code>SCI_SETWHITESPACESIZE</code> sets the size of the dots used for mark space characters.
2235 The <code>SCI_GETWHITESPACESIZE</code> message retrieves the current size.
2236 </p>
2239 <b id="SCI_SETEXTRAASCENT">SCI_SETEXTRAASCENT(int extraAscent)</b><br />
2240 <b id="SCI_GETEXTRAASCENT">SCI_GETEXTRAASCENT</b><br />
2241 <b id="SCI_SETEXTRADESCENT">SCI_SETEXTRADESCENT(int extraDescent)</b><br />
2242 <b id="SCI_GETEXTRADESCENT">SCI_GETEXTRADESCENT</b><br />
2243 Text is drawn with the base of each character on a 'baseline'. The height of a line is found from the maximum
2244 that any style extends above the baseline (its 'ascent'), added to the maximum that any style extends below the
2245 baseline (its 'descent').
2246 Space may be added to the maximum ascent (<code>SCI_SETEXTRAASCENT</code>) and the
2247 maximum descent (<code>SCI_SETEXTRADESCENT</code>) to allow for more space between lines.
2248 This may done to make the text easier to read or to accommodate underlines or highlights.
2249 </p>
2251 <h2 id="Cursor">Cursor</h2>
2253 <p><b id="SCI_SETCURSOR">SCI_SETCURSOR(int curType)</b><br />
2254 <b id="SCI_GETCURSOR">SCI_GETCURSOR</b><br />
2255 The cursor is normally chosen in a context sensitive way, so it will be different over the
2256 margin than when over the text. When performing a slow action, you may wish to change to a wait
2257 cursor. You set the cursor type with <code>SCI_SETCURSOR</code>. The <code>curType</code>
2258 argument can be:</p>
2260 <table cellpadding="1" cellspacing="2" border="0" summary="Mouse cursors">
2261 <tbody valign="top">
2262 <tr>
2263 <th align="left"><code>SC_CURSORNORMAL</code></th>
2265 <td>-1</td>
2267 <td>The normal cursor is displayed.</td>
2268 </tr>
2270 <tr>
2271 <th align="left"><code>SC_CURSORWAIT</code></th>
2273 <td>&nbsp;4</td>
2275 <td>The wait cursor is displayed when the mouse is over or owned by the Scintilla
2276 window.</td>
2277 </tr>
2278 </tbody>
2279 </table>
2281 <p>Cursor values 1 through 7 have defined cursors, but only <code>SC_CURSORWAIT</code> is
2282 usefully controllable. Other values of <code>curType</code> cause a pointer to be displayed.
2283 The <code>SCI_GETCURSOR</code> message returns the last cursor type you set, or
2284 <code>SC_CURSORNORMAL</code> (-1) if you have not set a cursor type.</p>
2286 <h2 id="MouseCapture">Mouse capture</h2>
2288 <p><b id="SCI_SETMOUSEDOWNCAPTURES">SCI_SETMOUSEDOWNCAPTURES(bool captures)</b><br />
2289 <b id="SCI_GETMOUSEDOWNCAPTURES">SCI_GETMOUSEDOWNCAPTURES</b><br />
2290 When the mouse is pressed inside Scintilla, it is captured so future mouse movement events are
2291 sent to Scintilla. This behaviour may be turned off with
2292 <code>SCI_SETMOUSEDOWNCAPTURES(0)</code>.</p>
2294 <h2 id="LineEndings">Line endings</h2>
2296 <p>Scintilla can handle the major line end conventions and, depending on settings and
2297 the current lexer also support additional Unicode line ends.</p>
2299 <p>Scintilla can interpret any of the Macintosh (\r), Unix (\n) and Windows (\r\n)
2300 line ends.
2301 When the user presses the Enter key, one of these line
2302 end strings is inserted into the buffer. The default is \r\n in Windows and \n in Unix, but
2303 this can be changed with the <code>SCI_SETEOLMODE</code> message. You can also convert the
2304 entire document to one of these line endings with <code>SCI_CONVERTEOLS</code>. Finally, you
2305 can choose to display the line endings with <code>SCI_SETVIEWEOL</code>.</p>
2307 <p>For the UTF-8 encoding, three additional Unicode line ends,
2308 Next Line (<code>NEL=U+0085</code>), Line Separator (<code>LS=U+2028</code>), and Paragraph Separator (<code>PS=U+2029</code>)
2309 may optionally be interpreted when Unicode line ends is turned on and the current lexer also supports
2310 Unicode line ends.</p>
2312 <a class="message" href="#SCI_SETEOLMODE">SCI_SETEOLMODE(int eolMode)</a><br />
2313 <a class="message" href="#SCI_GETEOLMODE">SCI_GETEOLMODE</a><br />
2314 <a class="message" href="#SCI_CONVERTEOLS">SCI_CONVERTEOLS(int eolMode)</a><br />
2315 <a class="message" href="#SCI_SETVIEWEOL">SCI_SETVIEWEOL(bool visible)</a><br />
2316 <a class="message" href="#SCI_GETVIEWEOL">SCI_GETVIEWEOL</a><br />
2318 <a class="message" href="#SCI_GETLINEENDTYPESSUPPORTED">SCI_GETLINEENDTYPESSUPPORTED</a><br />
2319 <a class="message" href="#SCI_SETLINEENDTYPESALLOWED">SCI_SETLINEENDTYPESALLOWED(int lineEndBitSet)</a><br />
2320 <a class="message" href="#SCI_GETLINEENDTYPESALLOWED">SCI_GETLINEENDTYPESALLOWED</a><br />
2321 <a class="message" href="#SCI_GETLINEENDTYPESACTIVE">SCI_GETLINEENDTYPESACTIVE</a><br />
2323 <p><b id="SCI_SETEOLMODE">SCI_SETEOLMODE(int eolMode)</b><br />
2324 <b id="SCI_GETEOLMODE">SCI_GETEOLMODE</b><br />
2325 <code>SCI_SETEOLMODE</code> sets the characters that are added into the document when the user
2326 presses the Enter key. You can set <code>eolMode</code> to one of <code>SC_EOL_CRLF</code> (0),
2327 <code>SC_EOL_CR</code> (1), or <code>SC_EOL_LF</code> (2). The <code>SCI_GETEOLMODE</code>
2328 message retrieves the current state.</p>
2330 <p><b id="SCI_CONVERTEOLS">SCI_CONVERTEOLS(int eolMode)</b><br />
2331 This message changes all the end of line characters in the document to match
2332 <code>eolMode</code>. Valid values are: <code>SC_EOL_CRLF</code> (0), <code>SC_EOL_CR</code>
2333 (1), or <code>SC_EOL_LF</code> (2).</p>
2335 <p><b id="SCI_SETVIEWEOL">SCI_SETVIEWEOL(bool visible)</b><br />
2336 <b id="SCI_GETVIEWEOL">SCI_GETVIEWEOL</b><br />
2337 Normally, the end of line characters are hidden, but <code>SCI_SETVIEWEOL</code> allows you to
2338 display (or hide) them by setting <code>visible</code> <code>true</code> (or
2339 <code>false</code>). The visible rendering of the end of line characters is similar to
2340 <code>(CR)</code>, <code>(LF)</code>, or <code>(CR)(LF)</code>. <code>SCI_GETVIEWEOL</code>
2341 returns the current state.</p>
2343 <p><b id="SCI_GETLINEENDTYPESSUPPORTED">SCI_GETLINEENDTYPESSUPPORTED</b><br />
2344 <code>SCI_GETLINEENDTYPESSUPPORTED</code> reports the different types of line ends supported
2345 by the current lexer. This is a bit set although there is currently only a single choice
2346 with either <code>SC_LINE_END_TYPE_DEFAULT</code> (0) or <code>SC_LINE_END_TYPE_UNICODE</code> (1).
2347 These values are also used by the other messages concerned with Unicode line ends.</p>
2349 <p><b id="SCI_SETLINEENDTYPESALLOWED">SCI_SETLINEENDTYPESALLOWED(int lineEndBitSet)</b><br />
2350 <b id="SCI_GETLINEENDTYPESALLOWED">SCI_GETLINEENDTYPESALLOWED</b><br />
2351 By default, only the ASCII line ends are interpreted. Unicode line ends may be requested with
2352 <code>SCI_SETLINEENDTYPESALLOWED(SC_LINE_END_TYPE_UNICODE)</code>
2353 but this will be ineffective unless the lexer also allows you Unicode line ends.
2354 <code>SCI_GETLINEENDTYPESALLOWED</code> returns the current state.</p>
2356 <p><b id="SCI_GETLINEENDTYPESACTIVE">SCI_GETLINEENDTYPESACTIVE</b><br />
2357 <code>SCI_GETLINEENDTYPESACTIVE</code> reports the set of line ends currently interpreted
2358 by Scintilla. It is <code>SCI_GETLINEENDTYPESSUPPORTED &amp; SCI_GETLINEENDTYPESALLOWED</code>.</p>
2360 <h2 id="Styling">Styling</h2>
2362 <p>The styling messages allow you to assign styles to text. If your styling needs can be met by
2363 one of the standard lexers, or if you can write your own, then a lexer is probably the easiest
2364 way to style your document. If you choose to use the container to do the styling you can use
2365 the <a class="message" href="#SCI_SETLEXER"><code>SCI_SETLEXER</code></a> command to select
2366 <code>SCLEX_CONTAINER</code>, in which case the container is sent a <a class="message"
2367 href="#SCN_STYLENEEDED"><code>SCN_STYLENEEDED</code></a> <a class="jump"
2368 href="#Notifications">notification</a> each time text needs styling for display. As another
2369 alternative, you might use idle time to style the document. Even if you use a lexer, you might
2370 use the styling commands to mark errors detected by a compiler. The following commands can be
2371 used.</p>
2372 <code><a class="message" href="#SCI_GETENDSTYLED">SCI_GETENDSTYLED</a><br />
2373 <a class="message" href="#SCI_STARTSTYLING">SCI_STARTSTYLING(int position, int unused)</a><br />
2374 <a class="message" href="#SCI_SETSTYLING">SCI_SETSTYLING(int length, int style)</a><br />
2375 <a class="message" href="#SCI_SETSTYLINGEX">SCI_SETSTYLINGEX(int length, const char
2376 *styles)</a><br />
2377 <a class="message" href="#SCI_SETLINESTATE">SCI_SETLINESTATE(int line, int value)</a><br />
2378 <a class="message" href="#SCI_GETLINESTATE">SCI_GETLINESTATE(int line)</a><br />
2379 <a class="message" href="#SCI_GETMAXLINESTATE">SCI_GETMAXLINESTATE</a><br />
2380 </code>
2382 <p><b id="SCI_GETENDSTYLED">SCI_GETENDSTYLED</b><br />
2383 Scintilla keeps a record of the last character that is likely to be styled correctly. This is
2384 moved forwards when characters after it are styled and moved backwards if changes are made to
2385 the text of the document before it. Before drawing text, this position is checked to see if any
2386 styling is needed and, if so, a <code><a class="message"
2387 href="#SCN_STYLENEEDED">SCN_STYLENEEDED</a></code> notification message is sent to the
2388 container. The container can send <code>SCI_GETENDSTYLED</code> to work out where it needs to
2389 start styling. Scintilla will always ask to style whole lines.</p>
2391 <p><b id="SCI_STARTSTYLING">SCI_STARTSTYLING(int pos, int unused)</b><br />
2392 This prepares for styling by setting the styling position <code>pos</code> to start at.
2393 The unused argument was used in earlier versions but is now ignored.
2394 After
2395 <code>SCI_STARTSTYLING</code>, send multiple <code>SCI_SETSTYLING</code> messages for each
2396 lexical entity to style or send <code>SCI_SETSTYLINGEX</code> to style in blocks.</p>
2398 <p><b id="SCI_SETSTYLING">SCI_SETSTYLING(int length, int style)</b><br />
2399 This message sets the style of <code>length</code> characters starting at the styling position
2400 and then increases the styling position by <code>length</code>, ready for the next call.
2401 <code>SCI_STARTSTYLING</code> should be called before the first call to this.
2402 </p>
2404 <p><b id="SCI_SETSTYLINGEX">SCI_SETSTYLINGEX(int length, const char *styles)</b><br />
2405 As an alternative to <code>SCI_SETSTYLING</code>, which applies the same style to each byte,
2406 you can use this message which specifies the styles for each of <code>length</code> bytes from
2407 the styling position and then increases the styling position by <code>length</code>, ready for
2408 the next call.
2409 <code>SCI_STARTSTYLING</code> should be called before the first call to this.
2410 </p>
2412 <p><b id="SCI_SETLINESTATE">SCI_SETLINESTATE(int line, int value)</b><br />
2413 <b id="SCI_GETLINESTATE">SCI_GETLINESTATE(int line)</b><br />
2414 As well as the 8 bits of lexical state stored for each character there is also an integer
2415 stored for each line. This can be used for longer lived parse states such as what the current
2416 scripting language is in an ASP page. Use <code>SCI_SETLINESTATE</code> to set the integer
2417 value and <code>SCI_GETLINESTATE</code> to get the value.
2418 Changing the value produces a <a class="message" href="#SC_MOD_CHANGELINESTATE">SC_MOD_CHANGELINESTATE</a> notification.
2419 </p>
2421 <p><b id="SCI_GETMAXLINESTATE">SCI_GETMAXLINESTATE</b><br />
2422 This returns the last line that has any line state.</p>
2424 <h2 id="StyleDefinition">Style definition</h2>
2426 <p>While the style setting messages mentioned above change the style numbers associated with
2427 text, these messages define how those style numbers are interpreted visually. There are 256
2428 lexer styles that can be set, numbered 0 to <code>STYLE_MAX</code> (255).
2429 There are also some
2430 predefined numbered styles starting at 32, The following <code>STYLE_</code>* constants are
2431 defined.</p>
2433 <table cellpadding="1" cellspacing="2" border="0" summary="Preset styles">
2434 <tbody valign="top">
2435 <tr>
2436 <th align="left"><code>STYLE_DEFAULT</code></th>
2438 <td>32</td>
2440 <td>This style defines the attributes that all styles receive when the
2441 <code>SCI_STYLECLEARALL</code> message is used.</td>
2442 </tr>
2444 <tr>
2445 <th align="left"><code>STYLE_LINENUMBER</code></th>
2447 <td>33</td>
2449 <td>This style sets the attributes of the text used to display line numbers in a line
2450 number margin. The background colour set for this style also sets the background colour
2451 for all margins that do not have any folding mask bits set. That is, any margin for which
2452 <code>mask &amp; SC_MASK_FOLDERS</code> is 0. See <a class="message"
2453 href="#SCI_SETMARGINMASKN"><code>SCI_SETMARGINMASKN</code></a> for more about masks.</td>
2454 </tr>
2456 <tr>
2457 <th align="left"><code>STYLE_BRACELIGHT</code></th>
2459 <td>34</td>
2461 <td>This style sets the attributes used when highlighting braces with the <a
2462 class="message" href="#BraceHighlighting"><code>SCI_BRACEHIGHLIGHT</code></a> message and
2463 when highlighting the corresponding indentation with <a class="message"
2464 href="#SCI_SETHIGHLIGHTGUIDE"><code>SCI_SETHIGHLIGHTGUIDE</code></a>.</td>
2465 </tr>
2467 <tr>
2468 <th align="left"><code>STYLE_BRACEBAD</code></th>
2470 <td>35</td>
2472 <td>This style sets the display attributes used when marking an unmatched brace with the
2473 <a class="message" href="#BraceHighlighting"><code>SCI_BRACEBADLIGHT</code></a>
2474 message.</td>
2475 </tr>
2477 <tr>
2478 <th align="left"><code>STYLE_CONTROLCHAR</code></th>
2480 <td>36</td>
2482 <td>This style sets the font used when drawing control characters.
2483 Only the font, size, bold, italics, and character set attributes are used and not
2484 the colour attributes. See
2485 also: <a class="message"
2486 href="#SCI_SETCONTROLCHARSYMBOL"><code>SCI_SETCONTROLCHARSYMBOL</code></a>.</td>
2487 </tr>
2489 <tr>
2490 <th align="left"><code>STYLE_INDENTGUIDE</code></th>
2492 <td>37</td>
2494 <td>This style sets the foreground and background colours used when drawing the
2495 indentation guides.</td>
2496 </tr>
2498 <tr>
2499 <th align="left"><code>STYLE_CALLTIP</code></th>
2501 <td>38</td>
2503 <td> Call tips normally use the font attributes defined by <code>STYLE_DEFAULT</code>.
2504 Use of <a class="message" href="#SCI_CALLTIPUSESTYLE"><code>SCI_CALLTIPUSESTYLE</code></a>
2505 causes call tips to use this style instead. Only the font face name, font size,
2506 foreground and background colours and character set attributes are used.</td>
2507 </tr>
2509 <tr>
2510 <th align="left"><code>STYLE_LASTPREDEFINED</code></th>
2512 <td>39</td>
2514 <td>To make it easier for client code to discover the range of styles that are
2515 predefined, this is set to the style number of the last predefined style. This is
2516 currently set to 39 and the last style with an identifier is 38, which reserves space
2517 for one future predefined style.</td>
2518 </tr>
2520 <tr>
2521 <th align="left"><code>STYLE_MAX</code></th>
2523 <td>255</td>
2525 <td>This is not a style but is the number of the maximum style that can be set. Styles
2526 between <code>STYLE_LASTPREDEFINED</code> and <code>STYLE_MAX</code> may be used.</td>
2527 </tr>
2528 </tbody>
2529 </table>
2531 <p>For each style you can set the font name, size and use of bold, italic and underline,
2532 foreground and background colour and the character set. You can also choose to hide text with a
2533 given style, display all characters as upper or lower case and fill from the last character on
2534 a line to the end of the line (for embedded languages). There is also an experimental attribute
2535 to make text read-only.</p>
2537 <p>It is entirely up to you how you use styles. If you want to use syntax colouring you might
2538 use style 0 for white space, style 1 for numbers, style 2 for keywords, style 3 for strings,
2539 style 4 for preprocessor, style 5 for operators, and so on.</p>
2540 <code><a class="message" href="#SCI_STYLERESETDEFAULT">SCI_STYLERESETDEFAULT</a><br />
2541 <a class="message" href="#SCI_STYLECLEARALL">SCI_STYLECLEARALL</a><br />
2542 <a class="message" href="#SCI_STYLESETFONT">SCI_STYLESETFONT(int styleNumber, char
2543 *fontName)</a><br />
2544 <a class="message" href="#SCI_STYLEGETFONT">SCI_STYLEGETFONT(int styleNumber, char *fontName)</a><br />
2545 <a class="message" href="#SCI_STYLESETSIZE">SCI_STYLESETSIZE(int styleNumber, int
2546 sizeInPoints)</a><br />
2547 <a class="message" href="#SCI_STYLEGETSIZE">SCI_STYLEGETSIZE(int styleNumber)</a><br />
2548 <a class="message" href="#SCI_STYLESETSIZEFRACTIONAL">SCI_STYLESETSIZEFRACTIONAL(int styleNumber, int
2549 sizeInHundredthPoints)</a><br />
2550 <a class="message" href="#SCI_STYLEGETSIZEFRACTIONAL">SCI_STYLEGETSIZEFRACTIONAL(int styleNumber)</a><br />
2551 <a class="message" href="#SCI_STYLESETBOLD">SCI_STYLESETBOLD(int styleNumber, bool
2552 bold)</a><br />
2553 <a class="message" href="#SCI_STYLEGETBOLD">SCI_STYLEGETBOLD(int styleNumber)</a><br />
2554 <a class="message" href="#SCI_STYLESETWEIGHT">SCI_STYLESETWEIGHT(int styleNumber, int
2555 weight)</a><br />
2556 <a class="message" href="#SCI_STYLEGETWEIGHT">SCI_STYLEGETWEIGHT(int styleNumber)</a><br />
2557 <a class="message" href="#SCI_STYLESETITALIC">SCI_STYLESETITALIC(int styleNumber, bool
2558 italic)</a><br />
2559 <a class="message" href="#SCI_STYLEGETITALIC">SCI_STYLEGETITALIC(int styleNumber)</a><br />
2560 <a class="message" href="#SCI_STYLESETUNDERLINE">SCI_STYLESETUNDERLINE(int styleNumber, bool
2561 underline)</a><br />
2562 <a class="message" href="#SCI_STYLEGETUNDERLINE">SCI_STYLEGETUNDERLINE(int styleNumber)</a><br />
2563 <a class="message" href="#SCI_STYLESETFORE">SCI_STYLESETFORE(int styleNumber, int
2564 colour)</a><br />
2565 <a class="message" href="#SCI_STYLEGETFORE">SCI_STYLEGETFORE(int styleNumber)</a><br />
2566 <a class="message" href="#SCI_STYLESETBACK">SCI_STYLESETBACK(int styleNumber, int
2567 colour)</a><br />
2568 <a class="message" href="#SCI_STYLEGETBACK">SCI_STYLEGETBACK(int styleNumber)</a><br />
2569 <a class="message" href="#SCI_STYLESETEOLFILLED">SCI_STYLESETEOLFILLED(int styleNumber, bool
2570 eolFilled)</a><br />
2571 <a class="message" href="#SCI_STYLEGETEOLFILLED">SCI_STYLEGETEOLFILLED(int styleNumber)</a><br />
2572 <a class="message" href="#SCI_STYLESETCHARACTERSET">SCI_STYLESETCHARACTERSET(int styleNumber,
2573 int charSet)</a><br />
2574 <a class="message" href="#SCI_STYLEGETCHARACTERSET">SCI_STYLEGETCHARACTERSET(int styleNumber)</a><br />
2575 <a class="message" href="#SCI_STYLESETCASE">SCI_STYLESETCASE(int styleNumber, int
2576 caseMode)</a><br />
2577 <a class="message" href="#SCI_STYLEGETCASE">SCI_STYLEGETCASE(int styleNumber)</a><br />
2578 <a class="message" href="#SCI_STYLESETVISIBLE">SCI_STYLESETVISIBLE(int styleNumber, bool
2579 visible)</a><br />
2580 <a class="message" href="#SCI_STYLEGETVISIBLE">SCI_STYLEGETVISIBLE(int styleNumber)</a><br />
2581 <a class="message" href="#SCI_STYLESETCHANGEABLE">SCI_STYLESETCHANGEABLE(int styleNumber, bool
2582 changeable)</a><br />
2583 <a class="message" href="#SCI_STYLEGETCHANGEABLE">SCI_STYLEGETCHANGEABLE(int styleNumber)</a><br />
2584 <a class="message" href="#SCI_STYLESETHOTSPOT">SCI_STYLESETHOTSPOT(int styleNumber, bool
2585 hotspot)</a><br />
2586 <a class="message" href="#SCI_STYLEGETHOTSPOT">SCI_STYLEGETHOTSPOT(int styleNumber)</a><br />
2587 </code>
2589 <p><b id="SCI_STYLERESETDEFAULT">SCI_STYLERESETDEFAULT</b><br />
2590 This message resets <code>STYLE_DEFAULT</code> to its state when Scintilla was
2591 initialised.</p>
2593 <p><b id="SCI_STYLECLEARALL">SCI_STYLECLEARALL</b><br />
2594 This message sets all styles to have the same attributes as <code>STYLE_DEFAULT</code>. If you
2595 are setting up Scintilla for syntax colouring, it is likely that the lexical styles you set
2596 will be very similar. One way to set the styles is to:<br />
2597 1. Set <code>STYLE_DEFAULT</code> to the common features of all styles.<br />
2598 2. Use <code>SCI_STYLECLEARALL</code> to copy this to all styles.<br />
2599 3. Set the style attributes that make your lexical styles different.</p>
2601 <p><b id="SCI_STYLESETFONT">SCI_STYLESETFONT(int styleNumber, const char *fontName)</b><br />
2602 <b id="SCI_STYLEGETFONT">SCI_STYLEGETFONT(int styleNumber, char *fontName NUL-terminated)</b><br />
2603 <b id="SCI_STYLESETSIZE">SCI_STYLESETSIZE(int styleNumber, int sizeInPoints)</b><br />
2604 <b id="SCI_STYLEGETSIZE">SCI_STYLEGETSIZE(int styleNumber)</b><br />
2605 <b id="SCI_STYLESETSIZEFRACTIONAL">SCI_STYLESETSIZEFRACTIONAL(int styleNumber, int sizeInHundredthPoints)</b><br />
2606 <b id="SCI_STYLEGETSIZEFRACTIONAL">SCI_STYLEGETSIZEFRACTIONAL(int styleNumber)</b><br />
2607 <b id="SCI_STYLESETBOLD">SCI_STYLESETBOLD(int styleNumber, bool bold)</b><br />
2608 <b id="SCI_STYLEGETBOLD">SCI_STYLEGETBOLD(int styleNumber)</b><br />
2609 <b id="SCI_STYLESETWEIGHT">SCI_STYLESETWEIGHT(int styleNumber, int weight)</b><br />
2610 <b id="SCI_STYLEGETWEIGHT">SCI_STYLEGETWEIGHT(int styleNumber)</b><br />
2611 <b id="SCI_STYLESETITALIC">SCI_STYLESETITALIC(int styleNumber, bool italic)</b><br />
2612 <b id="SCI_STYLEGETITALIC">SCI_STYLEGETITALIC(int styleNumber)</b><br />
2613 These messages (plus <a class="message"
2614 href="#SCI_STYLESETCHARACTERSET"><code>SCI_STYLESETCHARACTERSET</code></a>) set the font
2615 attributes that are used to match the fonts you request to those available.</p>
2616 <p>The
2617 <code>fontName</code> is a zero terminated string holding the name of a font. Under Windows,
2618 only the first 32 characters of the name are used, the name is decoded as UTF-8, and the name is not case sensitive. For
2619 internal caching, Scintilla tracks fonts by name and does care about the casing of font names,
2620 so please be consistent.
2621 On GTK+, Pango is used to display text and the name is sent directly to Pango without transformation.
2622 On Qt, the name is decoded as UTF-8.
2623 On Cocoa, the name is decoded as MacRoman.</p>
2624 <p>Sizes can be set to a whole number of points with <code>SCI_STYLESETSIZE</code>
2625 or to a fractional point size in hundredths of a point with <code>SCI_STYLESETSIZEFRACTIONAL</code>
2626 by multiplying the size by 100 (<code>SC_FONT_SIZE_MULTIPLIER</code>).
2627 For example, a text size of 9.4 points is set with <code>SCI_STYLESETSIZEFRACTIONAL(&lt;style&gt;, 940)</code>.
2628 </p>
2629 <p>The weight or boldness of a font can be set with <code>SCI_STYLESETBOLD</code>
2630 or <code>SCI_STYLESETWEIGHT</code>. The weight is a number between 1 and 999 with 1 being very light
2631 and 999 very heavy. While any value can be used, fonts often only support between 2 and 4 weights with three weights
2632 being common enough to have symbolic names:
2633 <code>SC_WEIGHT_NORMAL</code> (400),
2634 <code>SC_WEIGHT_SEMIBOLD</code> (600), and
2635 <code>SC_WEIGHT_BOLD</code> (700).
2636 The <code>SCI_STYLESETBOLD</code> message takes a boolean argument with 0 choosing <code>SC_WEIGHT_NORMAL</code>
2637 and 1 <code>SC_WEIGHT_BOLD</code>.
2638 </p>
2640 <p><b id="SCI_STYLESETUNDERLINE">SCI_STYLESETUNDERLINE(int styleNumber, bool
2641 underline)</b><br />
2642 <b id="SCI_STYLEGETUNDERLINE">SCI_STYLEGETUNDERLINE(int styleNumber)</b><br />
2643 You can set a style to be underlined. The underline is drawn in the foreground colour. All
2644 characters with a style that includes the underline attribute are underlined, even if they are
2645 white space.</p>
2647 <p><b id="SCI_STYLESETFORE">SCI_STYLESETFORE(int styleNumber, int <a class="jump"
2648 href="#colour">colour</a>)</b><br />
2649 <b id="SCI_STYLEGETFORE">SCI_STYLEGETFORE(int styleNumber)</b><br />
2650 <b id="SCI_STYLESETBACK">SCI_STYLESETBACK(int styleNumber, int <a class="jump"
2651 href="#colour">colour</a>)</b><br />
2652 <b id="SCI_STYLEGETBACK">SCI_STYLEGETBACK(int styleNumber)</b><br />
2653 Text is drawn in the foreground colour. The space in each character cell that is not occupied
2654 by the character is drawn in the background colour.</p>
2656 <p><b id="SCI_STYLESETEOLFILLED">SCI_STYLESETEOLFILLED(int styleNumber, bool
2657 eolFilled)</b><br />
2658 <b id="SCI_STYLEGETEOLFILLED">SCI_STYLEGETEOLFILLED(int styleNumber)</b><br />
2659 If the last character in the line has a style with this attribute set, the remainder of the
2660 line up to the right edge of the window is filled with the background colour set for the last
2661 character. This is useful when a document contains embedded sections in another language such
2662 as HTML pages with embedded JavaScript. By setting <code>eolFilled</code> to <code>true</code>
2663 and a consistent background colour (different from the background colour set for the HTML
2664 styles) to all JavaScript styles then JavaScript sections will be easily distinguished from
2665 HTML.</p>
2667 <p><b id="SCI_STYLESETCHARACTERSET">SCI_STYLESETCHARACTERSET(int styleNumber, int
2668 charSet)</b><br />
2669 <b id="SCI_STYLEGETCHARACTERSET">SCI_STYLEGETCHARACTERSET(int styleNumber)</b><br />
2670 You can set a style to use a different character set than the default. The places where such
2671 characters sets are likely to be useful are comments and literal strings. For example,
2672 <code>SCI_STYLESETCHARACTERSET(SCE_C_STRING, SC_CHARSET_RUSSIAN)</code> would ensure that
2673 strings in Russian would display correctly in C and C++ (<code>SCE_C_STRING</code> is the style
2674 number used by the C and C++ lexer to display literal strings; it has the value 6). This
2675 feature works differently on Windows and GTK+.</p>
2677 <p>The character sets supported on Windows are:<br />
2678 <code>SC_CHARSET_ANSI</code>, <code>SC_CHARSET_ARABIC</code>, <code>SC_CHARSET_BALTIC</code>,
2679 <code>SC_CHARSET_CHINESEBIG5</code>, <code>SC_CHARSET_DEFAULT</code>,
2680 <code>SC_CHARSET_EASTEUROPE</code>, <code>SC_CHARSET_GB2312</code>,
2681 <code>SC_CHARSET_GREEK</code>, <code>SC_CHARSET_HANGUL</code>, <code>SC_CHARSET_HEBREW</code>,
2682 <code>SC_CHARSET_JOHAB</code>, <code>SC_CHARSET_MAC</code>, <code>SC_CHARSET_OEM</code>,
2683 <code>SC_CHARSET_RUSSIAN</code> (code page 1251),
2684 <code>SC_CHARSET_SHIFTJIS</code>, <code>SC_CHARSET_SYMBOL</code>, <code>SC_CHARSET_THAI</code>,
2685 <code>SC_CHARSET_TURKISH</code>, and <code>SC_CHARSET_VIETNAMESE</code>.</p>
2687 <p>The character sets supported on GTK+ are:<br />
2688 <code>SC_CHARSET_ANSI</code>, <code>SC_CHARSET_CYRILLIC</code> (code page 1251),
2689 <code>SC_CHARSET_EASTEUROPE</code>,
2690 <code>SC_CHARSET_GB2312</code>, <code>SC_CHARSET_HANGUL</code>,
2691 <code>SC_CHARSET_RUSSIAN</code> (KOI8-R), <code>SC_CHARSET_SHIFTJIS</code>, and
2692 <code>SC_CHARSET_8859_15</code>.</p>
2694 <p><b id="SCI_STYLESETCASE">SCI_STYLESETCASE(int styleNumber, int caseMode)</b><br />
2695 <b id="SCI_STYLEGETCASE">SCI_STYLEGETCASE(int styleNumber)</b><br />
2696 The value of caseMode determines how text is displayed. You can set upper case
2697 (<code>SC_CASE_UPPER</code>, 1) or lower case (<code>SC_CASE_LOWER</code>, 2) or display
2698 normally (<code>SC_CASE_MIXED</code>, 0). This does not change the stored text, only how it is
2699 displayed.</p>
2701 <p><b id="SCI_STYLESETVISIBLE">SCI_STYLESETVISIBLE(int styleNumber, bool visible)</b><br />
2702 <b id="SCI_STYLEGETVISIBLE">SCI_STYLEGETVISIBLE(int styleNumber)</b><br />
2703 Text is normally visible. However, you can completely hide it by giving it a style with the
2704 <code>visible</code> set to 0. This could be used to hide embedded formatting instructions or
2705 hypertext keywords in HTML or XML.</p>
2707 <p><b id="SCI_STYLESETCHANGEABLE">SCI_STYLESETCHANGEABLE(int styleNumber, bool
2708 changeable)</b><br />
2709 <b id="SCI_STYLEGETCHANGEABLE">SCI_STYLEGETCHANGEABLE(int styleNumber)</b><br />
2710 This is an experimental and incompletely implemented style attribute. The default setting is
2711 <code>changeable</code> set <code>true</code> but when set <code>false</code> it makes text
2712 read-only. Currently it only stops the caret from being within not-changeable text and does not
2713 yet stop deleting a range that contains not-changeable text.</p>
2715 <p><b id="SCI_STYLESETHOTSPOT">SCI_STYLESETHOTSPOT(int styleNumber, bool
2716 hotspot)</b><br />
2717 <b id="SCI_STYLEGETHOTSPOT">SCI_STYLEGETHOTSPOT(int styleNumber)</b><br />
2718 This style is used to mark ranges of text that can detect mouse clicks.
2719 The cursor changes to a hand over hotspots, and the foreground, and background colours
2720 may change and an underline appear to indicate that these areas are sensitive to clicking.
2721 This may be used to allow hyperlinks to other documents.</p>
2723 <h2 id="CaretAndSelectionStyles">Caret, selection, and hotspot styles</h2>
2725 <p>The selection is shown by changing the foreground and/or background colours. If one of these
2726 is not set then that attribute is not changed for the selection. The default is to show the
2727 selection by changing the background to light grey and leaving the foreground the same as when
2728 it was not selected. When there is no selection, the current insertion point is marked by the
2729 text caret. This is a vertical line that is normally blinking on and off to attract the users
2730 attention.</p>
2731 <code><a class="message" href="#SCI_SETSELFORE">SCI_SETSELFORE(bool useSelectionForeColour, int colour)</a><br />
2732 <a class="message" href="#SCI_SETSELBACK">SCI_SETSELBACK(bool useSelectionBackColour, int colour)</a><br />
2733 <a class="message" href="#SCI_SETSELALPHA">SCI_SETSELALPHA(int alpha)</a><br />
2734 <a class="message" href="#SCI_GETSELALPHA">SCI_GETSELALPHA</a><br />
2735 <a class="message" href="#SCI_SETSELEOLFILLED">SCI_SETSELEOLFILLED(bool filled)</a><br />
2736 <a class="message" href="#SCI_GETSELEOLFILLED">SCI_GETSELEOLFILLED</a><br />
2737 <a class="message" href="#SCI_SETCARETFORE">SCI_SETCARETFORE(int colour)</a><br />
2738 <a class="message" href="#SCI_GETCARETFORE">SCI_GETCARETFORE</a><br />
2739 <a class="message" href="#SCI_SETCARETLINEVISIBLE">SCI_SETCARETLINEVISIBLE(bool show)</a><br />
2740 <a class="message" href="#SCI_GETCARETLINEVISIBLE">SCI_GETCARETLINEVISIBLE</a><br />
2741 <a class="message" href="#SCI_SETCARETLINEBACK">SCI_SETCARETLINEBACK(int colour)</a><br />
2742 <a class="message" href="#SCI_GETCARETLINEBACK">SCI_GETCARETLINEBACK</a><br />
2743 <a class="message" href="#SCI_SETCARETLINEBACKALPHA">SCI_SETCARETLINEBACKALPHA(int alpha)</a><br />
2744 <a class="message" href="#SCI_GETCARETLINEBACKALPHA">SCI_GETCARETLINEBACKALPHA</a><br />
2745 <a class="message" href="#SCI_SETCARETLINEVISIBLEALWAYS">SCI_SETCARETLINEVISIBLEALWAYS(bool alwaysVisible)</a><br />
2746 <a class="message" href="#SCI_GETCARETLINEVISIBLEALWAYS">SCI_GETCARETLINEVISIBLEALWAYS</a><br />
2747 <a class="message" href="#SCI_SETCARETPERIOD">SCI_SETCARETPERIOD(int milliseconds)</a><br />
2748 <a class="message" href="#SCI_GETCARETPERIOD">SCI_GETCARETPERIOD</a><br />
2749 <a class="message" href="#SCI_SETCARETSTYLE">SCI_SETCARETSTYLE(int style)</a><br />
2750 <a class="message" href="#SCI_GETCARETSTYLE">SCI_GETCARETSTYLE</a><br />
2751 <a class="message" href="#SCI_SETCARETWIDTH">SCI_SETCARETWIDTH(int pixels)</a><br />
2752 <a class="message" href="#SCI_GETCARETWIDTH">SCI_GETCARETWIDTH</a><br />
2753 <a class="message" href="#SCI_SETHOTSPOTACTIVEFORE">SCI_SETHOTSPOTACTIVEFORE(bool useSetting, int colour)</a><br />
2754 <a class="message" href="#SCI_GETHOTSPOTACTIVEFORE">SCI_GETHOTSPOTACTIVEFORE</a><br />
2755 <a class="message" href="#SCI_SETHOTSPOTACTIVEBACK">SCI_SETHOTSPOTACTIVEBACK(bool useSetting, int colour)</a><br />
2756 <a class="message" href="#SCI_GETHOTSPOTACTIVEBACK">SCI_GETHOTSPOTACTIVEBACK</a><br />
2757 <a class="message" href="#SCI_SETHOTSPOTACTIVEUNDERLINE">SCI_SETHOTSPOTACTIVEUNDERLINE(bool underline)</a><br />
2758 <a class="message" href="#SCI_GETHOTSPOTACTIVEUNDERLINE">SCI_GETHOTSPOTACTIVEUNDERLINE</a><br />
2759 <a class="message" href="#SCI_SETHOTSPOTSINGLELINE">SCI_SETHOTSPOTSINGLELINE(bool singleLine)</a><br />
2760 <a class="message" href="#SCI_GETHOTSPOTSINGLELINE">SCI_GETHOTSPOTSINGLELINE</a><br />
2761 <a class="message" href="#SCI_SETCARETSTICKY">SCI_SETCARETSTICKY(int useCaretStickyBehaviour)</a><br />
2762 <a class="message" href="#SCI_GETCARETSTICKY">SCI_GETCARETSTICKY</a><br />
2763 <a class="message" href="#SCI_TOGGLECARETSTICKY">SCI_TOGGLECARETSTICKY</a><br />
2764 </code>
2766 <p><b id="SCI_SETSELFORE">SCI_SETSELFORE(bool useSelectionForeColour, int <a class="jump"
2767 href="#colour">colour</a>)</b><br />
2768 <b id="SCI_SETSELBACK">SCI_SETSELBACK(bool useSelectionBackColour, int <a class="jump"
2769 href="#colour">colour</a>)</b><br />
2770 You can choose to override the default selection colouring with these two messages. The colour
2771 you provide is used if you set <code>useSelection*Colour</code> to <code>true</code>. If it is
2772 set to <code>false</code>, the default styled colouring is used and the <code>colour</code>
2773 argument has no effect.</p>
2774 <p><b id="SCI_SETSELALPHA">SCI_SETSELALPHA(int <a class="jump" href="#alpha">alpha</a>)</b><br />
2775 <b id="SCI_GETSELALPHA">SCI_GETSELALPHA</b><br />
2776 The selection can be drawn translucently in the selection background colour by
2777 setting an alpha value.</p>
2779 <p><b id="SCI_SETSELEOLFILLED">SCI_SETSELEOLFILLED(bool filled)</b><br />
2780 <b id="SCI_GETSELEOLFILLED">SCI_GETSELEOLFILLED</b><br />
2781 The selection can be drawn up to the right hand border by setting this property.</p>
2783 <p><b id="SCI_SETCARETFORE">SCI_SETCARETFORE(int <a class="jump"
2784 href="#colour">colour</a>)</b><br />
2785 <b id="SCI_GETCARETFORE">SCI_GETCARETFORE</b><br />
2786 The colour of the caret can be set with <code>SCI_SETCARETFORE</code> and retrieved with
2787 <code>SCI_GETCARETFORE</code>.</p>
2789 <p><b id="SCI_SETCARETLINEVISIBLE">SCI_SETCARETLINEVISIBLE(bool show)</b><br />
2790 <b id="SCI_GETCARETLINEVISIBLE">SCI_GETCARETLINEVISIBLE</b><br />
2791 <b id="SCI_SETCARETLINEBACK">SCI_SETCARETLINEBACK(int <a class="jump"
2792 href="#colour">colour</a>)</b><br />
2793 <b id="SCI_GETCARETLINEBACK">SCI_GETCARETLINEBACK</b><br />
2794 <b id="SCI_SETCARETLINEBACKALPHA">SCI_SETCARETLINEBACKALPHA(int <a class="jump" href="#alpha">alpha</a>)</b><br />
2795 <b id="SCI_GETCARETLINEBACKALPHA">SCI_GETCARETLINEBACKALPHA</b><br />
2796 You can choose to make the background colour of the line containing the caret different with
2797 these messages. To do this, set the desired background colour with
2798 <code>SCI_SETCARETLINEBACK</code>, then use <code>SCI_SETCARETLINEVISIBLE(true)</code> to
2799 enable the effect. You can cancel the effect with <code>SCI_SETCARETLINEVISIBLE(false)</code>.
2800 The two <code>SCI_GETCARET*</code> functions return the state and the colour. This form of
2801 background colouring has highest priority when a line has markers that would otherwise change
2802 the background colour.
2803 The caret line may also be drawn translucently which allows other background colours to show
2804 through. This is done by setting the alpha (translucency) value by calling
2805 SCI_SETCARETLINEBACKALPHA. When the alpha is not SC_ALPHA_NOALPHA,
2806 the caret line is drawn after all other features so will affect the colour of all other features.
2807 </p>
2809 <p><b id="SCI_SETCARETLINEVISIBLEALWAYS">SCI_SETCARETLINEVISIBLEALWAYS(bool alwaysVisible)</b><br />
2810 <b id="SCI_GETCARETLINEVISIBLEALWAYS">SCI_GETCARETLINEVISIBLEALWAYS</b><br />
2811 Choose to make the caret line always visible even when the window is not in focus.
2812 Default behaviour <code>SCI_SETCARETLINEVISIBLEALWAYS(false)</code> the caret line is only visible when the window is in focus.
2813 </p>
2815 <p><b id="SCI_SETCARETPERIOD">SCI_SETCARETPERIOD(int milliseconds)</b><br />
2816 <b id="SCI_GETCARETPERIOD">SCI_GETCARETPERIOD</b><br />
2817 The rate at which the caret blinks can be set with <code>SCI_SETCARETPERIOD</code> which
2818 determines the time in milliseconds that the caret is visible or invisible before changing
2819 state. Setting the period to 0 stops the caret blinking. The default value is 500 milliseconds.
2820 <code>SCI_GETCARETPERIOD</code> returns the current setting.</p>
2822 <p><b id="SCI_SETCARETSTYLE">SCI_SETCARETSTYLE(int style)</b><br />
2823 <b id="SCI_GETCARETSTYLE">SCI_GETCARETSTYLE</b><br />
2824 The style of the caret can be set with <code>SCI_SETCARETSTYLE</code> to be a line caret
2825 (CARETSTYLE_LINE=1), a block caret (CARETSTYLE_BLOCK=2) or to not draw at all
2826 (CARETSTYLE_INVISIBLE=0). The default value is the line caret (CARETSTYLE_LINE=1).
2827 You can determine the current caret style setting using <code>SCI_GETCARETSTYLE</code>.</p>
2829 <p>The block character draws most combining and multibyte character sequences successfully,
2830 though some fonts like Thai Fonts (and possibly others) can sometimes appear strange when
2831 the cursor is positioned at these characters, which may result in only drawing a part of the
2832 cursor character sequence. This is most notable on Windows platforms.</p>
2834 <p><b id="SCI_SETCARETWIDTH">SCI_SETCARETWIDTH(int pixels)</b><br />
2835 <b id="SCI_GETCARETWIDTH">SCI_GETCARETWIDTH</b><br />
2836 The width of the line caret can be set with <code>SCI_SETCARETWIDTH</code> to a value of
2837 0, 1, 2 or 3 pixels. The default width is 1 pixel. You can read back the current width with
2838 <code>SCI_GETCARETWIDTH</code>. A width of 0 makes the caret invisible (added at version
2839 1.50), similar to setting the caret style to CARETSTYLE_INVISIBLE (though not interchangeable).
2840 This setting only affects the width of the cursor when the cursor style is set to line caret
2841 mode, it does not affect the width for a block caret.</p>
2843 <p><b id="SCI_SETHOTSPOTACTIVEFORE">SCI_SETHOTSPOTACTIVEFORE(bool useHotSpotForeColour, int <a class="jump"
2844 href="#colour">colour</a>)</b><br />
2845 <b id="SCI_GETHOTSPOTACTIVEFORE">SCI_GETHOTSPOTACTIVEFORE</b><br />
2846 <b id="SCI_SETHOTSPOTACTIVEBACK">SCI_SETHOTSPOTACTIVEBACK(bool useHotSpotBackColour, int <a class="jump"
2847 href="#colour">colour</a>)</b><br />
2848 <b id="SCI_GETHOTSPOTACTIVEBACK">SCI_GETHOTSPOTACTIVEBACK</b><br />
2849 <b id="SCI_SETHOTSPOTACTIVEUNDERLINE">SCI_SETHOTSPOTACTIVEUNDERLINE(bool underline)</b><br />
2850 <b id="SCI_GETHOTSPOTACTIVEUNDERLINE">SCI_GETHOTSPOTACTIVEUNDERLINE</b><br />
2851 <b id="SCI_SETHOTSPOTSINGLELINE">SCI_SETHOTSPOTSINGLELINE(bool singleLine)</b><br />
2852 <b id="SCI_GETHOTSPOTSINGLELINE">SCI_GETHOTSPOTSINGLELINE</b><br />
2853 While the cursor hovers over text in a style with the hotspot attribute set,
2854 the default colouring can be modified and an underline drawn with these settings.
2855 Single line mode stops a hotspot from wrapping onto next line.</p>
2857 <p><b id="SCI_SETCARETSTICKY">SCI_SETCARETSTICKY(int useCaretStickyBehaviour)</b><br />
2858 <b id="SCI_GETCARETSTICKY">SCI_GETCARETSTICKY</b><br />
2859 <b id="SCI_TOGGLECARETSTICKY">SCI_TOGGLECARETSTICKY</b><br />
2860 These messages set, get or toggle the caretSticky setting which controls when the last position
2861 of the caret on the line is saved.</p>
2863 <p>When set to <code>SC_CARETSTICKY_OFF</code> (0), the sticky flag is off; all text changes
2864 (and all caret position changes) will remember the
2865 caret's new horizontal position when moving to different lines. This is the default.</p>
2867 <p>When set to <code>SC_CARETSTICKY_ON</code> (1), the sticky flag is on, and the only thing which will cause the editor to remember the
2868 horizontal caret position is moving the caret with mouse or keyboard (left/right arrow keys, home/end keys, etc). </p>
2870 <p>When set to <code>SC_CARETSTICKY_WHITESPACE</code> (2), the caret acts like mode 0 (sticky off) except under one
2871 special case; when space or tab characters are inserted. (Including pasting <b>only space/tabs</b> -- undo, redo,
2872 etc. do not exhibit this behaviour..).</p>
2874 <p><code>SCI_TOGGLECARETSTICKY</code> switches from <code>SC_CARETSTICKY_ON</code> and <code>SC_CARETSTICKY_WHITESPACE</code>
2875 to <code>SC_CARETSTICKY_OFF</code> and from <code>SC_CARETSTICKY_OFF</code> to <code>SC_CARETSTICKY_ON</code>.</p>
2877 <h2 id="CharacterRepresentations">Character representations</h2>
2879 <p>Some characters, such as control characters and invalid bytes, do not have a visual glyph or use a glyph that is hard to distinguish.</p>
2881 <p>Control characters (characters with codes less than 32, or between 128 and 159 in some encodings)
2882 are displayed by Scintilla using their mnemonics inverted in a rounded rectangle. These mnemonics come from the
2883 early days of signalling, though some are still used (LF = Line Feed, BS = Back Space, CR =
2884 Carriage Return, for example).</p>
2886 <p>For the low 'C0' values: "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
2887 "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", "DLE", "DC1", "DC2", "DC3", "DC4", "NAK",
2888 "SYN", "ETB", "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US".</p>
2890 <p>For the high 'C1' values:
2891 "PAD", "HOP", "BPH", "NBH", "IND", "NEL", "SSA", "ESA",
2892 "HTS", "HTJ", "VTS", "PLD", "PLU", "RI", "SS2", "SS3",
2893 "DCS", "PU1", "PU2", "STS", "CCH", "MW", "SPA", "EPA",
2894 "SOS", "SGCI", "SCI", "CSI", "ST", "OSC", "PM", "APC".</p>
2896 <p>Invalid bytes are shown in a similar way with an 'x' followed by their value in hexadecimal, like "xFE".</p>
2898 <code>
2899 <a class="message" href="#SCI_SETREPRESENTATION">SCI_SETREPRESENTATION(const char *encodedCharacter, const char *representation)</a><br />
2900 <a class="message" href="#SCI_GETREPRESENTATION">SCI_GETREPRESENTATION(const char *encodedCharacter, char *representation)</a><br />
2901 <a class="message" href="#SCI_CLEARREPRESENTATION">SCI_CLEARREPRESENTATION(const char *encodedCharacter)</a><br />
2902 <a class="message" href="#SCI_SETCONTROLCHARSYMBOL">SCI_SETCONTROLCHARSYMBOL(int symbol)</a><br />
2903 <a class="message" href="#SCI_GETCONTROLCHARSYMBOL">SCI_GETCONTROLCHARSYMBOL</a><br />
2904 </code>
2906 <p><b id="SCI_SETREPRESENTATION">SCI_SETREPRESENTATION(const char *encodedCharacter, const char *representation)</b><br />
2907 <b id="SCI_GETREPRESENTATION">SCI_GETREPRESENTATION(const char *encodedCharacter, char *representation NUL-terminated)</b><br />
2908 <b id="SCI_CLEARREPRESENTATION">SCI_CLEARREPRESENTATION(const char *encodedCharacter)</b><br />
2909 Any character, including those normally displayed as mnemonics may be represented by a
2910 string inverted in a rounded rectangle.</p>
2912 <p>For example, the Ohm sign &#x2126; U+2126 looks very similar to the Greek Omega character &#x3a9; U+03C9 so,
2913 for the UTF-8 encoding, to distinguish the Ohm sign as "U+2126 &#x2126;" this call could be made:
2914 <code>SCI_SETREPRESENTATION("\xe2\x84\xa6", "U+2126 \xe2\x84\xa6")</code></p>
2916 <p>The encodedCharacter parameter is a NUL-terminated string of the bytes for one character in the
2917 current encoding. This can not be used to set a representation for multiple-character strings. </p>
2919 <p>The NUL (0) character is a special case since the encodedCharacter parameter is NUL terminated, the NUL
2920 character is specified as an empty string.</p>
2922 <p><b id="SCI_SETCONTROLCHARSYMBOL">SCI_SETCONTROLCHARSYMBOL(int symbol)</b><br />
2923 <b id="SCI_GETCONTROLCHARSYMBOL">SCI_GETCONTROLCHARSYMBOL</b><br />
2924 The mnemonics may be replaced by a nominated symbol with an ASCII code in the
2925 range 32 to 255. If you set a symbol value less than 32, all control characters are displayed
2926 as mnemonics. The symbol you set is rendered in the font of the style set for the character.
2927 You can read back the current symbol with the <code>SCI_GETCONTROLCHARSYMBOL</code> message.
2928 The default symbol value is 0.</p>
2930 <h2 id="Margins">Margins</h2>
2932 <p>There may be up to five margins, numbered 0 to <code>SC_MAX_MARGIN</code> (4)
2933 to the left of the text display, plus a gap either side of
2934 the text. Each margin can be set to display only symbols, line numbers, or text with <a
2935 class="message" href="#SCI_SETMARGINTYPEN"><code>SCI_SETMARGINTYPEN</code></a>.
2936 Textual margins may also display symbols.
2937 The markers
2938 that can be displayed in each margin are set with <a class="message"
2939 href="#SCI_SETMARGINMASKN"><code>SCI_SETMARGINMASKN</code></a>. Any markers not associated with
2940 a visible margin will be displayed as changes in background colour in the text. A width in
2941 pixels can be set for each margin. Margins with a zero width are ignored completely. You can
2942 choose if a mouse click in a margin sends a <a class="message"
2943 href="#SCN_MARGINCLICK"><code>SCN_MARGINCLICK</code></a> notification to the container or
2944 selects a line of text.</p>
2946 <p>The margins are numbered 0 to 4. Using a margin number outside the valid range has no
2947 effect. By default, margin 0 is set to display line numbers, but is given a width of 0, so it
2948 is hidden. Margin 1 is set to display non-folding symbols and is given a width of 16 pixels, so
2949 it is visible. Margin 2 is set to display the folding symbols, but is given a width of 0, so it
2950 is hidden. Of course, you can set the margins to be whatever you wish.</p>
2952 <p>Styled text margins used to show revision and blame information:</p>
2953 <p><img src="styledmargin.png" alt="Styled text margins used to show revision and blame information" /></p>
2955 <code><a class="message" href="#SCI_SETMARGINTYPEN">SCI_SETMARGINTYPEN(int margin, int
2956 type)</a><br />
2957 <a class="message" href="#SCI_GETMARGINTYPEN">SCI_GETMARGINTYPEN(int margin)</a><br />
2958 <a class="message" href="#SCI_SETMARGINWIDTHN">SCI_SETMARGINWIDTHN(int margin, int
2959 pixelWidth)</a><br />
2960 <a class="message" href="#SCI_GETMARGINWIDTHN">SCI_GETMARGINWIDTHN(int margin)</a><br />
2961 <a class="message" href="#SCI_SETMARGINMASKN">SCI_SETMARGINMASKN(int margin, int
2962 mask)</a><br />
2963 <a class="message" href="#SCI_GETMARGINMASKN">SCI_GETMARGINMASKN(int margin)</a><br />
2964 <a class="message" href="#SCI_SETMARGINSENSITIVEN">SCI_SETMARGINSENSITIVEN(int margin, bool
2965 sensitive)</a><br />
2966 <a class="message" href="#SCI_GETMARGINSENSITIVEN">SCI_GETMARGINSENSITIVEN(int
2967 margin)</a><br />
2968 <a class="message" href="#SCI_SETMARGINCURSORN">SCI_SETMARGINCURSORN(int margin, int
2969 cursor)</a><br />
2970 <a class="message" href="#SCI_GETMARGINCURSORN">SCI_GETMARGINCURSORN(int
2971 margin)</a><br />
2972 <a class="message" href="#SCI_SETMARGINLEFT">SCI_SETMARGINLEFT(&lt;unused&gt;, int
2973 pixels)</a><br />
2974 <a class="message" href="#SCI_GETMARGINLEFT">SCI_GETMARGINLEFT</a><br />
2975 <a class="message" href="#SCI_SETMARGINRIGHT">SCI_SETMARGINRIGHT(&lt;unused&gt;, int
2976 pixels)</a><br />
2977 <a class="message" href="#SCI_GETMARGINRIGHT">SCI_GETMARGINRIGHT</a><br />
2978 <a class="message" href="#SCI_SETFOLDMARGINCOLOUR">SCI_SETFOLDMARGINCOLOUR(bool useSetting, int colour)</a><br />
2979 <a class="message" href="#SCI_SETFOLDMARGINHICOLOUR">SCI_SETFOLDMARGINHICOLOUR(bool useSetting, int colour)</a><br />
2980 <a class="message" href="#SCI_MARGINSETTEXT">SCI_MARGINSETTEXT(int line, char *text)</a><br />
2981 <a class="message" href="#SCI_MARGINGETTEXT">SCI_MARGINGETTEXT(int line, char *text)</a><br />
2982 <a class="message" href="#SCI_MARGINSETSTYLE">SCI_MARGINSETSTYLE(int line, int style)</a><br />
2983 <a class="message" href="#SCI_MARGINGETSTYLE">SCI_MARGINGETSTYLE(int line)</a><br />
2984 <a class="message" href="#SCI_MARGINSETSTYLES">SCI_MARGINSETSTYLES(int line, char *styles)</a><br />
2985 <a class="message" href="#SCI_MARGINGETSTYLES">SCI_MARGINGETSTYLES(int line, char *styles)</a><br />
2986 <a class="message" href="#SCI_MARGINTEXTCLEARALL">SCI_MARGINTEXTCLEARALL</a><br />
2987 <a class="message" href="#SCI_MARGINSETSTYLEOFFSET">SCI_MARGINSETSTYLEOFFSET(int style)</a><br />
2988 <a class="message" href="#SCI_MARGINGETSTYLEOFFSET">SCI_MARGINGETSTYLEOFFSET</a><br />
2989 <a class="message" href="#SCI_SETMARGINOPTIONS">SCI_SETMARGINOPTIONS(int marginOptions)</a><br />
2990 <a class="message" href="#SCI_GETMARGINOPTIONS">SCI_GETMARGINOPTIONS</a><br />
2991 </code>
2993 <p><b id="SCI_SETMARGINTYPEN">SCI_SETMARGINTYPEN(int margin, int iType)</b><br />
2994 <b id="SCI_GETMARGINTYPEN">SCI_GETMARGINTYPEN(int margin)</b><br />
2995 These two routines set and get the type of a margin. The margin argument should be 0, 1, 2, 3 or 4.
2996 You can use the predefined constants <code>SC_MARGIN_SYMBOL</code> (0) and
2997 <code>SC_MARGIN_NUMBER</code> (1) to set a margin as either a line number or a symbol margin.
2998 A margin with application defined text may use <code>SC_MARGIN_TEXT</code> (4) or
2999 <code>SC_MARGIN_RTEXT</code> (5) to right justify the text.
3000 By convention, margin 0 is used for line numbers and the next two are used for symbols. You can
3001 also use the constants <code>SC_MARGIN_BACK</code> (2) and <code>SC_MARGIN_FORE</code> (3) for
3002 symbol margins that set their background colour to match the STYLE_DEFAULT background and
3003 foreground colours.</p>
3005 <p><b id="SCI_SETMARGINWIDTHN">SCI_SETMARGINWIDTHN(int margin, int pixelWidth)</b><br />
3006 <b id="SCI_GETMARGINWIDTHN">SCI_GETMARGINWIDTHN(int margin)</b><br />
3007 These routines set and get the width of a margin in pixels. A margin with zero width is
3008 invisible. By default, Scintilla sets margin 1 for symbols with a width of 16 pixels, so this
3009 is a reasonable guess if you are not sure what would be appropriate. Line number margins widths
3010 should take into account the number of lines in the document and the line number style. You
3011 could use something like <a class="message"
3012 href="#SCI_TEXTWIDTH"><code>SCI_TEXTWIDTH(STYLE_LINENUMBER, "_99999")</code></a> to get a
3013 suitable width.</p>
3015 <p><b id="SCI_SETMARGINMASKN">SCI_SETMARGINMASKN(int margin, int mask)</b><br />
3016 <b id="SCI_GETMARGINMASKN">SCI_GETMARGINMASKN(int margin)</b><br />
3017 The mask is a 32-bit value. Each bit corresponds to one of 32 logical symbols that can be
3018 displayed in a margin that is enabled for symbols. There is a useful constant,
3019 <code>SC_MASK_FOLDERS</code> (0xFE000000 or -33554432), that is a mask for the 7 logical
3020 symbols used to denote folding. You can assign a wide range of symbols and colours to each of
3021 the 32 logical symbols, see <a href="#Markers">Markers</a> for more information. If <code>(mask
3022 &amp; SC_MASK_FOLDERS)==0</code>, the margin background colour is controlled by style 33 (<a
3023 class="message" href="#StyleDefinition"><code>STYLE_LINENUMBER</code></a>).</p>
3025 <p>You add logical markers to a line with <a class="message"
3026 href="#SCI_MARKERADD"><code>SCI_MARKERADD</code></a>. If a line has an associated marker that
3027 does not appear in the mask of any margin with a non-zero width, the marker changes the
3028 background colour of the line. For example, suppose you decide to use logical marker 10 to mark
3029 lines with a syntax error and you want to show such lines by changing the background colour.
3030 The mask for this marker is 1 shifted left 10 times (1&lt;&lt;10) which is 0x400. If you make
3031 sure that no symbol margin includes 0x400 in its mask, any line with the marker gets the
3032 background colour changed.</p>
3034 <p>To set a non-folding margin 1 use <code>SCI_SETMARGINMASKN(1, ~SC_MASK_FOLDERS)</code>
3035 which is the default set by Scintilla.
3036 To set a folding margin 2 use <code>SCI_SETMARGINMASKN(2, SC_MASK_FOLDERS)</code>.
3037 <code>~SC_MASK_FOLDERS</code> is 0x1FFFFFF in hexadecimal or 33554431
3038 decimal. Of course, you may need to display all 32 symbols in a margin, in which case use
3039 <code>SCI_SETMARGINMASKN(margin, -1)</code>.</p>
3041 <p><b id="SCI_SETMARGINSENSITIVEN">SCI_SETMARGINSENSITIVEN(int margin, bool
3042 sensitive)</b><br />
3043 <b id="SCI_GETMARGINSENSITIVEN">SCI_GETMARGINSENSITIVEN(int margin)</b><br />
3044 Each of the five margins can be set sensitive or insensitive to mouse clicks. A click in a
3045 sensitive margin sends a <a class="message"
3046 href="#SCN_MARGINCLICK"><code>SCN_MARGINCLICK</code></a> <a class="jump"
3047 href="#Notifications">notification</a> to the container. Margins that are not sensitive act as
3048 selection margins which make it easy to select ranges of lines. By default, all margins are
3049 insensitive.</p>
3051 <p><b id="SCI_SETMARGINCURSORN">SCI_SETMARGINCURSORN(int margin, int
3052 cursor)</b><br />
3053 <b id="SCI_GETMARGINCURSORN">SCI_GETMARGINCURSORN(int margin)</b><br />
3054 A reversed arrow cursor is normally shown over all margins. This may be changed to a normal arrow with
3055 <code>SCI_SETMARGINCURSORN(margin, SC_CURSORARROW)</code> or restored to a
3056 reversed arrow with
3057 <code>SCI_SETMARGINCURSORN(margin, SC_CURSORREVERSEARROW)</code>.</p>
3059 <p><b id="SCI_SETMARGINLEFT">SCI_SETMARGINLEFT(&lt;unused&gt;, int pixels)</b><br />
3060 <b id="SCI_GETMARGINLEFT">SCI_GETMARGINLEFT</b><br />
3061 <b id="SCI_SETMARGINRIGHT">SCI_SETMARGINRIGHT(&lt;unused&gt;, int pixels)</b><br />
3062 <b id="SCI_GETMARGINRIGHT">SCI_GETMARGINRIGHT</b><br />
3063 These messages set and get the width of the blank margin on both sides of the text in pixels.
3064 The default is to one pixel on each side.</p>
3066 <p><b id="SCI_SETFOLDMARGINCOLOUR">SCI_SETFOLDMARGINCOLOUR(bool useSetting, int colour)</b><br />
3067 <b id="SCI_SETFOLDMARGINHICOLOUR">SCI_SETFOLDMARGINHICOLOUR(bool useSetting, int colour)</b><br />
3068 These messages allow changing the colour of the fold margin and fold margin highlight.
3069 On Windows the fold margin colour defaults to ::GetSysColor(COLOR_3DFACE) and the fold margin highlight
3070 colour to ::GetSysColor(COLOR_3DHIGHLIGHT).</p>
3073 <b id="SCI_MARGINSETTEXT">SCI_MARGINSETTEXT(int line, char *text)</b><br />
3074 <b id="SCI_MARGINGETTEXT">SCI_MARGINGETTEXT(int line, char *text)</b><br />
3075 <b id="SCI_MARGINSETSTYLE">SCI_MARGINSETSTYLE(int line, int style)</b><br />
3076 <b id="SCI_MARGINGETSTYLE">SCI_MARGINGETSTYLE(int line)</b><br />
3077 <b id="SCI_MARGINSETSTYLES">SCI_MARGINSETSTYLES(int line, char *styles)</b><br />
3078 <b id="SCI_MARGINGETSTYLES">SCI_MARGINGETSTYLES(int line, char *styles)</b><br />
3079 <b id="SCI_MARGINTEXTCLEARALL">SCI_MARGINTEXTCLEARALL</b><br />
3080 Text margins are created with the type SC_MARGIN_TEXT or SC_MARGIN_RTEXT.
3081 A different string may be set for each line with <code>SCI_MARGINSETTEXT</code>.
3082 The whole of the text margin on a line may be displayed in a particular style with
3083 <code>SCI_MARGINSETSTYLE</code> or each character may be individually styled with
3084 <code>SCI_MARGINSETSTYLES</code> which uses an array of bytes with each byte setting the style
3085 of the corresponding text byte similar to <code>SCI_SETSTYLINGEX</code>.
3086 Setting a text margin will cause a
3087 <a class="message" href="#SC_MOD_CHANGEMARGIN"><code>SC_MOD_CHANGEMARGIN</code></a>
3088 notification to be sent.
3089 </p>
3091 Only some style attributes are active in text margins: font, size/sizeFractional, bold/weight, italics, fore, back, and characterSet.
3092 </p>
3094 <b id="SCI_MARGINSETSTYLEOFFSET">SCI_MARGINSETSTYLEOFFSET(int style)</b><br />
3095 <b id="SCI_MARGINGETSTYLEOFFSET">SCI_MARGINGETSTYLEOFFSET</b><br />
3096 Margin styles may be completely separated from standard text styles by setting a style offset. For example,
3097 <code>SCI_MARGINSETSTYLEOFFSET(256)</code> would allow the margin styles to be numbered from
3098 256 up to 511 so they do not overlap styles set by lexers. Each style number set with <code>SCI_MARGINSETSTYLE</code>
3099 or <code>SCI_MARGINSETSTYLES</code> has the offset added before looking up the style.
3100 </p>
3102 Always call <a class="message" href="#SCI_ALLOCATEEXTENDEDSTYLES">SCI_ALLOCATEEXTENDEDSTYLES</a>
3103 before <code>SCI_MARGINSETSTYLEOFFSET</code> and use the result as the argument to <code>SCI_MARGINSETSTYLEOFFSET</code>.
3104 </p>
3106 <b id="SCI_SETMARGINOPTIONS">SCI_SETMARGINOPTIONS(int marginOptions)</b><br />
3107 <b id="SCI_GETMARGINOPTIONS">SCI_GETMARGINOPTIONS</b><br />
3108 Define margin options by enabling appropriate bit flags. At the moment, only one flag is available
3109 <code>SC_MARGINOPTION_SUBLINESELECT</code>=1, which controls how wrapped lines are selected when clicking
3110 on margin in front of them. If <code>SC_MARGINOPTION_SUBLINESELECT</code> is set only sub line of wrapped
3111 line is selected, otherwise whole wrapped line is selected. Margin options are set to
3112 <code>SC_MARGINOPTION_NONE</code>=0 by default.
3113 </p>
3115 <h2 id="Annotations">Annotations</h2>
3117 <p>Annotations are read-only lines of text underneath each line of editable text.
3118 An annotation may consist of multiple lines separated by '\n'.
3119 Annotations can be used to display an assembler version of code for debugging or to show diagnostic messages inline or to
3120 line up different versions of text in a merge tool.</p>
3121 <p>Annotations count as display lines for the methods
3122 <a class="message" href="#SCI_VISIBLEFROMDOCLINE"><code>SCI_VISIBLEFROMDOCLINE</code></a> and
3123 <a class="message" href="#SCI_DOCLINEFROMVISIBLE"><code>SCI_DOCLINEFROMVISIBLE</code></a></p>
3124 <p>Annotations used for inline diagnostics:</p>
3125 <p><img src="annotations.png" alt="Annotations used for inline diagnostics" /></p>
3127 <code>
3128 <a class="message" href="#SCI_ANNOTATIONSETTEXT">SCI_ANNOTATIONSETTEXT(int line, char *text)</a><br />
3129 <a class="message" href="#SCI_ANNOTATIONGETTEXT">SCI_ANNOTATIONGETTEXT(int line, char *text)</a><br />
3130 <a class="message" href="#SCI_ANNOTATIONSETSTYLE">SCI_ANNOTATIONSETSTYLE(int line, int style)</a><br />
3131 <a class="message" href="#SCI_ANNOTATIONGETSTYLE">SCI_ANNOTATIONGETSTYLE(int line)</a><br />
3132 <a class="message" href="#SCI_ANNOTATIONSETSTYLES">SCI_ANNOTATIONSETSTYLES(int line, char *styles)</a><br />
3133 <a class="message" href="#SCI_ANNOTATIONGETSTYLES">SCI_ANNOTATIONGETSTYLES(int line, char *styles)</a><br />
3134 <a class="message" href="#SCI_ANNOTATIONGETLINES">SCI_ANNOTATIONGETLINES(int line)</a><br />
3135 <a class="message" href="#SCI_ANNOTATIONCLEARALL">SCI_ANNOTATIONCLEARALL</a><br />
3136 <a class="message" href="#SCI_ANNOTATIONSETVISIBLE">SCI_ANNOTATIONSETVISIBLE(int visible)</a><br />
3137 <a class="message" href="#SCI_ANNOTATIONGETVISIBLE">SCI_ANNOTATIONGETVISIBLE</a><br />
3138 <a class="message" href="#SCI_ANNOTATIONSETSTYLEOFFSET">SCI_ANNOTATIONSETSTYLEOFFSET(int style)</a><br />
3139 <a class="message" href="#SCI_ANNOTATIONGETSTYLEOFFSET">SCI_ANNOTATIONGETSTYLEOFFSET</a><br />
3140 </code>
3143 <b id="SCI_ANNOTATIONSETTEXT">SCI_ANNOTATIONSETTEXT(int line, char *text)</b><br />
3144 <b id="SCI_ANNOTATIONGETTEXT">SCI_ANNOTATIONGETTEXT(int line, char *text)</b><br />
3145 <b id="SCI_ANNOTATIONSETSTYLE">SCI_ANNOTATIONSETSTYLE(int line, int style)</b><br />
3146 <b id="SCI_ANNOTATIONGETSTYLE">SCI_ANNOTATIONGETSTYLE(int line)</b><br />
3147 <b id="SCI_ANNOTATIONSETSTYLES">SCI_ANNOTATIONSETSTYLES(int line, char *styles)</b><br />
3148 <b id="SCI_ANNOTATIONGETSTYLES">SCI_ANNOTATIONGETSTYLES(int line, char *styles)</b><br />
3149 <b id="SCI_ANNOTATIONGETLINES">SCI_ANNOTATIONGETLINES(int line)</b><br />
3150 <b id="SCI_ANNOTATIONCLEARALL">SCI_ANNOTATIONCLEARALL</b><br />
3151 A different string may be set for each line with <code>SCI_ANNOTATIONSETTEXT</code>.
3152 To clear annotations call <code>SCI_ANNOTATIONSETTEXT</code> with a NULL pointer.
3153 The whole of the text ANNOTATION on a line may be displayed in a particular style with
3154 <code>SCI_ANNOTATIONSETSTYLE</code> or each character may be individually styled with
3155 <code>SCI_ANNOTATIONSETSTYLES</code> which uses an array of bytes with each byte setting the style
3156 of the corresponding text byte similar to <code>SCI_SETSTYLINGEX</code>. The text must be set first as it
3157 specifies how long the annotation is so how many bytes of styling to read.
3158 Setting an annotation will cause a
3159 <a class="message" href="#SC_MOD_CHANGEANNOTATION"><code>SC_MOD_CHANGEANNOTATION</code></a>
3160 notification to be sent.
3161 </p>
3163 The number of lines annotating a line can be retrieved with <code>SCI_ANNOTATIONGETLINES</code>.
3164 All the lines can be cleared of annotations with <code>SCI_ANNOTATIONCLEARALL</code>
3165 which is equivalent to clearing each line (setting to 0) and then deleting other memory used for this feature.
3166 </p>
3168 Only some style attributes are active in annotations: font, size/sizeFractional, bold/weight, italics, fore, back, and characterSet.
3169 </p>
3171 <b id="SCI_ANNOTATIONSETVISIBLE">SCI_ANNOTATIONSETVISIBLE(int visible)</b><br />
3172 <b id="SCI_ANNOTATIONGETVISIBLE">SCI_ANNOTATIONGETVISIBLE</b><br />
3173 Annotations can be made visible in a view and there is a choice of display style when visible.
3174 The two messages set and get the annotation display mode. The <code>visible</code>
3175 argument can be one of:</p>
3177 <table cellpadding="1" cellspacing="2" border="0" summary="Annotation visibility">
3178 <tbody valign="top">
3179 <tr>
3180 <th align="left"><code>ANNOTATION_HIDDEN</code></th>
3182 <td>0</td>
3184 <td>Annotations are not displayed.</td>
3185 </tr>
3187 <tr>
3188 <th align="left"><code>ANNOTATION_STANDARD</code></th>
3190 <td>1</td>
3192 <td>Annotations are drawn left justified with no adornment.</td>
3193 </tr>
3195 <tr>
3196 <th align="left"><code>ANNOTATION_BOXED</code></th>
3198 <td>2</td>
3200 <td>Annotations are indented to match the text and are surrounded by a box.</td>
3201 </tr>
3203 <tr>
3204 <th align="left"><code>ANNOTATION_INDENTED</code></th>
3206 <td>3</td>
3208 <td>Annotations are indented to match the text.</td>
3209 </tr>
3210 </tbody>
3211 </table>
3214 <b id="SCI_ANNOTATIONSETSTYLEOFFSET">SCI_ANNOTATIONSETSTYLEOFFSET(int style)</b><br />
3215 <b id="SCI_ANNOTATIONGETSTYLEOFFSET">SCI_ANNOTATIONGETSTYLEOFFSET</b><br />
3216 Annotation styles may be completely separated from standard text styles by setting a style offset. For example,
3217 <code>SCI_ANNOTATIONSETSTYLEOFFSET(512)</code> would allow the annotation styles to be numbered from
3218 512 up to 767 so they do not overlap styles set by lexers (or margins if margins offset is 256).
3219 Each style number set with <code>SCI_ANNOTATIONSETSTYLE</code>
3220 or <code>SCI_ANNOTATIONSETSTYLES</code> has the offset added before looking up the style.
3221 </p>
3223 Always call <a class="message" href="#SCI_ALLOCATEEXTENDEDSTYLES">SCI_ALLOCATEEXTENDEDSTYLES</a>
3224 before <code>SCI_ANNOTATIONSETSTYLEOFFSET</code> and use the result as the argument to <code>SCI_ANNOTATIONSETSTYLEOFFSET</code>.
3225 </p>
3227 <h2 id="OtherSettings">Other settings</h2>
3228 <code>
3229 <a class="message" href="#SCI_SETBUFFEREDDRAW">SCI_SETBUFFEREDDRAW(bool isBuffered)</a><br />
3230 <a class="message" href="#SCI_GETBUFFEREDDRAW">SCI_GETBUFFEREDDRAW</a><br />
3231 <a class="message" href="#SCI_SETPHASESDRAW">SCI_SETPHASESDRAW(int phases)</a><br />
3232 <a class="message" href="#SCI_GETPHASESDRAW">SCI_GETPHASESDRAW</a><br />
3233 <a class="message" href="#SCI_SETTWOPHASEDRAW">SCI_SETTWOPHASEDRAW(bool twoPhase)</a><br />
3234 <a class="message" href="#SCI_GETTWOPHASEDRAW">SCI_GETTWOPHASEDRAW</a><br />
3235 <a class="message" href="#SCI_SETTECHNOLOGY">SCI_SETTECHNOLOGY(int technology)</a><br />
3236 <a class="message" href="#SCI_GETTECHNOLOGY">SCI_GETTECHNOLOGY</a><br />
3237 <a class="message" href="#SCI_SETFONTQUALITY">SCI_SETFONTQUALITY(int fontQuality)</a><br />
3238 <a class="message" href="#SCI_GETFONTQUALITY">SCI_GETFONTQUALITY</a><br />
3239 <a class="message" href="#SCI_SETCODEPAGE">SCI_SETCODEPAGE(int codePage)</a><br />
3240 <a class="message" href="#SCI_GETCODEPAGE">SCI_GETCODEPAGE</a><br />
3241 <a class="message" href="#SCI_SETIMEINTERACTION">SCI_SETIMEINTERACTION(int imeInteraction)</a><br />
3242 <a class="message" href="#SCI_GETIMEINTERACTION">SCI_GETIMEINTERACTION</a><br />
3243 <a class="message" href="#SCI_SETWORDCHARS">SCI_SETWORDCHARS(&lt;unused&gt;, const char *characters)</a><br />
3244 <a class="message" href="#SCI_GETWORDCHARS">SCI_GETWORDCHARS(&lt;unused&gt;, char *characters)</a><br />
3245 <a class="message" href="#SCI_SETWHITESPACECHARS">SCI_SETWHITESPACECHARS(&lt;unused&gt;, const char *characters)</a><br />
3246 <a class="message" href="#SCI_GETWHITESPACECHARS">SCI_GETWHITESPACECHARS(&lt;unused&gt;, char *characters)</a><br />
3247 <a class="message" href="#SCI_SETPUNCTUATIONCHARS">SCI_SETPUNCTUATIONCHARS(&lt;unused&gt;, const char *characters)</a><br />
3248 <a class="message" href="#SCI_GETPUNCTUATIONCHARS">SCI_GETPUNCTUATIONCHARS(&lt;unused&gt;, char *characters)</a><br />
3249 <a class="message" href="#SCI_SETCHARSDEFAULT">SCI_SETCHARSDEFAULT</a><br />
3250 <a class="message" href="#SCI_GRABFOCUS">SCI_GRABFOCUS</a><br />
3251 <a class="message" href="#SCI_SETFOCUS">SCI_SETFOCUS(bool focus)</a><br />
3252 <a class="message" href="#SCI_GETFOCUS">SCI_GETFOCUS</a><br />
3253 </code>
3255 <p>To forward a message <code>(WM_XXXX, WPARAM, LPARAM)</code> to Scintilla, you can use
3256 <code>SendMessage(hScintilla, WM_XXXX, WPARAM, LPARAM)</code> where <code>hScintilla</code> is
3257 the handle to the Scintilla window you created as your editor.</p>
3259 <p>While we are on the subject of forwarding messages in Windows, the top level window should
3260 forward any <code>WM_SETTINGCHANGE</code> messages to Scintilla (this is currently used to
3261 collect changes to mouse settings, but could be used for other user interface items in the
3262 future).</p>
3264 <p><b id="SCI_SETBUFFEREDDRAW">SCI_SETBUFFEREDDRAW(bool isBuffered)</b><br />
3265 <b id="SCI_GETBUFFEREDDRAW">SCI_GETBUFFEREDDRAW</b><br />
3266 These messages turn buffered drawing on or off and report the buffered drawing state. Buffered
3267 drawing draws each line into a bitmap rather than directly to the screen and then copies the
3268 bitmap to the screen. This avoids flickering although it does take longer. The default is for
3269 drawing to be buffered.</p>
3271 <p><b id="SCI_SETPHASESDRAW">SCI_SETPHASESDRAW(int phases)</b><br />
3272 <b id="SCI_GETPHASESDRAW">SCI_GETPHASESDRAW</b><br />
3273 There are several orders in which the text area may be drawn offering a trade-off between speed
3274 and allowing all pixels of text to be seen even when they overlap other elements.</p>
3275 <p>In single phase drawing (<code>SC_PHASES_ONE</code>) each
3276 run of characters in one style is drawn along with its background.
3277 If a character overhangs the end of a run, such as in "<i>V</i>_" where the
3278 "<i>V</i>" is in a different style from the "_", then this can cause the right hand
3279 side of the "<i>V</i>" to be overdrawn by the background of the "_" which
3280 cuts it off.</p>
3281 <p>Two phase drawing (<code>SC_PHASES_TWO</code>)
3282 fixes this by drawing all the backgrounds of a line first and then drawing the text
3283 in transparent mode. Lines are drawn separately and no line will overlap another
3284 so any pixels that overlap into another line such as extreme ascenders and
3285 descenders on characters will be cut off.
3286 Two phase drawing may flicker more than single phase
3287 unless buffered drawing is on or the platform is naturally buffered.
3288 The default is for drawing to be two phase.</p>
3289 <p>Multiple phase drawing (<code>SC_PHASES_MULTIPLE</code>)
3290 draws the whole area multiple times, once for each feature, building up the
3291 the appearance in layers or phases. The coloured backgrounds for all lines are
3292 drawn before any text and then all the text is drawn in transparent mode over this
3293 combined background without clipping text to the line boundaries. This allows
3294 extreme ascenders and descenders to overflow into the adjacent lines.
3295 This mode is incompatible with buffered drawing and will act as <code>SC_PHASES_TWO</code>
3296 if buffered drawing is turned on.
3297 Multiple phase drawing is slower than two phase drawing.
3298 Setting the layout cache to <a class="message" href="#SCI_SETLAYOUTCACHE">SC_CACHE_PAGE</a>
3299 or higher can ensure that multiple phase drawing is not significantly slower.</p>
3301 <p><b id="SCI_SETTWOPHASEDRAW">SCI_SETTWOPHASEDRAW(bool twoPhase)</b><br />
3302 <b id="SCI_GETTWOPHASEDRAW">SCI_GETTWOPHASEDRAW</b><br />
3303 This property has been replaced with the preceding PHASESDRAW property which is more general,
3304 allowing multiple phase drawing as well as one and two phase drawing.</p>
3306 <p><b id="SCI_SETTECHNOLOGY">SCI_SETTECHNOLOGY(int technology)</b><br />
3307 <b id="SCI_GETTECHNOLOGY">SCI_GETTECHNOLOGY</b><br />
3308 The technology property allows choosing between different drawing APIs and options.
3309 On most platforms, the only choice is <code>SC_TECHNOLOGY_DEFAULT</code> (0).
3310 On Windows Vista or later, <code>SC_TECHNOLOGY_DIRECTWRITE</code> (1),
3311 <code class="provisional">SC_TECHNOLOGY_DIRECTWRITERETAIN</code> (2), or
3312 <code class="provisional">SC_TECHNOLOGY_DIRECTWRITEDC</code> (3)
3313 can be chosen to use the Direct2D and DirectWrite APIs for higher quality antialiased drawing.
3314 <code class="provisional">SC_TECHNOLOGY_DIRECTWRITERETAIN</code> differs from
3315 <code>SC_TECHNOLOGY_DIRECTWRITE</code> by requesting that the frame
3316 is retained after being presented which may prevent drawing failures on some cards and drivers.
3317 <code class="provisional">SC_TECHNOLOGY_DIRECTWRITEDC</code> differs from
3318 <code>SC_TECHNOLOGY_DIRECTWRITE</code> by using DirectWrite to draw into a GDI DC.
3319 Since Direct2D buffers drawing, Scintilla's buffering can be turned off with
3320 <code>SCI_SETBUFFEREDDRAW(0)</code>.
3321 <span class="provisional">Since <code>SC_TECHNOLOGY_DIRECTWRITERETAIN</code> and
3322 <code>SC_TECHNOLOGY_DIRECTWRITEDC</code>
3323 are provisional, they may be changed or removed in a future release if a better solution is found.</span></p>
3325 <p><b id="SCI_SETFONTQUALITY">SCI_SETFONTQUALITY(int fontQuality)</b><br />
3326 <b id="SCI_GETFONTQUALITY">SCI_GETFONTQUALITY</b><br />
3327 Manage font quality (antialiasing method). Currently, the following values are available on Windows:
3328 <code>SC_EFF_QUALITY_DEFAULT</code> (backward compatible),
3329 <code>SC_EFF_QUALITY_NON_ANTIALIASED</code>,
3330 <code>SC_EFF_QUALITY_ANTIALIASED</code>,
3331 <code>SC_EFF_QUALITY_LCD_OPTIMIZED</code>.</p>
3332 <p>In case it is necessary to squeeze more options into this property, only a limited number of bits defined
3333 by SC_EFF_QUALITY_MASK (0xf) will be used for quality.</p>
3335 <p><b id="SCI_SETCODEPAGE">SCI_SETCODEPAGE(int codePage)</b><br />
3336 <b id="SCI_GETCODEPAGE">SCI_GETCODEPAGE</b><br />
3337 Scintilla has some support for Japanese, Chinese and Korean DBCS. Use this message with
3338 <code>codePage</code> set to the code page number to set Scintilla to use code page information
3339 to ensure double byte characters are treated as one character rather than two. This also stops
3340 the caret from moving between the two bytes in a double byte character.
3341 Do not use this message to choose between different single byte character sets: it doesn't do that.
3342 Call with
3343 <code>codePage</code> set to zero to disable DBCS support. The default is
3344 <code>SCI_SETCODEPAGE(0)</code>.</p>
3346 <p>Code page <code>SC_CP_UTF8</code> (65001) sets Scintilla into Unicode mode with the document
3347 treated as a sequence of characters expressed in UTF-8. The text is converted to the platform's
3348 normal Unicode encoding before being drawn by the OS and thus can display Hebrew, Arabic,
3349 Cyrillic, and Han characters. Languages which can use two characters stacked vertically in one
3350 horizontal space, such as Thai, will mostly work but there are some issues where the characters
3351 are drawn separately leading to visual glitches. Bi-directional text is not supported. </p>
3353 <p>Code page can be set to 932 (Japanese Shift-JIS), 936 (Simplified Chinese GBK),
3354 949 (Korean Unified Hangul Code), 950 (Traditional Chinese Big5), or 1361 (Korean Johab)
3355 although these may require installation of language specific support.</p>
3357 <p><b id="SCI_SETIMEINTERACTION">SCI_SETIMEINTERACTION(int imeInteraction)</b><br />
3358 <b id="SCI_GETIMEINTERACTION">SCI_GETIMEINTERACTION</b><br />
3359 When entering text in Chinese, Japanese, or Korean an Input Method Editor (IME) may be displayed.
3360 The IME may be an extra window appearing above Scintilla or may be displayed by Scintilla itself
3361 as text. On some platforms there is a choice between the two techniques.
3362 A windowed IME <code>SC_IME_WINDOWED</code> (0) may be more similar in appearance and
3363 behaviour to the IME in other applications.
3364 An inline IME <code>SC_IME_INLINE</code> (1) may work better with some Scintilla features such as
3365 rectangular and multiple selection.</p>
3366 <p>The windowed behaviour can be chosen with <code>SCI_SETIMEINTERACTION(SC_IME_WINDOWED)</code>
3367 and the inline behaviour with <code>SCI_SETIMEINTERACTION(SC_IME_INLINE)</code>.
3368 Scintilla may ignore this call in some cases. For example, the inline behaviour might only be supported for some languages.</p>
3370 <p><b id="SCI_SETWORDCHARS">SCI_SETWORDCHARS(&lt;unused&gt;, const char *characters)</b><br />
3371 Scintilla has several functions that operate on words, which are defined to be contiguous
3372 sequences of characters from a particular set of characters. This message defines which
3373 characters are members of that set. The character sets are set to default values before processing this
3374 function.
3375 For example, if you don't allow '_' in your set of characters
3376 use:<br />
3377 <code>SCI_SETWORDCHARS(0, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")</code>;</p>
3379 <p><b id="SCI_GETWORDCHARS">SCI_GETWORDCHARS(&lt;unused&gt;, char *characters)</b><br />
3380 This fills the characters parameter with all the characters included in words.
3381 The characters parameter must be large enough to hold all of the characters.
3382 If the characters parameter is 0 then the length that should be allocated
3383 to store the entire set is returned.</p>
3385 <p><b id="SCI_SETWHITESPACECHARS">SCI_SETWHITESPACECHARS(&lt;unused&gt;, const char *characters)</b><br />
3386 <b id="SCI_GETWHITESPACECHARS">SCI_GETWHITESPACECHARS(&lt;unused&gt;, char *characters)</b><br />
3387 Similar to <code>SCI_SETWORDCHARS</code>, this message allows the user to define which chars Scintilla considers
3388 as whitespace. Setting the whitespace chars allows the user to fine-tune Scintilla's behaviour doing
3389 such things as moving the cursor to the start or end of a word; for example, by defining punctuation chars
3390 as whitespace, they will be skipped over when the user presses ctrl+left or ctrl+right.
3391 This function should be called after <code>SCI_SETWORDCHARS</code> as it will
3392 reset the whitespace characters to the default set.
3393 <code>SCI_GETWHITESPACECHARS</code> behaves similarly to <code>SCI_GETWORDCHARS</code>.</p>
3395 <p><b id="SCI_SETPUNCTUATIONCHARS">SCI_SETPUNCTUATIONCHARS(&lt;unused&gt;, const char *characters)</b><br />
3396 <b id="SCI_GETPUNCTUATIONCHARS">SCI_GETPUNCTUATIONCHARS(&lt;unused&gt;, char *characters)</b><br />
3397 Similar to <code>SCI_SETWORDCHARS</code> and <code>SCI_SETWHITESPACECHARS</code>, this message
3398 allows the user to define which chars Scintilla considers as punctuation.
3399 <code>SCI_GETPUNCTUATIONCHARS</code> behaves similarly to <code>SCI_GETWORDCHARS</code>.</p>
3401 <p><b id="SCI_SETCHARSDEFAULT">SCI_SETCHARSDEFAULT</b><br />
3402 Use the default sets of word and whitespace characters. This sets whitespace to space, tab and other
3403 characters with codes less than 0x20, with word characters set to alphanumeric and '_'.
3404 </p>
3407 <p><b id="SCI_GRABFOCUS">SCI_GRABFOCUS</b><br />
3408 <b id="SCI_SETFOCUS">SCI_SETFOCUS(bool focus)</b><br />
3409 <b id="SCI_GETFOCUS">SCI_GETFOCUS</b><br />
3410 Scintilla can be told to grab the focus with this message. This is needed more on GTK+ where
3411 focus handling is more complicated than on Windows.</p>
3413 <p>The internal focus flag can be set with <code>SCI_SETFOCUS</code>. This is used by clients
3414 that have complex focus requirements such as having their own window that gets the real focus
3415 but with the need to indicate that Scintilla has the logical focus.</p>
3417 <h2 id="BraceHighlighting">Brace highlighting</h2>
3418 <code><a class="message" href="#SCI_BRACEHIGHLIGHT">SCI_BRACEHIGHLIGHT(int pos1, int
3419 pos2)</a><br />
3420 <a class="message" href="#SCI_BRACEBADLIGHT">SCI_BRACEBADLIGHT(int pos1)</a><br />
3421 <a class="message" href="#SCI_BRACEHIGHLIGHTINDICATOR">SCI_BRACEHIGHLIGHTINDICATOR(bool useBraceHighlightIndicator, int indicatorNumber)</a><br />
3422 <a class="message" href="#SCI_BRACEBADLIGHTINDICATOR">SCI_BRACEBADLIGHTINDICATOR(bool useBraceBadLightIndicator, int indicatorNumber)</a><br />
3423 <a class="message" href="#SCI_BRACEMATCH">SCI_BRACEMATCH(int position, int
3424 maxReStyle)</a><br />
3425 </code>
3427 <p><b id="SCI_BRACEHIGHLIGHT">SCI_BRACEHIGHLIGHT(int pos1, int pos2)</b><br />
3428 Up to two characters can be highlighted in a 'brace highlighting style', which is defined as
3429 style number <a class="message" href="#StyleDefinition"><code>STYLE_BRACELIGHT</code></a> (34).
3430 If you have enabled indent guides, you may also wish to highlight the indent that corresponds
3431 with the brace. You can locate the column with <a class="message"
3432 href="#SCI_GETCOLUMN"><code>SCI_GETCOLUMN</code></a> and highlight the indent with <a
3433 class="message" href="#SCI_SETHIGHLIGHTGUIDE"><code>SCI_SETHIGHLIGHTGUIDE</code></a>.</p>
3435 <p><b id="SCI_BRACEBADLIGHT">SCI_BRACEBADLIGHT(int pos1)</b><br />
3436 If there is no matching brace then the <a class="jump" href="#StyleDefinition">brace
3437 badlighting style</a>, style <code>STYLE_BRACEBAD</code> (35), can be used to show the brace
3438 that is unmatched. Using a position of <code>INVALID_POSITION</code> (-1) removes the
3439 highlight.</p>
3441 <p><b id="SCI_BRACEHIGHLIGHTINDICATOR">SCI_BRACEHIGHLIGHTINDICATOR(bool useBraceHighlightIndicator, int indicatorNumber)</b><br />
3442 Use specified indicator to highlight matching braces instead of changing their style.</p>
3444 <p><b id="SCI_BRACEBADLIGHTINDICATOR">SCI_BRACEBADLIGHTINDICATOR(bool useBraceBadLightIndicator, int indicatorNumber)</b><br />
3445 Use specified indicator to highlight non matching brace instead of changing its style.</p>
3447 <p><b id="SCI_BRACEMATCH">SCI_BRACEMATCH(int pos, int maxReStyle)</b><br />
3448 The <code>SCI_BRACEMATCH</code> message finds a corresponding matching brace given
3449 <code>pos</code>, the position of one brace. The brace characters handled are '(', ')', '[',
3450 ']', '{', '}', '&lt;', and '&gt;'. The search is forwards from an opening brace and backwards
3451 from a closing brace. If the character at position is not a brace character, or a matching
3452 brace cannot be found, the return value is -1. Otherwise, the return value is the position of
3453 the matching brace.</p>
3455 <p>A match only occurs if the style of the matching brace is the same as the starting brace or
3456 the matching brace is beyond the end of styling. Nested braces are handled correctly. The
3457 <code>maxReStyle</code> parameter must currently be 0 - it may be used in the future to limit
3458 the length of brace searches.</p>
3460 <h2 id="TabsAndIndentationGuides">Tabs and Indentation Guides</h2>
3462 <p>Indentation (the white space at the start of a line) is often used by programmers to clarify
3463 program structure and in some languages, for example Python, it may be part of the language
3464 syntax. Tabs are normally used in editors to insert a tab character or to pad text with spaces
3465 up to the next tab.</p>
3467 <p>When Scintilla is laying out a section of text, text after a tab character will usually be
3468 displayed at the next multiple of TABWIDTH columns from the left. However, it is also possible
3469 to explicitly set tabstops in pixels for each line.</p>
3471 <p>Scintilla can be set to treat tab and backspace in the white space at the start of a line in
3472 a special way: inserting a tab indents the line to the next indent position rather than just
3473 inserting a tab at the current character position and backspace unindents the line rather than
3474 deleting a character. Scintilla can also display indentation guides (vertical lines) to help
3475 you to generate code.</p>
3476 <code><a class="message" href="#SCI_SETTABWIDTH">SCI_SETTABWIDTH(int widthInChars)</a><br />
3477 <a class="message" href="#SCI_GETTABWIDTH">SCI_GETTABWIDTH</a><br />
3478 <a class="message" href="#SCI_CLEARTABSTOPS">SCI_CLEARTABSTOPS(int line)</a><br />
3479 <a class="message" href="#SCI_ADDTABSTOP">SCI_ADDTABSTOP(int line, int x)</a><br />
3480 <a class="message" href="#SCI_GETNEXTTABSTOP">SCI_GETNEXTTABSTOP(int line, int x)</a><br />
3481 <a class="message" href="#SCI_SETUSETABS">SCI_SETUSETABS(bool useTabs)</a><br />
3482 <a class="message" href="#SCI_GETUSETABS">SCI_GETUSETABS</a><br />
3483 <a class="message" href="#SCI_SETINDENT">SCI_SETINDENT(int widthInChars)</a><br />
3484 <a class="message" href="#SCI_GETINDENT">SCI_GETINDENT</a><br />
3485 <a class="message" href="#SCI_SETTABINDENTS">SCI_SETTABINDENTS(bool tabIndents)</a><br />
3486 <a class="message" href="#SCI_GETTABINDENTS">SCI_GETTABINDENTS</a><br />
3487 <a class="message" href="#SCI_SETBACKSPACEUNINDENTS">SCI_SETBACKSPACEUNINDENTS(bool
3488 bsUnIndents)</a><br />
3489 <a class="message" href="#SCI_GETBACKSPACEUNINDENTS">SCI_GETBACKSPACEUNINDENTS</a><br />
3490 <a class="message" href="#SCI_SETLINEINDENTATION">SCI_SETLINEINDENTATION(int line, int
3491 indentation)</a><br />
3492 <a class="message" href="#SCI_GETLINEINDENTATION">SCI_GETLINEINDENTATION(int line)</a><br />
3493 <a class="message" href="#SCI_GETLINEINDENTPOSITION">SCI_GETLINEINDENTPOSITION(int
3494 line)</a><br />
3495 <a class="message" href="#SCI_SETINDENTATIONGUIDES">SCI_SETINDENTATIONGUIDES(int indentView)</a><br />
3496 <a class="message" href="#SCI_GETINDENTATIONGUIDES">SCI_GETINDENTATIONGUIDES</a><br />
3497 <a class="message" href="#SCI_SETHIGHLIGHTGUIDE">SCI_SETHIGHLIGHTGUIDE(int column)</a><br />
3498 <a class="message" href="#SCI_GETHIGHLIGHTGUIDE">SCI_GETHIGHLIGHTGUIDE</a><br />
3499 </code>
3501 <p><b id="SCI_SETTABWIDTH">SCI_SETTABWIDTH(int widthInChars)</b><br />
3502 <b id="SCI_GETTABWIDTH">SCI_GETTABWIDTH</b><br />
3503 <code>SCI_SETTABWIDTH</code> sets the size of a tab as a multiple of the size of a space
3504 character in <code>STYLE_DEFAULT</code>. The default tab width is 8 characters. There are no
3505 limits on tab sizes, but values less than 1 or large values may have undesirable effects.</p>
3507 <p><b id="SCI_CLEARTABSTOPS">SCI_CLEARTABSTOPS(int line)</b><br />
3508 <b id="SCI_ADDTABSTOP">SCI_ADDTABSTOP(int line, int x)</b><br />
3509 <b id="SCI_GETNEXTTABSTOP">SCI_GETNEXTTABSTOP(int line, int x)</b><br />
3510 <code>SCI_CLEARTABSTOPS</code> clears explicit tabstops on a line. <code>SCI_ADDTABSTOP</code>
3511 adds an explicit tabstop at the specified distance from the left (in pixels), and
3512 <code>SCI_GETNEXTTABSTOP</code> gets the next explicit tabstop position set after the given x position,
3513 or zero if there aren't any.
3514 Changing tab stops produces a <a class="message" href="#SC_MOD_CHANGETABSTOPS">SC_MOD_CHANGETABSTOPS</a> notification.
3515 </p>
3517 <p><b id="SCI_SETUSETABS">SCI_SETUSETABS(bool useTabs)</b><br />
3518 <b id="SCI_GETUSETABS">SCI_GETUSETABS</b><br />
3519 <code>SCI_SETUSETABS</code> determines whether indentation should be created out of a mixture
3520 of tabs and spaces or be based purely on spaces. Set <code>useTabs</code> to <code>false</code>
3521 (0) to create all tabs and indents out of spaces. The default is <code>true</code>. You can use
3522 <a class="message" href="#SCI_GETCOLUMN"><code>SCI_GETCOLUMN</code></a> to get the column of a
3523 position taking the width of a tab into account.</p>
3524 <p><b id="SCI_SETINDENT">SCI_SETINDENT(int widthInChars)</b><br />
3525 <b id="SCI_GETINDENT">SCI_GETINDENT</b><br />
3526 <code>SCI_SETINDENT</code> sets the size of indentation in terms of the width of a space in <a
3527 class="message" href="#StyleDefinition"><code>STYLE_DEFAULT</code></a>. If you set a width of
3528 0, the indent size is the same as the tab size. There are no limits on indent sizes, but values
3529 less than 0 or large values may have undesirable effects.
3530 </p>
3532 <p><b id="SCI_SETTABINDENTS">SCI_SETTABINDENTS(bool tabIndents)</b><br />
3533 <b id="SCI_GETTABINDENTS">SCI_GETTABINDENTS</b><br />
3534 <b id="SCI_SETBACKSPACEUNINDENTS">SCI_SETBACKSPACEUNINDENTS(bool bsUnIndents)</b><br />
3535 <b id="SCI_GETBACKSPACEUNINDENTS">SCI_GETBACKSPACEUNINDENTS</b><br />
3536 </p>
3538 <p>Inside indentation white space, the tab and backspace keys can be made to indent and
3539 unindent rather than insert a tab character or delete a character with the
3540 <code>SCI_SETTABINDENTS</code> and <code>SCI_SETBACKSPACEUNINDENTS</code> functions.</p>
3542 <p><b id="SCI_SETLINEINDENTATION">SCI_SETLINEINDENTATION(int line, int indentation)</b><br />
3543 <b id="SCI_GETLINEINDENTATION">SCI_GETLINEINDENTATION(int line)</b><br />
3544 The amount of indentation on a line can be discovered and set with
3545 <code>SCI_GETLINEINDENTATION</code> and <code>SCI_SETLINEINDENTATION</code>. The indentation is
3546 measured in character columns, which correspond to the width of space characters.</p>
3548 <p><b id="SCI_GETLINEINDENTPOSITION">SCI_GETLINEINDENTPOSITION(int line)</b><br />
3549 This returns the position at the end of indentation of a line.</p>
3551 <p><b id="SCI_SETINDENTATIONGUIDES">SCI_SETINDENTATIONGUIDES(int indentView)</b><br />
3552 <b id="SCI_GETINDENTATIONGUIDES">SCI_GETINDENTATIONGUIDES</b><br />
3553 Indentation guides are dotted vertical lines that appear within indentation white space every
3554 indent size columns. They make it easy to see which constructs line up especially when they
3555 extend over multiple pages. Style <a class="message"
3556 href="#StyleDefinition"><code>STYLE_INDENTGUIDE</code></a> (37) is used to specify the
3557 foreground and background colour of the indentation guides.</p>
3559 <p>There are 4 indentation guide views.
3560 SC_IV_NONE turns the feature off but the other 3 states determine how far the guides appear on
3561 empty lines. </p>
3562 <table border="0" summary="Search flags">
3563 <tbody>
3564 <tr>
3565 <td><code>SC_IV_NONE</code></td>
3566 <td>No indentation guides are shown.</td>
3567 </tr>
3569 <tr>
3570 <td><code>SC_IV_REAL</code></td>
3571 <td>Indentation guides are shown inside real indentation white space.</td>
3572 </tr>
3574 <tr>
3575 <td><code>SC_IV_LOOKFORWARD</code></td>
3576 <td>Indentation guides are shown beyond the actual indentation up to the level of the
3577 next non-empty line.
3578 If the previous non-empty line was a fold header then indentation guides are shown for
3579 one more level of indent than that line. This setting is good for Python.</td>
3580 </tr>
3582 <tr>
3583 <td><code>SC_IV_LOOKBOTH</code></td>
3584 <td>Indentation guides are shown beyond the actual indentation up to the level of the
3585 next non-empty line or previous non-empty line whichever is the greater.
3586 This setting is good for most languages.</td>
3587 </tr>
3589 </tbody>
3590 </table>
3592 <p><b id="SCI_SETHIGHLIGHTGUIDE">SCI_SETHIGHLIGHTGUIDE(int column)</b><br />
3593 <b id="SCI_GETHIGHLIGHTGUIDE">SCI_GETHIGHLIGHTGUIDE</b><br />
3594 When brace highlighting occurs, the indentation guide corresponding to the braces may be
3595 highlighted with the brace highlighting style, <a class="message"
3596 href="#StyleDefinition"><code>STYLE_BRACELIGHT</code></a> (34). Set <code>column</code> to 0 to
3597 cancel this highlight.</p>
3599 <h2 id="Markers">Markers</h2>
3601 <p>There are 32 markers, numbered 0 to <code>MARKER_MAX</code> (31), and you can assign any combination of them to each
3602 line in the document. Markers appear in the <a class="jump" href="#Margins">selection
3603 margin</a> to the left of the text. If the selection margin is set to zero width, the
3604 background colour of the whole line is changed instead. Marker numbers 25 to 31 are used by
3605 Scintilla in folding margins, and have symbolic names of the form <code>SC_MARKNUM_</code>*,
3606 for example <code>SC_MARKNUM_FOLDEROPEN</code>.</p>
3608 <p>Marker numbers 0 to 24 have no pre-defined function; you can use them to mark syntax errors
3609 or the current point of execution, break points, or whatever you need marking. If you do not
3610 need folding, you can use all 32 for any purpose you wish.</p>
3612 <p>Each marker number has a symbol associated with it. You can also set the foreground and
3613 background colour for each marker number, so you can use the same symbol more than once with
3614 different colouring for different uses. Scintilla has a set of symbols you can assign
3615 (<code>SC_MARK_</code>*) or you can use characters. By default, all 32 markers are set to
3616 <code>SC_MARK_CIRCLE</code> with a black foreground and a white background.</p>
3618 <p>The markers are drawn in the order of their numbers, so higher numbered markers appear on
3619 top of lower numbered ones. Markers try to move with their text by tracking where the start of
3620 their line moves. When a line is deleted, its markers are combined, by an <code>OR</code>
3621 operation, with the markers of the next line.</p>
3622 <code><a class="message" href="#SCI_MARKERDEFINE">SCI_MARKERDEFINE(int markerNumber, int
3623 markerSymbols)</a><br />
3624 <a class="message" href="#SCI_MARKERDEFINEPIXMAP">SCI_MARKERDEFINEPIXMAP(int markerNumber,
3625 const char *xpm)</a><br />
3626 <a class="message" href="#SCI_RGBAIMAGESETWIDTH">SCI_RGBAIMAGESETWIDTH(int width)</a><br />
3627 <a class="message" href="#SCI_RGBAIMAGESETHEIGHT">SCI_RGBAIMAGESETHEIGHT(int height)</a><br />
3628 <a class="message" href="#SCI_RGBAIMAGESETSCALE">SCI_RGBAIMAGESETSCALE(int scalePercent)</a><br />
3629 <a class="message" href="#SCI_MARKERDEFINERGBAIMAGE">SCI_MARKERDEFINERGBAIMAGE(int markerNumber,
3630 const char *pixels)</a><br />
3631 <a class="message" href="#SCI_MARKERSYMBOLDEFINED">SCI_MARKERSYMBOLDEFINED(int markerNumber)
3632 </a><br />
3633 <a class="message" href="#SCI_MARKERSETFORE">SCI_MARKERSETFORE(int markerNumber, int
3634 colour)</a><br />
3635 <a class="message" href="#SCI_MARKERSETBACK">SCI_MARKERSETBACK(int markerNumber, int
3636 colour)</a><br />
3637 <a class="message" href="#SCI_MARKERSETBACKSELECTED">SCI_MARKERSETBACKSELECTED(int markerNumber, int
3638 colour)</a><br />
3639 <a class="message" href="#SCI_MARKERENABLEHIGHLIGHT">SCI_MARKERENABLEHIGHLIGHT(int enabled)</a><br />
3640 <a class="message" href="#SCI_MARKERSETALPHA">SCI_MARKERSETALPHA(int markerNumber, int
3641 alpha)</a><br />
3642 <a class="message" href="#SCI_MARKERADD">SCI_MARKERADD(int line, int markerNumber)</a><br />
3643 <a class="message" href="#SCI_MARKERADDSET">SCI_MARKERADDSET(int line, int markerMask)</a><br />
3644 <a class="message" href="#SCI_MARKERDELETE">SCI_MARKERDELETE(int line, int
3645 markerNumber)</a><br />
3646 <a class="message" href="#SCI_MARKERDELETEALL">SCI_MARKERDELETEALL(int markerNumber)</a><br />
3647 <a class="message" href="#SCI_MARKERGET">SCI_MARKERGET(int line)</a><br />
3648 <a class="message" href="#SCI_MARKERNEXT">SCI_MARKERNEXT(int lineStart, int
3649 markerMask)</a><br />
3650 <a class="message" href="#SCI_MARKERPREVIOUS">SCI_MARKERPREVIOUS(int lineStart, int
3651 markerMask)</a><br />
3652 <a class="message" href="#SCI_MARKERLINEFROMHANDLE">SCI_MARKERLINEFROMHANDLE(int
3653 handle)</a><br />
3654 <a class="message" href="#SCI_MARKERDELETEHANDLE">SCI_MARKERDELETEHANDLE(int handle)</a><br />
3655 </code>
3657 <p><b id="SCI_MARKERDEFINE">SCI_MARKERDEFINE(int markerNumber, int markerSymbols)</b><br />
3658 This message associates a marker number in the range 0 to 31 with one of the marker symbols or
3659 an ASCII character. The general-purpose marker symbols currently available are:<br />
3660 <code>SC_MARK_CIRCLE</code>,
3661 <code>SC_MARK_ROUNDRECT</code>,
3662 <code>SC_MARK_ARROW</code>,
3663 <code>SC_MARK_SMALLRECT</code>,
3664 <code>SC_MARK_SHORTARROW</code>,
3665 <code>SC_MARK_EMPTY</code>,
3666 <code>SC_MARK_ARROWDOWN</code>,
3667 <code>SC_MARK_MINUS</code>,
3668 <code>SC_MARK_PLUS</code>,
3669 <code>SC_MARK_ARROWS</code>,
3670 <code>SC_MARK_DOTDOTDOT</code>,
3671 <code>SC_MARK_BACKGROUND</code>,
3672 <code>SC_MARK_LEFTRECT</code>,
3673 <code>SC_MARK_FULLRECT</code>,
3674 <code>SC_MARK_BOOKMARK</code>, and
3675 <code>SC_MARK_UNDERLINE</code>.
3676 </p>
3678 <p>The <code>SC_MARK_BACKGROUND</code> marker changes the background colour of the line only.
3679 The <code>SC_MARK_FULLRECT</code> symbol mirrors this, changing only the margin background colour.
3680 <code>SC_MARK_UNDERLINE</code> draws an underline across the text.
3681 The <code>SC_MARK_EMPTY</code> symbol is invisible, allowing client code to track the movement
3682 of lines. You would also use it if you changed the folding style and wanted one or more of the
3683 <code>SC_FOLDERNUM_</code>* markers to have no associated symbol.</p>
3685 <p>Applications may use the marker symbol <code>SC_MARK_AVAILABLE</code> to indicate that
3686 plugins may allocate that marker number.
3687 </p>
3689 <p>There are also marker symbols designed for use in the folding margin in a flattened tree
3690 style.<br />
3691 <code>SC_MARK_BOXMINUS</code>,
3692 <code>SC_MARK_BOXMINUSCONNECTED</code>,
3693 <code>SC_MARK_BOXPLUS</code>,
3694 <code>SC_MARK_BOXPLUSCONNECTED</code>,
3695 <code>SC_MARK_CIRCLEMINUS</code>,
3696 <code>SC_MARK_CIRCLEMINUSCONNECTED</code>,
3697 <code>SC_MARK_CIRCLEPLUS</code>,
3698 <code>SC_MARK_CIRCLEPLUSCONNECTED</code>,
3699 <code>SC_MARK_LCORNER</code>,
3700 <code>SC_MARK_LCORNERCURVE</code>,
3701 <code>SC_MARK_TCORNER</code>,
3702 <code>SC_MARK_TCORNERCURVE</code>, and
3703 <code>SC_MARK_VLINE</code>.</p>
3704 Characters can be used as markers by adding the ASCII value of the character to
3705 <code>SC_MARK_CHARACTER</code> (10000). For example, to use 'A' (ASCII code 65) as marker
3706 number 1 use:<br />
3707 <code>SCI_MARKERDEFINE(1, SC_MARK_CHARACTER+65)</code>. <br />
3709 <p>The marker numbers <code>SC_MARKNUM_FOLDER</code> and <code>SC_MARKNUM_FOLDEROPEN</code> are
3710 used for showing that a fold is present and open or closed. Any symbols may be assigned for
3711 this purpose although the (<code>SC_MARK_PLUS</code>, <code>SC_MARK_MINUS</code>) pair or the
3712 (<code>SC_MARK_ARROW</code>, <code>SC_MARK_ARROWDOWN</code>) pair are good choices. As well as
3713 these two, more assignments are needed for the flattened tree style:
3714 <code>SC_MARKNUM_FOLDEREND</code>, <code>SC_MARKNUM_FOLDERMIDTAIL</code>,
3715 <code>SC_MARKNUM_FOLDEROPENMID</code>, <code>SC_MARKNUM_FOLDERSUB</code>, and
3716 <code>SC_MARKNUM_FOLDERTAIL</code>. The bits used for folding are specified by
3717 <code>SC_MASK_FOLDERS</code>, which is commonly used as an argument to
3718 <code>SCI_SETMARGINMASKN</code> when defining a margin to be used for folding.</p>
3720 <p>This table shows which <code>SC_MARK_</code>* symbols should be assigned to which
3721 <code>SC_MARKNUM_</code>* marker numbers to obtain four folding styles: Arrow (mimics
3722 Macintosh), plus/minus shows folded lines as '+' and opened folds as '-', Circle tree, Box
3723 tree.</p>
3725 <table cellpadding="1" cellspacing="2" border="0" summary="Markers used for folding">
3726 <thead align="left">
3727 <tr>
3728 <th><code>SC_MARKNUM_</code>*</th>
3730 <th>Arrow</th>
3732 <th>Plus/minus</th>
3734 <th>Circle tree</th>
3736 <th>Box tree</th>
3737 </tr>
3738 </thead>
3740 <tbody valign="top">
3741 <tr>
3742 <th align="left"><code>FOLDEROPEN</code></th>
3744 <td><code>ARROWDOWN</code></td>
3746 <td><code>MINUS</code></td>
3748 <td><code>CIRCLEMINUS</code></td>
3750 <td><code>BOXMINUS</code></td>
3751 </tr>
3753 <tr>
3754 <th align="left"><code>FOLDER</code></th>
3756 <td><code>ARROW</code></td>
3758 <td><code>PLUS</code></td>
3760 <td><code>CIRCLEPLUS</code></td>
3762 <td><code>BOXPLUS</code></td>
3763 </tr>
3765 <tr>
3766 <th align="left"><code>FOLDERSUB</code></th>
3768 <td><code>EMPTY</code></td>
3770 <td><code>EMPTY</code></td>
3772 <td><code>VLINE</code></td>
3774 <td><code>VLINE</code></td>
3775 </tr>
3777 <tr>
3778 <th align="left"><code>FOLDERTAIL</code></th>
3780 <td><code>EMPTY</code></td>
3782 <td><code>EMPTY</code></td>
3784 <td><code>LCORNERCURVE</code></td>
3786 <td><code>LCORNER</code></td>
3787 </tr>
3789 <tr>
3790 <th align="left"><code>FOLDEREND</code></th>
3792 <td><code>EMPTY</code></td>
3794 <td><code>EMPTY</code></td>
3796 <td><code>CIRCLEPLUSCONNECTED</code></td>
3798 <td><code>BOXPLUSCONNECTED</code></td>
3799 </tr>
3801 <tr>
3802 <th align="left"><code>FOLDEROPENMID</code></th>
3804 <td><code>EMPTY</code></td>
3806 <td><code>EMPTY</code></td>
3808 <td><code>CIRCLEMINUSCONNECTED</code></td>
3810 <td><code>BOXMINUSCONNECTED</code></td>
3811 </tr>
3813 <tr>
3814 <th align="left"><code>FOLDERMIDTAIL</code></th>
3816 <td><code>EMPTY</code></td>
3818 <td><code>EMPTY</code></td>
3820 <td><code>TCORNERCURVE</code></td>
3822 <td><code>TCORNER</code></td>
3823 </tr>
3824 </tbody>
3825 </table>
3826 <p><img src="Markers.png" alt="Marker samples" /></p>
3828 <p><b id="SCI_MARKERDEFINEPIXMAP">SCI_MARKERDEFINEPIXMAP(int markerNumber, const char
3829 *xpm)</b><br />
3830 Markers can be set to pixmaps with this message. The
3831 <a class="jump" href="#XPM">XPM format</a> is used for the pixmap.
3832 Pixmaps use the <code>SC_MARK_PIXMAP</code> marker symbol. </p>
3835 <b id="SCI_RGBAIMAGESETWIDTH">SCI_RGBAIMAGESETWIDTH(int width)</b><br />
3836 <b id="SCI_RGBAIMAGESETHEIGHT">SCI_RGBAIMAGESETHEIGHT(int height)</b><br />
3837 <b id="SCI_RGBAIMAGESETSCALE">SCI_RGBAIMAGESETSCALE(int scalePercent)</b><br />
3838 <b id="SCI_MARKERDEFINERGBAIMAGE">SCI_MARKERDEFINERGBAIMAGE(int markerNumber, const char *pixels)</b><br />
3839 Markers can be set to translucent pixmaps with this message. The
3840 <a class="jump" href="#RGBA">RGBA format</a> is used for the pixmap.
3841 The width and height must previously been set with the <code>SCI_RGBAIMAGESETWIDTH</code> and
3842 <code>SCI_RGBAIMAGESETHEIGHT</code> messages.</p>
3843 <p>A scale factor in percent may be set with <code>SCI_RGBAIMAGESETSCALE</code>. This is useful on OS X with
3844 a retina display where each display unit is 2 pixels: use a factor of 200 so that each image pixel is displayed using a screen pixel.
3845 The default scale, 100, will stretch each image pixel to cover 4 screen pixels on a retina display.</p>
3846 <p>Pixmaps use the <code>SC_MARK_RGBAIMAGE</code> marker symbol. </p>
3848 <p><b id="SCI_MARKERSYMBOLDEFINED">SCI_MARKERSYMBOLDEFINED(int markerNumber)</b><br />
3849 Returns the symbol defined for a markerNumber with <code>SCI_MARKERDEFINE</code>
3850 or <code>SC_MARK_PIXMAP</code> if defined with <code>SCI_MARKERDEFINEPIXMAP</code>
3851 or <code>SC_MARK_RGBAIMAGE</code> if defined with <code>SCI_MARKERDEFINERGBAIMAGE</code>.</p>
3853 <p><b id="SCI_MARKERSETFORE">SCI_MARKERSETFORE(int markerNumber, int <a class="jump"
3854 href="#colour">colour</a>)</b><br />
3855 <b id="SCI_MARKERSETBACK">SCI_MARKERSETBACK(int markerNumber, int <a class="jump"
3856 href="#colour">colour</a>)</b><br />
3857 These two messages set the foreground and background colour of a marker number.<br />
3858 <b id="SCI_MARKERSETBACKSELECTED">SCI_MARKERSETBACKSELECTED(int markerNumber, int <a class="jump"
3859 href="#colour">colour</a>)</b><br />
3860 This message sets the highlight background colour of a marker number when its folding block is selected. The default colour is #FF0000.</p>
3861 <p><b id="SCI_MARKERENABLEHIGHLIGHT">SCI_MARKERENABLEHIGHLIGHT(bool enabled)</b><br />
3862 This message allows to enable/disable the highlight folding block when it is selected. (i.e. block that contains the caret)</p>
3863 <p><b id="SCI_MARKERSETALPHA">SCI_MARKERSETALPHA(int markerNumber, int <a class="jump"
3864 href="#alpha">alpha</a>)</b><br />
3865 When markers are drawn in the content area, either because there is no margin for them or
3866 they are of <code>SC_MARK_BACKGROUND</code> or <code>SC_MARK_UNDERLINE</code> types, they may be drawn translucently by
3867 setting an alpha value.</p>
3869 <p><b id="SCI_MARKERADD">SCI_MARKERADD(int line, int markerNumber)</b><br />
3870 This message adds marker number <code>markerNumber</code> to a line. The message returns -1 if
3871 this fails (illegal line number, out of memory) or it returns a marker handle number that
3872 identifies the added marker. You can use this returned handle with <a class="message"
3873 href="#SCI_MARKERLINEFROMHANDLE"><code>SCI_MARKERLINEFROMHANDLE</code></a> to find where a
3874 marker is after moving or combining lines and with <a class="message"
3875 href="#SCI_MARKERDELETEHANDLE"><code>SCI_MARKERDELETEHANDLE</code></a> to delete the marker
3876 based on its handle. The message does not check the value of markerNumber, nor does it
3877 check if the line already contains the marker.</p>
3879 <p><b id="SCI_MARKERADDSET">SCI_MARKERADDSET(int line, int markerMask)</b><br />
3880 This message can add one or more markers to a line with a single call, specified in the same "one-bit-per-marker" 32-bit integer format returned by
3881 <a class="message" href="#SCI_MARKERGET"><code>SCI_MARKERGET</code></a>
3882 (and used by the mask-based marker search functions
3883 <a class="message" href="#SCI_MARKERNEXT"><code>SCI_MARKERNEXT</code></a> and
3884 <a class="message" href="#SCI_MARKERPREVIOUS"><code>SCI_MARKERPREVIOUS</code></a>).
3885 As with
3886 <a class="message" href="#SCI_MARKERADD"><code>SCI_MARKERADD</code></a>, no check is made
3887 to see if any of the markers are already present on the targeted line.</p>
3889 <p><b id="SCI_MARKERDELETE">SCI_MARKERDELETE(int line, int markerNumber)</b><br />
3890 This searches the given line number for the given marker number and deletes it if it is
3891 present. If you added the same marker more than once to the line, this will delete one copy
3892 each time it is used. If you pass in a marker number of -1, all markers are deleted from the
3893 line.</p>
3895 <p><b id="SCI_MARKERDELETEALL">SCI_MARKERDELETEALL(int markerNumber)</b><br />
3896 This removes markers of the given number from all lines. If markerNumber is -1, it deletes all
3897 markers from all lines.</p>
3899 <p><b id="SCI_MARKERGET">SCI_MARKERGET(int line)</b><br />
3900 This returns a 32-bit integer that indicates which markers were present on the line. Bit 0 is
3901 set if marker 0 is present, bit 1 for marker 1 and so on.</p>
3903 <p><b id="SCI_MARKERNEXT">SCI_MARKERNEXT(int lineStart, int markerMask)</b><br />
3904 <b id="SCI_MARKERPREVIOUS">SCI_MARKERPREVIOUS(int lineStart, int markerMask)</b><br />
3905 These messages search efficiently for lines that include a given set of markers. The search
3906 starts at line number <code>lineStart</code> and continues forwards to the end of the file
3907 (<code>SCI_MARKERNEXT</code>) or backwards to the start of the file
3908 (<code>SCI_MARKERPREVIOUS</code>). The <code>markerMask</code> argument should have one bit set
3909 for each marker you wish to find. Set bit 0 to find marker 0, bit 1 for marker 1 and so on. The
3910 message returns the line number of the first line that contains one of the markers in
3911 <code>markerMask</code> or -1 if no marker is found.</p>
3913 <p><b id="SCI_MARKERLINEFROMHANDLE">SCI_MARKERLINEFROMHANDLE(int markerHandle)</b><br />
3914 The <code>markerHandle</code> argument is an identifier for a marker returned by <a
3915 class="message" href="#SCI_MARKERADD"><code>SCI_MARKERADD</code></a>. This function searches
3916 the document for the marker with this handle and returns the line number that contains it or -1
3917 if it is not found.</p>
3919 <p><b id="SCI_MARKERDELETEHANDLE">SCI_MARKERDELETEHANDLE(int markerHandle)</b><br />
3920 The <code>markerHandle</code> argument is an identifier for a marker returned by <a
3921 class="message" href="#SCI_MARKERADD"><code>SCI_MARKERADD</code></a>. This function searches
3922 the document for the marker with this handle and deletes the marker if it is found.</p>
3924 <h2 id="Indicators">Indicators</h2>
3926 <p>Indicators are used to display additional information over the top of styling.
3927 They can be used to show, for example, syntax errors, deprecated names and bad indentation
3928 by drawing underlines under text or boxes around text.</p>
3930 <p>Indicators may have a different "hover" colour and style when the mouse is over them or the caret is moved into them.
3931 This may be used, for example, to indicate that a URL can be clicked.</p>
3933 <p>Indicators may be displayed as simple underlines, squiggly underlines, a
3934 line of small 'T' shapes, a line of diagonal hatching, a strike-out or a rectangle around the text.
3935 They may also be invisible when used to track pieces of content for the application as <code>INDIC_HIDDEN</code>.</p>
3937 <p>The <code>SCI_INDIC*</code> messages allow you to get and set the visual appearance of the
3938 indicators. They all use an <code>indicatorNumber</code> argument in the range 0 to INDIC_MAX(35)
3939 to set the indicator to style. To prevent interference the set of indicators is divided up into a range for use
3940 by lexers (0..7) a range for use by containers
3941 (8=<code>INDIC_CONTAINER</code> .. 31=<code>INDIC_IME-1</code>)
3942 and a range for IME indicators (32=<code>INDIC_IME</code> .. 35=<code>INDIC_IME_MAX</code>).</p>
3944 <p>Indicators are stored in a format similar to run length encoding which is efficient in both
3945 speed and storage for sparse information.</p>
3946 <p>An indicator may store different values for each range but currently all values are drawn the same.
3947 In the future, it may be possible to draw different values in different styles.</p>
3949 <p>Originally, Scintilla used a different technique for indicators but this
3950 has been <a href="#RemovedFeatures">removed</a>
3951 and the APIs perform <a href="#StyleByteIndicators">no action</a>.
3952 While both techniques were supported, the term "modern indicators" was used for the
3953 newer implementation.</p>
3955 <code><a class="message" href="#SCI_INDICSETSTYLE">SCI_INDICSETSTYLE(int indicatorNumber, int
3956 indicatorStyle)</a><br />
3957 <a class="message" href="#SCI_INDICGETSTYLE">SCI_INDICGETSTYLE(int indicatorNumber)</a><br />
3958 <a class="message" href="#SCI_INDICSETFORE">SCI_INDICSETFORE(int indicatorNumber, int
3959 colour)</a><br />
3960 <a class="message" href="#SCI_INDICGETFORE">SCI_INDICGETFORE(int indicatorNumber)</a><br />
3961 <a class="message" href="#SCI_INDICSETALPHA">SCI_INDICSETALPHA(int indicatorNumber, int alpha)</a><br />
3962 <a class="message" href="#SCI_INDICGETALPHA">SCI_INDICGETALPHA(int indicatorNumber)</a><br />
3963 <a class="message" href="#SCI_INDICSETOUTLINEALPHA">SCI_INDICSETOUTLINEALPHA(int indicatorNumber, int alpha)</a><br />
3964 <a class="message" href="#SCI_INDICGETOUTLINEALPHA">SCI_INDICGETOUTLINEALPHA(int indicatorNumber)</a><br />
3965 <a class="message" href="#SCI_INDICSETUNDER">SCI_INDICSETUNDER(int indicatorNumber, bool under)</a><br />
3966 <a class="message" href="#SCI_INDICGETUNDER">SCI_INDICGETUNDER(int indicatorNumber)</a><br />
3967 <a class="message" href="#SCI_INDICSETHOVERSTYLE">SCI_INDICSETHOVERSTYLE(int indicatorNumber, int
3968 indicatorStyle)</a><br />
3969 <a class="message" href="#SCI_INDICGETHOVERSTYLE">SCI_INDICGETHOVERSTYLE(int indicatorNumber)</a><br />
3970 <a class="message" href="#SCI_INDICSETHOVERFORE">SCI_INDICSETHOVERFORE(int indicatorNumber, int
3971 colour)</a><br />
3972 <a class="message" href="#SCI_INDICGETHOVERFORE">SCI_INDICGETHOVERFORE(int indicatorNumber)</a><br />
3973 <a class="message" href="#SCI_INDICSETFLAGS">SCI_INDICSETFLAGS(int indicatorNumber, int flags)</a><br />
3974 <a class="message" href="#SCI_INDICGETFLAGS">SCI_INDICGETFLAGS(int indicatorNumber)</a><br />
3975 <br />
3977 <a class="message" href="#SCI_SETINDICATORCURRENT">SCI_SETINDICATORCURRENT(int indicator)</a><br />
3978 <a class="message" href="#SCI_GETINDICATORCURRENT">SCI_GETINDICATORCURRENT</a><br />
3979 <a class="message" href="#SCI_SETINDICATORVALUE">SCI_SETINDICATORVALUE(int value)</a><br />
3980 <a class="message" href="#SCI_GETINDICATORVALUE">SCI_GETINDICATORVALUE</a><br />
3981 <a class="message" href="#SCI_INDICATORFILLRANGE">SCI_INDICATORFILLRANGE(int position, int fillLength)</a><br />
3982 <a class="message" href="#SCI_INDICATORCLEARRANGE">SCI_INDICATORCLEARRANGE(int position, int clearLength)</a><br />
3983 <a class="message" href="#SCI_INDICATORALLONFOR">SCI_INDICATORALLONFOR(int position)</a><br />
3984 <a class="message" href="#SCI_INDICATORVALUEAT">SCI_INDICATORVALUEAT(int indicator, int position)</a><br />
3985 <a class="message" href="#SCI_INDICATORSTART">SCI_INDICATORSTART(int indicator, int position)</a><br />
3986 <a class="message" href="#SCI_INDICATOREND">SCI_INDICATOREND(int indicator, int position)</a><br />
3988 <a class="message" href="#SCI_FINDINDICATORSHOW">SCI_FINDINDICATORSHOW(int start, int end)</a><br />
3989 <a class="message" href="#SCI_FINDINDICATORFLASH">SCI_FINDINDICATORFLASH(int start, int end)</a><br />
3990 <a class="message" href="#SCI_FINDINDICATORHIDE">SCI_FINDINDICATORHIDE</a><br />
3991 </code>
3993 <p><b id="SCI_INDICSETSTYLE">SCI_INDICSETSTYLE(int indicatorNumber, int
3994 indicatorStyle)</b><br />
3995 <b id="SCI_INDICGETSTYLE">SCI_INDICGETSTYLE(int indicatorNumber)</b><br />
3996 These two messages set and get the style for a particular indicator. The indicator styles
3997 currently available are:<br />
3999 <img src="Indicators.png" alt="Indicator samples" /></p>
4001 <table cellpadding="1" cellspacing="2" border="0" summary="Indicators">
4002 <tbody>
4003 <tr>
4004 <th align="left">Symbol</th>
4006 <th>Value</th>
4008 <th align="left">Visual effect</th>
4009 </tr>
4010 </tbody>
4012 <tbody valign="top">
4013 <tr>
4014 <td align="left"><code>INDIC_PLAIN</code></td>
4016 <td align="center">0</td>
4018 <td>Underlined with a single, straight line.</td>
4019 </tr>
4021 <tr>
4022 <td align="left"><code>INDIC_SQUIGGLE</code></td>
4024 <td align="center">1</td>
4026 <td>A squiggly underline. Requires 3 pixels of descender space.</td>
4027 </tr>
4029 <tr>
4030 <td align="left"><code>INDIC_TT</code></td>
4032 <td align="center">2</td>
4034 <td>A line of small T shapes.</td>
4035 </tr>
4037 <tr>
4038 <td align="left"><code>INDIC_DIAGONAL</code></td>
4040 <td align="center">3</td>
4042 <td>Diagonal hatching.</td>
4043 </tr>
4045 <tr>
4046 <td align="left"><code>INDIC_STRIKE</code></td>
4048 <td align="center">4</td>
4050 <td>Strike out.</td>
4051 </tr>
4053 <tr>
4054 <td align="left"><code>INDIC_HIDDEN</code></td>
4056 <td align="center">5</td>
4058 <td>An indicator with no visual effect.</td>
4059 </tr>
4061 <tr>
4062 <td align="left"><code>INDIC_BOX</code></td>
4064 <td align="center">6</td>
4066 <td>A rectangle around the text.</td>
4067 </tr>
4069 <tr>
4070 <td align="left"><code>INDIC_ROUNDBOX</code></td>
4072 <td align="center">7</td>
4074 <td>A rectangle with rounded corners around the text using translucent drawing with the
4075 interior usually more transparent than the border. You can use
4076 <a class="message" href="#SCI_INDICSETALPHA">SCI_INDICSETALPHA</a> and
4077 <a class="message" href="#SCI_INDICSETOUTLINEALPHA">SCI_INDICSETOUTLINEALPHA</a>
4078 to control the alpha transparency values. The default alpha values are 30 for fill colour and 50 for outline colour.</td>
4079 </tr>
4081 <tr>
4082 <td align="left"><code>INDIC_STRAIGHTBOX</code></td>
4084 <td align="center">8</td>
4086 <td>A rectangle around the text using translucent drawing with the
4087 interior usually more transparent than the border. You can use
4088 <a class="message" href="#SCI_INDICSETALPHA">SCI_INDICSETALPHA</a> and
4089 <a class="message" href="#SCI_INDICSETOUTLINEALPHA">SCI_INDICSETOUTLINEALPHA</a>
4090 to control the alpha transparency values. The default alpha values are 30 for fill colour and 50 for outline colour.
4091 This indicator does not colour the top pixel of the line so that indicators on contiguous lines are visually distinct
4092 and disconnected.</td>
4093 </tr>
4095 <tr>
4096 <td align="left"><code>INDIC_FULLBOX</code></td>
4098 <td align="center">16</td>
4100 <td>A rectangle around the text using translucent drawing similar to <code>INDIC_STRAIGHTBOX</code>
4101 but covering the entire character area.</td>
4102 </tr>
4104 <tr>
4105 <td align="left"><code>INDIC_DASH</code></td>
4107 <td align="center">9</td>
4109 <td>A dashed underline.</td>
4110 </tr>
4112 <tr>
4113 <td align="left"><code>INDIC_DOTS</code></td>
4115 <td align="center">10</td>
4117 <td>A dotted underline.</td>
4118 </tr>
4120 <tr>
4121 <td align="left"><code>INDIC_SQUIGGLELOW</code></td>
4123 <td align="center">11</td>
4125 <td>Similar to <code>INDIC_SQUIGGLE</code> but only using 2 vertical pixels
4126 so will fit under small fonts.</td>
4127 </tr>
4129 <tr>
4130 <td align="left"><code>INDIC_DOTBOX</code></td>
4132 <td align="center">12</td>
4134 <td>A dotted rectangle around the text using translucent drawing.
4135 Translucency alternates between the alpha and outline alpha settings with the top-left pixel using the alpha setting.
4136 <a class="message" href="#SCI_INDICSETALPHA">SCI_INDICSETALPHA</a> and
4137 <a class="message" href="#SCI_INDICSETOUTLINEALPHA">SCI_INDICSETOUTLINEALPHA</a>
4138 control the alpha transparency values. The default values are 30 for alpha and 50 for outline alpha.
4139 To avoid excessive memory allocation the maximum width of a dotted box is 4000 pixels.</td>
4140 </tr>
4142 <tr>
4143 <td align="left"><code>INDIC_SQUIGGLEPIXMAP</code></td>
4145 <td align="center">13</td>
4147 <td>A version of <code>INDIC_SQUIGGLE</code> that draws using a pixmap instead of
4148 as a series of line segments for performance.
4149 Measured to be between 3 and 6 times faster than <code>INDIC_SQUIGGLE</code> on GTK+.
4150 Appearance will not be as good as <code>INDIC_SQUIGGLE</code> on OS X in HiDPI mode.</td>
4151 </tr>
4153 <tr>
4154 <td align="left"><code>INDIC_COMPOSITIONTHICK</code></td>
4156 <td align="center">14</td>
4158 <td>A 2-pixel thick underline located at the bottom of the line to try to avoid touching the character base.
4159 Each side is inset 1 pixel so that different indicators in this style covering a range appear isolated.
4160 This is similar to an appearance used for the target in Asian language input composition.</td>
4161 </tr>
4163 <tr>
4164 <td align="left"><code>INDIC_COMPOSITIONTHIN</code></td>
4166 <td align="center">15</td>
4168 <td>A 1-pixel thick underline located just before the bottom of the line.
4169 Each side is inset 1 pixel so that different indicators in this style covering a range appear isolated.
4170 This is similar to an appearance used for non-target ranges in Asian language input composition.</td>
4171 </tr>
4173 <tr>
4174 <td align="left"><code>INDIC_TEXTFORE</code></td>
4176 <td align="center">17</td>
4178 <td>Change the colour of the text to the indicator's fore colour.</td>
4179 </tr>
4181 </tbody>
4182 </table>
4184 <p>The default indicator styles are equivalent to:<br />
4185 <code>SCI_INDICSETSTYLE(0, INDIC_SQUIGGLE);</code><br />
4186 <code>SCI_INDICSETSTYLE(1, INDIC_TT);</code><br />
4187 <code>SCI_INDICSETSTYLE(2, INDIC_PLAIN);</code></p>
4189 <p><b id="SCI_INDICSETFORE">SCI_INDICSETFORE(int indicatorNumber, int <a class="jump" href="#colour">colour</a>)</b><br />
4190 <b id="SCI_INDICGETFORE">SCI_INDICGETFORE(int indicatorNumber)</b><br />
4191 These two messages set and get the colour used to draw an indicator. The default indicator
4192 colours are equivalent to:<br />
4193 <code>SCI_INDICSETFORE(0, 0x007f00);</code> (dark green)<br />
4194 <code>SCI_INDICSETFORE(1, 0xff0000);</code> (light blue)<br />
4195 <code>SCI_INDICSETFORE(2, 0x0000ff);</code> (light red)</p>
4197 <p><b id="SCI_INDICSETALPHA">SCI_INDICSETALPHA(int indicatorNumber, int alpha)</b><br />
4198 <b id="SCI_INDICGETALPHA">SCI_INDICGETALPHA(int indicatorNumber)</b><br />
4199 These two messages set and get the alpha transparency used for drawing the
4200 fill colour of the INDIC_ROUNDBOX and INDIC_STRAIGHTBOX rectangle. The alpha value can range from
4201 0 (completely transparent) to 255 (no transparency).
4202 </p>
4204 <p><b id="SCI_INDICSETOUTLINEALPHA">SCI_INDICSETOUTLINEALPHA(int indicatorNumber, int alpha)</b><br />
4205 <b id="SCI_INDICGETOUTLINEALPHA">SCI_INDICGETOUTLINEALPHA(int indicatorNumber)</b><br />
4206 These two messages set and get the alpha transparency used for drawing the
4207 outline colour of the INDIC_ROUNDBOX and INDIC_STRAIGHTBOX rectangle. The alpha value can range from
4208 0 (completely transparent) to 255 (no transparency).
4209 </p>
4211 <p><b id="SCI_INDICSETUNDER">SCI_INDICSETUNDER(int indicatorNumber, bool under)</b><br />
4212 <b id="SCI_INDICGETUNDER">SCI_INDICGETUNDER(int indicatorNumber)</b><br />
4213 These two messages set and get whether an indicator is drawn under text or over(default).
4214 Drawing under text works only for indicators when <a class="message" href="#SCI_SETTWOPHASEDRAW">two phase drawing</a>
4215 is enabled.</p>
4217 <p><b id="SCI_INDICSETHOVERSTYLE">SCI_INDICSETHOVERSTYLE(int indicatorNumber, int
4218 indicatorStyle)</b><br />
4219 <b id="SCI_INDICGETHOVERSTYLE">SCI_INDICGETHOVERSTYLE(int indicatorNumber)</b><br />
4220 <b id="SCI_INDICSETHOVERFORE">SCI_INDICSETHOVERFORE(int indicatorNumber, int <a class="jump" href="#colour">colour</a>)</b><br />
4221 <b id="SCI_INDICGETHOVERFORE">SCI_INDICGETHOVERFORE(int indicatorNumber)</b><br />
4222 These messages set and get the colour and style used to draw indicators when the mouse is over them or the caret moved into them.
4223 The mouse cursor also changes when an indicator is drawn in hover style.
4224 The default is for the hover appearance to be the same as the normal appearance and calling
4225 <a class="message" href="#SCI_INDICSETFORE">SCI_INDICSETFORE</a> or
4226 <a class="message" href="#SCI_INDICSETSTYLE">SCI_INDICSETSTYLE</a> will
4227 also reset the hover attribute.</p>
4229 <p><b id="SCI_INDICSETFLAGS">SCI_INDICSETFLAGS(int indicatorNumber, int flags)</b><br />
4230 <b id="SCI_INDICGETFLAGS">SCI_INDICGETFLAGS(int indicatorNumber)</b><br />
4231 These messages set and get the flags associated with an indicator.
4232 There is currently one flag defined, <code>SC_INDICFLAG_VALUEFORE</code>: when this flag is set
4233 the colour used by the indicator is not from the indicator's fore setting but instead from the value of the indicator at
4234 that point in the file. This allows many colours to be displayed for a single indicator. The value is an <a class="jump"
4235 href="#colour">RGB integer colour</a> that has been ored with <code>SC_INDICVALUEBIT</code>(0x1000000)
4236 when calling <a class="message" href="#SCI_SETINDICATORVALUE">SCI_SETINDICATORVALUE</a>.
4237 To find the colour from the value, and the value with <code>SC_INDICVALUEMASK</code>(0xFFFFFF).
4238 </p>
4241 <b id="SCI_SETINDICATORCURRENT">SCI_SETINDICATORCURRENT(int indicator)</b><br />
4242 <b id="SCI_GETINDICATORCURRENT">SCI_GETINDICATORCURRENT</b><br />
4243 These two messages set and get the indicator that will be affected by calls to
4244 <a class="message" href="#SCI_INDICATORFILLRANGE">SCI_INDICATORFILLRANGE(int position, int fillLength)</a> and
4245 <a class="message" href="#SCI_INDICATORCLEARRANGE">SCI_INDICATORCLEARRANGE(int position, int clearLength)</a>.
4246 </p>
4249 <b id="SCI_SETINDICATORVALUE">SCI_SETINDICATORVALUE(int value)</b><br />
4250 <b id="SCI_GETINDICATORVALUE">SCI_GETINDICATORVALUE</b><br />
4251 These two messages set and get the value that will be set by calls to
4252 <a class="message" href="#SCI_INDICATORFILLRANGE">SCI_INDICATORFILLRANGE</a>.
4253 </p>
4256 <b id="SCI_INDICATORFILLRANGE">SCI_INDICATORFILLRANGE(int position, int fillLength)</b><br />
4257 <b id="SCI_INDICATORCLEARRANGE">SCI_INDICATORCLEARRANGE(int position, int clearLength)</b><br />
4258 These two messages fill or clear a range for the current indicator.
4259 <code>SCI_INDICATORFILLRANGE</code> fills with the
4260 the current value.
4261 </p>
4264 <b id="SCI_INDICATORALLONFOR">SCI_INDICATORALLONFOR(int position)</b><br />
4265 Retrieve a bitmap value representing which indicators are non-zero at a position.
4266 Only the first 32 indicators are represented in the result so no IME indicators are included.
4267 </p>
4270 <b id="SCI_INDICATORVALUEAT">SCI_INDICATORVALUEAT(int indicator, int position)</b><br />
4271 Retrieve the value of a particular indicator at a position.
4272 </p>
4275 <b id="SCI_INDICATORSTART">SCI_INDICATORSTART(int indicator, int position)</b><br />
4276 <b id="SCI_INDICATOREND">SCI_INDICATOREND(int indicator, int position)</b><br />
4277 Find the start or end of a range with one value from a position within the range.
4278 Can be used to iterate through the document to discover all the indicator positions.
4279 </p>
4281 <h3 id="FindIndicators">OS X Find Indicator</h3>
4283 <p>On OS X search matches are highlighted with an animated gold rounded rectangle.
4284 The indicator shows, then briefly grows 25% and shrinks to the original size to draw the user's attention.
4285 While this feature is currently only implemented on OS X, it may be implemented on other platforms
4286 in the future.</p>
4288 <p><b id="SCI_FINDINDICATORSHOW">SCI_FINDINDICATORSHOW(int start, int end)</b><br />
4289 <b id="SCI_FINDINDICATORFLASH">SCI_FINDINDICATORFLASH(int start, int end)</b><br />
4290 These two messages show and animate the find indicator. The indicator remains visible with
4291 <code>SCI_FINDINDICATORSHOW</code> and fades out after showing for half a second with
4292 <code>SCI_FINDINDICATORFLASH</code>.
4293 <code>SCI_FINDINDICATORSHOW</code> behaves similarly to the OS X TextEdit and Safari applications
4294 and is best suited to editing documentation where the search target is often a word.
4295 <code>SCI_FINDINDICATORFLASH</code> is similar to Xcode and is suited to editing source code
4296 where the match will often be located next to operators which would otherwise be hidden under the indicator's
4297 padding.
4298 </p>
4300 <p><b id="SCI_FINDINDICATORHIDE">SCI_FINDINDICATORHIDE</b><br />
4301 This message hides the find indicator.
4302 </p>
4304 <p>Earlier versions of Scintilla allowed <a href="#StyleByteIndicators">partitioning style bytes</a>
4305 between style numbers and indicators and provided APIs for setting and querying this.</p>
4308 <h2 id="Autocompletion">Autocompletion</h2>
4310 <p>Autocompletion displays a list box showing likely identifiers based upon the user's typing.
4311 The user chooses the currently selected item by pressing the tab character or another character
4312 that is a member of the fillup character set defined with <code>SCI_AUTOCSETFILLUPS</code>.
4313 Autocompletion is triggered by your application. For example, in C if you detect that the user
4314 has just typed <code>fred.</code> you could look up <code>fred</code>, and if it has a known
4315 list of members, you could offer them in an autocompletion list. Alternatively, you could
4316 monitor the user's typing and offer a list of likely items once their typing has narrowed down
4317 the choice to a reasonable list. As yet another alternative, you could define a key code to
4318 activate the list.</p>
4320 <p>When the user makes a selection from the list the container is sent a <code><a class="message"
4321 href="#SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</a></code> <a class="jump"
4322 href="#Notifications">notification message</a>. On return from the notification Scintilla will insert
4323 the selected text unless the autocompletion list has been cancelled, for example by the container sending
4324 <code><a class="message" href="#SCI_AUTOCCANCEL">SCI_AUTOCCANCEL</a></code>.</p>
4326 <p>To make use of autocompletion you must monitor each character added to the document. See
4327 <code>SciTEBase::CharAdded()</code> in SciTEBase.cxx for an example of autocompletion.</p>
4328 <code><a class="message" href="#SCI_AUTOCSHOW">SCI_AUTOCSHOW(int lenEntered, const char
4329 *list)</a><br />
4330 <a class="message" href="#SCI_AUTOCCANCEL">SCI_AUTOCCANCEL</a><br />
4331 <a class="message" href="#SCI_AUTOCACTIVE">SCI_AUTOCACTIVE</a><br />
4332 <a class="message" href="#SCI_AUTOCPOSSTART">SCI_AUTOCPOSSTART</a><br />
4333 <a class="message" href="#SCI_AUTOCCOMPLETE">SCI_AUTOCCOMPLETE</a><br />
4334 <a class="message" href="#SCI_AUTOCSTOPS">SCI_AUTOCSTOPS(&lt;unused&gt;, const char
4335 *chars)</a><br />
4336 <a class="message" href="#SCI_AUTOCSETSEPARATOR">SCI_AUTOCSETSEPARATOR(char
4337 separator)</a><br />
4338 <a class="message" href="#SCI_AUTOCGETSEPARATOR">SCI_AUTOCGETSEPARATOR</a><br />
4339 <a class="message" href="#SCI_AUTOCSELECT">SCI_AUTOCSELECT(&lt;unused&gt;, const char
4340 *select)</a><br />
4341 <a class="message" href="#SCI_AUTOCGETCURRENT">SCI_AUTOCGETCURRENT</a><br />
4342 <a class="message" href="#SCI_AUTOCGETCURRENTTEXT">SCI_AUTOCGETCURRENTTEXT(&lt;unused&gt;,
4343 char *text)</a><br />
4344 <a class="message" href="#SCI_AUTOCSETCANCELATSTART">SCI_AUTOCSETCANCELATSTART(bool
4345 cancel)</a><br />
4346 <a class="message" href="#SCI_AUTOCGETCANCELATSTART">SCI_AUTOCGETCANCELATSTART</a><br />
4347 <a class="message" href="#SCI_AUTOCSETFILLUPS">SCI_AUTOCSETFILLUPS(&lt;unused&gt;, const char
4348 *chars)</a><br />
4349 <a class="message" href="#SCI_AUTOCSETCHOOSESINGLE">SCI_AUTOCSETCHOOSESINGLE(bool
4350 chooseSingle)</a><br />
4351 <a class="message" href="#SCI_AUTOCGETCHOOSESINGLE">SCI_AUTOCGETCHOOSESINGLE</a><br />
4352 <a class="message" href="#SCI_AUTOCSETIGNORECASE">SCI_AUTOCSETIGNORECASE(bool
4353 ignoreCase)</a><br />
4354 <a class="message" href="#SCI_AUTOCGETIGNORECASE">SCI_AUTOCGETIGNORECASE</a><br />
4355 <a class="message" href="#SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR">SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR(int behaviour)</a><br />
4356 <a class="message" href="#SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR">SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR</a><br />
4357 <a class="message" href="#SCI_AUTOCSETMULTI">SCI_AUTOCSETMULTI(int multi)</a><br />
4358 <a class="message" href="#SCI_AUTOCGETMULTI">SCI_AUTOCGETMULTI</a><br />
4359 <a class="message" href="#SCI_AUTOCSETORDER">SCI_AUTOCSETORDER(int order)</a><br />
4360 <a class="message" href="#SCI_AUTOCGETORDER">SCI_AUTOCGETORDER</a><br />
4361 <a class="message" href="#SCI_AUTOCSETAUTOHIDE">SCI_AUTOCSETAUTOHIDE(bool autoHide)</a><br />
4362 <a class="message" href="#SCI_AUTOCGETAUTOHIDE">SCI_AUTOCGETAUTOHIDE</a><br />
4363 <a class="message" href="#SCI_AUTOCSETDROPRESTOFWORD">SCI_AUTOCSETDROPRESTOFWORD(bool
4364 dropRestOfWord)</a><br />
4365 <a class="message" href="#SCI_AUTOCGETDROPRESTOFWORD">SCI_AUTOCGETDROPRESTOFWORD</a><br />
4366 <a class="message" href="#SCI_REGISTERIMAGE">SCI_REGISTERIMAGE(int type, const char *xpmData)</a><br />
4367 <a class="message" href="#SCI_REGISTERRGBAIMAGE">SCI_REGISTERRGBAIMAGE(int type, const char *pixels)</a><br />
4368 <a class="message" href="#SCI_CLEARREGISTEREDIMAGES">SCI_CLEARREGISTEREDIMAGES</a><br />
4369 <a class="message" href="#SCI_AUTOCSETTYPESEPARATOR">SCI_AUTOCSETTYPESEPARATOR(char separatorCharacter)</a><br />
4370 <a class="message" href="#SCI_AUTOCGETTYPESEPARATOR">SCI_AUTOCGETTYPESEPARATOR</a><br />
4371 <a class="message" href="#SCI_AUTOCSETMAXHEIGHT">SCI_AUTOCSETMAXHEIGHT(int rowCount)</a><br />
4372 <a class="message" href="#SCI_AUTOCGETMAXHEIGHT">SCI_AUTOCGETMAXHEIGHT</a><br />
4373 <a class="message" href="#SCI_AUTOCSETMAXWIDTH">SCI_AUTOCSETMAXWIDTH(int characterCount)</a><br />
4374 <a class="message" href="#SCI_AUTOCGETMAXWIDTH">SCI_AUTOCGETMAXWIDTH</a><br />
4375 </code>
4377 <p><b id="SCI_AUTOCSHOW">SCI_AUTOCSHOW(int lenEntered, const char *list)</b><br />
4378 This message causes a list to be displayed. <code>lenEntered</code> is the number of
4379 characters of the word already entered and <code>list</code> is the list of words separated by
4380 separator characters. The initial separator character is a space but this can be set or got
4381 with <a class="message" href="#SCI_AUTOCSETSEPARATOR"><code>SCI_AUTOCSETSEPARATOR</code></a>
4382 and <a class="message"
4383 href="#SCI_AUTOCGETSEPARATOR"><code>SCI_AUTOCGETSEPARATOR</code></a>.</p>
4385 <p>With default settings, the list of words should be in sorted order.
4386 If set to ignore case mode with <a class="message" href="#SCI_AUTOCSETIGNORECASE"><code>SCI_AUTOCSETIGNORECASE</code></a>, then
4387 strings are matched after being converted to upper case. One result of this is that the list
4388 should be sorted with the punctuation characters '[', '\', ']', '^', '_', and '`' sorted after
4389 letters.
4390 Alternative handling of list order may be specified with <a class="message" href="#SCI_AUTOCSETORDER">SCI_AUTOCSETORDER</a>
4391 </p>
4393 <p><b id="SCI_AUTOCCANCEL">SCI_AUTOCCANCEL</b><br />
4394 This message cancels any displayed autocompletion list. When in autocompletion mode, the list
4395 should disappear when the user types a character that can not be part of the autocompletion,
4396 such as '.', '(' or '[' when typing an identifier. A set of characters that will cancel
4397 autocompletion can be specified with <a class="message"
4398 href="#SCI_AUTOCSTOPS"><code>SCI_AUTOCSTOPS</code></a>.</p>
4400 <p><b id="SCI_AUTOCACTIVE">SCI_AUTOCACTIVE</b><br />
4401 This message returns non-zero if there is an active autocompletion list and zero if there is
4402 not.</p>
4404 <p><b id="SCI_AUTOCPOSSTART">SCI_AUTOCPOSSTART</b><br />
4405 This returns the value of the current position when <code>SCI_AUTOCSHOW</code> started display
4406 of the list.</p>
4408 <p><b id="SCI_AUTOCCOMPLETE">SCI_AUTOCCOMPLETE</b><br />
4409 This message triggers autocompletion. This has the same effect as the tab key.</p>
4411 <p><b id="SCI_AUTOCSTOPS">SCI_AUTOCSTOPS(&lt;unused&gt;, const char *chars)</b><br />
4412 The <code>chars</code> argument is a string containing a list of characters that will
4413 automatically cancel the autocompletion list. When you start the editor, this list is
4414 empty.</p>
4416 <p><b id="SCI_AUTOCSETSEPARATOR">SCI_AUTOCSETSEPARATOR(char separator)</b><br />
4417 <b id="SCI_AUTOCGETSEPARATOR">SCI_AUTOCGETSEPARATOR</b><br />
4418 These two messages set and get the separator character used to separate words in the
4419 <code>SCI_AUTOCSHOW</code> list. The default is the space character.</p>
4421 <p><b id="SCI_AUTOCSELECT">SCI_AUTOCSELECT(&lt;unused&gt;, const char *select)</b><br />
4422 <b id="SCI_AUTOCGETCURRENT">SCI_AUTOCGETCURRENT</b><br />
4423 This message selects an item in the autocompletion list. It searches the list of words for the
4424 first that matches <code>select</code>. By default, comparisons are case sensitive, but you can
4425 change this with <a class="message"
4426 href="#SCI_AUTOCSETIGNORECASE"><code>SCI_AUTOCSETIGNORECASE</code></a>. The match is character
4427 by character for the length of the <code>select</code> string. That is, if select is "Fred" it
4428 will match "Frederick" if this is the first item in the list that begins with "Fred". If an
4429 item is found, it is selected. If the item is not found, the autocompletion list closes if
4430 auto-hide is true (see <a class="message"
4431 href="#SCI_AUTOCSETAUTOHIDE"><code>SCI_AUTOCSETAUTOHIDE</code></a>).<br />
4432 The current selection index can be retrieved with <code>SCI_AUTOCGETCURRENT</code>.</p>
4434 <p><b id="SCI_AUTOCGETCURRENTTEXT">SCI_AUTOCGETCURRENTTEXT(&lt;unused&gt;, char *text NUL-terminated)</b><br />
4435 This message retrieves the current selected text in the autocompletion list. Normally the
4436 <a class="message" href="#SCN_AUTOCSELECTION"><code>SCN_AUTOCSELECTION</code></a> notification
4437 is used instead.</p>
4439 <p>The value is copied to the <code>text</code> buffer, returning the length (not including the
4440 terminating 0). If not found, an empty string is copied to the buffer and 0 is returned.</p>
4442 <p>If the value argument is 0 then the length that should be allocated to store the value is
4443 returned; again, the terminating 0 is not included.</p>
4445 <p><b id="SCI_AUTOCSETCANCELATSTART">SCI_AUTOCSETCANCELATSTART(bool cancel)</b><br />
4446 <b id="SCI_AUTOCGETCANCELATSTART">SCI_AUTOCGETCANCELATSTART</b><br />
4447 The default behaviour is for the list to be cancelled if the caret moves to the location it
4448 was at when the list was displayed. By calling this message with a <code>false</code> argument,
4449 the list is not cancelled until the caret moves at least one character before the word being
4450 completed.</p>
4452 <p><b id="SCI_AUTOCSETFILLUPS">SCI_AUTOCSETFILLUPS(&lt;unused&gt;, const char *chars)</b><br />
4453 If a fillup character is typed with an autocompletion list active, the currently selected item
4454 in the list is added into the document, then the fillup character is added. Common fillup
4455 characters are '(', '[' and '.' but others are possible depending on the language. By default,
4456 no fillup characters are set.</p>
4458 <p><b id="SCI_AUTOCSETCHOOSESINGLE">SCI_AUTOCSETCHOOSESINGLE(bool chooseSingle)</b><br />
4459 <b id="SCI_AUTOCGETCHOOSESINGLE">SCI_AUTOCGETCHOOSESINGLE</b><br />
4460 If you use <code>SCI_AUTOCSETCHOOSESINGLE(1)</code> and a list has only one item, it is
4461 automatically added and no list is displayed. The default is to display the list even if there
4462 is only a single item.</p>
4464 <p><b id="SCI_AUTOCSETIGNORECASE">SCI_AUTOCSETIGNORECASE(bool ignoreCase)</b><br />
4465 <b id="SCI_AUTOCGETIGNORECASE">SCI_AUTOCGETIGNORECASE</b><br />
4466 By default, matching of characters to list members is case sensitive. These messages let you
4467 set and get case sensitivity.</p>
4469 <p><b id="SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR">SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR(int behaviour)</b><br />
4470 <b id="SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR">SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR</b><br />
4471 When autocompletion is set to ignore case (<code>SCI_AUTOCSETIGNORECASE</code>), by default it will
4472 nonetheless select the first list member that matches in a case sensitive way to entered characters.
4473 This corresponds to a behaviour property of <code>SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE</code> (0).
4474 If you want autocompletion to ignore case at all, choose <code>SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE</code> (1).</p>
4476 <p><b id="SCI_AUTOCSETMULTI">SCI_AUTOCSETMULTI(int multi)</b><br />
4477 <b id="SCI_AUTOCGETMULTI">SCI_AUTOCGETMULTI</b><br />
4478 When autocompleting with multiple selections present, the autocompleted text can go into just the main selection with
4479 <code>SC_MULTIAUTOC_ONCE</code> (0) or into each selection with <code>SC_MULTIAUTOC_EACH</code> (1).
4480 The default is <code>SC_MULTIAUTOC_ONCE</code>.</p>
4482 <p><b id="SCI_AUTOCSETORDER">SCI_AUTOCSETORDER(int order)</b><br />
4483 <b id="SCI_AUTOCGETORDER">SCI_AUTOCGETORDER</b><br />
4484 The default setting <code>SC_ORDER_PRESORTED</code> (0) requires that the list be provided in alphabetical sorted order.
4485 </p>
4486 <p>Sorting the list can be done by Scintilla instead of the application with <code>SC_ORDER_PERFORMSORT</code> (1).
4487 This will take additional time.
4488 </p>
4489 <p>Applications that wish to prioritize some values and show the list in order of priority instead
4490 of alphabetical order can use <code>SC_ORDER_CUSTOM</code> (2).
4491 This requires extra processing in <a class="message" href="#SCI_AUTOCSHOW">SCI_AUTOCSHOW</a> to create a sorted index.
4492 </p>
4493 <p>Setting the order should be done before calling <a class="message" href="#SCI_AUTOCSHOW">SCI_AUTOCSHOW</a>.
4494 </p>
4496 <p><b id="SCI_AUTOCSETAUTOHIDE">SCI_AUTOCSETAUTOHIDE(bool autoHide)</b><br />
4497 <b id="SCI_AUTOCGETAUTOHIDE">SCI_AUTOCGETAUTOHIDE</b><br />
4498 By default, the list is cancelled if there are no viable matches (the user has typed
4499 characters that no longer match a list entry). If you want to keep displaying the original
4500 list, set <code>autoHide</code> to <code>false</code>. This also effects <a class="message"
4501 href="#SCI_AUTOCSELECT"><code>SCI_AUTOCSELECT</code></a>.</p>
4503 <p><b id="SCI_AUTOCSETDROPRESTOFWORD">SCI_AUTOCSETDROPRESTOFWORD(bool dropRestOfWord)</b><br />
4504 <b id="SCI_AUTOCGETDROPRESTOFWORD">SCI_AUTOCGETDROPRESTOFWORD</b><br />
4505 When an item is selected, any word characters following the caret are first erased if
4506 <code>dropRestOfWord</code> is set <code>true</code>. The default is <code>false</code>.</p>
4509 <b id="SCI_REGISTERIMAGE">SCI_REGISTERIMAGE(int type, const char *xpmData)</b><br />
4510 <b id="SCI_REGISTERRGBAIMAGE">SCI_REGISTERRGBAIMAGE(int type, const char *pixels)</b><br />
4511 <b id="SCI_CLEARREGISTEREDIMAGES">SCI_CLEARREGISTEREDIMAGES</b><br />
4512 <b id="SCI_AUTOCSETTYPESEPARATOR">SCI_AUTOCSETTYPESEPARATOR(char separatorCharacter)</b><br />
4513 <b id="SCI_AUTOCGETTYPESEPARATOR">SCI_AUTOCGETTYPESEPARATOR</b><br />
4515 Autocompletion list items may display an image as well as text. Each image is first registered with an integer
4516 type. Then this integer is included in the text of the list separated by a '?' from the text. For example,
4517 "fclose?2 fopen" displays image 2 before the string "fclose" and no image before "fopen".
4518 The images are in either the <a class="jump" href="#XPM">XPM format</a> (<code>SCI_REGISTERIMAGE</code>) or
4519 <a class="jump" href="#RGBA">RGBA format</a> (<code>SCI_REGISTERRGBAIMAGE</code>).
4520 For <code>SCI_REGISTERRGBAIMAGE</code> the width and height must previously been set with
4521 the <a class="message" href="#SCI_RGBAIMAGESETWIDTH"><code>SCI_RGBAIMAGESETWIDTH</code></a> and
4522 <a class="message" href="#SCI_RGBAIMAGESETHEIGHT"><code>SCI_RGBAIMAGESETHEIGHT</code></a> messages.
4523 The set of registered images can be cleared with <code>SCI_CLEARREGISTEREDIMAGES</code> and the '?' separator changed
4524 with <code>SCI_AUTOCSETTYPESEPARATOR</code>.
4525 </p>
4528 <b id="SCI_AUTOCSETMAXHEIGHT">SCI_AUTOCSETMAXHEIGHT(int rowCount)</b><br />
4529 <b id="SCI_AUTOCGETMAXHEIGHT">SCI_AUTOCGETMAXHEIGHT</b><br />
4531 Get or set the maximum number of rows that will be visible in an autocompletion list. If there are more rows in the list, then a vertical
4532 scrollbar is shown. The default is 5.
4533 </p>
4536 <b id="SCI_AUTOCSETMAXWIDTH">SCI_AUTOCSETMAXWIDTH(int characterCount)</b><br />
4537 <b id="SCI_AUTOCGETMAXWIDTH">SCI_AUTOCGETMAXWIDTH</b><br />
4539 Get or set the maximum width of an autocompletion list expressed as the number of characters in the longest item that will be totally visible.
4540 If zero (the default) then the list's width is calculated to fit the item with the most characters. Any items that cannot be fully displayed within
4541 the available width are indicated by the presence of ellipsis.
4542 </p>
4544 <h2 id="UserLists">User lists</h2>
4546 <p>User lists use the same internal mechanisms as autocompletion lists, and all the calls
4547 listed for autocompletion work on them; you cannot display a user list at the same time as an
4548 autocompletion list is active. They differ in the following respects:</p>
4550 <p>o The <code><a class="message"
4551 href="#SCI_AUTOCSETCHOOSESINGLE">SCI_AUTOCSETCHOOSESINGLE</a></code> message has no
4552 effect.<br />
4553 o When the user makes a selection you are sent a <code><a class="message"
4554 href="#SCN_USERLISTSELECTION">SCN_USERLISTSELECTION</a></code> <a class="jump"
4555 href="#Notifications">notification message</a> rather than <code><a class="message"
4556 href="#SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</a></code>.</p>
4558 <p>BEWARE: if you have set fillup characters or stop characters, these will still be active
4559 with the user list, and may result in items being selected or the user list cancelled due to
4560 the user typing into the editor.</p>
4562 <p><b id="SCI_USERLISTSHOW">SCI_USERLISTSHOW(int listType, const char *list)</b><br />
4563 The <code>listType</code> parameter is returned to the container as the <code>wParam</code>
4564 field of the <a class="message" href="#SCNotification"><code>SCNotification</code></a>
4565 structure. It must be greater than 0 as this is how Scintilla tells the difference between an
4566 autocompletion list and a user list. If you have different types of list, for example a list of
4567 buffers and a list of macros, you can use <code>listType</code> to tell which one has returned
4568 a selection. </p>
4570 <h2 id="CallTips">Call tips</h2>
4572 <p>Call tips are small windows displaying the arguments to a function and are displayed after
4573 the user has typed the name of the function. They normally display characters using the font
4574 facename, size and character set defined by
4575 <code><a class="message" href="#StyleDefinition">STYLE_DEFAULT</a></code>. You can choose to
4576 use <code><a class="message" href="#StyleDefinition">STYLE_CALLTIP</a></code> to define the
4577 facename, size, foreground and background colours and character set with
4578 <code><a class="message" href="#SCI_CALLTIPUSESTYLE">SCI_CALLTIPUSESTYLE</a></code>.
4579 This also enables support for Tab characters.
4581 There is some interaction between call tips and autocompletion lists in that showing a
4582 call tip cancels any active autocompletion list, and vice versa.</p>
4584 <p>Call tips are not implemented on Qt.</p>
4586 <p>Call tips can highlight part of the text within them. You could use this to highlight the
4587 current argument to a function by counting the number of commas (or whatever separator your
4588 language uses). See <code>SciTEBase::CharAdded()</code> in <code>SciTEBase.cxx</code> for an
4589 example of call tip use.</p>
4591 <p>The mouse may be clicked on call tips and this causes a
4592 <code><a class="message" href="#SCN_CALLTIPCLICK">SCN_CALLTIPCLICK</a></code>
4593 notification to be sent to the container. Small up and down arrows may be displayed within
4594 a call tip by, respectively, including the characters '\001', or '\002'. This is useful
4595 for showing that there are overloaded variants of one function name and that the user can
4596 click on the arrows to cycle through the overloads.</p>
4598 <p>Alternatively, call tips can be displayed when you leave the mouse pointer for a while over
4599 a word in response to the <code><a class="message"
4600 href="#SCN_DWELLSTART">SCN_DWELLSTART</a></code> <a class="jump"
4601 href="#Notifications">notification</a> and cancelled in response to <code><a class="message"
4602 href="#SCN_DWELLEND">SCN_DWELLEND</a></code>. This method could be used in a debugger to give
4603 the value of a variable, or during editing to give information about the word under the
4604 pointer.</p>
4605 <code><a class="message" href="#SCI_CALLTIPSHOW">SCI_CALLTIPSHOW(int posStart, const char
4606 *definition)</a><br />
4607 <a class="message" href="#SCI_CALLTIPCANCEL">SCI_CALLTIPCANCEL</a><br />
4608 <a class="message" href="#SCI_CALLTIPACTIVE">SCI_CALLTIPACTIVE</a><br />
4609 <a class="message" href="#SCI_CALLTIPPOSSTART">SCI_CALLTIPPOSSTART</a><br />
4610 <a class="message" href="#SCI_CALLTIPSETPOSSTART">SCI_CALLTIPSETPOSSTART(int posStart)</a><br />
4611 <a class="message" href="#SCI_CALLTIPSETHLT">SCI_CALLTIPSETHLT(int highlightStart, int
4612 highlightEnd)</a><br />
4613 <a class="message" href="#SCI_CALLTIPSETBACK">SCI_CALLTIPSETBACK(int colour)</a><br />
4614 <a class="message" href="#SCI_CALLTIPSETFORE">SCI_CALLTIPSETFORE(int colour)</a><br />
4615 <a class="message" href="#SCI_CALLTIPSETFOREHLT">SCI_CALLTIPSETFOREHLT(int colour)</a><br />
4616 <a class="message" href="#SCI_CALLTIPUSESTYLE">SCI_CALLTIPUSESTYLE(int tabsize)</a><br />
4617 <a class="message" href="#SCI_CALLTIPSETPOSITION">SCI_CALLTIPSETPOSITION(bool above)</a><br />
4618 </code>
4620 <p><b id="SCI_CALLTIPSHOW">SCI_CALLTIPSHOW(int posStart, const char *definition)</b><br />
4621 This message starts the process by displaying the call tip window. If a call tip is already
4622 active, this has no effect.<br />
4623 <code>posStart</code> is the position in the document at which to align the call tip. The call
4624 tip text is aligned to start 1 line below this character unless you have included up and/or
4625 down arrows in the call tip text in which case the tip is aligned to the right-hand edge of
4626 the rightmost arrow. The assumption is that you will start the text with something like
4627 "\001 1 of 3 \002".<br />
4628 <code>definition</code> is the call tip text. This can contain multiple lines separated by
4629 '\n' (Line Feed, ASCII code 10) characters. Do not include '\r' (Carriage Return, ASCII
4630 code 13), as this will most likely print as an empty box. '\t' (Tab, ASCII code 9) is
4631 supported if you set a tabsize with
4632 <code><a class="message" href="#SCI_CALLTIPUSESTYLE">SCI_CALLTIPUSESTYLE</a></code>.<br />
4633 The position of the caret is remembered here so that the call tip can be cancelled automatically if subsequent deletion
4634 moves the caret before this position.</p>
4636 <p><b id="SCI_CALLTIPCANCEL">SCI_CALLTIPCANCEL</b><br />
4637 This message cancels any displayed call tip. Scintilla will also cancel call tips for you if
4638 you use any keyboard commands that are not compatible with editing the argument list of a
4639 function.
4640 Call tips are cancelled if you delete back past the position where the caret was when the tip was triggered.</p>
4642 <p><b id="SCI_CALLTIPACTIVE">SCI_CALLTIPACTIVE</b><br />
4643 This returns 1 if a call tip is active and 0 if it is not active.</p>
4645 <p><b id="SCI_CALLTIPPOSSTART">SCI_CALLTIPPOSSTART</b><br />
4646 <b id="SCI_CALLTIPSETPOSSTART">SCI_CALLTIPSETPOSSTART(int posStart)</b><br />
4647 This message returns or sets the value of the current position when <code>SCI_CALLTIPSHOW</code>
4648 started to display the tip.</p>
4650 <p><b id="SCI_CALLTIPSETHLT">SCI_CALLTIPSETHLT(int hlStart, int hlEnd)</b><br />
4651 This sets the region of the call tips text to display in a highlighted style.
4652 <code>hlStart</code> is the zero-based index into the string of the first character to
4653 highlight and <code>hlEnd</code> is the index of the first character after the highlight.
4654 <code>hlEnd</code> must be greater than <code>hlStart</code>; <code>hlEnd-hlStart</code> is the
4655 number of characters to highlight. Highlights can extend over line ends if this is
4656 required.</p>
4658 <p>Unhighlighted text is drawn in a mid grey. Selected text is drawn in a dark blue. The
4659 background is white. These can be changed with
4660 <code>SCI_CALLTIPSETBACK</code>,
4661 <code>SCI_CALLTIPSETFORE</code>, and
4662 <code>SCI_CALLTIPSETFOREHLT</code>.
4663 </p>
4665 <p><b id="SCI_CALLTIPSETBACK">SCI_CALLTIPSETBACK(int colour)</b><br />
4666 The background colour of call tips can be set with this message; the default colour is white.
4667 It is not a good idea to set a dark colour as the background as the default colour for normal
4668 calltip text is mid grey and the default colour for highlighted text is dark blue. This also
4669 sets the background colour of <code>STYLE_CALLTIP</code>.</p>
4671 <p><b id="SCI_CALLTIPSETFORE">SCI_CALLTIPSETFORE(int colour)</b><br />
4672 The colour of call tip text can be set with this message; the default colour is mid grey.
4673 This also sets the foreground colour of <code>STYLE_CALLTIP</code>.</p>
4675 <p><b id="SCI_CALLTIPSETFOREHLT">SCI_CALLTIPSETFOREHLT(int colour)</b><br />
4676 The colour of highlighted call tip text can be set with this message; the default colour
4677 is dark blue.</p>
4679 <p><b id="SCI_CALLTIPUSESTYLE">SCI_CALLTIPUSESTYLE(int tabsize)</b><br />
4680 This message changes the style used for call tips from <code>STYLE_DEFAULT</code> to
4681 <code>STYLE_CALLTIP</code> and sets a tab size in screen pixels. If <code>tabsize</code> is
4682 less than 1, Tab characters are not treated specially. Once this call has been used, the
4683 call tip foreground and background colours are also taken from the style.</p>
4685 <p><b id="SCI_CALLTIPSETPOSITION">SCI_CALLTIPSETPOSITION(bool above)</b><br />
4686 By default the calltip is displayed below the text, setting above to <code>true</code>
4687 (1) will display it above the text.</p>
4690 <h2 id="KeyboardCommands">Keyboard commands</h2>
4692 <p>To allow the container application to perform any of the actions available to the user with
4693 keyboard, all the keyboard actions are messages. They do not take any parameters. These
4694 commands are also used when redefining the key bindings with the <a class="message"
4695 href="#SCI_ASSIGNCMDKEY"><code>SCI_ASSIGNCMDKEY</code></a> message.</p>
4697 <table border="0" summary="Keyboard commands">
4698 <tbody>
4699 <tr>
4700 <td><code>SCI_LINEDOWN</code></td>
4702 <td><code>SCI_LINEDOWNEXTEND</code></td>
4704 <td><code>SCI_LINEDOWNRECTEXTEND</code></td>
4706 <td><code>SCI_LINESCROLLDOWN</code></td>
4707 </tr>
4709 <tr>
4710 <td><code>SCI_LINEUP</code></td>
4712 <td><code>SCI_LINEUPEXTEND</code></td>
4714 <td><code>SCI_LINEUPRECTEXTEND</code></td>
4716 <td><code>SCI_LINESCROLLUP</code></td>
4717 </tr>
4719 <tr>
4720 <td><code>SCI_PARADOWN</code></td>
4722 <td><code>SCI_PARADOWNEXTEND</code></td>
4724 <td><code>SCI_PARAUP</code></td>
4726 <td><code>SCI_PARAUPEXTEND</code></td>
4727 </tr>
4729 <tr>
4730 <td><code>SCI_CHARLEFT</code></td>
4732 <td><code>SCI_CHARLEFTEXTEND</code></td>
4734 <td><code>SCI_CHARLEFTRECTEXTEND</code></td>
4735 </tr>
4737 <tr>
4738 <td><code>SCI_CHARRIGHT</code></td>
4740 <td><code>SCI_CHARRIGHTEXTEND</code></td>
4742 <td><code>SCI_CHARRIGHTRECTEXTEND</code></td>
4743 </tr>
4745 <tr>
4746 <td><code>SCI_WORDLEFT</code></td>
4748 <td><code>SCI_WORDLEFTEXTEND</code></td>
4750 <td><code>SCI_WORDRIGHT</code></td>
4752 <td><code>SCI_WORDRIGHTEXTEND</code></td>
4753 </tr>
4755 <tr>
4756 <td><code>SCI_WORDLEFTEND</code></td>
4758 <td><code>SCI_WORDLEFTENDEXTEND</code></td>
4760 <td><code>SCI_WORDRIGHTEND</code></td>
4762 <td><code>SCI_WORDRIGHTENDEXTEND</code></td>
4763 </tr>
4765 <tr>
4766 <td><code>SCI_WORDPARTLEFT</code></td>
4768 <td><code>SCI_WORDPARTLEFTEXTEND</code></td>
4770 <td><code>SCI_WORDPARTRIGHT</code></td>
4772 <td><code>SCI_WORDPARTRIGHTEXTEND</code></td>
4773 </tr>
4775 <tr>
4776 <td><code>SCI_HOME</code></td>
4778 <td><code>SCI_HOMEEXTEND</code></td>
4780 <td><code>SCI_HOMERECTEXTEND</code></td>
4781 </tr>
4783 <tr>
4784 <td><code>SCI_HOMEDISPLAY</code></td>
4786 <td><code>SCI_HOMEDISPLAYEXTEND</code></td>
4788 <td><code>SCI_HOMEWRAP</code></td>
4790 <td><code>SCI_HOMEWRAPEXTEND</code></td>
4791 </tr>
4793 <tr>
4794 <td><code>SCI_VCHOME</code></td>
4796 <td><code>SCI_VCHOMEEXTEND</code></td>
4798 <td><code>SCI_VCHOMERECTEXTEND</code></td>
4799 </tr>
4801 <tr>
4802 <td><code>SCI_VCHOMEWRAP</code></td>
4804 <td><code>SCI_VCHOMEWRAPEXTEND</code></td>
4806 <td><code>SCI_VCHOMEDISPLAY</code></td>
4808 <td><code>SCI_VCHOMEDISPLAYEXTEND</code></td>
4809 </tr>
4811 <tr>
4812 <td><code>SCI_LINEEND</code></td>
4814 <td><code>SCI_LINEENDEXTEND</code></td>
4816 <td><code>SCI_LINEENDRECTEXTEND</code></td>
4817 </tr>
4819 <tr>
4820 <td><code>SCI_LINEENDDISPLAY</code></td>
4822 <td><code>SCI_LINEENDDISPLAYEXTEND</code></td>
4824 <td><code>SCI_LINEENDWRAP</code></td>
4826 <td><code>SCI_LINEENDWRAPEXTEND</code></td>
4827 </tr>
4829 <tr>
4830 <td><code>SCI_DOCUMENTSTART</code></td>
4832 <td><code>SCI_DOCUMENTSTARTEXTEND</code></td>
4834 <td><code>SCI_DOCUMENTEND</code></td>
4836 <td><code>SCI_DOCUMENTENDEXTEND</code></td>
4837 </tr>
4839 <tr>
4840 <td><code>SCI_PAGEUP</code></td>
4842 <td><code>SCI_PAGEUPEXTEND</code></td>
4844 <td><code>SCI_PAGEUPRECTEXTEND</code></td>
4845 </tr>
4847 <tr>
4848 <td><code>SCI_PAGEDOWN</code></td>
4850 <td><code>SCI_PAGEDOWNEXTEND</code></td>
4852 <td><code>SCI_PAGEDOWNRECTEXTEND</code></td>
4853 </tr>
4856 <tr>
4857 <td><code>SCI_STUTTEREDPAGEUP</code></td>
4859 <td><code>SCI_STUTTEREDPAGEUPEXTEND</code></td>
4860 </tr>
4862 <tr>
4863 <td><code>SCI_STUTTEREDPAGEDOWN</code></td>
4865 <td><code>SCI_STUTTEREDPAGEDOWNEXTEND</code></td>
4866 </tr>
4868 <tr>
4869 <td><code>SCI_DELETEBACK</code></td>
4871 <td><code>SCI_DELETEBACKNOTLINE</code></td>
4872 </tr>
4874 <tr>
4875 <td><code>SCI_DELWORDLEFT</code></td>
4877 <td><code>SCI_DELWORDRIGHT</code></td>
4879 <td><code>SCI_DELWORDRIGHTEND</code></td>
4880 </tr>
4882 <tr>
4883 <td><code>SCI_DELLINELEFT</code></td>
4885 <td><code>SCI_DELLINERIGHT</code></td>
4887 <td><code>SCI_LINEDELETE</code></td>
4888 </tr>
4890 <tr>
4891 <td><code>SCI_LINECUT</code></td>
4893 <td><code>SCI_LINECOPY</code></td>
4895 <td><code>SCI_LINETRANSPOSE</code></td>
4897 <td><code>SCI_LINEDUPLICATE</code></td>
4898 </tr>
4900 <tr>
4901 <td><code>SCI_LOWERCASE</code></td>
4903 <td><code>SCI_UPPERCASE</code></td>
4905 <td><code>SCI_CANCEL</code></td>
4907 <td><code>SCI_EDITTOGGLEOVERTYPE</code></td>
4908 </tr>
4910 <tr>
4911 <td><code>SCI_NEWLINE</code></td>
4913 <td><code>SCI_FORMFEED</code></td>
4915 <td><code>SCI_TAB</code></td>
4917 <td><code>SCI_BACKTAB</code></td>
4918 </tr>
4920 <tr>
4921 <td><code>SCI_SELECTIONDUPLICATE</code></td>
4923 <td><code>SCI_VERTICALCENTRECARET</code></td>
4925 </tr>
4927 <tr>
4928 <td><code>SCI_MOVESELECTEDLINESUP</code></td>
4930 <td><code>SCI_MOVESELECTEDLINESDOWN</code></td>
4931 </tr>
4933 <tr>
4934 <td><code>SCI_SCROLLTOSTART</code></td>
4936 <td><code>SCI_SCROLLTOEND</code></td>
4937 </tr>
4938 </tbody>
4939 </table>
4941 <p>The <code>SCI_*EXTEND</code> messages extend the selection.</p>
4943 <p>The <code>SCI_*RECTEXTEND</code> messages extend the rectangular selection
4944 (and convert regular selection to rectangular one, if any).</p>
4946 <p>The <code>SCI_WORDPART*</code> commands are used to move between word segments marked by
4947 capitalisation (aCamelCaseIdentifier) or underscores (an_under_bar_ident).</p>
4949 <p>The <code>SCI_HOME*</code> commands move the caret to the start of the line, while the
4950 <code>SCI_VCHOME*</code> commands move the caret to the first non-blank character of the line
4951 (ie. just after the indentation) unless it is already there; in this case, it acts as SCI_HOME*.</p>
4953 <p>The <code>SCI_[HOME|LINEEND]DISPLAY*</code> commands are used when in line wrap mode to
4954 allow movement to the start or end of display lines as opposed to the normal
4955 <code>SCI_[HOME|LINEEND]</code> commands which move to the start or end of document lines.</p>
4957 <p>The <code>SCI_[[VC]HOME|LINEEND]WRAP*</code> commands are like their namesakes
4958 <code>SCI_[[VC]HOME|LINEEND]*</code> except they behave differently when word-wrap is enabled:
4959 They go first to the start / end of the display line, like <code>SCI_[HOME|LINEEND]DISPLAY*</code>,
4960 but if the cursor is already at the point, it goes on to the start or end of the document line,
4961 as appropriate for <code>SCI_[[VC]HOME|LINEEND]*</code>.
4962 </p>
4964 <p>The <code>SCI_SCROLLTO[START|END]</code> commands scroll the document to the start
4965 or end without changing the selection. These commands match OS X platform conventions for the behaviour of the
4966 <code>home</code> and <code>end</code> keys. Scintilla can be made to match OS X applications
4967 by binding the <code>home</code> and <code>end</code> keys to these commands.
4968 </p>
4970 <h2 id="KeyBindings">Key bindings</h2>
4972 <p>There is a default binding of keys to commands that is defined in the Scintilla source in
4973 the file <code>KeyMap.cxx</code> by the constant <code>KeyMap::MapDefault[]</code>. This table
4974 maps key definitions to <code>SCI_*</code> messages with no parameters (mostly the <a
4975 class="jump" href="#KeyboardCommands">keyboard commands</a> discussed above, but any Scintilla
4976 command that has no arguments can be mapped). You can change the mapping to suit your own
4977 requirements.</p>
4978 <code><a class="message" href="#SCI_ASSIGNCMDKEY">SCI_ASSIGNCMDKEY(int keyDefinition, int
4979 sciCommand)</a><br />
4980 <a class="message" href="#SCI_CLEARCMDKEY">SCI_CLEARCMDKEY(int keyDefinition)</a><br />
4981 <a class="message" href="#SCI_CLEARALLCMDKEYS">SCI_CLEARALLCMDKEYS</a><br />
4982 <a class="message" href="#SCI_NULL">SCI_NULL</a><br />
4983 </code>
4985 <p><b id="keyDefinition">keyDefinition</b><br />
4986 A key definition contains the key code in the low 16-bits and the key modifiers in the high
4987 16-bits. To combine <code>keyCode</code> and <code>keyMod</code> set:<br />
4988 <br />
4989 <code>keyDefinition = keyCode + (keyMod &lt;&lt; 16)</code></p>
4991 <p>The key code is a visible or control character or a key from the <code>SCK_*</code>
4992 enumeration, which contains:<br />
4993 <code>SCK_ADD</code>, <code>SCK_BACK</code>, <code>SCK_DELETE</code>, <code>SCK_DIVIDE</code>,
4994 <code>SCK_DOWN</code>, <code>SCK_END</code>, <code>SCK_ESCAPE</code>, <code>SCK_HOME</code>,
4995 <code>SCK_INSERT</code>, <code>SCK_LEFT</code>, <code>SCK_MENU</code>, <code>SCK_NEXT</code> (Page Down),
4996 <code>SCK_PRIOR</code> (Page Up), <code>SCK_RETURN</code>, <code>SCK_RIGHT</code>,
4997 <code>SCK_RWIN</code>,
4998 <code>SCK_SUBTRACT</code>, <code>SCK_TAB</code>, <code>SCK_UP</code>, and
4999 <code>SCK_WIN</code>.</p>
5001 <p>The modifiers are a combination of zero or more of <code>SCMOD_ALT</code>,
5002 <code>SCMOD_CTRL</code>, <code>SCMOD_SHIFT</code>, and <code>SCMOD_META</code>.
5003 On OS X, the Command key is mapped to <code>SCMOD_CTRL</code> and the Control key to
5004 <code>SCMOD_META</code>.
5005 If you are building a table, you might
5006 want to use <code>SCMOD_NORM</code>, which has the value 0, to mean no modifiers.</p>
5008 <p><b id="SCI_ASSIGNCMDKEY">SCI_ASSIGNCMDKEY(int <a class="jump"
5009 href="#keyDefinition">keyDefinition</a>, int sciCommand)</b><br />
5010 This assigns the given key definition to a Scintilla command identified by
5011 <code>sciCommand</code>. <code>sciCommand</code> can be any <code>SCI_*</code> command that has
5012 no arguments.</p>
5014 <p><b id="SCI_CLEARCMDKEY">SCI_CLEARCMDKEY(int <a class="jump"
5015 href="#keyDefinition">keyDefinition</a>)</b><br />
5016 This makes the given key definition do nothing by assigning the action <code>SCI_NULL</code>
5017 to it.</p>
5019 <p><b id="SCI_CLEARALLCMDKEYS">SCI_CLEARALLCMDKEYS</b><br />
5020 This command removes all keyboard command mapping by setting an empty mapping table.</p>
5022 <p><b id="SCI_NULL">SCI_NULL</b><br />
5023 The <code>SCI_NULL</code> does nothing and is the value assigned to keys that perform no
5024 action. SCI_NULL ensures that keys do not propagate to the parent window as that may
5025 cause focus to move. If you want the standard platform behaviour use the constant 0 instead.</p>
5027 <h2 id="PopupEditMenu">Popup edit menu</h2>
5029 <p><b id="SCI_USEPOPUP">SCI_USEPOPUP(bool bEnablePopup)</b><br />
5030 Clicking the wrong button on the mouse pops up a short default editing menu. This may be
5031 turned off with <code>SCI_USEPOPUP(0)</code>. If you turn it off, context menu commands (in
5032 Windows, <code>WM_CONTEXTMENU</code>) will not be handled by Scintilla, so the parent of the
5033 Scintilla window will have the opportunity to handle the message.</p>
5035 <h2 id="MacroRecording">Macro recording</h2>
5037 <p>Start and stop macro recording mode. In macro recording mode, actions are reported to the
5038 container through <code><a class="message" href="#SCN_MACRORECORD">SCN_MACRORECORD</a></code>
5039 <a class="jump" href="#Notifications">notifications</a>. It is then up to the container to
5040 record these actions for future replay.</p>
5042 <p><b id="SCI_STARTRECORD">SCI_STARTRECORD</b><br />
5043 <b id="SCI_STOPRECORD">SCI_STOPRECORD</b><br />
5044 These two messages turn macro recording on and off.</p>
5046 <h2 id="Printing">Printing</h2>
5048 <p><code>SCI_FORMATRANGE</code> can be used to draw the text onto a display surface
5049 which can include a printer display surface. Printed output shows text styling as on the
5050 screen, but it hides all margins except a line number margin. All special marker effects are
5051 removed and the selection and caret are hidden.</p>
5053 <p>Different platforms use different display surface ID types to print on. On Windows, these are
5054 <code>HDC</code>s., on GTK+ 3.x <code>cairo_t *</code>,
5055 and on Cocoa <code>CGContextRef</code> is used.</p>
5057 <code><a class="message" href="#SCI_FORMATRANGE">SCI_FORMATRANGE(bool bDraw, Sci_RangeToFormat
5058 *pfr)</a><br />
5059 <a class="message" href="#SCI_SETPRINTMAGNIFICATION">SCI_SETPRINTMAGNIFICATION(int
5060 magnification)</a><br />
5061 <a class="message" href="#SCI_GETPRINTMAGNIFICATION">SCI_GETPRINTMAGNIFICATION</a><br />
5062 <a class="message" href="#SCI_SETPRINTCOLOURMODE">SCI_SETPRINTCOLOURMODE(int mode)</a><br />
5063 <a class="message" href="#SCI_GETPRINTCOLOURMODE">SCI_GETPRINTCOLOURMODE</a><br />
5064 <a class="message" href="#SCI_SETPRINTWRAPMODE">SCI_SETPRINTWRAPMODE</a><br />
5065 <a class="message" href="#SCI_GETPRINTWRAPMODE">SCI_GETPRINTWRAPMODE</a><br />
5066 </code>
5068 <p><b id="SCI_FORMATRANGE">SCI_FORMATRANGE(bool bDraw, Sci_RangeToFormat *pfr)</b><br />
5069 This call renders a range of text into a device context. If you use
5070 this for printing, you will probably want to arrange a page header and footer; Scintilla does
5071 not do this for you. See <code>SciTEWin::Print()</code> in <code>SciTEWinDlg.cxx</code> for an
5072 example. Each use of this message renders a range of text into a rectangular area and returns
5073 the position in the document of the next character to print.</p>
5075 <p><code>bDraw</code> controls if any output is done. Set this to false if you are paginating
5076 (for example, if you use this with MFC you will need to paginate in
5077 <code>OnBeginPrinting()</code> before you output each page.</p>
5078 <pre>
5079 struct Sci_Rectangle { int left; int top; int right; int bottom; };
5081 struct Sci_RangeToFormat {
5082 Sci_SurfaceID hdc; // The Surface ID we print to
5083 Sci_SurfaceID hdcTarget; // The Surface ID we use for measuring (may be same as hdc)
5084 Sci_Rectangle rc; // Rectangle in which to print
5085 Sci_Rectangle rcPage; // Physically printable page size
5086 Sci_CharacterRange chrg; // Range of characters to print
5088 </pre>
5090 <p>On Windows, <code>hdc</code> and <code>hdcTarget</code> should both be set to the device context handle
5091 of the output device (usually a printer). If you print to a metafile these will not be the same
5092 as Windows metafiles (unlike extended metafiles) do not implement the full API for returning
5093 information. In this case, set <code>hdcTarget</code> to the screen DC.<br />
5094 <code>rcPage</code> is the rectangle <code>{0, 0, maxX, maxY}</code> where <code>maxX+1</code>
5095 and <code>maxY+1</code> are the number of physically printable pixels in x and y.<br />
5096 <code>rc</code> is the rectangle to render the text in (which will, of course, fit within the
5097 rectangle defined by rcPage).<br />
5098 <code>chrg.cpMin</code> and <code>chrg.cpMax</code> define the start position and maximum
5099 position of characters to output. All of each line within this character range is drawn.</p>
5101 <p>On Cocoa, the surface IDs for printing (<code>bDraw=1</code>) should be the graphics port of the current context
5102 (<code>(CGContextRef) [[NSGraphicsContext currentContext] graphicsPort]</code>) when the view's drawRect method is called.
5103 The Surface IDs are not really used for measurement (<code>bDraw=0</code>) but can be set
5104 to a bitmap context (created with <code>CGBitmapContextCreate</code>) to avoid runtime warnings.</p>
5106 <p>On GTK+, the surface IDs to use can be found from the printing context with
5107 <code>gtk_print_context_get_cairo_context(context)</code>.</p>
5109 <p><code>chrg.cpMin</code> and <code>chrg.cpMax</code> define the start position and maximum
5110 position of characters to output. All of each line within this character range is drawn.</p>
5112 <p>When printing, the most tedious part is always working out what the margins should be to
5113 allow for the non-printable area of the paper and printing a header and footer. If you look at
5114 the printing code in SciTE, you will find that most of it is taken up with this. The loop that
5115 causes Scintilla to render text is quite simple if you strip out all the margin, non-printable
5116 area, header and footer code.</p>
5118 <p><b id="SCI_SETPRINTMAGNIFICATION">SCI_SETPRINTMAGNIFICATION(int magnification)</b><br />
5119 <b id="SCI_GETPRINTMAGNIFICATION">SCI_GETPRINTMAGNIFICATION</b><br />
5120 <code>SCI_GETPRINTMAGNIFICATION</code> lets you to print at a different size than the screen
5121 font. <code>magnification</code> is the number of points to add to the size of each screen
5122 font. A value of -3 or -4 gives reasonably small print. You can get this value with
5123 <code>SCI_GETPRINTMAGNIFICATION</code>.</p>
5125 <p><b id="SCI_SETPRINTCOLOURMODE">SCI_SETPRINTCOLOURMODE(int mode)</b><br />
5126 <b id="SCI_GETPRINTCOLOURMODE">SCI_GETPRINTCOLOURMODE</b><br />
5127 These two messages set and get the method used to render coloured text on a printer that is
5128 probably using white paper. It is especially important to consider the treatment of colour if
5129 you use a dark or black screen background. Printing white on black uses up toner and ink very
5130 many times faster than the other way around. You can set the mode to one of:</p>
5132 <table cellpadding="1" cellspacing="2" border="0" summary="Colour printing modes">
5133 <tbody>
5134 <tr>
5135 <th align="left">Symbol</th>
5137 <th>Value</th>
5139 <th align="left">Purpose</th>
5140 </tr>
5141 </tbody>
5143 <tbody valign="top">
5144 <tr>
5145 <td align="left"><code>SC_PRINT_NORMAL</code></td>
5147 <td align="center">0</td>
5149 <td>Print using the current screen colours. This is the default.</td>
5150 </tr>
5152 <tr>
5153 <td align="left"><code>SC_PRINT_INVERTLIGHT</code></td>
5155 <td align="center">1</td>
5157 <td>If you use a dark screen background this saves ink by inverting the light value of
5158 all colours and printing on a white background.</td>
5159 </tr>
5161 <tr>
5162 <td align="left"><code>SC_PRINT_BLACKONWHITE</code></td>
5164 <td align="center">2</td>
5166 <td>Print all text as black on a white background.</td>
5167 </tr>
5169 <tr>
5170 <td align="left"><code>SC_PRINT_COLOURONWHITE</code></td>
5172 <td align="center">3</td>
5174 <td>Everything prints in its own colour on a white background.</td>
5175 </tr>
5177 <tr>
5178 <td align="left"><code>SC_PRINT_COLOURONWHITEDEFAULTBG</code></td>
5180 <td align="center">4</td>
5182 <td>Everything prints in its own colour on a white background except that line numbers
5183 use their own background colour.</td>
5184 </tr>
5185 </tbody>
5186 </table>
5188 <p><b id="SCI_SETPRINTWRAPMODE">SCI_SETPRINTWRAPMODE(int wrapMode)</b><br />
5189 <b id="SCI_GETPRINTWRAPMODE">SCI_GETPRINTWRAPMODE</b><br />
5190 These two functions get and set the printer wrap mode. <code>wrapMode</code> can be
5191 set to <code>SC_WRAP_NONE</code> (0), <code>SC_WRAP_WORD</code> (1) or
5192 <code>SC_WRAP_CHAR</code> (2). The default is
5193 <code>SC_WRAP_WORD</code>, which wraps printed output so that all characters fit
5194 into the print rectangle. If you set <code>SC_WRAP_NONE</code>, each line of text
5195 generates one line of output and the line is truncated if it is too long to fit
5196 into the print area.<br />
5197 <code>SC_WRAP_WORD</code> tries to wrap only between words as indicated by
5198 white space or style changes although if a word is longer than a line, it will be wrapped before
5199 the line end. <code>SC_WRAP_CHAR</code> is preferred to
5200 <code>SC_WRAP_WORD</code> for Asian languages where there is no white space
5201 between words.</p>
5203 <h2 id="DirectAccess">Direct access</h2>
5204 <code><a class="message" href="#SCI_GETDIRECTFUNCTION">SCI_GETDIRECTFUNCTION</a><br />
5205 <a class="message" href="#SCI_GETDIRECTPOINTER">SCI_GETDIRECTPOINTER</a><br />
5206 <a class="message" href="#SCI_GETCHARACTERPOINTER">SCI_GETCHARACTERPOINTER</a><br />
5207 <a class="message" href="#SCI_GETRANGEPOINTER">SCI_GETRANGEPOINTER(int position, int rangeLength)</a><br />
5208 <a class="message" href="#SCI_GETGAPPOSITION">SCI_GETGAPPOSITION</a><br />
5209 </code>
5211 <p>On Windows, the message-passing scheme used to communicate between the container and
5212 Scintilla is mediated by the operating system <code>SendMessage</code> function and can lead to
5213 bad performance when calling intensively. To avoid this overhead, Scintilla provides messages
5214 that allow you to call the Scintilla message function directly. The code to do this in C/C++ is
5215 of the form:</p>
5216 <pre>
5217 #include "Scintilla.h"
5218 SciFnDirect pSciMsg = (SciFnDirect)SendMessage(hSciWnd, SCI_GETDIRECTFUNCTION, 0, 0);
5219 sptr_t pSciWndData = (sptr_t)SendMessage(hSciWnd, SCI_GETDIRECTPOINTER, 0, 0);
5221 // now a wrapper to call Scintilla directly
5222 sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
5223 return pSciMsg(pSciWndData, iMessage, wParam, lParam);
5225 </pre>
5227 <p><code>SciFnDirect</code>, <code>sptr_t</code> and <code>uptr_t</code> are declared in
5228 <code>Scintilla.h</code>. <code>hSciWnd</code> is the window handle returned when you created
5229 the Scintilla window.</p>
5231 <p>While faster, this direct calling will cause problems if performed from a different thread
5232 to the native thread of the Scintilla window in which case <code>SendMessage(hSciWnd, SCI_*,
5233 wParam, lParam)</code> should be used to synchronize with the window's thread.</p>
5235 <p>This feature also works on GTK+ but has no significant impact on speed.</p>
5237 <p>From version 1.47 on Windows, Scintilla exports a function called
5238 <code>Scintilla_DirectFunction</code> that can be used the same as the function returned by
5239 <code>SCI_GETDIRECTFUNCTION</code>. This saves you the call to
5240 <code>SCI_GETDIRECTFUNCTION</code> and the need to call Scintilla indirectly via the function
5241 pointer.</p>
5243 <p><b id="SCI_GETDIRECTFUNCTION">SCI_GETDIRECTFUNCTION</b><br />
5244 This message returns the address of the function to call to handle Scintilla messages without
5245 the overhead of passing through the Windows messaging system. You need only call this once,
5246 regardless of the number of Scintilla windows you create.</p>
5248 <p><b id="SCI_GETDIRECTPOINTER">SCI_GETDIRECTPOINTER</b><br />
5249 This returns a pointer to data that identifies which Scintilla window is in use. You must call
5250 this once for each Scintilla window you create. When you call the direct function, you must
5251 pass in the direct pointer associated with the target window.</p>
5253 <p><b id="SCI_GETCHARACTERPOINTER">SCI_GETCHARACTERPOINTER</b><br />
5254 <b id="SCI_GETRANGEPOINTER">SCI_GETRANGEPOINTER(int position, int rangeLength)</b><br />
5255 <b id="SCI_GETGAPPOSITION">SCI_GETGAPPOSITION</b><br />
5256 Grant temporary direct read-only access to the memory used by Scintilla to store
5257 the document.</p>
5258 <p><code>SCI_GETCHARACTERPOINTER</code> moves the gap within Scintilla so that the
5259 text of the document is stored consecutively
5260 and ensure there is a NUL character after the text, then returns a pointer to the first character.
5261 Applications may then pass this to a function that accepts a character pointer such as a regular
5262 expression search or a parser. The pointer should <em>not</em> be written to as that may desynchronize
5263 the internal state of Scintilla.</p>
5264 <p>Since any action in Scintilla may change its internal state
5265 this pointer becomes invalid after any call or by allowing user interface activity. The application
5266 should reacquire the pointer after making any call to Scintilla or performing any user-interface calls such
5267 as modifying a progress indicator.</p>
5268 <p>This call takes similar time to inserting a character at the end of the document and this may
5269 include moving the document contents. Specifically, all the characters after the document gap
5270 are moved to before the gap. This compacted state should persist over calls and user interface
5271 actions that do not change the document contents so reacquiring the pointer afterwards is very
5272 quick. If this call is used to implement a global replace operation, then each replacement will
5273 move the gap so if <code>SCI_GETCHARACTERPOINTER</code> is called after
5274 each replacement then the operation will become O(n^2) rather than O(n). Instead, all
5275 matches should be found and remembered, then all the replacements performed.</p>
5277 <p><code>SCI_GETRANGEPOINTER</code> provides direct access to just the
5278 range requested. The gap is not moved unless it is within the requested range so this call
5279 can be faster than <code>SCI_GETCHARACTERPOINTER</code>.
5280 This can be used by application code that is able to act on blocks of text or ranges of lines.</p>
5282 <p><code>SCI_GETGAPPOSITION</code> returns the current gap position.
5283 This is a hint that applications can use to avoid calling <code>SCI_GETRANGEPOINTER</code>
5284 with a range that contains the gap and consequent costs of moving the gap.</p>
5286 <h2 id="MultipleViews">Multiple views</h2>
5288 <p>A Scintilla window and the document that it displays are separate entities. When you create
5289 a new window, you also create a new, empty document. Each document has a reference count that
5290 is initially set to 1. The document also has a list of the Scintilla windows that are linked to
5291 it so when any window changes the document, all other windows in which it appears are notified
5292 to cause them to update. The system is arranged in this way so that you can work with many
5293 documents in a single Scintilla window and so you can display a single document in multiple
5294 windows (for use with splitter windows).</p>
5296 <p>Although these messages use <code>document *pDoc</code>, to ensure compatibility with future
5297 releases of Scintilla you should treat <code>pDoc</code> as an opaque <code>void*</code>. That
5298 is, you can use and store the pointer as described in this section but you should not
5299 dereference it.</p>
5300 <code><a class="message" href="#SCI_GETDOCPOINTER">SCI_GETDOCPOINTER</a><br />
5301 <a class="message" href="#SCI_SETDOCPOINTER">SCI_SETDOCPOINTER(&lt;unused&gt;, document
5302 *pDoc)</a><br />
5303 <a class="message" href="#SCI_CREATEDOCUMENT">SCI_CREATEDOCUMENT</a><br />
5304 <a class="message" href="#SCI_ADDREFDOCUMENT">SCI_ADDREFDOCUMENT(&lt;unused&gt;, document
5305 *pDoc)</a><br />
5306 <a class="message" href="#SCI_RELEASEDOCUMENT">SCI_RELEASEDOCUMENT(&lt;unused&gt;, document
5307 *pDoc)</a><br />
5308 </code>
5310 <p><b id="SCI_GETDOCPOINTER">SCI_GETDOCPOINTER</b><br />
5311 This returns a pointer to the document currently in use by the window. It has no other
5312 effect.</p>
5314 <p><b id="SCI_SETDOCPOINTER">SCI_SETDOCPOINTER(&lt;unused&gt;, document *pDoc)</b><br />
5315 This message does the following:<br />
5316 1. It removes the current window from the list held by the current document.<br />
5317 2. It reduces the reference count of the current document by 1.<br />
5318 3. If the reference count reaches 0, the document is deleted.<br />
5319 4. <code>pDoc</code> is set as the new document for the window.<br />
5320 5. If <code>pDoc</code> was 0, a new, empty document is created and attached to the
5321 window.<br />
5322 6. If <code>pDoc</code> was not 0, its reference count is increased by 1.</p>
5324 <p><b id="SCI_CREATEDOCUMENT">SCI_CREATEDOCUMENT</b><br />
5325 This message creates a new, empty document and returns a pointer to it. This document is not
5326 selected into the editor and starts with a reference count of 1. This means that you have
5327 ownership of it and must either reduce its reference count by 1 after using
5328 <code>SCI_SETDOCPOINTER</code> so that the Scintilla window owns it or you must make sure that
5329 you reduce the reference count by 1 with <code>SCI_RELEASEDOCUMENT</code> before you close the
5330 application to avoid memory leaks.</p>
5332 <p><b id="SCI_ADDREFDOCUMENT">SCI_ADDREFDOCUMENT(&lt;unused&gt;, document *pDoc)</b><br />
5333 This increases the reference count of a document by 1. If you want to replace the current
5334 document in the Scintilla window and take ownership of the current document, for example if you
5335 are editing many documents in one window, do the following:<br />
5336 1. Use <code>SCI_GETDOCPOINTER</code> to get a pointer to the document,
5337 <code>pDoc</code>.<br />
5338 2. Use <code>SCI_ADDREFDOCUMENT(0, pDoc)</code> to increment the reference count.<br />
5339 3. Use <code>SCI_SETDOCPOINTER(0, pNewDoc)</code> to set a different document or
5340 <code>SCI_SETDOCPOINTER(0, 0)</code> to set a new, empty document.</p>
5342 <p><b id="SCI_RELEASEDOCUMENT">SCI_RELEASEDOCUMENT(&lt;unused&gt;, document *pDoc)</b><br />
5343 This message reduces the reference count of the document identified by <code>pDoc</code>. pDoc
5344 must be the result of <code>SCI_GETDOCPOINTER</code> or <code>SCI_CREATEDOCUMENT</code> and
5345 must point at a document that still exists. If you call this on a document with a reference
5346 count of 1 that is still attached to a Scintilla window, bad things will happen. To keep the
5347 world spinning in its orbit you must balance each call to <code>SCI_CREATEDOCUMENT</code> or
5348 <code>SCI_ADDREFDOCUMENT</code> with a call to <code>SCI_RELEASEDOCUMENT</code>.</p>
5350 <h2 id="BackgroundLoadSave">Background loading and saving</h2>
5352 <p>To ensure a responsive user interface, applications may decide to load and save documents using a separate thread
5353 from the user interface.</p>
5355 <h3 id="BackgroundLoad">Loading in the background</h3>
5357 <p>An application can load all of a file into a buffer it allocates on a background thread and then add the data in that buffer
5358 into a Scintilla document on the user interface thread. That technique uses extra memory to store a complete copy of the
5359 file and also means that the time that Scintilla takes to perform initial line end discovery blocks the user interface.</p>
5361 <p>To avoid these issues, a loader object may be created and used to load the file. The loader object supports the ILoader interface.</p>
5363 <p><b id="SCI_CREATELOADER">SCI_CREATELOADER(int bytes)</b><br />
5364 Create an object that supports the <code>ILoader</code> interface which can be used to load data and then
5365 be turned into a Scintilla document object for attachment to a view object.
5366 The <code>bytes</code> argument determines the initial memory allocation for the document as it is more efficient
5367 to allocate once rather than rely on the buffer growing as data is added.
5368 If <code>SCI_CREATELOADER</code> fails then 0 is returned.</p>
5370 <h4>ILoader</h4>
5372 <div class="highlighted">
5373 <span class="S5">class</span><span class="S0"> </span>ILoader<span class="S0"> </span><span class="S10">{</span><br />
5374 <span class="S5">public</span><span class="S10">:</span><br />
5375 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>Release<span class="S10">()</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5376 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S2">// Returns a status code from SC_STATUS_*</span><br />
5377 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>AddData<span class="S10">(</span><span class="S5">char</span><span class="S0"> </span><span class="S10">*</span>data<span class="S10">,</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>length<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5378 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">void</span><span class="S0"> </span><span class="S10">*</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>ConvertToDocument<span class="S10">()</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5379 <span class="S10">};</span><br />
5380 </div>
5382 <p>The application should call the <code>AddData</code> method with each block of data read from the file.
5383 <code>AddData</code> will return SC_STATUS_OK unless a failure, such as memory exhaustion occurs.
5384 If a failure occurs in <code>AddData</code> or in a file reading call then loading can be abandoned and the loader released with
5385 the <code>Release</code> call.
5386 When the whole file has been read, the <code>ConvertToDocument</code> method should be called to produce a Scintilla
5387 document pointer which can be used in the same way as a document pointer returned from
5388 <a class="message" href="#SCI_CREATEDOCUMENT">SCI_CREATEDOCUMENT</a>.
5389 There is no need to call <code>Release</code> after <code>ConvertToDocument</code>.</p>
5391 <h3 id="BackgroundSave">Saving in the background</h3>
5393 <p>An application that wants to save in the background should lock the document with <code>SCI_SETREADONLY(1)</code>
5394 to prevent modifications and retrieve a pointer to the unified document contents with
5395 <a class="message" href="#SCI_GETCHARACTERPOINTER">SCI_GETCHARACTERPOINTER</a>.
5396 The buffer of a locked document will not move so the pointer is valid until the application calls <code>SCI_SETREADONLY(0)</code>.</p>
5398 <p>If the user tries to performs a modification while the document is locked then a <code><a class="message"
5399 href="#SCN_MODIFYATTEMPTRO">SCN_MODIFYATTEMPTRO</a></code> notification is sent to the application.
5400 The application may then decide to ignore the modification or to terminate the background saving thread and reenable
5401 modification before returning from the notification.</p>
5403 <h2 id="Folding">Folding</h2>
5405 <p>The fundamental operation in folding is making lines invisible or visible. Line visibility
5406 is a property of the view rather than the document so each view may be displaying a different
5407 set of lines. From the point of view of the user, lines are hidden and displayed using fold
5408 points. Generally, the fold points of a document are based on the hierarchical structure of the
5409 document contents. In Python, the hierarchy is determined by indentation and in C++ by brace
5410 characters. This hierarchy can be represented within a Scintilla document object by attaching a
5411 numeric "fold level" to each line. The fold level is most easily set by a lexer, but you can
5412 also set it with messages.</p>
5414 <p>It is up to your code to set the connection between user actions and folding and unfolding.
5415 The best way to see how this is done is to search the SciTE source code for the messages used
5416 in this section of the documentation and see how they are used. You will also need to use
5417 markers and a folding margin to complete your folding implementation.
5418 The <code>"fold"</code> property should be set to <code>"1"</code> with
5419 <code>SCI_SETPROPERTY("fold", "1")</code> to enable folding. </p>
5420 <code><a class="message" href="#SCI_VISIBLEFROMDOCLINE">SCI_VISIBLEFROMDOCLINE(int
5421 docLine)</a><br />
5422 <a class="message" href="#SCI_DOCLINEFROMVISIBLE">SCI_DOCLINEFROMVISIBLE(int
5423 displayLine)</a><br />
5424 <a class="message" href="#SCI_SHOWLINES">SCI_SHOWLINES(int lineStart, int lineEnd)</a><br />
5425 <a class="message" href="#SCI_HIDELINES">SCI_HIDELINES(int lineStart, int lineEnd)</a><br />
5426 <a class="message" href="#SCI_GETLINEVISIBLE">SCI_GETLINEVISIBLE(int line)</a><br />
5427 <a class="message" href="#SCI_GETALLLINESVISIBLE">SCI_GETALLLINESVISIBLE</a><br />
5428 <a class="message" href="#SCI_SETFOLDLEVEL">SCI_SETFOLDLEVEL(int line, int level)</a><br />
5429 <a class="message" href="#SCI_GETFOLDLEVEL">SCI_GETFOLDLEVEL(int line)</a><br />
5430 <a class="message" href="#SCI_SETAUTOMATICFOLD">SCI_SETAUTOMATICFOLD(int automaticFold)</a><br />
5431 <a class="message" href="#SCI_GETAUTOMATICFOLD">SCI_GETAUTOMATICFOLD</a><br />
5432 <a class="message" href="#SCI_SETFOLDFLAGS">SCI_SETFOLDFLAGS(int flags)</a><br />
5433 <a class="message" href="#SCI_GETLASTCHILD">SCI_GETLASTCHILD(int line, int level)</a><br />
5434 <a class="message" href="#SCI_GETFOLDPARENT">SCI_GETFOLDPARENT(int line)</a><br />
5435 <a class="message" href="#SCI_SETFOLDEXPANDED">SCI_SETFOLDEXPANDED(int line, bool
5436 expanded)</a><br />
5437 <a class="message" href="#SCI_GETFOLDEXPANDED">SCI_GETFOLDEXPANDED(int line)</a><br />
5438 <a class="message" href="#SCI_CONTRACTEDFOLDNEXT">SCI_CONTRACTEDFOLDNEXT(int lineStart)</a><br />
5439 <a class="message" href="#SCI_TOGGLEFOLD">SCI_TOGGLEFOLD(int line)</a><br />
5440 <a class="message" href="#SCI_FOLDLINE">SCI_FOLDLINE(int line, int action)</a><br />
5441 <a class="message" href="#SCI_FOLDCHILDREN">SCI_FOLDCHILDREN(int line, int action)</a><br />
5442 <a class="message" href="#SCI_FOLDALL">SCI_FOLDALL(int action)</a><br />
5443 <a class="message" href="#SCI_EXPANDCHILDREN">SCI_EXPANDCHILDREN(int line, int level)</a><br />
5444 <a class="message" href="#SCI_ENSUREVISIBLE">SCI_ENSUREVISIBLE(int line)</a><br />
5445 <a class="message" href="#SCI_ENSUREVISIBLEENFORCEPOLICY">SCI_ENSUREVISIBLEENFORCEPOLICY(int
5446 line)</a><br />
5447 </code>
5449 <p><b id="SCI_VISIBLEFROMDOCLINE">SCI_VISIBLEFROMDOCLINE(int docLine)</b><br />
5450 When some lines are hidden and/or annotations are displayed, then a particular line in the
5451 document may be displayed at a
5452 different position to its document position. If no lines are hidden and there are no annotations,
5453 this message returns
5454 <code>docLine</code>. Otherwise, this returns the display line (counting the very first visible
5455 line as 0). The display line of an invisible line is the same as the previous visible line. The
5456 display line number of the first line in the document is 0. If lines are hidden and
5457 <code>docLine</code> is outside the range of lines in the document, the return value is -1.
5458 Lines can occupy more than one display line if they wrap.</p>
5460 <p><b id="SCI_DOCLINEFROMVISIBLE">SCI_DOCLINEFROMVISIBLE(int displayLine)</b><br />
5461 When some lines are hidden and/or annotations are displayed, then a particular line in the
5462 document may be displayed at a
5463 different position to its document position. This message returns the document line number that
5464 corresponds to a display line (counting the display line of the first line in the document as
5465 0). If <code>displayLine</code> is less than or equal to 0, the result is 0. If
5466 <code>displayLine</code> is greater than or equal to the number of displayed lines, the result
5467 is the number of lines in the document.</p>
5469 <p><b id="SCI_SHOWLINES">SCI_SHOWLINES(int lineStart, int lineEnd)</b><br />
5470 <b id="SCI_HIDELINES">SCI_HIDELINES(int lineStart, int lineEnd)</b><br />
5471 <b id="SCI_GETLINEVISIBLE">SCI_GETLINEVISIBLE(int line)</b><br />
5472 <b id="SCI_GETALLLINESVISIBLE">SCI_GETALLLINESVISIBLE</b><br />
5473 The first two messages mark a range of lines as visible or invisible and then redraw the
5474 display.
5475 <code>SCI_GETLINEVISIBLE</code> reports on the visible state of a line and returns 1 if it is
5476 visible and 0 if it is not visible.
5477 <code>SCI_GETALLLINESVISIBLE</code> returns 1 if all lines are visible and 0
5478 if some lines are hidden.
5479 These messages have no effect on fold levels or fold
5480 flags. The first line can not be hidden.</p>
5482 <p><b id="SCI_SETFOLDLEVEL">SCI_SETFOLDLEVEL(int line, int level)</b><br />
5483 <b id="SCI_GETFOLDLEVEL">SCI_GETFOLDLEVEL(int line)</b><br />
5484 These two messages set and get a 32-bit value that contains the fold level of a line and some
5485 flags associated with folding. The fold level is a number in the range 0 to
5486 <code>SC_FOLDLEVELNUMBERMASK</code> (4095). However, the initial fold level is set to
5487 <code>SC_FOLDLEVELBASE</code> (1024) to allow unsigned arithmetic on folding levels. There are
5488 two addition flag bits. <code>SC_FOLDLEVELWHITEFLAG</code> indicates that the line is blank and
5489 allows it to be treated slightly different then its level may indicate. For example, blank
5490 lines should generally not be fold points and will be considered part of the preceding section even though
5491 they may have a lesser fold level.
5492 <code>SC_FOLDLEVELHEADERFLAG</code> indicates that
5493 the line is a header (fold point).</p>
5495 <p>Use <code>SCI_GETFOLDLEVEL(line) &amp; SC_FOLDLEVELNUMBERMASK</code> to get the fold level
5496 of a line. Likewise, use <code>SCI_GETFOLDLEVEL(line) &amp; SC_FOLDLEVEL*FLAG</code> to get the
5497 state of the flags. To set the fold level you must or in the associated flags. For instance, to
5498 set the level to <code>thisLevel</code> and mark a line as being a fold point use:
5499 <code>SCI_SETFOLDLEVEL(line, thisLevel | SC_FOLDLEVELHEADERFLAG)</code>.</p>
5500 If you use a lexer, you should not need to use <code>SCI_SETFOLDLEVEL</code> as this is far
5501 better handled by the lexer. You will need to use <code>SCI_GETFOLDLEVEL</code> to decide how
5502 to handle user folding requests. If you do change the fold levels, the folding margin will
5503 update to match your changes.
5505 <p><b id="SCI_SETFOLDFLAGS">SCI_SETFOLDFLAGS(int flags)</b><br />
5506 In addition to showing markers in the folding margin, you can indicate folds to the user by
5507 drawing lines in the text area. The lines are drawn in the foreground colour set for <a
5508 class="message" href="#StyleDefinition"><code>STYLE_DEFAULT</code></a>. Bits set in
5509 <code>flags</code> determine where folding lines are drawn:<br />
5510 </p>
5512 <table cellpadding="1" cellspacing="2" border="0" summary="Fold flags">
5513 <tbody>
5514 <tr>
5515 <th align="left">Symbol</th>
5516 <th align="left">Value</th>
5517 <th align="left">Effect</th>
5518 </tr>
5519 </tbody>
5521 <tbody valign="top">
5522 <tr>
5523 <td align="left"></td>
5524 <td align="left">1</td>
5525 <td align="left">Experimental feature that has been removed.</td>
5526 </tr>
5528 <tr>
5529 <td align="left">SC_FOLDFLAG_LINEBEFORE_EXPANDED</td>
5530 <td align="left">2</td>
5532 <td align="left">Draw above if expanded</td>
5533 </tr>
5535 <tr>
5536 <td align="left">SC_FOLDFLAG_LINEBEFORE_CONTRACTED</td>
5537 <td align="left">4</td>
5539 <td align="left">Draw above if not expanded</td>
5540 </tr>
5542 <tr>
5543 <td align="left">SC_FOLDFLAG_LINEAFTER_EXPANDED</td>
5544 <td align="left">8</td>
5546 <td align="left">Draw below if expanded</td>
5547 </tr>
5549 <tr>
5550 <td align="left">SC_FOLDFLAG_LINEAFTER_CONTRACTED</td>
5551 <td align="left">16</td>
5553 <td align="left">Draw below if not expanded</td>
5554 </tr>
5556 <tr>
5557 <td align="left">SC_FOLDFLAG_LEVELNUMBERS</td>
5558 <td align="left">64</td>
5560 <td align="left">display hexadecimal fold levels in line margin to aid debugging of
5561 folding. The appearance of this feature may change in the future.</td>
5562 </tr>
5564 <tr>
5565 <td align="left">SC_FOLDFLAG_LINESTATE</td>
5566 <td align="left">128</td>
5568 <td align="left">display hexadecimal line state in line margin to aid debugging of lexing and folding.
5569 May not be used at the same time as <code>SC_FOLDFLAG_LEVELNUMBERS</code>.</td>
5570 </tr>
5571 </tbody>
5572 </table>
5574 <p>This message causes the display to redraw.</p>
5576 <p><b id="SCI_GETLASTCHILD">SCI_GETLASTCHILD(int startLine, int level)</b><br />
5577 This message searches for the next line after <code>startLine</code>, that has a folding level
5578 that is less than or equal to <code>level</code> and then returns the previous line number. If
5579 you set <code>level</code> to -1, <code>level</code> is set to the folding level of line
5580 <code>startLine</code>. If <code>from</code> is a fold point, <code>SCI_GETLASTCHILD(from,
5581 -1)</code> returns the last line that would be in made visible or hidden by toggling the fold
5582 state.</p>
5584 <p><b id="SCI_GETFOLDPARENT">SCI_GETFOLDPARENT(int startLine)</b><br />
5585 This message returns the line number of the first line before <code>startLine</code> that is
5586 marked as a fold point with <code>SC_FOLDLEVELHEADERFLAG</code> and has a fold level less than
5587 the <code>startLine</code>. If no line is found, or if the header flags and fold levels are
5588 inconsistent, the return value is -1.</p>
5590 <p><b id="SCI_TOGGLEFOLD">SCI_TOGGLEFOLD(int line)</b><br />
5591 Each fold point may be either expanded, displaying all its child lines, or contracted, hiding
5592 all the child lines. This message toggles the folding state of the given line as long as it has
5593 the <code>SC_FOLDLEVELHEADERFLAG</code> set. This message takes care of folding or expanding
5594 all the lines that depend on the line. The display updates after this message.</p>
5596 <p><b id="SCI_SETFOLDEXPANDED">SCI_SETFOLDEXPANDED(int line, bool expanded)</b><br />
5597 <b id="SCI_GETFOLDEXPANDED">SCI_GETFOLDEXPANDED(int line)</b><br />
5598 These messages set and get the expanded state of a single line. The set message has no effect
5599 on the visible state of the line or any lines that depend on it. It does change the markers in
5600 the folding margin. If you ask for the expansion state of a line that is outside the document,
5601 the result is <code>false</code> (0).</p>
5603 <p>If you just want to toggle the fold state of one line and handle all the lines that are
5604 dependent on it, it is much easier to use <code>SCI_TOGGLEFOLD</code>. You would use the
5605 <code>SCI_SETFOLDEXPANDED</code> message to process many folds without updating the display
5606 until you had finished. See <code>SciTEBase::FoldAll()</code> and
5607 <code>SciTEBase::Expand()</code> for examples of the use of these messages.</p>
5609 <p><b id="SCI_FOLDLINE">SCI_FOLDLINE(int line, int action)</b><br />
5610 <b id="SCI_FOLDCHILDREN">SCI_FOLDCHILDREN(int line, int action)</b><br />
5611 <b id="SCI_FOLDALL">SCI_FOLDALL(int action)</b><br />
5612 These messages provide a higher-level approach to folding instead of setting expanded flags and showing
5613 or hiding individual lines.</p>
5614 <p>An individual fold can be contracted/expanded/toggled with <code>SCI_FOLDLINE</code>.
5615 To affect all child folds as well call <code>SCI_FOLDCHILDREN</code>.</p>
5616 <p>To affect the entire document call <code>SCI_FOLDALL</code>. With <code>SC_FOLDACTION_TOGGLE</code>
5617 the first fold header in the document is examined to decide whether to expand or contract.
5618 </p>
5619 <table cellpadding="1" cellspacing="2" border="0" summary="Fold flags">
5620 <tbody>
5621 <tr>
5622 <th align="left">Symbol</th>
5623 <th align="left">Value</th>
5624 <th align="left">Effect</th>
5625 </tr>
5626 </tbody>
5628 <tbody valign="top">
5629 <tr>
5630 <td align="left">SC_FOLDACTION_CONTRACT</td>
5631 <td align="left">0</td>
5632 <td align="left">Contract.</td>
5633 </tr>
5635 <tr>
5636 <td align="left">SC_FOLDACTION_EXPAND</td>
5637 <td align="left">1</td>
5638 <td align="left">Expand.</td>
5639 </tr>
5641 <tr>
5642 <td align="left">SC_FOLDACTION_TOGGLE</td>
5643 <td align="left">2</td>
5644 <td align="left">Toggle between contracted and expanded.</td>
5645 </tr>
5647 </tbody>
5648 </table>
5650 <p><b id="SCI_EXPANDCHILDREN">SCI_EXPANDCHILDREN(int line, int level)</b><br />
5651 This is used to respond to a change to a line causing its fold level or whether it is a header to change,
5652 perhaps when adding or removing a '{'.</p>
5653 <p>By the time the container has received the notification that the line has changed,
5654 the fold level has already been set, so the container has to use the previous level in this call
5655 so that any range hidden underneath this line can be shown.
5656 </p>
5658 <p><b id="SCI_SETAUTOMATICFOLD">SCI_SETAUTOMATICFOLD(int automaticFold)</b><br />
5659 <b id="SCI_GETAUTOMATICFOLD">SCI_GETAUTOMATICFOLD</b><br />
5660 Instead of implementing all the logic for handling folding in the container, Scintilla can provide behaviour
5661 that is adequate for many applications. The <code>automaticFold</code> argument is a bit set defining
5662 which of the 3 pieces of folding implementation should be enabled. Most applications should be able to use the
5663 <code>SC_AUTOMATICFOLD_SHOW</code> and <code>SC_AUTOMATICFOLD_CHANGE</code>
5664 flags unless they wish to implement quite different behaviour such as defining their own fold structure.
5665 <code>SC_AUTOMATICFOLD_CLICK</code> is more likely to be set off when an application would
5666 like to add or change click behaviour such as showing method headers only when Shift+Alt is used in
5667 conjunction with a click.
5668 </p>
5669 <table cellpadding="1" cellspacing="2" border="0" summary="Fold flags">
5670 <tbody>
5671 <tr>
5672 <th align="left">Symbol</th>
5673 <th align="left">Value</th>
5674 <th align="left">Effect</th>
5675 </tr>
5676 </tbody>
5678 <tbody valign="top">
5679 <tr>
5680 <td align="left">SC_AUTOMATICFOLD_SHOW</td>
5681 <td align="left">1</td>
5682 <td align="left">Automatically show lines as needed.
5683 This avoids sending the <code>SCN_NEEDSHOWN</code> notification.</td>
5684 </tr>
5686 <tr>
5687 <td align="left">SC_AUTOMATICFOLD_CLICK</td>
5688 <td align="left">2</td>
5689 <td align="left">Handle clicks in fold margin automatically.
5690 This avoids sending the <code>SCN_MARGINCLICK</code> notification for folding margins.</td>
5691 </tr>
5693 <tr>
5694 <td align="left">SC_AUTOMATICFOLD_CHANGE</td>
5695 <td align="left">4</td>
5696 <td align="left">Show lines as needed when fold structure is changed.
5697 The <code>SCN_MODIFIED</code> notification is still sent unless it is disabled by the
5698 container.</td>
5699 </tr>
5701 </tbody>
5702 </table>
5704 <p><b id="SCI_CONTRACTEDFOLDNEXT">SCI_CONTRACTEDFOLDNEXT(int lineStart)</b><br />
5705 Search efficiently for lines that are contracted fold headers.
5706 This is useful when saving the user's folding when switching documents or saving folding with a file.
5707 The search starts at line number <code>lineStart</code> and continues forwards to the end of the file.
5708 <code>lineStart</code> is returned if it is a contracted fold header otherwise the next contracted
5709 fold header is returned. If there are no more contracted fold headers then -1 is returned.</p>
5711 <p><b id="SCI_ENSUREVISIBLE">SCI_ENSUREVISIBLE(int line)</b><br />
5712 <b id="SCI_ENSUREVISIBLEENFORCEPOLICY">SCI_ENSUREVISIBLEENFORCEPOLICY(int line)</b><br />
5713 A line may be hidden because more than one of its parent lines is contracted. Both these
5714 message travels up the fold hierarchy, expanding any contracted folds until they reach the top
5715 level. The line will then be visible. If you use <code>SCI_ENSUREVISIBLEENFORCEPOLICY</code>,
5716 the vertical caret policy set by <a class="message"
5717 href="#SCI_SETVISIBLEPOLICY"><code>SCI_SETVISIBLEPOLICY</code></a> is then applied.</p>
5719 <h2 id="LineWrapping">Line wrapping</h2>
5721 <code><a class="message" href="#SCI_SETWRAPMODE">SCI_SETWRAPMODE(int wrapMode)</a><br />
5722 <a class="message" href="#SCI_GETWRAPMODE">SCI_GETWRAPMODE</a><br />
5723 <a class="message" href="#SCI_SETWRAPVISUALFLAGS">SCI_SETWRAPVISUALFLAGS(int wrapVisualFlags)</a><br />
5724 <a class="message" href="#SCI_GETWRAPVISUALFLAGS">SCI_GETWRAPVISUALFLAGS</a><br />
5725 <a class="message" href="#SCI_SETWRAPVISUALFLAGSLOCATION">SCI_SETWRAPVISUALFLAGSLOCATION(int wrapVisualFlagsLocation)</a><br />
5726 <a class="message" href="#SCI_GETWRAPVISUALFLAGSLOCATION">SCI_GETWRAPVISUALFLAGSLOCATION</a><br />
5727 <a class="message" href="#SCI_SETWRAPINDENTMODE">SCI_SETWRAPINDENTMODE(int indentMode)</a><br />
5728 <a class="message" href="#SCI_GETWRAPINDENTMODE">SCI_GETWRAPINDENTMODE</a><br />
5729 <a class="message" href="#SCI_SETWRAPSTARTINDENT">SCI_SETWRAPSTARTINDENT(int indent)</a><br />
5730 <a class="message" href="#SCI_GETWRAPSTARTINDENT">SCI_GETWRAPSTARTINDENT</a><br />
5731 <a class="message" href="#SCI_SETLAYOUTCACHE">SCI_SETLAYOUTCACHE(int cacheMode)</a><br />
5732 <a class="message" href="#SCI_GETLAYOUTCACHE">SCI_GETLAYOUTCACHE</a><br />
5733 <a class="message" href="#SCI_SETPOSITIONCACHE">SCI_SETPOSITIONCACHE(int size)</a><br />
5734 <a class="message" href="#SCI_GETPOSITIONCACHE">SCI_GETPOSITIONCACHE</a><br />
5735 <a class="message" href="#SCI_LINESSPLIT">SCI_LINESSPLIT(int pixelWidth)</a><br />
5736 <a class="message" href="#SCI_LINESJOIN">SCI_LINESJOIN</a><br />
5737 <a class="message" href="#SCI_WRAPCOUNT">SCI_WRAPCOUNT(int docLine)</a><br />
5738 </code>
5740 <p>By default, Scintilla does not wrap lines of text. If you enable line wrapping, lines wider
5741 than the window width are continued on the following lines. Lines are broken after space or tab
5742 characters or between runs of different styles. If this is not possible because a word in one
5743 style is wider than the window then the break occurs after the last character that completely
5744 fits on the line. The horizontal scroll bar does not appear when wrap mode is on.</p>
5746 <p>For wrapped lines Scintilla can draw visual flags (little arrows) at end of a a subline of a
5747 wrapped line and at begin of the next subline. These can be enabled individually, but if Scintilla
5748 draws the visual flag at the beginning of the next subline this subline will be indented by one char.
5749 Independent from drawing a visual flag at the begin the subline can have an indention.</p>
5751 <p>Much of the time used by Scintilla is spent on laying out and drawing text. The same text
5752 layout calculations may be performed many times even when the data used in these calculations
5753 does not change. To avoid these unnecessary calculations in some circumstances, the line layout
5754 cache can store the results of the calculations. The cache is invalidated whenever the
5755 underlying data, such as the contents or styling of the document changes. Caching the layout of
5756 the whole document has the most effect, making dynamic line wrap as much as 20 times faster but
5757 this requires 7 times the memory required by the document contents plus around 80 bytes per
5758 line.</p>
5760 <p>Wrapping is not performed immediately there is a change but is delayed until the display
5761 is redrawn. This delay improves performance by allowing a set of changes to be performed
5762 and then wrapped and displayed once. Because of this, some operations may not occur as
5763 expected. If a file is read and the scroll position moved to a particular line in the text,
5764 such as occurs when a container tries to restore a previous editing session, then
5765 the scroll position will have been determined before wrapping so an unexpected range
5766 of text will be displayed. To scroll to the position correctly, delay the scroll until the
5767 wrapping has been performed by waiting for an initial
5768 <a class="message" href="#SCN_PAINTED">SCN_PAINTED</a> notification.</p>
5770 <p><b id="SCI_SETWRAPMODE">SCI_SETWRAPMODE(int wrapMode)</b><br />
5771 <b id="SCI_GETWRAPMODE">SCI_GETWRAPMODE</b><br />
5772 Set wrapMode to <code>SC_WRAP_WORD</code> (1) to enable wrapping
5773 on word or style boundaries, <code>SC_WRAP_CHAR</code> (2) to enable wrapping
5774 between any characters, <code>SC_WRAP_WHITESPACE</code> (3) to enable
5775 wrapping on whitespace, and <code>SC_WRAP_NONE</code> (0) to disable line
5776 wrapping. <code>SC_WRAP_CHAR</code> is preferred for Asian languages where
5777 there is no white space between words.
5778 </p>
5781 <p><b id="SCI_SETWRAPVISUALFLAGS">SCI_SETWRAPVISUALFLAGS(int wrapVisualFlags)</b><br />
5782 <b id="SCI_GETWRAPVISUALFLAGS">SCI_GETWRAPVISUALFLAGS</b><br />
5783 You can enable the drawing of visual flags to indicate a line is wrapped. Bits set in
5784 wrapVisualFlags determine which visual flags are drawn.
5785 </p>
5786 <table cellpadding="1" cellspacing="2" border="0" summary="Wrap visual flags">
5787 <tbody>
5788 <tr>
5789 <th align="left">Symbol</th>
5790 <th>Value</th>
5791 <th align="left">Effect</th>
5792 </tr>
5793 </tbody>
5795 <tbody valign="top">
5796 <tr>
5797 <td align="left"><code>SC_WRAPVISUALFLAG_NONE</code></td>
5798 <td align="center">0</td>
5799 <td>No visual flags</td>
5800 </tr>
5802 <tr>
5803 <td align="left"><code>SC_WRAPVISUALFLAG_END</code></td>
5804 <td align="center">1</td>
5805 <td>Visual flag at end of subline of a wrapped line.</td>
5806 </tr>
5808 <tr>
5809 <td align="left"><code>SC_WRAPVISUALFLAG_START</code></td>
5810 <td align="center">2</td>
5811 <td>Visual flag at begin of subline of a wrapped line.<br />
5812 Subline is indented by at least 1 to make room for the flag.<br />
5813 </td>
5814 </tr>
5816 <tr>
5817 <td align="left"><code>SC_WRAPVISUALFLAG_MARGIN</code></td>
5818 <td align="center">4</td>
5819 <td>Visual flag in line number margin.</td>
5820 </tr>
5821 </tbody>
5822 </table>
5824 <p><b id="SCI_SETWRAPVISUALFLAGSLOCATION">SCI_SETWRAPVISUALFLAGSLOCATION(int wrapVisualFlagsLocation)</b><br />
5825 <b id="SCI_GETWRAPVISUALFLAGSLOCATION">SCI_GETWRAPVISUALFLAGSLOCATION</b><br />
5826 You can set whether the visual flags to indicate a line is wrapped are drawn near the border or near the text.
5827 Bits set in wrapVisualFlagsLocation set the location to near the text for the corresponding visual flag.
5828 </p>
5830 <table cellpadding="1" cellspacing="2" border="0" summary="Wrap visual flags locations">
5831 <tbody>
5832 <tr>
5833 <th align="left">Symbol</th>
5834 <th>Value</th>
5835 <th align="left">Effect</th>
5836 </tr>
5837 </tbody>
5839 <tbody valign="top">
5840 <tr>
5841 <td align="left"><code>SC_WRAPVISUALFLAGLOC_DEFAULT</code></td>
5842 <td align="center">0</td>
5843 <td>Visual flags drawn near border</td>
5844 </tr>
5846 <tr>
5847 <td align="left"><code>SC_WRAPVISUALFLAGLOC_END_BY_TEXT</code></td>
5848 <td align="center">1</td>
5849 <td>Visual flag at end of subline drawn near text</td>
5850 </tr>
5852 <tr>
5853 <td align="left"><code>SC_WRAPVISUALFLAGLOC_START_BY_TEXT</code></td>
5854 <td align="center">2</td>
5855 <td>Visual flag at beginning of subline drawn near text</td>
5856 </tr>
5857 </tbody>
5858 </table>
5860 <p><b id="SCI_SETWRAPINDENTMODE">SCI_SETWRAPINDENTMODE(int indentMode)</b><br />
5861 <b id="SCI_GETWRAPINDENTMODE">SCI_GETWRAPINDENTMODE</b><br />
5862 Wrapped sublines can be indented to the position of their first subline or one more indent level.
5863 The default is <code>SC_WRAPINDENT_FIXED</code>.
5864 The modes are:
5865 </p>
5867 <table cellpadding="1" cellspacing="2" border="0" summary="Wrap visual flags locations">
5868 <tbody>
5869 <tr>
5870 <th align="left">Symbol</th>
5871 <th>Value</th>
5872 <th align="left">Effect</th>
5873 </tr>
5874 </tbody>
5876 <tbody valign="top">
5877 <tr>
5878 <td align="left"><code>SC_WRAPINDENT_FIXED</code></td>
5879 <td align="center">0</td>
5880 <td>Wrapped sublines aligned to left of window plus amount set by
5881 <a class="message" href="#SCI_SETWRAPSTARTINDENT">SCI_SETWRAPSTARTINDENT</a></td>
5882 </tr>
5884 <tr>
5885 <td align="left"><code>SC_WRAPINDENT_SAME</code></td>
5886 <td align="center">1</td>
5887 <td>Wrapped sublines are aligned to first subline indent</td>
5888 </tr>
5890 <tr>
5891 <td align="left"><code>SC_WRAPINDENT_INDENT</code></td>
5892 <td align="center">2</td>
5893 <td>Wrapped sublines are aligned to first subline indent plus one more level of indentation</td>
5894 </tr>
5895 </tbody>
5896 </table>
5898 <p><b id="SCI_SETWRAPSTARTINDENT">SCI_SETWRAPSTARTINDENT(int indent)</b><br />
5899 <b id="SCI_GETWRAPSTARTINDENT">SCI_GETWRAPSTARTINDENT</b><br />
5900 <code>SCI_SETWRAPSTARTINDENT</code> sets the size of indentation of sublines for
5901 wrapped lines in terms of the average character width in
5902 <a class="message" href="#StyleDefinition"><code>STYLE_DEFAULT</code></a>.
5903 There are no limits on indent sizes, but values less than 0 or large values may have
5904 undesirable effects.<br />
5905 The indention of sublines is independent of visual flags, but if
5906 <code>SC_WRAPVISUALFLAG_START</code> is set an indent of at least 1 is used.
5907 </p>
5909 <p><b id="SCI_SETLAYOUTCACHE">SCI_SETLAYOUTCACHE(int cacheMode)</b><br />
5910 <b id="SCI_GETLAYOUTCACHE">SCI_GETLAYOUTCACHE</b><br />
5911 You can set <code>cacheMode</code> to one of the symbols in the table:</p>
5913 <table cellpadding="1" cellspacing="2" border="0" summary="Line caching styles">
5914 <tbody>
5915 <tr>
5916 <th align="left">Symbol</th>
5918 <th>Value</th>
5920 <th align="left">Layout cached for these lines</th>
5921 </tr>
5922 </tbody>
5924 <tbody valign="top">
5925 <tr>
5926 <td align="left"><code>SC_CACHE_NONE</code></td>
5928 <td align="center">0</td>
5930 <td>No lines are cached.</td>
5931 </tr>
5933 <tr>
5934 <td align="left"><code>SC_CACHE_CARET</code></td>
5936 <td align="center">1</td>
5938 <td>The line containing the text caret. This is the default.</td>
5939 </tr>
5941 <tr>
5942 <td align="left"><code>SC_CACHE_PAGE</code></td>
5944 <td align="center">2</td>
5946 <td>Visible lines plus the line containing the caret.</td>
5947 </tr>
5949 <tr>
5950 <td align="left"><code>SC_CACHE_DOCUMENT</code></td>
5952 <td align="center">3</td>
5954 <td>All lines in the document.</td>
5955 </tr>
5956 </tbody>
5957 </table>
5959 <p><b id="SCI_SETPOSITIONCACHE">SCI_SETPOSITIONCACHE(int size)</b><br />
5960 <b id="SCI_GETPOSITIONCACHE">SCI_GETPOSITIONCACHE</b><br />
5961 The position cache stores position information for short runs of text
5962 so that their layout can be determined more quickly if the run recurs.
5963 The size in entries of this cache can be set with <code>SCI_SETPOSITIONCACHE</code>.</p>
5965 <p><b id="SCI_LINESSPLIT">SCI_LINESSPLIT(int pixelWidth)</b><br />
5966 Split a range of lines indicated by the target into lines that are at most pixelWidth wide.
5967 Splitting occurs on word boundaries wherever possible in a similar manner to line wrapping.
5968 When <code>pixelWidth</code> is 0 then the width of the window is used.
5969 </p>
5971 <p><b id="SCI_LINESJOIN">SCI_LINESJOIN</b><br />
5972 Join a range of lines indicated by the target into one line by
5973 removing line end characters.
5974 Where this would lead to no space between words, an extra space is inserted.
5975 </p>
5977 <p><b id="SCI_WRAPCOUNT">SCI_WRAPCOUNT(int docLine)</b><br />
5978 Document lines can occupy more than one display line if they wrap and this
5979 returns the number of display lines needed to wrap a document line.</p>
5981 <h2 id="Zooming">Zooming</h2>
5983 <p>Scintilla incorporates a "zoom factor" that lets you make all the text in the document
5984 larger or smaller in steps of one point. The displayed point size never goes below 2, whatever
5985 zoom factor you set. You can set zoom factors in the range -10 to +20 points.</p>
5986 <code><a class="message" href="#SCI_ZOOMIN">SCI_ZOOMIN</a><br />
5987 <a class="message" href="#SCI_ZOOMOUT">SCI_ZOOMOUT</a><br />
5988 <a class="message" href="#SCI_SETZOOM">SCI_SETZOOM(int zoomInPoints)</a><br />
5989 <a class="message" href="#SCI_GETZOOM">SCI_GETZOOM</a><br />
5990 </code>
5992 <p><b id="SCI_ZOOMIN">SCI_ZOOMIN</b><br />
5993 <b id="SCI_ZOOMOUT">SCI_ZOOMOUT</b><br />
5994 <code>SCI_ZOOMIN</code> increases the zoom factor by one point if the current zoom factor is
5995 less than 20 points. <code>SCI_ZOOMOUT</code> decreases the zoom factor by one point if the
5996 current zoom factor is greater than -10 points.</p>
5998 <p><b id="SCI_SETZOOM">SCI_SETZOOM(int zoomInPoints)</b><br />
5999 <b id="SCI_GETZOOM">SCI_GETZOOM</b><br />
6000 These messages let you set and get the zoom factor directly. There is no limit set on the
6001 factors you can set, so limiting yourself to -10 to +20 to match the incremental zoom functions
6002 is a good idea.</p>
6004 <h2 id="LongLines">Long lines</h2>
6006 <p>You can choose to mark lines that exceed a given length by drawing a vertical line or by
6007 colouring the background of characters that exceed the set length.</p>
6008 <code><a class="message" href="#SCI_SETEDGEMODE">SCI_SETEDGEMODE(int mode)</a><br />
6009 <a class="message" href="#SCI_GETEDGEMODE">SCI_GETEDGEMODE</a><br />
6010 <a class="message" href="#SCI_SETEDGECOLUMN">SCI_SETEDGECOLUMN(int column)</a><br />
6011 <a class="message" href="#SCI_GETEDGECOLUMN">SCI_GETEDGECOLUMN</a><br />
6012 <a class="message" href="#SCI_SETEDGECOLOUR">SCI_SETEDGECOLOUR(int colour)</a><br />
6013 <a class="message" href="#SCI_GETEDGECOLOUR">SCI_GETEDGECOLOUR</a><br />
6014 </code>
6016 <p><b id="SCI_SETEDGEMODE">SCI_SETEDGEMODE(int edgeMode)</b><br />
6017 <b id="SCI_GETEDGEMODE">SCI_GETEDGEMODE</b><br />
6018 These two messages set and get the mode used to display long lines. You can set one of the
6019 values in the table:</p>
6021 <table cellpadding="1" cellspacing="2" border="0" summary="Long line styles">
6022 <tbody>
6023 <tr>
6024 <th align="left">Symbol</th>
6026 <th>Value</th>
6028 <th align="left">Long line display mode</th>
6029 </tr>
6030 </tbody>
6032 <tbody valign="top">
6033 <tr>
6034 <td align="left"><code>EDGE_NONE</code></td>
6036 <td align="center">0</td>
6038 <td>Long lines are not marked. This is the default state.</td>
6039 </tr>
6041 <tr>
6042 <td align="left"><code>EDGE_LINE</code></td>
6044 <td align="center">1</td>
6046 <td>A vertical line is drawn at the column number set by <code>SCI_SETEDGECOLUMN</code>.
6047 This works well for monospaced fonts. The line is drawn at a position based on the width
6048 of a space character in <a class="message"
6049 href="#StyleDefinition"><code>STYLE_DEFAULT</code></a>, so it may not work very well if
6050 your styles use proportional fonts or if your style have varied font sizes or you use a
6051 mixture of bold, italic and normal text.</td>
6052 </tr>
6054 <tr>
6055 <td align="left"><code>EDGE_BACKGROUND</code></td>
6057 <td align="center">2</td>
6059 <td>The background colour of characters after the column limit is changed to the colour
6060 set by <code>SCI_SETEDGECOLOUR</code>. This is recommended for proportional fonts.</td>
6061 </tr>
6062 </tbody>
6063 </table>
6065 <p><b id="SCI_SETEDGECOLUMN">SCI_SETEDGECOLUMN(int column)</b><br />
6066 <b id="SCI_GETEDGECOLUMN">SCI_GETEDGECOLUMN</b><br />
6067 These messages set and get the column number at which to display the long line marker. When
6068 drawing lines, the column sets a position in units of the width of a space character in
6069 <code>STYLE_DEFAULT</code>. When setting the background colour, the column is a character count
6070 (allowing for tabs) into the line.</p>
6072 <p><b id="SCI_SETEDGECOLOUR">SCI_SETEDGECOLOUR(int <a class="jump"
6073 href="#colour">colour</a>)</b><br />
6074 <b id="SCI_GETEDGECOLOUR">SCI_GETEDGECOLOUR</b><br />
6075 These messages set and get the colour of the marker used to show that a line has exceeded the
6076 length set by <code>SCI_SETEDGECOLUMN</code>.</p>
6078 <h2 id="Lexer">Lexer</h2>
6080 <p>If you define the symbol <code>SCI_LEXER</code> when building Scintilla, (this is sometimes
6081 called the SciLexer version of Scintilla), lexing support for a wide range of programming
6082 languages is included and the messages in this section are supported. If you want to set
6083 styling and fold points for an unsupported language you can either do this in the container or
6084 better still, write your own lexer following the pattern of one of the existing ones.</p>
6086 <p>Scintilla also supports external lexers. These are DLLs (on Windows) or .so modules (on GTK+/Linux) that export three
6087 functions: <code>GetLexerCount</code>, <code>GetLexerName</code>, and
6088 <code>GetLexerFactory</code>. See <code>externalLexer.cxx</code> for more.</p>
6089 <a class="message" href="#SCI_SETLEXER">SCI_SETLEXER(int lexer)</a><br />
6090 <a class="message" href="#SCI_GETLEXER">SCI_GETLEXER</a><br />
6091 <a class="message" href="#SCI_SETLEXERLANGUAGE">SCI_SETLEXERLANGUAGE(&lt;unused&gt;, const char
6092 *name)</a><br />
6093 <a class="message" href="#SCI_GETLEXERLANGUAGE">SCI_GETLEXERLANGUAGE(&lt;unused&gt;, char
6094 *name)</a><br />
6095 <a class="message" href="#SCI_LOADLEXERLIBRARY">SCI_LOADLEXERLIBRARY(&lt;unused&gt;, const char
6096 *path)</a><br />
6097 <a class="message" href="#SCI_COLOURISE">SCI_COLOURISE(int start, int end)</a><br />
6098 <a class="message" href="#SCI_CHANGELEXERSTATE">SCI_CHANGELEXERSTATE(int start, int end)</a><br />
6099 <a class="message" href="#SCI_PROPERTYNAMES">SCI_PROPERTYNAMES(&lt;unused&gt;, char *names)</a><br />
6100 <a class="message" href="#SCI_PROPERTYTYPE">SCI_PROPERTYTYPE(const char *name)</a><br />
6101 <a class="message" href="#SCI_DESCRIBEPROPERTY">SCI_DESCRIBEPROPERTY(const char *name, char *description)</a><br />
6102 <a class="message" href="#SCI_SETPROPERTY">SCI_SETPROPERTY(const char *key, const char *value)</a><br />
6103 <a class="message" href="#SCI_GETPROPERTY">SCI_GETPROPERTY(const char *key, char *value)</a><br />
6104 <a class="message" href="#SCI_GETPROPERTYEXPANDED">SCI_GETPROPERTYEXPANDED(const char *key, char *value)</a><br />
6105 <a class="message" href="#SCI_GETPROPERTYINT">SCI_GETPROPERTYINT(const char *key, int default)</a><br />
6106 <a class="message" href="#SCI_DESCRIBEKEYWORDSETS">SCI_DESCRIBEKEYWORDSETS(&lt;unused&gt;, char *descriptions)</a><br />
6107 <a class="message" href="#SCI_SETKEYWORDS">SCI_SETKEYWORDS(int keyWordSet, const char
6108 *keyWordList)</a><br />
6110 <a class="message" href="#SCI_GETSUBSTYLEBASES">SCI_GETSUBSTYLEBASES(&lt;unused&gt;, char *styles)</a><br />
6111 <a class="message" href="#SCI_DISTANCETOSECONDARYSTYLES">SCI_DISTANCETOSECONDARYSTYLES</a><br />
6112 <a class="message" href="#SCI_ALLOCATESUBSTYLES">SCI_ALLOCATESUBSTYLES(int styleBase, int numberStyles)</a><br />
6113 <a class="message" href="#SCI_FREESUBSTYLES">SCI_FREESUBSTYLES</a><br />
6114 <a class="message" href="#SCI_GETSUBSTYLESSTART">SCI_GETSUBSTYLESSTART(int styleBase)</a><br />
6115 <a class="message" href="#SCI_GETSUBSTYLESLENGTH">SCI_GETSUBSTYLESLENGTH(int styleBase)</a><br />
6116 <a class="message" href="#SCI_GETSTYLEFROMSUBSTYLE">SCI_GETSTYLEFROMSUBSTYLE(int subStyle)</a><br />
6117 <a class="message" href="#SCI_GETPRIMARYSTYLEFROMSTYLE">SCI_GETPRIMARYSTYLEFROMSTYLE(int style)</a><br />
6118 <a class="message" href="#SCI_SETIDENTIFIERS">SCI_SETIDENTIFIERS(int style, const char *identifiers)</a><br />
6120 <p><b id="SCI_SETLEXER">SCI_SETLEXER(int lexer)</b><br />
6121 <b id="SCI_GETLEXER">SCI_GETLEXER</b><br />
6122 You can select the lexer to use with an integer code from the <code>SCLEX_*</code> enumeration
6123 in <code>Scintilla.h</code>. There are two codes in this sequence that do not use lexers:
6124 <code>SCLEX_NULL</code> to select no lexing action and <code>SCLEX_CONTAINER</code> which sends
6125 the <code><a class="message" href="#SCN_STYLENEEDED">SCN_STYLENEEDED</a></code> notification to
6126 the container whenever a range of text needs to be styled. You cannot use the
6127 <code>SCLEX_AUTOMATIC</code> value; this identifies additional external lexers that Scintilla
6128 assigns unused lexer numbers to.</p>
6130 <p><b id="SCI_SETLEXERLANGUAGE">SCI_SETLEXERLANGUAGE(&lt;unused&gt;, const char *name)</b><br />
6131 <b id="SCI_GETLEXERLANGUAGE">SCI_GETLEXERLANGUAGE(&lt;unused&gt;, char *name NUL-terminated)</b><br />
6132 <code>SCI_SETLEXERLANGUAGE</code> lets you select a lexer by name, and is the only method if you are using an
6133 external lexer or if you have written a lexer module for a language of your own and do not wish
6134 to assign it an explicit lexer number. To select an existing lexer, set <code>name</code> to
6135 match the (case sensitive) name given to the module, for example "ada" or "python", not "Ada"
6136 or "Python". To locate the name for the built-in lexers, open the relevant
6137 <code>Lex*.cxx</code> file and search for <code>LexerModule</code>. The third argument in the
6138 <code>LexerModule</code> constructor is the name to use.</p>
6140 <p>To test if your lexer assignment worked, use <a class="message"
6141 href="#SCI_GETLEXER"><code>SCI_GETLEXER</code></a> before and after setting the new lexer to
6142 see if the lexer number changed.</p>
6144 <p><code>SCI_GETLEXERLANGUAGE</code> retrieves the name of the lexer.</p>
6146 <p><b id="SCI_LOADLEXERLIBRARY">SCI_LOADLEXERLIBRARY(&lt;unused&gt;, const char *path)</b><br />
6147 Load a lexer implemented in a shared library. This is a .so file on GTK+/Linux or a .DLL file on Windows.
6148 </p>
6150 <p><b id="SCI_COLOURISE">SCI_COLOURISE(int startPos, int endPos)</b><br />
6151 This requests the current lexer or the container (if the lexer is set to
6152 <code>SCLEX_CONTAINER</code>) to style the document between <code>startPos</code> and
6153 <code>endPos</code>. If <code>endPos</code> is -1, the document is styled from
6154 <code>startPos</code> to the end. If the <code>"fold"</code> property is set to
6155 <code>"1"</code> and your lexer or container supports folding, fold levels are also set. This
6156 message causes a redraw.</p>
6158 <p><b id="SCI_CHANGELEXERSTATE">SCI_CHANGELEXERSTATE(int startPos, int endPos)</b><br />
6159 Indicate that the internal state of a lexer has changed over a range and therefore
6160 there may be a need to redraw.</p>
6162 <p><b id="SCI_PROPERTYNAMES">SCI_PROPERTYNAMES(&lt;unused&gt;, char *names NUL-terminated)</b><br />
6163 <b id="SCI_PROPERTYTYPE">SCI_PROPERTYTYPE(const char *name)</b><br />
6164 <b id="SCI_DESCRIBEPROPERTY">SCI_DESCRIBEPROPERTY(const char *name, char *description NUL-terminated)</b><br />
6165 Information may be retrieved about the properties that can be set for the current lexer.
6166 This information is only available for newer lexers.
6167 <code>SCI_PROPERTYNAMES</code> returns a string with all of the valid properties separated by "\n".
6168 If the lexer does not support this call then an empty string is returned.
6169 Properties may be boolean (<code>SC_TYPE_BOOLEAN</code>), integer (<code>SC_TYPE_INTEGER</code>),
6170 or string (<code>SC_TYPE_STRING</code>) and this is found with <code>SCI_PROPERTYTYPE</code>.
6171 A description of a property in English is returned by <code>SCI_DESCRIBEPROPERTY</code>.</p>
6173 <p><b id="SCI_SETPROPERTY">SCI_SETPROPERTY(const char *key, const char *value)</b><br />
6174 You can communicate settings to lexers with keyword:value string pairs. There is no limit to
6175 the number of keyword pairs you can set, other than available memory. <code>key</code> is a
6176 case sensitive keyword, <code>value</code> is a string that is associated with the keyword. If
6177 there is already a value string associated with the keyword, it is replaced. If you pass a zero
6178 length string, the message does nothing. Both <code>key</code> and <code>value</code> are used
6179 without modification; extra spaces at the beginning or end of <code>key</code> are
6180 significant.</p>
6182 <p>The <code>value</code> string can refer to other keywords. For example,
6183 <code>SCI_SETPROPERTY("foldTimes10", "$(fold)0")</code> stores the string
6184 <code>"$(fold)0"</code>, but when this is accessed, the <code>$(fold)</code> is replaced by the
6185 value of the <code>"fold"</code> keyword (or by nothing if this keyword does not exist).</p>
6187 <p>Currently the "fold" property is defined for most of the lexers to set the fold structure if
6188 set to "1". <code>SCLEX_PYTHON</code> understands <code>"tab.timmy.whinge.level"</code> as a
6189 setting that determines how to indicate bad indentation. Most keywords have values that are
6190 interpreted as integers. Search the lexer sources for <code>GetPropertyInt</code> to see how
6191 properties are used.</p>
6193 <p>There is a convention for naming properties used by lexers so that the set of properties can be found by scripts.
6194 Property names should start with "lexer.&lt;lexer&gt;." or "fold.&lt;lexer&gt;." when they apply to one
6195 lexer or start with "lexer." or "fold." if they apply to multiple lexers.</p>
6197 <p>Applications may discover the set of properties used by searching the source code of lexers for lines that contain
6198 <code>GetProperty</code> and a double quoted string and extract the value of the double quoted string as the property name.
6199 The <code>scintilla/scripts/LexGen.py</code> script does this and can be used as an example.
6200 Documentation for the property may be located above the call as a multi-line comment starting with
6201 <br/><code>// property &lt;property-name&gt;</code></p>
6203 <p><b id="SCI_GETPROPERTY">SCI_GETPROPERTY(const char *key, char *value NUL-terminated)</b><br />
6204 Lookup a keyword:value pair using the specified key; if found, copy the value to the user-supplied
6205 buffer and return the length (not including the terminating 0). If not found, copy an empty string
6206 to the buffer and return 0.</p>
6208 <p>Note that "keyword replacement" as described in <a class="message" href="#SCI_SETPROPERTY">
6209 <code>SCI_SETPROPERTY</code></a> will not be performed.</p>
6211 <p>If the value argument is 0 then the length that should be allocated to store the value is returned;
6212 again, the terminating 0 is not included.</p>
6214 <p><b id="SCI_GETPROPERTYEXPANDED">SCI_GETPROPERTYEXPANDED(const char *key, char *value)</b><br />
6215 Lookup a keyword:value pair using the specified key; if found, copy the value to the user-supplied
6216 buffer and return the length (not including the terminating 0). If not found, copy an empty string
6217 to the buffer and return 0.</p>
6219 <p>Note that "keyword replacement" as described in <a class="message" href="#SCI_SETPROPERTY">
6220 <code>SCI_SETPROPERTY</code></a> will be performed.</p>
6222 <p>If the value argument is 0 then the length that should be allocated to store the value (including any indicated keyword replacement)
6223 is returned; again, the terminating 0 is not included.</p>
6225 <p><b id="SCI_GETPROPERTYINT">SCI_GETPROPERTYINT(const char *key, int default)</b><br />
6226 Lookup a keyword:value pair using the specified key; if found, interpret the value as an integer and return it.
6227 If not found (or the value is an empty string) then return the supplied default. If the keyword:value pair is found but is not
6228 a number, then return 0.</p>
6230 <p>Note that "keyword replacement" as described in <a class="message" href="#SCI_SETPROPERTY">
6231 <code>SCI_SETPROPERTY</code></a> will be performed before any numeric interpretation.</p>
6233 <p><b id="SCI_SETKEYWORDS">SCI_SETKEYWORDS(int keyWordSet, const char *keyWordList)</b><br />
6234 You can set up to 9 lists of keywords for use by the current lexer.
6235 <code>keyWordSet</code> can be 0 to 8 (actually 0 to <code>KEYWORDSET_MAX</code>)
6236 and selects which keyword list to replace. <code>keyWordList</code> is a list of keywords
6237 separated by spaces, tabs, <code>"\n"</code> or <code>"\r"</code> or any combination of these.
6238 It is expected that the keywords will be composed of standard ASCII printing characters,
6239 but there is nothing to stop you using any non-separator character codes from 1 to 255
6240 (except common sense).</p>
6242 <p>How these keywords are used is entirely up to the lexer. Some languages, such as HTML may
6243 contain embedded languages, VBScript and JavaScript are common for HTML. For HTML, key word set
6244 0 is for HTML, 1 is for JavaScript and 2 is for VBScript, 3 is for Python, 4 is for PHP and 5
6245 is for SGML and DTD keywords. Review the lexer code to see examples of keyword list. A fully
6246 conforming lexer sets the fourth argument of the <code>LexerModule</code> constructor to be a
6247 list of strings that describe the uses of the keyword lists.</p>
6249 <p>Alternatively, you might use set 0 for general keywords, set 1 for keywords that cause
6250 indentation and set 2 for keywords that cause unindentation. Yet again, you might have a simple
6251 lexer that colours keywords and you could change languages by changing the keywords in set 0.
6252 There is nothing to stop you building your own keyword lists into the lexer, but this means
6253 that the lexer must be rebuilt if more keywords are added.</p>
6255 <p><b id="SCI_DESCRIBEKEYWORDSETS">SCI_DESCRIBEKEYWORDSETS(&lt;unused&gt;, char *descriptions NUL-terminated)</b><br />
6256 A description of all of the keyword sets separated by "\n" is returned by <code>SCI_DESCRIBEKEYWORDSETS</code>.</p>
6258 <h3 id="Substyles">Substyles</h3>
6259 <p>Lexers may support several different sublanguages and each sublanguage may want to style some number of
6260 sets of identifiers (or similar lexemes such as documentation keywords) uniquely. Preallocating a large number for each
6261 purpose would exhaust the number of allowed styles quickly.
6262 This is alleviated by substyles which allow the application to determine how many sets of identifiers to allocate for
6263 each purpose.
6264 Lexers have to explicitly support this feature by implementing the methods in <code>ILexerWithSubStyles</code>.</p>
6266 <p><b id="SCI_GETSUBSTYLEBASES">SCI_GETSUBSTYLEBASES(&lt;unused&gt;, char *styles NUL-terminated)</b><br />
6267 Fill <code>styles</code> with a byte for each style that can be split into substyles.</p>
6269 <p><b id="SCI_DISTANCETOSECONDARYSTYLES">SCI_DISTANCETOSECONDARYSTYLES</b><br />
6270 Returns the distance between a primary style and its corresponding secondary style.</p>
6272 <p><b id="SCI_ALLOCATESUBSTYLES">SCI_ALLOCATESUBSTYLES(int styleBase, int numberStyles)</b><br />
6273 Allocate some number of substyles for a particular base style returning the first substyle number allocated.
6274 Substyles are allocated contiguously.</p>
6276 <p><b id="SCI_FREESUBSTYLES">SCI_FREESUBSTYLES</b><br />
6277 Free all allocated substyles.</p>
6279 <p><b id="SCI_GETSUBSTYLESSTART">SCI_GETSUBSTYLESSTART(int styleBase)</b><br />
6280 <b id="SCI_GETSUBSTYLESLENGTH">SCI_GETSUBSTYLESLENGTH(int styleBase)</b><br />
6281 Return the start and length of the substyles allocated for a base style.</p>
6283 <p><b id="SCI_GETSTYLEFROMSUBSTYLE">SCI_GETSTYLEFROMSUBSTYLE(int subStyle)</b><br />
6284 For a sub style, return the base style, else return the argument.</p>
6286 <p><b id="SCI_GETPRIMARYSTYLEFROMSTYLE">SCI_GETPRIMARYSTYLEFROMSTYLE(int style)</b><br />
6287 For a secondary style, return the primary style, else return the argument.</p>
6289 <p><b id="SCI_SETIDENTIFIERS">SCI_SETIDENTIFIERS(int style, const char *identifiers)</b><br />
6290 Similar to <code>SCI_SETKEYWORDS</code> but for substyles.
6291 The prefix feature available with <code>SCI_SETKEYWORDS</code> is not implemented for <code>SCI_SETIDENTIFIERS</code>.</p>
6293 <h2 id="LexerObjects">Lexer Objects</h2>
6295 <p>Lexers are programmed as objects that implement the ILexer interface and that interact
6296 with the document they are lexing through the IDocument interface.
6297 Previously lexers were defined by providing lexing and folding functions but creating an object
6298 to handle the interaction of a lexer with a document allows the lexer to store state information that
6299 can be used during lexing. For example a C++ lexer may store a set of preprocessor definitions
6300 or variable declarations and style these depending on their role.</p>
6302 <p>A set of helper classes allows older lexers defined by functions to be used in Scintilla.</p>
6303 <h4>ILexer</h4>
6305 <div class="highlighted">
6306 <span class="S5">class</span><span class="S0"> </span>ILexer<span class="S0"> </span><span class="S10">{</span><br />
6307 <span class="S5">public</span><span class="S10">:</span><br />
6308 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6309 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
6310 <span class="S0"> </span>Version<span class="S10">()</span><span class="S0"> </span>
6311 <span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
6312 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6313 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6314 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
6315 <span class="S0"> </span>Release<span class="S10">()</span><span class="S0"> </span>
6316 <span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6317 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span>
6318 <span class="S5">const</span><span class="S0"> </span>
6319 <span class="S5">char</span><span class="S0"> </span>
6320 <span class="S10">*</span><span class="S0"> </span>
6321 SCI_METHOD<span class="S0"> </span>PropertyNames<span class="S10">()</span>
6322 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6323 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6324 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>PropertyType<span class="S10">(</span><span class="S5">const</span><span class="S0"> </span><span class="S5">char</span><span class="S0"> </span><span class="S10">*</span>name<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6325 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6326 <span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S5">char</span><span class="S0"> </span><span class="S10">*</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>DescribeProperty<span class="S10">(</span><span class="S5">const</span><span class="S0"> </span><span class="S5">char</span><span class="S0"> </span><span class="S10">*</span>name<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6327 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6328 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
6329 <span class="S0"> </span>PropertySet<span class="S10">(</span><span class="S5">const</span>
6330 <span class="S0"> </span><span class="S5">char</span>
6331 <span class="S0"> </span><span class="S10">*</span>key<span class="S10">,</span>
6332 <span class="S0"> </span><span class="S5">const</span><span class="S0"> </span>
6333 <span class="S5">char</span><span class="S0"> </span><span class="S10">*</span>val<span class="S10">)</span>
6334 <span class="S0"> </span><span class="S10">=</span>
6335 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6336 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span>
6337 <span class="S5">const</span><span class="S0"> </span><span class="S5">char</span><span class="S0"> </span>
6338 <span class="S10">*</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>DescribeWordListSets<span class="S10">()</span>
6339 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
6340 <span class="S4">0</span><span class="S10">;</span><br />
6341 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6342 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
6343 <span class="S0"> </span>WordListSet<span class="S10">(</span><span class="S5">int</span>
6344 <span class="S0"> </span>n<span class="S10">,</span>
6345 <span class="S0"> </span><span class="S5">const</span><span class="S0"> </span>
6346 <span class="S5">char</span><span class="S0"> </span><span class="S10">*</span>wl<span class="S10">)</span>
6347 <span class="S0"> </span><span class="S10">=</span>
6348 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6349 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6350 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
6351 <span class="S0"> </span>Lex<span class="S10">(</span><span class="S5">unsigned</span>
6352 <span class="S0"> </span><span class="S5">int</span>
6353 <span class="S0"> </span>startPos<span class="S10">,</span>
6354 <span class="S0"> </span><span class="S5">int</span>
6355 <span class="S0"> </span>lengthDoc<span class="S10">,</span><span class="S0">
6356 </span><span class="S5">int</span><span class="S0"> </span>initStyle<span class="S10">,</span>
6357 <span class="S0"> </span>IDocument<span class="S0">
6358 </span><span class="S10">*</span>pAccess<span class="S10">)</span>
6359 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
6360 <span class="S4">0</span><span class="S10">;</span><br />
6361 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6362 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
6363 <span class="S0"> </span>Fold<span class="S10">(</span><span class="S5">unsigned</span>
6364 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>startPos<span class="S10">,</span>
6365 <span class="S0"> </span><span class="S5">int</span>
6366 <span class="S0"> </span>lengthDoc<span class="S10">,</span><span class="S0">
6367 </span><span class="S5">int</span><span class="S0"> </span>initStyle<span class="S10">,</span>
6368 <span class="S0"> </span>IDocument<span class="S0">
6369 </span><span class="S10">*</span>pAccess<span class="S10">)</span>
6370 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
6371 <span class="S4">0</span><span class="S10">;</span><br />
6372 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6373 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>
6374 <span class="S10">*</span><span class="S0"> </span>SCI_METHOD<span class="S0">
6375 </span>PrivateCall<span class="S10">(</span><span class="S5">int</span>
6376 <span class="S0"> </span>operation<span class="S10">,</span><span class="S0">
6377 </span><span class="S5">void</span><span class="S0"> </span>
6378 <span class="S10">*</span>pointer<span class="S10">)</span><span class="S0"> </span>
6379 <span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6380 <span class="S10">};</span><br />
6381 </div>
6384 The return values from PropertySet and WordListSet are used to indicate whether the change requires
6385 performing lexing or folding over any of the document. It is the position at which to restart lexing and folding or -1
6386 if the change does not require any extra work on the document.
6387 A simple approach is to return 0 if there is any possibility that a change requires lexing the document again while an
6388 optimisation could be to remember where a setting first affects the document and return that position.
6389 </p>
6391 <p><code>Version</code> returns an enumerated value specifying which version of the interface is implemented:
6392 <code>lvOriginal</code> for <code>ILexer</code> and <code>lvSubStyles</code> for <code>ILexerWithSubStyles</code>.</p>
6394 <p><code>Release</code> is called to destroy the lexer object.</p>
6396 <p><code>PrivateCall</code> allows for direct communication between the
6397 application and a lexer. An example would be where an application
6398 maintains a single large data structure containing symbolic information
6399 about system headers (like Windows.h) and provides this to the lexer
6400 where it can be applied to each document. This avoids the costs of
6401 constructing the system header information for each document. This is
6402 invoked with the <code>SCI_PRIVATELEXERCALL</code> API.</p>
6404 <p><code>Fold</code> is called with the exact range that needs folding.
6405 Previously, lexers were called with a range that started one line before the range that
6406 needs to be folded as this allowed fixing up the last line from the previous folding.
6407 The new approach allows the lexer to decide whether to backtrack or to handle this
6408 more efficiently.</p>
6410 <h4>ILexerWithSubStyles</h4>
6413 To allow lexers to report which line ends they support, and to support substyles,
6414 <code>Ilexer</code> is extended to <code>ILexerWithSubStyles</code>.
6415 </p>
6417 <div class="highlighted">
6418 <span class="S5">class</span><span class="S0"> </span>ILexerWithSubStyles<span class="S0"> </span><span class="S10">:</span><span class="S0"> </span><span class="S5">public</span><span class="S0"> </span>ILexer<span class="S0"> </span><span class="S10">{</span><br />
6419 <span class="S5">public</span><span class="S10">:</span><br />
6420 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>LineEndTypesSupported<span class="S10">()</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6421 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>AllocateSubStyles<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>styleBase<span class="S10">,</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>numberStyles<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6422 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>SubStylesStart<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>styleBase<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6423 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>SubStylesLength<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>styleBase<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6424 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>StyleFromSubStyle<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>subStyle<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6425 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>PrimaryStyleFromStyle<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>style<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6426 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>FreeSubStyles<span class="S10">()</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6427 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>SetIdentifiers<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>style<span class="S10">,</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S5">char</span><span class="S0"> </span><span class="S10">*</span>identifiers<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6428 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>DistanceToSecondaryStyles<span class="S10">()</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6429 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S5">char</span><span class="S0"> </span><span class="S10">*</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>GetSubStyleBases<span class="S10">()</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6430 <span class="S10">};</span><br />
6431 </div>
6433 <h4>IDocument</h4>
6435 <div class="highlighted">
6436 <span class="S5">class</span><span class="S0"> </span>IDocument
6437 <span class="S0"> </span><span class="S10">{</span><br />
6438 <span class="S5">public</span><span class="S10">:</span><br />
6439 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6440 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
6441 <span class="S0"> </span>Version<span class="S10">()</span><span class="S0"> </span>
6442 <span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
6443 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6444 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6445 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
6446 <span class="S0"> </span>SetErrorStatus<span class="S10">(</span><span class="S5">int</span>
6447 <span class="S0"> </span>status<span class="S10">)</span>
6448 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
6449 <span class="S4">0</span><span class="S10">;</span><br />
6450 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6451 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
6452 <span class="S0"> </span>Length<span class="S10">()</span><span class="S0"> </span>
6453 <span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
6454 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6455 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6456 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
6457 <span class="S0"> </span>GetCharRange<span class="S10">(</span><span class="S5">char</span>
6458 <span class="S0"> </span><span class="S10">*</span>buffer<span class="S10">,</span>
6459 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>
6460 position<span class="S10">,</span><span class="S0"> </span>
6461 <span class="S5">int</span><span class="S0"> </span>lengthRetrieve<span class="S10">)</span>
6462 <span class="S0"> </span><span class="S5">const</span>
6463 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
6464 <span class="S4">0</span><span class="S10">;</span><br />
6465 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6466 <span class="S0"> </span><span class="S5">char</span><span class="S0"> </span>SCI_METHOD
6467 <span class="S0"> </span>StyleAt<span class="S10">(</span><span class="S5">int</span>
6468 <span class="S0"> </span>position<span class="S10">)</span><span class="S0"> </span>
6469 <span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
6470 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6471 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6472 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
6473 <span class="S0"> </span>LineFromPosition<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>position<span class="S10">)</span>
6474 <span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
6475 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6476 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span>
6477 <span class="S5">int</span><span class="S0"> </span>SCI_METHOD
6478 <span class="S0"> </span>LineStart<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>line<span class="S10">)</span>
6479 <span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
6480 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6481 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span>
6482 <span class="S5">int</span><span class="S0"> </span>SCI_METHOD
6483 <span class="S0"> </span>GetLevel<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>line<span class="S10">)</span>
6484 <span class="S0"> </span>
6485 <span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
6486 <span class="S4">0</span><span class="S10">;</span><br />
6487 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span>
6488 <span class="S5">int</span><span class="S0"> </span>SCI_METHOD
6489 <span class="S0"> </span>SetLevel<span class="S10">(</span><span class="S5">int</span>
6490 <span class="S0"> </span>line<span class="S10">,</span><span class="S0"> </span>
6491 <span class="S5">int</span><span class="S0"> </span>level<span class="S10">)</span>
6492 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
6493 <span class="S4">0</span><span class="S10">;</span><br />
6494 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6495 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
6496 <span class="S0"> </span>GetLineState<span class="S10">(</span><span class="S5">int</span>
6497 <span class="S0"> </span>line<span class="S10">)</span>
6498 <span class="S0"> </span><span class="S5">const</span><span class="S0"> </span>
6499 <span class="S10">=</span><span class="S0"> </span><span class="S4">0</span>
6500 <span class="S10">;</span><br />
6501 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6502 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
6503 <span class="S0"> </span>SetLineState<span class="S10">(</span><span class="S5">int</span>
6504 <span class="S0"> </span>line<span class="S10">,</span>
6505 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>state<span class="S10">)</span>
6506 <span class="S0"> </span><span class="S10">=</span>
6507 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6508 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6509 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
6510 <span class="S0"> </span>StartStyling<span class="S10">(</span><span class="S5">int</span>
6511 <span class="S0"> </span>position<span class="S10">,</span>
6512 <span class="S0"> </span><span class="S5">char</span><span class="S0"> </span>mask<span class="S10">)</span>
6513 <span class="S0"> </span><span class="S10">=</span>
6514 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6515 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">bool</span>
6516 <span class="S0"> </span>SCI_METHOD
6517 <span class="S0"> </span>SetStyleFor<span class="S10">(</span><span class="S5">int</span>
6518 <span class="S0"> </span>length<span class="S10">,</span>
6519 <span class="S0"> </span><span class="S5">char</span><span class="S0"> </span>style<span class="S10">)</span>
6520 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span>
6521 <span class="S10">;</span><br />
6522 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6523 <span class="S0"> </span><span class="S5">bool</span><span class="S0"> </span>SCI_METHOD
6524 <span class="S0"> </span>SetStyles<span class="S10">(</span><span class="S5">int</span>
6525 <span class="S0"> </span>length<span class="S10">,</span><span class="S0"> </span>
6526 <span class="S5">const</span><span class="S0"> </span><span class="S5">char</span>
6527 <span class="S0"> </span><span class="S10">*</span>styles<span class="S10">)</span>
6528 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
6529 <span class="S4">0</span><span class="S10">;</span><br />
6530 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">void</span>
6531 <span class="S0"> </span>SCI_METHOD
6532 <span class="S0"> </span>DecorationSetCurrentIndicator<span class="S10">(</span><span class="S5">int</span>
6533 <span class="S0"> </span>indicator<span class="S10">)</span>
6534 <span class="S0"> </span><span class="S10">=</span>
6535 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6536 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6537 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
6538 <span class="S0"> </span>DecorationFillRange<span class="S10">(</span><span class="S5">int</span>
6539 <span class="S0"> </span>position<span class="S10">,</span>
6540 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>value<span class="S10">,</span>
6541 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>fillLength<span class="S10">)</span>
6542 <span class="S0">
6543 </span><span class="S10">=</span><span class="S0"> </span>
6544 <span class="S4">0</span><span class="S10">;</span><br />
6545 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6546 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
6547 <span class="S0"> </span>ChangeLexerState<span class="S10">(</span><span class="S5">int</span>
6548 <span class="S0"> </span>start<span class="S10">,</span>
6549 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>end<span class="S10">)</span>
6550 <span class="S0"> </span><span class="S10">=</span>
6551 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6552 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6553 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
6554 <span class="S0"> </span>CodePage<span class="S10">()</span><span class="S0">
6555 </span><span class="S5">const</span><span class="S0"> </span>
6556 <span class="S10">=</span><span class="S0"> </span><span class="S4">0</span>
6557 <span class="S10">;</span><br />
6558 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">bool</span>
6559 <span class="S0"> </span>SCI_METHOD
6560 <span class="S0"> </span>IsDBCSLeadByte<span class="S10">(</span><span class="S5">char</span>
6561 <span class="S0"> </span>ch<span class="S10">)</span>
6562 <span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
6563 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6564 <span class="S10">};</span><br />
6565 </div>
6567 <p>Scintilla tries to minimize the consequences of modifying text to
6568 only relex and redraw the line of the change where possible. Lexer
6569 objects contain their own private extra state which can affect later
6570 lines. For example, if the C++ lexer is greying out inactive code
6571 segments then changing the statement <code>#define BEOS 0</code> to <code>#define
6572 BEOS 1</code> may require restyling and redisplaying later parts of the
6573 document. The lexer can call <code>ChangeLexerState</code> to signal to
6574 the document that it should relex and display more.</p>
6576 <p>For <code>StartStyling</code> the mask argument has no effect. It was used in version 3.4.2 and earlier.</p>
6578 <p><code>SetErrorStatus</code> is used to notify the document of
6579 exceptions. Exceptions should not be thrown over build boundaries as the
6580 two sides may be built with different compilers or incompatible
6581 exception options.</p>
6583 <h4>IDocumentWithLineEnd</h4>
6586 To allow lexers to determine the end position of a line and thus more easily support Unicode line ends
6587 <code>IDocument</code> is extended to <code>IDocumentWithLineEnd</code>.</p>
6588 <p><code>GetRelativePosition</code> navigates the document by whole characters,
6589 returning <code>INVALID_POSITION</code> for movement beyond the start and end of the document.</p>
6590 <p><code>GetCharacterAndWidth</code> provides a standard
6591 conversion from UTF-8 bytes to a UTF-32 character or from DBCS to a 16 bit value.
6592 Bytes in invalid UTF-8 are reported individually with values 0xDC80+byteValue, which are
6593 not valid Unicode code points.
6594 The <code>pWidth</code> argument can be NULL if the caller does not need to know the number of
6595 bytes in the character.
6596 </p>
6598 <div class="highlighted">
6599 <span class="S5">class</span><span class="S0"> </span>IDocumentWithLineEnd<span class="S0"> </span><span class="S10">:</span><span class="S0"> </span><span class="S5">public</span><span class="S0"> </span>IDocument<span class="S0"> </span><span class="S10">{</span><br />
6600 <span class="S5">public</span><span class="S10">:</span><br />
6601 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>LineEnd<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>line<span class="S10">)</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6602 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>GetRelativePosition<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>positionStart<span class="S10">,</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>characterOffset<span class="S10">)</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6603 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>GetCharacterAndWidth<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>position<span class="S10">,</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span><span class="S10">*</span>pWidth<span class="S10">)</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6604 <span class="S10">};</span><br />
6605 </div>
6607 <p>The <code>ILexer</code>, <code>ILexerWithSubStyles</code>, <code>IDocument</code>, and
6608 <code>IDocumentWithLineEnd</code> interfaces may be
6609 expanded in the future with extended versions (<code>ILexer2</code>...).
6610 The <code>Version</code> method indicates which interface is
6611 implemented and thus which methods may be called.</p>
6613 <h2 id="Notifications">Notifications</h2>
6615 <p>Notifications are sent (fired) from the Scintilla control to its container when an event has
6616 occurred that may interest the container.</p>
6617 <p>Notifications are sent using the
6618 <code>WM_NOTIFY</code> message on Windows.</p>
6619 <p>On GTK+, the "sci-notify" signal is sent and the signal handler should have the signature
6620 <code>handler(GtkWidget *, gint, SCNotification *notification, gpointer userData)</code>.</p>
6621 <p>On Cocoa, a delegate implementing the <code>ScintillaNotificationProtocol</code>
6622 may be set to receive notifications or the <code>ScintillaView</code> class may be subclassed and the
6623 <code>notification:</code> method overridden. Overriding <code>notification:</code> allows the
6624 subclass to control whether default handling is performed.</p>
6625 <p>The container is
6626 passed a <code>SCNotification</code> structure containing information about the event.</p>
6627 <pre id="SCNotification">
6628 struct NotifyHeader { // This matches the Win32 NMHDR structure
6629 void *hwndFrom; // environment specific window handle/pointer
6630 uptr_t idFrom; // CtrlID of the window issuing the notification
6631 unsigned int code; // The SCN_* notification code
6634 struct SCNotification {
6635 struct Sci_NotifyHeader nmhdr;
6636 int position;
6637 /* SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_MARGINCLICK, */
6638 /* SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, SCN_CALLTIPCLICK, */
6639 /* SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK, */
6640 /* SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */
6641 /* SCN_USERLISTSELECTION, SCN_AUTOCSELECTION */
6643 int ch; /* SCN_CHARADDED, SCN_KEY */
6644 int modifiers;
6645 /* SCN_KEY, SCN_DOUBLECLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, */
6646 /* SCN_HOTSPOTRELEASECLICK, SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */
6648 int modificationType; /* SCN_MODIFIED */
6649 const char *text;
6650 /* SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION, SCN_URIDROPPED */
6652 int length; /* SCN_MODIFIED */
6653 int linesAdded; /* SCN_MODIFIED */
6654 int message; /* SCN_MACRORECORD */
6655 uptr_t wParam; /* SCN_MACRORECORD */
6656 sptr_t lParam; /* SCN_MACRORECORD */
6657 int line; /* SCN_MODIFIED */
6658 int foldLevelNow; /* SCN_MODIFIED */
6659 int foldLevelPrev; /* SCN_MODIFIED */
6660 int margin; /* SCN_MARGINCLICK */
6661 int listType; /* SCN_USERLISTSELECTION */
6662 int x; /* SCN_DWELLSTART, SCN_DWELLEND */
6663 int y; /* SCN_DWELLSTART, SCN_DWELLEND */
6664 int token; /* SCN_MODIFIED with SC_MOD_CONTAINER */
6665 int annotationLinesAdded; /* SCN_MODIFIED with SC_MOD_CHANGEANNOTATION */
6666 int updated; /* SCN_UPDATEUI */
6668 </pre>
6670 <p>The notification messages that your container can choose to handle and the messages
6671 associated with them are:</p>
6672 <code><a class="message" href="#SCN_STYLENEEDED">SCN_STYLENEEDED</a><br />
6673 <a class="message" href="#SCN_CHARADDED">SCN_CHARADDED</a><br />
6674 <a class="message" href="#SCN_SAVEPOINTREACHED">SCN_SAVEPOINTREACHED</a><br />
6675 <a class="message" href="#SCN_SAVEPOINTLEFT">SCN_SAVEPOINTLEFT</a><br />
6676 <a class="message" href="#SCN_MODIFYATTEMPTRO">SCN_MODIFYATTEMPTRO</a><br />
6677 <a class="message" href="#SCN_KEY">SCN_KEY</a><br />
6678 <a class="message" href="#SCN_DOUBLECLICK">SCN_DOUBLECLICK</a><br />
6679 <a class="message" href="#SCN_UPDATEUI">SCN_UPDATEUI</a><br />
6680 <a class="message" href="#SCN_MODIFIED">SCN_MODIFIED</a><br />
6681 <a class="message" href="#SCN_MACRORECORD">SCN_MACRORECORD</a><br />
6682 <a class="message" href="#SCN_MARGINCLICK">SCN_MARGINCLICK</a><br />
6683 <a class="message" href="#SCN_NEEDSHOWN">SCN_NEEDSHOWN</a><br />
6684 <a class="message" href="#SCN_PAINTED">SCN_PAINTED</a><br />
6685 <a class="message" href="#SCN_USERLISTSELECTION">SCN_USERLISTSELECTION</a><br />
6686 <a class="message" href="#SCN_URIDROPPED">SCN_URIDROPPED</a><br />
6687 <a class="message" href="#SCN_DWELLSTART">SCN_DWELLSTART</a><br />
6688 <a class="message" href="#SCN_DWELLEND">SCN_DWELLEND</a><br />
6689 <a class="message" href="#SCN_ZOOM">SCN_ZOOM</a><br />
6690 <a class="message" href="#SCN_HOTSPOTCLICK">SCN_HOTSPOTCLICK</a><br />
6691 <a class="message" href="#SCN_HOTSPOTDOUBLECLICK">SCN_HOTSPOTDOUBLECLICK</a><br />
6692 <a class="message" href="#SCN_HOTSPOTRELEASECLICK">SCN_HOTSPOTRELEASECLICK</a><br />
6693 <a class="message" href="#SCN_INDICATORCLICK">SCN_INDICATORCLICK</a><br />
6694 <a class="message" href="#SCN_INDICATORRELEASE">SCN_INDICATORRELEASE</a><br />
6695 <a class="message" href="#SCN_CALLTIPCLICK">SCN_CALLTIPCLICK</a><br />
6696 <a class="message" href="#SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</a><br />
6697 <a class="message" href="#SCN_AUTOCCANCELLED">SCN_AUTOCCANCELLED</a><br />
6698 <a class="message" href="#SCN_AUTOCCHARDELETED">SCN_AUTOCCHARDELETED</a><br />
6699 <a class="message" href="#SCN_FOCUSIN">SCN_FOCUSIN</a><br />
6700 <a class="message" href="#SCN_FOCUSOUT">SCN_FOCUSOUT</a><br />
6701 </code>
6703 <p>The following <code>SCI_*</code> messages are associated with these notifications:</p>
6704 <code><a class="message" href="#SCI_SETMODEVENTMASK">SCI_SETMODEVENTMASK(int eventMask)</a><br />
6705 <a class="message" href="#SCI_GETMODEVENTMASK">SCI_GETMODEVENTMASK</a><br />
6706 <a class="message" href="#SCI_SETMOUSEDWELLTIME">SCI_SETMOUSEDWELLTIME(int milliseconds)</a><br />
6707 <a class="message" href="#SCI_GETMOUSEDWELLTIME">SCI_GETMOUSEDWELLTIME</a><br />
6708 <a class="message" href="#SCI_SETIDENTIFIER">SCI_SETIDENTIFIER(int identifier)</a><br />
6709 <a class="message" href="#SCI_GETIDENTIFIER">SCI_GETIDENTIFIER</a><br />
6710 </code>
6712 <p>The following additional notifications are sent using a secondary "command" method and should
6713 be avoided in new code as the primary "notification" method provides all the same events with richer
6714 information.
6715 The <code>WM_COMMAND</code> message is used on Windows.
6716 This emulates the Windows Edit control. Only the lower
6717 16 bits of the control's ID is passed in these notifications.</p>
6718 <p>On GTK+, the "command" signal is sent and the signal handler should have the signature
6719 <code>handler(GtkWidget *, gint wParam, gpointer lParam, gpointer userData)</code>.</p>
6720 <code><a class="message" href="#SCEN_CHANGE">SCEN_CHANGE</a><br />
6721 <a class="message" href="#SCEN_SETFOCUS">SCEN_SETFOCUS</a><br />
6722 <a class="message" href="#SCEN_KILLFOCUS">SCEN_KILLFOCUS</a><br />
6723 </code>
6725 <p><b id="SCI_SETIDENTIFIER">SCI_SETIDENTIFIER(int identifier)</b><br />
6726 <b id="SCI_GETIDENTIFIER">SCI_GETIDENTIFIER</b><br />
6727 These two messages set and get the identifier of the Scintilla instance which is included in notifications as the
6728 <code>idFrom</code> field.
6729 When an application creates multiple Scintilla widgets, this allows the source of each notification to be found.
6730 On Windows, this value is initialised in the <code>CreateWindow</code> call and stored as the
6731 <code>GWLP_ID</code> attribute of the window.
6732 The value should be small, preferably less than 16 bits,
6733 rather than a pointer as some of the functions will only transmit 16 or 32 bits.
6734 </p>
6736 <p><b id="SCN_STYLENEEDED">SCN_STYLENEEDED</b><br />
6737 If you used <code><a class="message"
6738 href="#SCI_SETLEXER">SCI_SETLEXER</a>(SCLEX_CONTAINER)</code> to make the container act as the
6739 lexer, you will receive this notification when Scintilla is about to display or print text that
6740 requires styling. You are required to style the text from the line that contains the position
6741 returned by <a class="message" href="#SCI_GETENDSTYLED"><code>SCI_GETENDSTYLED</code></a> up to
6742 the position passed in <code>SCNotification.position</code>. Symbolically, you need code of the
6743 form:</p>
6744 <pre>
6745 startPos = <a class="message" href="#SCI_GETENDSTYLED">SCI_GETENDSTYLED</a>()
6746 lineNumber = <a class="message"
6747 href="#SCI_LINEFROMPOSITION">SCI_LINEFROMPOSITION</a>(startPos);
6748 startPos = <a class="message"
6749 href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE</a>(lineNumber);
6750 MyStyleRoutine(startPos, SCNotification.position);
6751 </pre>
6753 <p><b id="SCN_CHARADDED">SCN_CHARADDED</b><br />
6754 This is sent when the user types an ordinary text character (as opposed to a command
6755 character) that is entered into the text. The container can use this to decide to display a <a
6756 class="jump" href="#CallTips">call tip</a> or an <a class="jump" href="#Autocompletion">auto
6757 completion list</a>. The character is in <code>SCNotification.ch</code>.
6758 This notification is sent before the character has been styled so processing that depends on
6759 styling should instead be performed in the SCN_UPDATEUI notification.</p>
6761 <p><b id="SCN_SAVEPOINTREACHED">SCN_SAVEPOINTREACHED</b><br />
6762 <b id="SCN_SAVEPOINTLEFT">SCN_SAVEPOINTLEFT</b><br />
6763 Sent to the container when the save point is entered or left, allowing the container to
6764 display a "document dirty" indicator and change its menus.<br />
6765 See also: <a class="message" href="#SCI_SETSAVEPOINT"><code>SCI_SETSAVEPOINT</code></a>, <a
6766 class="message" href="#SCI_GETMODIFY"><code>SCI_GETMODIFY</code></a></p>
6768 <p><b id="SCN_MODIFYATTEMPTRO">SCN_MODIFYATTEMPTRO</b><br />
6769 When in read-only mode, this notification is sent to the container if the user tries to change
6770 the text. This can be used to check the document out of a version control system. You can set
6771 the read-only state of a document with <code><a class="message"
6772 href="#SCI_SETREADONLY">SCI_SETREADONLY</a></code>.</p>
6774 <p><b id="SCN_KEY">SCN_KEY</b><br />
6775 Reports all keys pressed but not consumed by Scintilla. Used on GTK+ because of
6776 some problems with keyboard focus and is not sent by the Windows version. <code>SCNotification.ch</code> holds the key code and
6777 <code>SCNotification.modifiers</code> holds the modifiers. This notification is sent if the
6778 modifiers include <code>SCMOD_ALT</code> or <code>SCMOD_CTRL</code> and the key code is less
6779 than 256.</p>
6781 <p><b id="SCN_DOUBLECLICK">SCN_DOUBLECLICK</b><br />
6782 The mouse button was double clicked in editor. The <code>position</code> field is set to the text position of the
6783 double click, the <code>line</code> field is set to the line of the double click, and
6784 the <code>modifiers</code> field is set to the key modifiers
6785 held down in a similar manner to <a class="message" href="#SCN_KEY">SCN_KEY</a>.</p>
6787 <p><b id="SCN_UPDATEUI">SCN_UPDATEUI</b><br />
6788 Either the text or styling of the document has changed or the selection range or scroll position has changed.
6789 Now would be a good time to update any container UI elements that depend on document or view state.
6790 The <code>updated</code> field is set to the bit set of things changed since the previous notification.</p>
6791 <table cellpadding="1" cellspacing="2" border="0" summary="Modify notification type flags">
6792 <tbody>
6793 <tr>
6794 <th align="left">Symbol</th>
6796 <th>Value</th>
6798 <th align="left">Meaning</th>
6800 </tr>
6801 </tbody>
6803 <tbody valign="top">
6804 <tr>
6805 <td align="left"><code>SC_UPDATE_CONTENT</code></td>
6807 <td align="center">0x01</td>
6809 <td>Contents, styling or markers have been changed.</td>
6811 </tr>
6813 <tr>
6814 <td align="left"><code>SC_UPDATE_SELECTION</code></td>
6816 <td align="center">0x02</td>
6818 <td>Selection has been changed.</td>
6820 </tr>
6822 <tr>
6823 <td align="left"><code>SC_UPDATE_V_SCROLL</code></td>
6825 <td align="center">0x04</td>
6827 <td>Scrolled vertically.</td>
6829 </tr>
6831 <tr>
6832 <td align="left"><code>SC_UPDATE_H_SCROLL</code></td>
6834 <td align="center">0x08</td>
6836 <td>Scrolled horizontally.</td>
6838 </tr>
6839 </tbody>
6840 </table>
6842 <p><b id="SCN_MODIFIED">SCN_MODIFIED</b><br />
6843 This notification is sent when the text or styling of the document changes or is about to
6844 change. You can set a mask for the notifications that are sent to the container with <a
6845 class="message" href="#SCI_SETMODEVENTMASK"><code>SCI_SETMODEVENTMASK</code></a>. The
6846 notification structure contains information about what changed, how the change occurred and
6847 whether this changed the number of lines in the document. No modifications may be performed
6848 while in a <code>SCN_MODIFIED</code> event. The <code>SCNotification</code> fields used
6849 are:</p>
6851 <table cellpadding="1" cellspacing="2" border="0" summary="Modify notification types">
6852 <tbody>
6853 <tr>
6854 <th align="left">Field</th>
6856 <th align="left">Usage</th>
6857 </tr>
6858 </tbody>
6860 <tbody valign="top">
6861 <tr>
6862 <td align="left"><code>modificationType</code></td>
6864 <td align="left">A set of flags that identify the change(s) made. See the next
6865 table.</td>
6866 </tr>
6868 <tr>
6869 <td align="left"><code>position</code></td>
6871 <td align="left">Start position of a text or styling change. Set to 0 if not used.</td>
6872 </tr>
6874 <tr>
6875 <td align="left"><code>length</code></td>
6877 <td align="left">Length of the change in cells or characters when the text or styling
6878 changes. Set to 0 if not used.</td>
6879 </tr>
6881 <tr>
6882 <td align="left"><code>linesAdded</code></td>
6884 <td align="left">Number of added lines. If negative, the number of deleted lines. Set to
6885 0 if not used or no lines added or deleted.</td>
6886 </tr>
6888 <tr>
6889 <td align="left"><code>text</code></td>
6891 <td align="left">Valid for text changes, not for style changes. If we are collecting undo
6892 information this holds a pointer to the text that is handed to the Undo system, otherwise
6893 it is zero. For user performed SC_MOD_BEFOREDELETE the text field is 0.</td>
6894 </tr>
6896 <tr>
6897 <td align="left"><code>line</code></td>
6899 <td align="left">The line number at which a fold level or marker change occurred. This is
6900 0 if unused and may be -1 if more than one line changed.</td>
6901 </tr>
6903 <tr>
6904 <td align="left"><code>foldLevelNow</code></td>
6906 <td align="left">The new fold level applied to the line or 0 if this field is
6907 unused.</td>
6908 </tr>
6910 <tr>
6911 <td align="left"><code>foldLevelPrev</code></td>
6913 <td align="left">The previous folding level of the line or 0 if this field is
6914 unused.</td>
6915 </tr>
6916 </tbody>
6917 </table>
6919 <p>The <code>SCNotification.modificationType</code> field has bits set to tell you what has
6920 been done. The <code>SC_MOD_*</code> bits correspond to actions. The
6921 <code>SC_PERFORMED_*</code> bits tell you if the action was done by the user, or the result of
6922 Undo or Redo of a previous action.</p>
6924 <table cellpadding="1" cellspacing="2" border="0" summary="Modify notification type flags">
6925 <tbody>
6926 <tr>
6927 <th align="left">Symbol</th>
6929 <th>Value</th>
6931 <th align="left">Meaning</th>
6933 <th align="left">SCNotification fields</th>
6934 </tr>
6935 </tbody>
6937 <tbody valign="top">
6938 <tr>
6939 <td align="left"><code>SC_MOD_INSERTTEXT</code></td>
6941 <td align="right">0x01</td>
6943 <td>Text has been inserted into the document.</td>
6945 <td><code>position, length, text, linesAdded</code></td>
6946 </tr>
6948 <tr>
6949 <td align="left"><code>SC_MOD_DELETETEXT</code></td>
6951 <td align="right">0x02</td>
6953 <td>Text has been removed from the document.</td>
6955 <td><code>position, length, text, linesAdded</code></td>
6956 </tr>
6958 <tr>
6959 <td align="left"><code>SC_MOD_CHANGESTYLE</code></td>
6961 <td align="right">0x04</td>
6963 <td>A style change has occurred.</td>
6965 <td><code>position, length</code></td>
6966 </tr>
6968 <tr>
6969 <td align="left"><code>SC_MOD_CHANGEFOLD</code></td>
6971 <td align="right">0x08</td>
6973 <td>A folding change has occurred.</td>
6975 <td><code>line, foldLevelNow, foldLevelPrev</code></td>
6976 </tr>
6978 <tr>
6979 <td align="left"><code>SC_PERFORMED_USER</code></td>
6981 <td align="right">0x10</td>
6983 <td>Information: the operation was done by the user.</td>
6985 <td>None</td>
6986 </tr>
6988 <tr>
6989 <td align="left"><code>SC_PERFORMED_UNDO</code></td>
6991 <td align="right">0x20</td>
6993 <td>Information: this was the result of an Undo.</td>
6995 <td>None</td>
6996 </tr>
6998 <tr>
6999 <td align="left"><code>SC_PERFORMED_REDO</code></td>
7001 <td align="right">0x40</td>
7003 <td>Information: this was the result of a Redo.</td>
7005 <td>None</td>
7006 </tr>
7008 <tr>
7009 <td align="left"><code>SC_MULTISTEPUNDOREDO</code></td>
7011 <td align="right">0x80</td>
7013 <td>This is part of a multi-step Undo or Redo transaction.</td>
7015 <td>None</td>
7016 </tr>
7018 <tr>
7019 <td align="left"><code>SC_LASTSTEPINUNDOREDO</code></td>
7021 <td align="right">0x100</td>
7023 <td>This is the final step in an Undo or Redo transaction.</td>
7025 <td>None</td>
7026 </tr>
7028 <tr>
7029 <td align="left"><code>SC_MOD_CHANGEMARKER</code></td>
7031 <td align="right">0x200</td>
7033 <td>One or more markers has changed in a line.</td>
7035 <td><code>line</code></td>
7036 </tr>
7038 <tr>
7039 <td align="left"><code>SC_MOD_BEFOREINSERT</code></td>
7041 <td align="right">0x400</td>
7043 <td>Text is about to be inserted into the document.</td>
7045 <td><code>position, if performed by user then text in cells, length in cells</code></td>
7046 </tr>
7048 <tr>
7049 <td align="left"><code>SC_MOD_BEFOREDELETE</code></td>
7051 <td align="right">0x800</td>
7053 <td>Text is about to be deleted from the document.</td>
7055 <td><code>position, length</code></td>
7056 </tr>
7058 <tr>
7059 <td align="left"><code>SC_MOD_CHANGEINDICATOR</code></td>
7061 <td align="right">0x4000</td>
7063 <td>An indicator has been added or removed from a range of text.</td>
7065 <td><code>position, length</code></td>
7066 </tr>
7068 <tr>
7069 <td align="left"><code id="SC_MOD_CHANGELINESTATE">SC_MOD_CHANGELINESTATE</code></td>
7071 <td align="right">0x8000</td>
7073 <td>A line state has changed because <a class="message" href="#SCI_SETLINESTATE">SCI_SETLINESTATE</a>
7074 was called.</td>
7076 <td><code>line</code></td>
7077 </tr>
7079 <tr>
7080 <td align="left"><code id="SC_MOD_CHANGETABSTOPS">SC_MOD_CHANGETABSTOPS</code></td>
7082 <td align="right">0x200000</td>
7084 <td>The explicit tab stops on a line have changed because <a class="message" href="#SCI_CLEARTABSTOPS">SCI_CLEARTABSTOPS</a> or
7085 <a class="message" href="#SCI_ADDTABSTOP">SCI_ADDTABSTOP</a> was called.</td>
7087 <td><code>line</code></td>
7088 </tr>
7090 <tr>
7091 <td align="left"><code id="SC_MOD_LEXERSTATE">SC_MOD_LEXERSTATE</code></td>
7093 <td align="right">0x80000</td>
7095 <td>The internal state of a lexer has changed over a range.</td>
7097 <td><code>position, length</code></td>
7098 </tr>
7100 <tr>
7101 <td align="left"><code id="SC_MOD_CHANGEMARGIN">SC_MOD_CHANGEMARGIN</code></td>
7103 <td align="right">0x10000</td>
7105 <td>A text margin has changed.</td>
7107 <td><code>line</code></td>
7108 </tr>
7110 <tr>
7111 <td align="left"><code id="SC_MOD_CHANGEANNOTATION">SC_MOD_CHANGEANNOTATION</code></td>
7113 <td align="right">0x20000</td>
7115 <td>An annotation has changed.</td>
7117 <td><code>line</code></td>
7118 </tr>
7120 <tr>
7121 <td align="left"><code id="SC_MOD_INSERTCHECK">SC_MOD_INSERTCHECK</code></td>
7123 <td align="right">0x100000</td>
7125 <td>Text is about to be inserted. The handler may change the text being inserted by calling
7126 <a class="message" href="#SCI_CHANGEINSERTION">SCI_CHANGEINSERTION</a>.
7127 No other modifications may be made in this handler.</td>
7129 <td><code>position, length, text</code></td>
7130 </tr>
7132 <tr>
7133 <td align="left"><code>SC_MULTILINEUNDOREDO</code></td>
7135 <td align="right">0x1000</td>
7137 <td>This is part of an Undo or Redo with multi-line changes.</td>
7139 <td>None</td>
7140 </tr>
7142 <tr>
7143 <td align="left"><code>SC_STARTACTION</code></td>
7145 <td align="right">0x2000</td>
7147 <td>This is set on a SC_PERFORMED_USER action when it is the
7148 first or only step in an undo transaction. This can be used to integrate the Scintilla
7149 undo stack with an undo stack in the container application by adding a Scintilla
7150 action to the container's stack for the currently opened container transaction or
7151 to open a new container transaction if there is no open container transaction.
7152 </td>
7154 <td>None</td>
7155 </tr>
7157 <tr>
7158 <td align="left"><code id="SC_MOD_CONTAINER">SC_MOD_CONTAINER</code></td>
7160 <td align="right">0x40000</td>
7162 <td>This is set on for actions that the container stored into the undo stack with
7163 <a class="message" href="#SCI_ADDUNDOACTION"><code>SCI_ADDUNDOACTION</code></a>.
7164 </td>
7166 <td>token</td>
7167 </tr>
7169 <tr>
7170 <td align="left"><code>SC_MODEVENTMASKALL</code></td>
7172 <td align="right">0x1FFFFF</td>
7174 <td>This is a mask for all valid flags. This is the default mask state set by <a
7175 class="message" href="#SCI_SETMODEVENTMASK"><code>SCI_SETMODEVENTMASK</code></a>.</td>
7177 <td>None</td>
7178 </tr>
7179 </tbody>
7180 </table>
7182 <p><b id="SCEN_CHANGE">SCEN_CHANGE</b><br />
7183 <code>SCEN_CHANGE</code> (768) is fired when the text (not the style) of the document changes.
7184 This notification is sent using the <code>WM_COMMAND</code> message on Windows and the
7185 "command" signal on GTK+ as this is the behaviour of the standard Edit control
7186 (<code>SCEN_CHANGE</code> has the same value as the Windows Edit control
7187 <code>EN_CHANGE</code>). No other information is sent. If you need more detailed information
7188 use <a class="message" href="#SCN_MODIFIED"><code>SCN_MODIFIED</code></a>. You can filter the
7189 types of changes you are notified about with <a class="message"
7190 href="#SCI_SETMODEVENTMASK"><code>SCI_SETMODEVENTMASK</code></a>.</p>
7192 <p><b id="SCI_SETMODEVENTMASK">SCI_SETMODEVENTMASK(int eventMask)</b><br />
7193 <b id="SCI_GETMODEVENTMASK">SCI_GETMODEVENTMASK</b><br />
7194 These messages set and get an event mask that determines which document change events are
7195 notified to the container with <a class="message"
7196 href="#SCN_MODIFIED"><code>SCN_MODIFIED</code></a> and <a class="message"
7197 href="#SCEN_CHANGE"><code>SCEN_CHANGE</code></a>. For example, a container may decide to see
7198 only notifications about changes to text and not styling changes by calling
7199 <code>SCI_SETMODEVENTMASK(SC_MOD_INSERTTEXT|SC_MOD_DELETETEXT)</code>.</p>
7201 <p>The possible notification types are the same as the <code>modificationType</code> bit flags
7202 used by <code>SCN_MODIFIED</code>: <code>SC_MOD_INSERTTEXT</code>,
7203 <code>SC_MOD_DELETETEXT</code>, <code>SC_MOD_CHANGESTYLE</code>,
7204 <code>SC_MOD_CHANGEFOLD</code>, <code>SC_PERFORMED_USER</code>, <code>SC_PERFORMED_UNDO</code>,
7205 <code>SC_PERFORMED_REDO</code>, <code>SC_MULTISTEPUNDOREDO</code>,
7206 <code>SC_LASTSTEPINUNDOREDO</code>, <code>SC_MOD_CHANGEMARKER</code>,
7207 <code>SC_MOD_BEFOREINSERT</code>, <code>SC_MOD_BEFOREDELETE</code>,
7208 <code>SC_MULTILINEUNDOREDO</code>, and <code>SC_MODEVENTMASKALL</code>.</p>
7210 <p><b id="SCEN_SETFOCUS">SCEN_SETFOCUS</b><br />
7211 <b id="SCEN_KILLFOCUS">SCEN_KILLFOCUS</b><br />
7212 <code>SCEN_SETFOCUS</code> (512) is fired when Scintilla receives focus and
7213 <code>SCEN_KILLFOCUS</code> (256) when it loses focus. These notifications are sent using the
7214 <code>WM_COMMAND</code> message on Windows and the "command" signal on GTK+ as this is the
7215 behaviour of the standard Edit control. Unfortunately, these codes do not match the Windows Edit
7216 notification codes <code>EN_SETFOCUS</code> (256) and <code>EN_KILLFOCUS</code> (512). It is
7217 now too late to change the Scintilla codes as clients depend on the current values.</p>
7219 <p><b id="SCN_MACRORECORD">SCN_MACRORECORD</b><br />
7220 The <code><a class="message" href="#SCI_STARTRECORD">SCI_STARTRECORD</a></code> and <a
7221 class="message" href="#SCI_STOPRECORD"><code>SCI_STOPRECORD</code></a> messages enable and
7222 disable macro recording. When enabled, each time a recordable change occurs, the
7223 <code>SCN_MACRORECORD</code> notification is sent to the container. It is up to the container
7224 to record the action. To see the complete list of <code>SCI_*</code> messages that are
7225 recordable, search the Scintilla source <code>Editor.cxx</code> for
7226 <code>Editor::NotifyMacroRecord</code>. The fields of <code>SCNotification</code> set in this
7227 notification are:</p>
7229 <table cellpadding="1" cellspacing="2" border="0" summary="Macro record notification data">
7230 <tbody>
7231 <tr>
7232 <th align="left">Field</th>
7234 <th align="left">Usage</th>
7235 </tr>
7236 </tbody>
7238 <tbody valign="top">
7239 <tr>
7240 <td align="left"><code>message</code></td>
7242 <td align="left">The <code>SCI_*</code> message that caused the notification.</td>
7243 </tr>
7245 <tr>
7246 <td align="left"><code>wParam</code></td>
7248 <td align="left">The value of <code>wParam</code> in the <code>SCI_*</code> message.</td>
7249 </tr>
7251 <tr>
7252 <td align="left"><code>lParam</code></td>
7254 <td align="left">The value of <code>lParam</code> in the <code>SCI_*</code> message.</td>
7255 </tr>
7256 </tbody>
7257 </table>
7259 <p><b id="SCN_MARGINCLICK">SCN_MARGINCLICK</b><br />
7260 This notification tells the container that the mouse was clicked inside a <a class="jump"
7261 href="#Margins">margin</a> that was marked as sensitive (see <a class="message"
7262 href="#SCI_SETMARGINSENSITIVEN"><code>SCI_SETMARGINSENSITIVEN</code></a>). This can be used to
7263 perform folding or to place breakpoints. The following <code>SCNotification</code> fields are
7264 used:</p>
7266 <table cellpadding="1" cellspacing="2" border="0" summary="Margin click notification">
7267 <tbody>
7268 <tr>
7269 <th align="left">Field</th>
7271 <th align="left">Usage</th>
7272 </tr>
7273 </tbody>
7275 <tbody valign="top">
7276 <tr>
7277 <td align="left"><code>modifiers</code></td>
7279 <td align="left">The appropriate combination of <code>SCI_SHIFT</code>,
7280 <code>SCI_CTRL</code> and <code>SCI_ALT</code> to indicate the keys that were held down
7281 at the time of the margin click.</td>
7282 </tr>
7284 <tr>
7285 <td align="left"><code>position</code></td>
7287 <td align="left">The position of the start of the line in the document that corresponds
7288 to the margin click.</td>
7289 </tr>
7291 <tr>
7292 <td align="left"><code>margin</code></td>
7294 <td align="left">The margin number that was clicked.</td>
7295 </tr>
7296 </tbody>
7297 </table>
7299 <p><b id="SCN_NEEDSHOWN">SCN_NEEDSHOWN</b><br />
7300 Scintilla has determined that a range of lines that is currently invisible should be made
7301 visible. An example of where this may be needed is if the end of line of a contracted fold
7302 point is deleted. This message is sent to the container in case it wants to make the line
7303 visible in some unusual way such as making the whole document visible. Most containers will
7304 just ensure each line in the range is visible by calling <a class="message"
7305 href="#SCI_ENSUREVISIBLE"><code>SCI_ENSUREVISIBLE</code></a>. The <code>position</code> and
7306 <code>length</code> fields of <code>SCNotification</code> indicate the range of the document
7307 that should be made visible. The container code will be similar to the following code
7308 skeleton:</p>
7309 <pre>
7310 firstLine = SCI_LINEFROMPOSITION(scn.position)
7311 lastLine = SCI_LINEFROMPOSITION(scn.position+scn.length-1)
7312 for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next
7313 </pre>
7315 <p><b id="SCN_PAINTED">SCN_PAINTED</b><br />
7316 Painting has just been done. Useful when you want to update some other widgets based on a
7317 change in Scintilla, but want to have the paint occur first to appear more responsive. There is
7318 no other information in <code>SCNotification</code>.</p>
7320 <p><b id="SCN_USERLISTSELECTION">SCN_USERLISTSELECTION</b><br />
7321 The user has selected an item in a <a class="jump" href="#UserLists">user list</a>. The
7322 <code>SCNotification</code> fields used are:</p>
7324 <table cellpadding="1" cellspacing="2" border="0" summary="User list notification">
7325 <tbody>
7326 <tr>
7327 <th align="left">Field</th>
7329 <th align="left">Usage</th>
7330 </tr>
7331 </tbody>
7333 <tbody valign="top">
7334 <tr>
7335 <td align="left"><code>listType</code></td>
7337 <td align="left">This is set to the <code>listType</code> parameter from the <a
7338 class="message" href="#SCI_USERLISTSHOW"><code>SCI_USERLISTSHOW</code></a> message that
7339 initiated the list.</td>
7340 </tr>
7342 <tr>
7343 <td align="left"><code>text</code></td>
7345 <td align="left">The text of the selection.</td>
7346 </tr>
7348 <tr>
7349 <td align="left"><code>position</code></td>
7351 <td align="left">The position the list was displayed at.</td>
7352 </tr>
7353 </tbody>
7354 </table>
7355 <br />
7358 <p><b id="SCN_URIDROPPED">SCN_URIDROPPED</b><br />
7359 Only on the GTK+ version. Indicates that the user has dragged a URI such as a file name or Web
7360 address onto Scintilla. The container could interpret this as a request to open the file. The
7361 <code>text</code> field of <code>SCNotification</code> points at the URI text.</p>
7363 <p><b id="SCN_DWELLSTART">SCN_DWELLSTART</b><br />
7364 <b id="SCN_DWELLEND">SCN_DWELLEND</b><br />
7365 <code>SCN_DWELLSTART</code> is generated when the user keeps the mouse in one position for the
7366 dwell period (see <code><a class="message"
7367 href="#SCI_SETMOUSEDWELLTIME">SCI_SETMOUSEDWELLTIME</a></code>). <code>SCN_DWELLEND</code> is
7368 generated after a <code>SCN_DWELLSTART</code> and the mouse is moved or other activity such as
7369 key press indicates the dwell is over. Both notifications set the same fields in
7370 <code>SCNotification</code>:</p>
7372 <table cellpadding="1" cellspacing="2" border="0" summary="Mouse dwell notification">
7373 <tbody>
7374 <tr>
7375 <th align="left">Field</th>
7377 <th align="left">Usage</th>
7378 </tr>
7379 </tbody>
7381 <tbody valign="top">
7382 <tr>
7383 <td align="left"><code>position</code></td>
7385 <td align="left">This is the nearest position in the document to the position where the
7386 mouse pointer was lingering.</td>
7387 </tr>
7389 <tr>
7390 <td align="left"><code>x, y</code></td>
7392 <td align="left">Where the pointer lingered. The <code>position</code> field is set to
7393 <code><a class="message"
7394 href="#SCI_POSITIONFROMPOINTCLOSE">SCI_POSITIONFROMPOINTCLOSE</a>(x, y)</code>.</td>
7395 </tr>
7396 </tbody>
7397 </table>
7398 <br />
7400 <p><b id="SCI_SETMOUSEDWELLTIME">SCI_SETMOUSEDWELLTIME(int milliseconds)</b><br />
7401 <b id="SCI_GETMOUSEDWELLTIME">SCI_GETMOUSEDWELLTIME</b><br />
7402 These two messages set and get the time the mouse must sit still, in milliseconds, to generate
7403 a <code><a class="message" href="#SCN_DWELLSTART">SCN_DWELLSTART</a></code> notification. If
7404 set to <code>SC_TIME_FOREVER</code>, the default, no dwell events are generated.</p>
7406 <p><b id="SCN_ZOOM">SCN_ZOOM</b><br />
7407 This notification is generated when the user zooms the display using the keyboard or the
7408 <code><a class="message" href="#SCI_SETZOOM">SCI_SETZOOM</a></code> method is called. This
7409 notification can be used to recalculate positions, such as the width of the line number margin
7410 to maintain sizes in terms of characters rather than pixels. <code>SCNotification</code> has no
7411 additional information.</p>
7414 <b id="SCN_HOTSPOTCLICK">SCN_HOTSPOTCLICK</b><br />
7415 <b id="SCN_HOTSPOTDOUBLECLICK">SCN_HOTSPOTDOUBLECLICK</b><br />
7416 <b id="SCN_HOTSPOTRELEASECLICK">SCN_HOTSPOTRELEASECLICK</b><br />
7417 These notifications are generated when the user clicks or double clicks on
7418 text that is in a style with the hotspot attribute set.
7419 This notification can be used to link to variable definitions or web pages.
7420 In the notification handler, you should avoid calling any function that modifies the current selection or caret position.
7421 The <code>position</code> field is set the text position of the click or
7422 double click and the <code>modifiers</code> field set to the key modifiers
7423 held down in a similar manner to <a class="message" href="#SCN_KEY">SCN_KEY</a>.
7424 Only the state of the Ctrl key is reported for <code>SCN_HOTSPOTRELEASECLICK</code>.</p>
7427 <b id="SCN_INDICATORCLICK">SCN_INDICATORCLICK</b><br />
7428 <b id="SCN_INDICATORRELEASE">SCN_INDICATORRELEASE</b><br />
7429 These notifications are generated when the user clicks or releases the mouse on
7430 text that has an indicator.
7431 The <code>position</code> field is set the text position of the click or
7432 double click and the <code>modifiers</code> field set to the key modifiers
7433 held down in a similar manner to <a class="message" href="#SCN_KEY">SCN_KEY</a>.</p>
7435 <p><b id="SCN_CALLTIPCLICK">SCN_CALLTIPCLICK</b><br />
7436 This notification is generated when the user clicks on a calltip.
7437 This notification can be used to display the next function prototype when a
7438 function name is overloaded with different arguments.
7439 The <code>position</code> field is set to 1 if the click is in an up arrow,
7440 2 if in a down arrow, and 0 if elsewhere.</p>
7442 <p><b id="SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</b><br />
7443 The user has selected an item in an <a class="jump" href="#Autocompletion">autocompletion list</a>. The
7444 notification is sent before the selection is inserted. Automatic insertion can be cancelled by sending a
7445 <code><a class="message" href="#SCI_AUTOCCANCEL">SCI_AUTOCCANCEL</a></code> message
7446 before returning from the notification. The <code>SCNotification</code> fields used are:</p>
7448 <table cellpadding="1" cellspacing="2" border="0" summary="Autocompletion list notification">
7449 <tbody>
7450 <tr>
7451 <th align="left">Field</th>
7453 <th align="left">Usage</th>
7454 </tr>
7455 </tbody>
7457 <tbody valign="top">
7458 <tr>
7459 <td align="left"><code>position</code></td>
7461 <td align="left">The start position of the word being completed.</td>
7462 </tr>
7463 <tr>
7464 <td align="left"><code>text</code></td>
7466 <td align="left">The text of the selection.</td>
7467 </tr>
7468 </tbody>
7469 </table>
7471 <p><b id="SCN_AUTOCCANCELLED">SCN_AUTOCCANCELLED</b><br />
7472 The user has cancelled an <a class="jump" href="#Autocompletion">autocompletion list</a>.
7473 There is no other information in SCNotification.</p>
7475 <p><b id="SCN_AUTOCCHARDELETED">SCN_AUTOCCHARDELETED</b><br />
7476 The user deleted a character while autocompletion list was active.
7477 There is no other information in SCNotification.</p>
7479 <p><b id="SCN_FOCUSIN">SCN_FOCUSIN</b><br />
7480 <b id="SCN_FOCUSOUT">SCN_FOCUSOUT</b><br />
7481 <code>SCN_FOCUSIN</code> (2028) is fired when Scintilla receives focus and
7482 <code>SCN_FOCUSOUT</code> (2029) when it loses focus.</p>
7484 <h2 id="Images">Images</h2>
7486 <p>Two formats are supported for images used in margin markers and autocompletion lists, RGBA and XPM.</p>
7488 <h3 id="RGBA">RGBA</h3>
7490 <p>The RGBA format allows translucency with an <a class="jump" href="#alpha">alpha</a>
7491 value for each pixel. It is simpler than
7492 <code>XPM</code> and more capable.</p>
7494 <p>The data is a sequence of 4 byte pixel values starting with the pixels for the top line, with the
7495 leftmost pixel first, then continuing with the pixels for subsequent lines. There is no gap between
7496 lines for alignment reasons.</p>
7498 <p>Each pixel consists of, in order, a red byte, a green byte, a blue byte and an alpha byte.
7499 The colour bytes are not premultiplied by the alpha value. That is, a fully red pixel that is
7500 25% opaque will be [FF, 00, 00, 3F]</p>
7502 <p>Since the RGBA pixel data does not include any size information the
7503 width and height must previously been set with the
7504 <a class="message" href="#SCI_RGBAIMAGESETWIDTH"><code>SCI_RGBAIMAGESETWIDTH</code></a> and
7505 <a class="message" href="#SCI_RGBAIMAGESETHEIGHT"><code>SCI_RGBAIMAGESETHEIGHT</code></a> messages.</p>
7507 <p>GUI platforms often include functions for reading image file formats like PNG into memory
7508 in the RGBA form or a similar form.
7509 If there is no suitable platform support, the <a href="http://lodev.org/lodepng/">LodePNG and picoPNG</a> libraries are small libraries
7510 for loading and decoding PNG files available under a BSD-style license.</p>
7512 <p>RGBA format is supported on Windows, GTK+ and OS X Cocoa.</p>
7514 <h3 id="XPM">XPM</h3>
7516 <p>The XPM format is
7517 <a class="jump" href="http://en.wikipedia.org/wiki/X_PixMap">described here</a>.
7518 Scintilla is only able to handle XPM pixmaps that use one character per pixel with no named colours.
7519 There may be a completely transparent colour named "None".</p>
7520 <p>There are two forms of data structure used for XPM images, the first "lines form" format is well suited
7521 to embedding an image inside C source code and the "text form" is suited to reading from a file.
7522 In the lines form, an array of strings is used with the first string indicating the dimensions and number of colours
7523 used. This is followed by a string for each colour and that section is followed by the image with one string per line.
7524 The text form contains the same data as one null terminated block formatted as C source code starting
7525 with a "/* XPM */" comment to mark the format.</p>
7526 <p>Either format may be used with Scintilla APIs with the bytes at the location pointed to examined
7527 to determine which format: if the bytes start with "/* XPM */" then it is treated as text form,
7528 otherwise it is treated as lines form.</p>
7530 <p>XPM format is supported on on all platforms.</p>
7532 <h2 id="GTK">GTK+</h2>
7533 <p>On GTK+, the following functions create a Scintilla widget, communicate with it and allow
7534 resources to be released after all Scintilla widgets have been destroyed.</p>
7535 <code><a class="message" href="#scintilla_new">GtkWidget *scintilla_new()</a><br />
7536 <a class="message" href="#scintilla_set_id">void scintilla_set_id(ScintillaObject *sci, uptr_t id)</a><br />
7537 <a class="message" href="#scintilla_send_message">sptr_t scintilla_send_message(ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam)</a><br />
7538 <a class="message" href="#scintilla_release_resources">void scintilla_release_resources()</a><br />
7539 </code>
7541 <p><b id="scintilla_new">GtkWidget *scintilla_new()</b><br />
7542 Create a new Scintilla widget. The returned pointer can be added to a container and displayed in the same way as other
7543 widgets.</p>
7545 <p><b id="scintilla_set_id">void scintilla_set_id(ScintillaObject *sci, uptr_t id)</b><br />
7546 Set the control ID which will be used in the idFrom field of the NotifyHeader structure of all
7547 notifications for this instance.
7548 This is equivalent to <a class="message" href="#SCI_SETIDENTIFIER">SCI_SETIDENTIFIER</a>.</p>
7550 <p><b id="scintilla_send_message">sptr_t scintilla_send_message(ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam)</b><br />
7551 The main entry point allows sending any of the messages described in this document.</p>
7553 <p><b id="scintilla_release_resources">void scintilla_release_resources()</b><br />
7554 Call this to free any remaining resources after all the Scintilla widgets have been destroyed.</p>
7556 <h2 id="ProvisionalMessages">Provisional messages</h2>
7558 <p>Complex new features may be added as 'provisional' to allow further changes to the API.
7559 Provisional features may even be removed if experience shows they are a mistake.</p>
7561 <p>Provisional features are displayed in this document with <span class="provisional">a distinctive background colour</span>.</p>
7563 <p>There are currently no provisional messages.
7564 The <code class="provisional">SC_TECHNOLOGY_DIRECTWRITERETAIN</code> and
7565 <code class="provisional">SC_TECHNOLOGY_DIRECTWRITEDC</code> values for
7566 <a class="message" href="#SCI_SETTECHNOLOGY">SCI_SETTECHNOLOGY</a> are provisional.</p>
7568 <p>Using C++11 &lt;regex&gt; is provisional.</p>
7570 <p>Some developers may want to only use features that are stable and have graduated from
7571 provisional status. To avoid using provisional messages compile with the symbol
7572 <code>SCI_DISABLE_PROVISIONAL</code> defined.</p>
7574 <h2 id="DeprecatedMessages">Deprecated messages and notifications</h2>
7576 <p>The following messages are currently supported to emulate existing Windows controls, but
7577 they will be removed in future versions of Scintilla. If you use these messages you should
7578 replace them with the Scintilla equivalent.</p>
7579 <pre>
7580 WM_GETTEXT(int length, char *text)
7581 WM_SETTEXT(&lt;unused&gt;, const char *text)
7582 EM_GETLINE(int line, char *text)
7583 EM_REPLACESEL(&lt;unused&gt;, const char *text)
7584 EM_SETREADONLY
7585 EM_GETTEXTRANGE(&lt;unused&gt;, TEXTRANGE *tr)
7586 WM_CUT
7587 WM_COPY
7588 WM_PASTE
7589 WM_CLEAR
7590 WM_UNDO
7591 EM_CANUNDO
7592 EM_EMPTYUNDOBUFFER
7593 WM_GETTEXTLENGTH
7594 EM_GETFIRSTVISIBLELINE
7595 EM_GETLINECOUNT
7596 EM_GETMODIFY
7597 EM_SETMODIFY(bool isModified)
7598 EM_GETRECT(RECT *rect)
7599 EM_GETSEL(int *start, int *end)
7600 EM_EXGETSEL(&lt;unused&gt;, CHARRANGE *cr)
7601 EM_SETSEL(int start, int end)
7602 EM_EXSETSEL(&lt;unused&gt;, CHARRANGE *cr)
7603 EM_GETSELTEXT(&lt;unused&gt;, char *text)
7604 EM_LINEFROMCHAR(int position)
7605 EM_EXLINEFROMCHAR(int position)
7606 EM_LINEINDEX(int line)
7607 EM_LINELENGTH(int position)
7608 EM_SCROLL(int line)
7609 EM_LINESCROLL(int column, int line)
7610 EM_SCROLLCARET()
7611 EM_CANPASTE
7612 EM_CHARFROMPOS(&lt;unused&gt;, POINT *location)
7613 EM_POSFROMCHAR(int position, POINT *location)
7614 EM_SELECTIONTYPE
7615 EM_HIDESELECTION(bool hide)
7616 EM_FINDTEXT(int flags, FINDTEXTEX *ft)
7617 EM_FINDTEXTEX(int flags, FINDTEXTEX *ft)
7618 EM_GETMARGINS
7619 EM_SETMARGINS(EC_LEFTMARGIN or EC_RIGHTMARGIN or EC_USEFONTINFO, int val)
7620 EM_FORMATRANGE
7621 </pre>
7623 <p>The following are features that are only included if you define
7624 <code>INCLUDE_DEPRECATED_FEATURES</code> in <code>Scintilla.h</code>. To ensure future
7625 compatibility you should change them as indicated.</p>
7627 <p><b id="SC_CP_DBCS">SC_CP_DBCS</b> Deprecated<br />
7628 This was used to set a DBCS (Double Byte Character Set) mode on GTK+.
7629 An explicit DBCS code page should be used when calling <a class="message" href="#SCI_SETCODEPAGE">SCI_SETCODEPAGE</a></p>
7631 <p><b id="SCI_SETUSEPALETTE">SCI_SETUSEPALETTE(bool allowPaletteUse)</b> Deprecated<br />
7632 <b id="SCI_GETUSEPALETTE">SCI_GETUSEPALETTE</b> Deprecated<br />
7633 Scintilla no longer supports palette mode. The last version to support palettes was 2.29.
7634 Any calls to these methods should be removed.</p>
7636 <p><b id="SCI_SETKEYSUNICODE">SCI_SETKEYSUNICODE(bool keysUnicode)</b> Deprecated<br />
7637 <b id="SCI_GETKEYSUNICODE">SCI_GETKEYSUNICODE</b> Deprecated<br />
7638 On Windows, Scintilla no longer supports narrow character windows so input is always treated as Unicode.</p>
7640 <p>The following are features that should be removed from calling code but are still
7641 defined to avoid breaking callers.</p>
7643 <p id="StyleByteIndicators"><b id="SCI_SETSTYLEBITS">SCI_SETSTYLEBITS(int bits)</b> Deprecated<br />
7644 <b id="SCI_GETSTYLEBITS">SCI_GETSTYLEBITS</b> Deprecated<br />
7645 <b id="SCI_GETSTYLEBITSNEEDED">SCI_GETSTYLEBITSNEEDED</b> Deprecated<br />
7646 <code>INDIC0_MASK</code>, <code>INDIC1_MASK</code>, <code>INDIC2_MASK</code>, <code>INDICS_MASK</code> Deprecated<br />
7647 Scintilla no longer supports style byte indicators. The last version to support style byte indicators was 3.4.2.
7648 Any use of these symbols should be removed and replaced with <a href="#Indicators">standard indicators</a>.
7649 <code>SCI_GETSTYLEBITS</code> and <code>SCI_GETSTYLEBITSNEEDED</code> always return 8,
7650 indicating that 8 bits are used for styling and there are 256 styles.</p>
7652 <h2 id="EditMessagesNeverSupportedByScintilla">Edit messages never supported by Scintilla</h2>
7653 <pre>
7654 EM_GETWORDBREAKPROC EM_GETWORDBREAKPROCEX
7655 EM_SETWORDBREAKPROC EM_SETWORDBREAKPROCEX
7656 EM_GETWORDWRAPMODE EM_SETWORDWRAPMODE
7657 EM_LIMITTEXT EM_EXLIMITTEXT
7658 EM_SETRECT EM_SETRECTNP
7659 EM_FMTLINES
7660 EM_GETHANDLE EM_SETHANDLE
7661 EM_GETPASSWORDCHAR EM_SETPASSWORDCHAR
7662 EM_SETTABSTOPS
7663 EM_FINDWORDBREAK
7664 EM_GETCHARFORMAT EM_SETCHARFORMAT
7665 EM_GETOLEINTERFACE EM_SETOLEINTERFACE
7666 EM_SETOLECALLBACK
7667 EM_GETPARAFORMAT EM_SETPARAFORMAT
7668 EM_PASTESPECIAL
7669 EM_REQUESTRESIZE
7670 EM_GETBKGNDCOLOR EM_SETBKGNDCOLOR
7671 EM_STREAMIN EM_STREAMOUT
7672 EM_GETIMECOLOR EM_SETIMECOLOR
7673 EM_GETIMEOPTIONS EM_SETIMEOPTIONS
7674 EM_GETOPTIONS EM_SETOPTIONS
7675 EM_GETPUNCTUATION EM_SETPUNCTUATION
7676 EM_GETTHUMB
7677 EM_GETEVENTMASK
7678 EM_SETEVENTMASK
7679 EM_DISPLAYBAND
7680 EM_SETTARGETDEVICE
7681 </pre>
7683 <p>Scintilla tries to be a superset of the standard windows Edit and RichEdit controls wherever
7684 that makes sense. As it is not intended for use in a word processor, some edit messages can not
7685 be sensibly handled. Unsupported messages have no effect.</p>
7687 <h2 id="RemovedFeatures">Removed features</h2>
7689 <p>Previous versions of Scintilla allowed indicators to be stored in bits of each style byte.
7690 This was deprecated in 2007 and removed in 2014 with release 3.4.3.
7691 All uses of style byte indicators should be replaced with <a href="#Indicators">standard indicators</a>.</p>
7693 <h2 id="BuildingScintilla">Building Scintilla</h2>
7695 <p>To build Scintilla or SciTE, see the README file present in both the Scintilla and SciTE
7696 directories. For Windows, GCC 4.7 or Microsoft Visual C++ 2010 can be used
7697 for building. For GTK+, GCC 4.1 or newer should be used. GTK+ 2.8+ and 3.x are
7698 supported. The version of GTK+ installed should be detected automatically.
7699 When both GTK+ 2 and GTK+ 3 are present, building for GTK+ 3.x requires defining GTK3
7700 on the command line.</p>
7702 <h3>Static linking</h3>
7704 <p>On Windows, Scintilla is normally used as a dynamic library as a .DLL file. If you want to
7705 link Scintilla directly into your application .EXE or .DLL file, then the
7706 <code>STATIC_BUILD</code> preprocessor symbol should be defined and
7707 <code>Scintilla_RegisterClasses</code> called. <code>STATIC_BUILD</code> prevents compiling the
7708 <code>DllMain</code> function which will conflict with any <code>DllMain</code> defined in your
7709 code. <code>Scintilla_RegisterClasses</code> takes the <code>HINSTANCE</code> of your
7710 application and ensures that the "Scintilla" window class is registered.</p>
7712 <h3>Ensuring lexers are linked into Scintilla</h3>
7714 <p>Depending on the compiler and linker used, the lexers may be stripped out. This is most
7715 often caused when building a static library. To ensure the lexers are linked in, the
7716 <code>Scintilla_LinkLexers()</code> function may be called.</p>
7718 <h3>Changing set of lexers</h3>
7720 <p>To change the set of lexers in Scintilla, add and remove lexer source files
7721 (<code>Lex*.cxx</code>) from the <code>scintilla/lexers directory</code> and run the
7722 <code>scripts/LexGen.py</code> script from the <code>scripts</code> directory to update the make files
7723 and <code>Catalogue.cxx</code>. <code>LexGen.py</code> requires Python 2.5 or later. If you do
7724 not have access to Python, you can hand edit <code>Catalogue.cxx</code> in a simple-minded way,
7725 following the patterns of other lexers. The important thing is to include
7726 <code>LINK_LEXER(lmMyLexer);</code> to correspond with the <code>LexerModule
7727 lmMyLexer(...);</code> in your lexer source code.</p>
7729 <h3>Building with an alternative Regular Expression implementation</h3>
7731 <p id="AlternativeRegEx">A simple interface provides support for switching the Regular Expressions engine at
7732 compile time. You must implement <code>RegexSearchBase</code> for your chosen engine,
7733 look at the built-in implementation <code>BuiltinRegex</code> to see how this is done.
7734 You then need to implement the factory method <code>CreateRegexSearch</code>
7735 to create an instance of your class. You must disable the built-in implementation by defining
7736 <code>SCI_OWNREGEX</code>.</p>
7738 </body>
7739 </html>