TortoiseGit can only show changes of the oldest commit if it has exactly one parent.
[TortoiseGit.git] / ext / scintilla / doc / ScintillaDoc.html
blob619fb00b70f65bfd4cceadf0d9a0b8490126271b
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 /*]]>*/
65 -->
66 </style>
67 </head>
69 <body bgcolor="#FFFFFF" text="#000000">
70 <table bgcolor="#000000" width="100%" cellspacing="0" cellpadding="0" border="0"
71 summary="Banner">
72 <tr>
73 <td><img src="SciTEIco.png" border="3" height="64" width="64" alt="Scintilla icon" /></td>
75 <td><a href="index.html"
76 style="color:white;text-decoration:none;font-size:200%">Scintilla</a></td>
77 </tr>
78 </table>
80 <h1>Scintilla Documentation</h1>
82 <p>Last edited 27/June/2012 NH</p>
84 <p>There is <a class="jump" href="Design.html">an overview of the internal design of
85 Scintilla</a>.<br />
86 <a class="jump" href="ScintillaUsage.html">Some notes on using Scintilla</a>.<br />
87 <a class="jump" href="Steps.html">How to use the Scintilla Edit Control on Windows</a>.<br />
88 <a class="jump" href="http://www.scintilla.org/dmapp.zip">A simple sample using Scintilla from
89 C++ on Windows</a>.<br />
90 <a class="jump" href="http://www.scintilla.org/SciTry.vb">A simple sample using Scintilla from
91 Visual Basic</a>.<br />
92 <a class="jump" href="http://www.scintilla.org/bait.zip">Bait is a tiny sample using Scintilla
93 on GTK+</a>.<br />
94 <a class="jump" href="Lexer.txt">A detailed description of how to write a lexer, including a
95 discussion of folding</a>.<br />
96 <a class="jump" href="http://sphere.sourceforge.net/flik/docs/scintilla-container_lexer.html">
97 How to implement a lexer in the container</a>.<br />
98 <a class="jump" href="http://sphere.sourceforge.net/flik/docs/scintilla-folding.html">
99 How to implement folding</a>.<br />
100 The <a class="jump" href="SciCoding.html">coding style</a> used in Scintilla and SciTE is
101 worth following if you want to contribute code to Scintilla but is not compulsory.</p>
103 <h2>Introduction</h2>
105 <p>The Windows version of Scintilla is a Windows Control. As such, its primary programming
106 interface is through Windows messages. Early versions of Scintilla emulated much of the API
107 defined by the standard Windows Edit and RichEdit controls but those APIs are now deprecated in
108 favour of Scintilla's own, more consistent API. In addition to messages performing the actions
109 of a normal Edit control, Scintilla allows control of syntax styling, folding, markers, autocompletion
110 and call tips.</p>
112 <p>The GTK+ version also uses messages in a similar way to the Windows version. This is
113 different to normal GTK+ practice but made it easier to implement rapidly.</p>
115 <p>Scintilla does not properly support right-to-left languages like Arabic and Hebrew.
116 While text in these languages may appear correct, it is not possible to interact with this text
117 as is normal with other editing components.</p>
119 <p>This documentation describes the individual messages and notifications used by Scintilla. It
120 does not describe how to link them together to form a useful editor. For now, the best way to
121 work out how to develop using Scintilla is to see how SciTE uses it. SciTE exercises most of
122 Scintilla's facilities.</p>
124 <p>In the descriptions that follow, the messages are described as function calls with zero, one
125 or two arguments. These two arguments are the standard <code>wParam</code> and
126 <code>lParam</code> familiar to Windows programmers. These parameters are integers that
127 are large enough to hold pointers, and the return value is also an integer large enough to contain a
128 pointer.
129 Although the commands only use the
130 arguments described, because all messages have two arguments whether Scintilla uses them or
131 not, it is strongly recommended that any unused arguments are set to 0. This allows future
132 enhancement of messages without the risk of breaking existing code. Common argument types
133 are:</p>
135 <table cellpadding="1" cellspacing="2" border="0" summary="Common argument types">
136 <tbody valign="top">
137 <tr>
138 <th align="left">bool</th>
140 <td>Arguments expect the values 0 for <code>false</code> and 1 for
141 <code>true</code>.</td>
142 </tr>
144 <tr>
145 <th align="left">int</th>
147 <td>Arguments are 32-bit signed integers.</td>
148 </tr>
150 <tr>
151 <th align="left">const&nbsp;char&nbsp;*</th>
153 <td>Arguments point at text that is being passed to Scintilla but not modified. The text
154 may be zero terminated or another argument may specify the character count, the
155 description will make this clear.</td>
156 </tr>
158 <tr>
159 <th align="left">char *</th>
161 <td>Arguments point at text buffers that Scintilla will fill with text. In some cases,
162 another argument will tell Scintilla the buffer size. In others, you must make sure that
163 the buffer is big enough to hold the requested text. If a NULL pointer (0) is passed
164 then, for SCI_* calls, the length that should be allocated is returned.</td>
165 </tr>
167 <tr>
168 <th align="left" id="colour">colour</th>
170 <td>Colours are set using the RGB format (Red, Green, Blue). The intensity of each colour
171 is set in the range 0 to 255. If you have three such intensities, they are combined as:
172 red | (green &lt;&lt; 8) | (blue &lt;&lt; 16). If you set all intensities to 255, the
173 colour is white. If you set all intensities to 0, the colour is black. When you set a
174 colour, you are making a request. What you will get depends on the capabilities of the
175 system and the current screen mode.</td>
176 </tr>
178 <tr>
179 <th align="left" id="alpha">alpha</th>
181 <td>Translucency is set using an alpha value.
182 Alpha ranges from 0 (SC_ALPHA_TRANSPARENT) which is completely transparent to
183 255 (SC_ALPHA_OPAQUE) which is opaque. The value 256 (SC_ALPHA_NOALPHA)
184 is opaque and uses code that is not alpha-aware and may be faster. Not all platforms support
185 translucency and only some Scintilla features implement translucency.
186 The default alpha value for most features is SC_ALPHA_NOALPHA.</td>
187 </tr>
189 <tr>
190 <th align="left">&lt;unused&gt;</th>
192 <td>This is an unused argument. Setting it to 0 will ensure compatibility with future
193 enhancements.</td>
194 </tr>
195 </tbody>
196 </table>
198 <h2 id="MessageCategories">Contents</h2>
200 <table cellpadding="4" cellspacing="2" border="0" summary="Message categories">
201 <tbody>
202 <tr>
203 <td>o <a class="toc" href="#TextRetrievalAndModification">Text retrieval and
204 modification</a></td>
206 <td>o <a class="toc" href="#Searching">Searching and replacing</a></td>
208 <td>o <a class="toc" href="#Overtype">Overtype</a></td>
209 </tr>
211 <tr>
212 <td>o <a class="toc" href="#CutCopyAndPaste">Cut, copy and paste</a></td>
214 <td>o <a class="toc" href="#ErrorHandling">Error handling</a></td>
216 <td>o <a class="toc" href="#UndoAndRedo">Undo and Redo</a></td>
217 </tr>
219 <tr>
220 <td>o <a class="toc" href="#SelectionAndInformation">Selection and information</a></td>
222 <td>o <a class="toc" href="#MultipleSelectionAndVirtualSpace">Multiple Selection and Virtual Space</a></td>
224 <td>o <a class="toc" href="#ScrollingAndAutomaticScrolling">Scrolling and automatic
225 scrolling</a></td>
226 </tr>
228 <tr>
229 <td>o <a class="toc" href="#WhiteSpace">White space</a></td>
231 <td>o <a class="toc" href="#Cursor">Cursor</a></td>
233 <td>o <a class="toc" href="#MouseCapture">Mouse capture</a></td>
234 </tr>
236 <tr>
237 <td>o <a class="toc" href="#LineEndings">Line endings</a></td>
239 <td>o <a class="toc" href="#Styling">Styling</a></td>
241 <td>o <a class="toc" href="#StyleDefinition">Style definition</a></td>
242 </tr>
244 <tr>
245 <td>o <a class="toc" href="#CaretAndSelectionStyles">Caret, selection, and hotspot styles</a></td>
247 <td>o <a class="toc" href="#Margins">Margins</a></td>
249 <td>o <a class="toc" href="#Annotations">Annotations</a></td>
250 </tr>
252 <tr>
253 <td>o <a class="toc" href="#OtherSettings">Other settings</a></td>
255 <td>o <a class="toc" href="#BraceHighlighting">Brace highlighting</a></td>
257 <td>o <a class="toc" href="#TabsAndIndentationGuides">Tabs and Indentation
258 Guides</a></td>
259 </tr>
261 <tr>
262 <td>o <a class="toc" href="#Markers">Markers</a></td>
264 <td>o <a class="toc" href="#Indicators">Indicators</a></td>
266 <td>o <a class="toc" href="#Autocompletion">Autocompletion</a></td>
267 </tr>
269 <tr>
270 <td>o <a class="toc" href="#UserLists">User lists</a></td>
272 <td>o <a class="toc" href="#CallTips">Call tips</a></td>
274 <td>o <a class="toc" href="#KeyboardCommands">Keyboard commands</a></td>
275 </tr>
277 <tr>
278 <td>o <a class="toc" href="#KeyBindings">Key bindings</a></td>
280 <td>o <a class="toc" href="#PopupEditMenu">Popup edit menu</a></td>
282 <td>o <a class="toc" href="#MacroRecording">Macro recording</a></td>
283 </tr>
285 <tr>
286 <td>o <a class="toc" href="#Printing">Printing</a></td>
288 <td>o <a class="toc" href="#DirectAccess">Direct access</a></td>
290 <td>o <a class="toc" href="#MultipleViews">Multiple views</a></td>
291 </tr>
293 <tr>
294 <td>o <a class="toc" href="#BackgroundLoadSave">Background loading and saving</a></td>
296 <td>o <a class="toc" href="#Folding">Folding</a></td>
298 <td>o <a class="toc" href="#LineWrapping">Line wrapping</a></td>
299 </tr>
301 <tr>
302 <td>o <a class="toc" href="#Zooming">Zooming</a></td>
304 <td>o <a class="toc" href="#LongLines">Long lines</a></td>
306 <td>o <a class="toc" href="#Lexer">Lexer</a></td>
307 </tr>
309 <tr>
310 <td>o <a class="toc" href="#LexerObjects">Lexer objects</a></td>
312 <td>o <a class="toc" href="#Notifications">Notifications</a></td>
314 <td>o <a class="toc" href="#Images">Images</a></td>
315 </tr>
317 <tr>
318 <td>o <a class="toc" href="#GTK">GTK+</a></td>
320 <td>o <a class="toc" href="#DeprecatedMessages">Deprecated messages</a></td>
322 <td>o <a class="toc" href="#EditMessagesNeverSupportedByScintilla">Edit messages never
323 supported by Scintilla</a></td>
325 </tr>
327 <tr>
328 <td>o <a class="toc" href="#BuildingScintilla">Building Scintilla</a></td>
329 </tr>
330 </tbody>
331 </table>
333 <p>Messages with names of the form <code>SCI_SETxxxxx</code> often have a companion
334 <code>SCI_GETxxxxx</code>. To save tedious repetition, if the <code>SCI_GETxxxxx</code> message
335 returns the value set by the <code>SCI_SETxxxxx</code> message, the <code>SET</code> routine is
336 described and the <code>GET</code> routine is left to your imagination.</p>
338 <h2 id="TextRetrievalAndModification">Text retrieval and modification</h2>
340 <p>Each byte in a Scintilla document is followed by an associated byte of styling
341 information. The combination of a character byte and a style byte is called a cell. Style bytes
342 are interpreted an index into an array of styles.
343 Style bytes may be split into an index and a set of indicator bits
344 but this use is discouraged and indicators should now use
345 <a class="message" href ="#SCI_INDICATORFILLRANGE">SCI_INDICATORFILLRANGE</a>
346 and related calls.
347 The default split is with the index in the low 5 bits and 3 high bits as <a class="jump"
348 href="#Indicators">indicators</a>. This allows 32 fundamental styles, which is enough for most
349 languages, and three independent indicators so that, for example, syntax errors, deprecated
350 names and bad indentation could all be displayed at once. The number of bits used for styles
351 can be altered with <a class="message"
352 href="#SCI_SETSTYLEBITS"><code>SCI_SETSTYLEBITS</code></a> up to a maximum of 8 bits.
353 The remaining bits can be used for indicators.</p>
355 <p>In this document, 'character' normally refers to a byte even when multi-byte characters are used.
356 Lengths measure the numbers of bytes, not the amount of characters in those bytes.</p>
358 <p>Positions within the Scintilla document refer to a character or the gap before that
359 character. The first character in a document is 0, the second 1 and so on. If a document
360 contains <code>nLen</code> characters, the last character is numbered <code>nLen</code>-1.
361 The caret exists between character positions and can be located from before the first character (0)
362 to after the last character (<code>nLen</code>).</p>
364 <p>There are places where the caret can not go where two character bytes make up one character.
365 This occurs when a DBCS character from a language like Japanese is included in the document or
366 when line ends are marked with the CP/M standard of a carriage return followed by a line feed.
367 The <code>INVALID_POSITION</code> constant (-1) represents an invalid position within the
368 document.</p>
370 <p>All lines of text in Scintilla are the same height, and this height is calculated from the
371 largest font in any current style. This restriction is for performance; if lines differed in
372 height then calculations involving positioning of text would require the text to be styled
373 first.</p>
374 <code><a class="message" href="#SCI_GETTEXT">SCI_GETTEXT(int length, char *text)</a><br />
375 <a class="message" href="#SCI_SETTEXT">SCI_SETTEXT(&lt;unused&gt;, const char *text)</a><br />
376 <a class="message" href="#SCI_SETSAVEPOINT">SCI_SETSAVEPOINT</a><br />
377 <a class="message" href="#SCI_GETLINE">SCI_GETLINE(int line, char *text)</a><br />
378 <a class="message" href="#SCI_REPLACESEL">SCI_REPLACESEL(&lt;unused&gt;, const char
379 *text)</a><br />
380 <a class="message" href="#SCI_SETREADONLY">SCI_SETREADONLY(bool readOnly)</a><br />
381 <a class="message" href="#SCI_GETREADONLY">SCI_GETREADONLY</a><br />
382 <a class="message" href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE(&lt;unused&gt;, Sci_TextRange
383 *tr)</a><br />
384 <a class="message" href="#SCI_ALLOCATE">SCI_ALLOCATE(int bytes, &lt;unused&gt;)</a><br />
385 <a class="message" href="#SCI_ADDTEXT">SCI_ADDTEXT(int length, const char *s)</a><br />
386 <a class="message" href="#SCI_ADDSTYLEDTEXT">SCI_ADDSTYLEDTEXT(int length, cell *s)</a><br />
387 <a class="message" href="#SCI_APPENDTEXT">SCI_APPENDTEXT(int length, const char *s)</a><br />
388 <a class="message" href="#SCI_INSERTTEXT">SCI_INSERTTEXT(int pos, const char *text)</a><br />
389 <a class="message" href="#SCI_CLEARALL">SCI_CLEARALL</a><br />
390 <a class="message" href="#SCI_DELETERANGE">SCI_DELETERANGE(int pos, int deleteLength)</a><br />
391 <a class="message" href="#SCI_CLEARDOCUMENTSTYLE">SCI_CLEARDOCUMENTSTYLE</a><br />
392 <a class="message" href="#SCI_GETCHARAT">SCI_GETCHARAT(int position)</a><br />
393 <a class="message" href="#SCI_GETSTYLEAT">SCI_GETSTYLEAT(int position)</a><br />
394 <a class="message" href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT(&lt;unused&gt;, Sci_TextRange
395 *tr)</a><br />
396 <a class="message" href="#SCI_SETSTYLEBITS">SCI_SETSTYLEBITS(int bits)</a><br />
397 <a class="message" href="#SCI_GETSTYLEBITS">SCI_GETSTYLEBITS</a><br />
398 <a class="message" href="#SCI_TARGETASUTF8">SCI_TARGETASUTF8(&lt;unused&gt;, char *s)</a><br />
399 <a class="message" href="#SCI_ENCODEDFROMUTF8">SCI_ENCODEDFROMUTF8(const char *utf8, char *encoded)</a><br />
400 <a class="message" href="#SCI_SETLENGTHFORENCODE">SCI_SETLENGTHFORENCODE(int bytes)</a><br />
401 </code>
403 <p><b id="SCI_GETTEXT">SCI_GETTEXT(int length, char *text)</b><br />
404 This returns <code>length</code>-1 characters of text from the start of the document plus one
405 terminating 0 character. To collect all the text in a document, use <code>SCI_GETLENGTH</code>
406 to get the number of characters in the document (<code>nLen</code>), allocate a character
407 buffer of length <code>nLen+1</code> bytes, then call <code>SCI_GETTEXT(nLen+1, char
408 *text)</code>. If the text argument is 0 then the length that should be allocated to store the
409 entire document is returned.
410 If you then save the text, you should use <code>SCI_SETSAVEPOINT</code> to mark
411 the text as unmodified.</p>
413 <p>See also: <code><a class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>, <a
414 class="message" href="#SCI_GETCURLINE">SCI_GETCURLINE</a>, <a class="message"
415 href="#SCI_GETLINE">SCI_GETLINE</a>, <a class="message"
416 href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>, <a class="message"
417 href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a></code></p>
419 <p><b id="SCI_SETTEXT">SCI_SETTEXT(&lt;unused&gt;, const char *text)</b><br />
420 This replaces all the text in the document with the zero terminated text string you pass
421 in.</p>
423 <p><b id="SCI_SETSAVEPOINT">SCI_SETSAVEPOINT</b><br />
424 This message tells Scintilla that the current state of the document is unmodified. This is
425 usually done when the file is saved or loaded, hence the name "save point". As Scintilla
426 performs undo and redo operations, it notifies the container that it has entered or left the
427 save point with <code><a class="message"
428 href="#SCN_SAVEPOINTREACHED">SCN_SAVEPOINTREACHED</a></code> and <code><a class="message"
429 href="#SCN_SAVEPOINTLEFT">SCN_SAVEPOINTLEFT</a></code> <a class="jump"
430 href="#Notifications">notification messages</a>, allowing the container to know if the file
431 should be considered dirty or not.</p>
433 <p>See also: <code><a class="message" href="#SCI_EMPTYUNDOBUFFER">SCI_EMPTYUNDOBUFFER</a>, <a
434 class="message" href="#SCI_GETMODIFY">SCI_GETMODIFY</a></code></p>
436 <p><b id="SCI_GETLINE">SCI_GETLINE(int line, char *text)</b><br />
437 This fills the buffer defined by text with the contents of the nominated line (lines start at
438 0). The buffer is not terminated by a 0 character. It is up to you to make sure that the buffer
439 is long enough for the text, use <a class="message"
440 href="#SCI_LINELENGTH"><code>SCI_LINELENGTH(int line)</code></a>. The returned value is the
441 number of characters copied to the buffer. The returned text includes any end of line
442 characters. If you ask for a line number outside the range of lines in the document, 0
443 characters are copied. If the text argument is 0 then the length that should be allocated
444 to store the entire line is returned.</p>
446 <p>See also: <code><a class="message" href="#SCI_GETCURLINE">SCI_GETCURLINE</a>, <a
447 class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>, <a class="message"
448 href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a>, <a class="message"
449 href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>, <a class="message"
450 href="#SCI_GETTEXT">SCI_GETTEXT</a></code></p>
452 <p><b id="SCI_REPLACESEL">SCI_REPLACESEL(&lt;unused&gt;, const char *text)</b><br />
453 The currently selected text between the <a class="jump" href="#SelectionAndInformation">anchor
454 and the current position</a> is replaced by the 0 terminated text string. If the anchor and
455 current position are the same, the text is inserted at the caret position. The caret is
456 positioned after the inserted text and the caret is scrolled into view.</p>
458 <p><b id="SCI_SETREADONLY">SCI_SETREADONLY(bool readOnly)</b><br />
459 <b id="SCI_GETREADONLY">SCI_GETREADONLY</b><br />
460 These messages set and get the read-only flag for the document. If you mark a document as read
461 only, attempts to modify the text cause the <a class="message"
462 href="#SCN_MODIFYATTEMPTRO"><code>SCN_MODIFYATTEMPTRO</code></a> notification.</p>
464 <p><b id="SCI_GETTEXTRANGE">SCI_GETTEXTRANGE(&lt;unused&gt;, <a class="jump"
465 href="#Sci_TextRange">Sci_TextRange</a> *tr)</b><br />
466 This collects the text between the positions <code>cpMin</code> and <code>cpMax</code> and
467 copies it to <code>lpstrText</code> (see <code>struct Sci_TextRange</code> in
468 <code>Scintilla.h</code>). If <code>cpMax</code> is -1, text is returned to the end of the
469 document. The text is 0 terminated, so you must supply a buffer that is at least 1 character
470 longer than the number of characters you wish to read. The return value is the length of the
471 returned text not including the terminating 0.</p>
473 <p>See also: <code><a class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>, <a
474 class="message" href="#SCI_GETLINE">SCI_GETLINE</a>, <a class="message"
475 href="#SCI_GETCURLINE">SCI_GETCURLINE</a>, <a class="message"
476 href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>, <a class="message"
477 href="#SCI_GETTEXT">SCI_GETTEXT</a></code></p>
479 <p><b id="SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT(&lt;unused&gt;, <a class="jump"
480 href="#Sci_TextRange">Sci_TextRange</a> *tr)</b><br />
481 This collects styled text into a buffer using two bytes for each cell, with the character at
482 the lower address of each pair and the style byte at the upper address. Characters between the
483 positions <code>cpMin</code> and <code>cpMax</code> are copied to <code>lpstrText</code> (see
484 <code>struct Sci_TextRange</code> in <code>Scintilla.h</code>). Two 0 bytes are added to the end of
485 the text, so the buffer that <code>lpstrText</code> points at must be at least
486 <code>2*(cpMax-cpMin)+2</code> bytes long. No check is made for sensible values of
487 <code>cpMin</code> or <code>cpMax</code>. Positions outside the document return character codes
488 and style bytes of 0.</p>
490 <p>See also: <code><a class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>, <a
491 class="message" href="#SCI_GETLINE">SCI_GETLINE</a>, <a class="message"
492 href="#SCI_GETCURLINE">SCI_GETCURLINE</a>, <a class="message"
493 href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a>, <a class="message"
494 href="#SCI_GETTEXT">SCI_GETTEXT</a></code></p>
496 <p><b id="SCI_ALLOCATE">SCI_ALLOCATE(int bytes, &lt;unused&gt;)</b><br />
497 Allocate a document buffer large enough to store a given number of bytes.
498 The document will not be made smaller than its current contents.</p>
500 <p><b id="SCI_ADDTEXT">SCI_ADDTEXT(int length, const char *s)</b><br />
501 This inserts the first <code>length</code> characters from the string <code>s</code>
502 at the current position. This will include any 0's in the string that you might have expected
503 to stop the insert operation. The current position is set at the end of the inserted text,
504 but it is not scrolled into view.</p>
506 <p><b id="SCI_ADDSTYLEDTEXT">SCI_ADDSTYLEDTEXT(int length, cell *s)</b><br />
507 This behaves just like <code>SCI_ADDTEXT</code>, but inserts styled text.</p>
509 <p><b id="SCI_APPENDTEXT">SCI_APPENDTEXT(int length, const char *s)</b><br />
510 This adds the first <code>length</code> characters from the string <code>s</code> to the end
511 of the document. This will include any 0's in the string that you might have expected to stop
512 the operation. The current selection is not changed and the new text is not scrolled into
513 view.</p>
515 <p><b id="SCI_INSERTTEXT">SCI_INSERTTEXT(int pos, const char *text)</b><br />
516 This inserts the zero terminated <code>text</code> string at position <code>pos</code> or at
517 the current position if <code>pos</code> is -1. If the current position is after the insertion point
518 then it is moved along with its surrounding text but no scrolling is performed.</p>
520 <p><b id="SCI_CLEARALL">SCI_CLEARALL</b><br />
521 Unless the document is read-only, this deletes all the text.</p>
523 <p><b id="SCI_DELETERANGE">SCI_DELETERANGE(int pos, int deleteLength)</b><br />
524 Deletes a range of text in the document.</p>
526 <p><b id="SCI_CLEARDOCUMENTSTYLE">SCI_CLEARDOCUMENTSTYLE</b><br />
527 When wanting to completely restyle the document, for example after choosing a lexer, the
528 <code>SCI_CLEARDOCUMENTSTYLE</code> can be used to clear all styling information and reset the
529 folding state.</p>
531 <p><b id="SCI_GETCHARAT">SCI_GETCHARAT(int pos)</b><br />
532 This returns the character at <code>pos</code> in the document or 0 if <code>pos</code> is
533 negative or past the end of the document.</p>
535 <p><b id="SCI_GETSTYLEAT">SCI_GETSTYLEAT(int pos)</b><br />
536 This returns the style at <code>pos</code> in the document, or 0 if <code>pos</code> is
537 negative or past the end of the document.</p>
539 <p><b id="SCI_SETSTYLEBITS">SCI_SETSTYLEBITS(int bits)</b><br />
540 <b id="SCI_GETSTYLEBITS">SCI_GETSTYLEBITS</b><br />
541 This pair of routines sets and reads back the number of bits in each cell to use for styling,
542 to a maximum of 8 style bits. The remaining bits can be used as indicators. The standard
543 setting is <code>SCI_SETSTYLEBITS(5)</code>.
544 The number of styling bits needed by the current lexer can be found with
545 <a class="message" href="#SCI_GETSTYLEBITSNEEDED">SCI_GETSTYLEBITSNEEDED</a>.</p>
547 <p><b id="Sci_TextRange">Sci_TextRange</b> and <b id="Sci_CharacterRange">Sci_CharacterRange</b><br />
548 These structures are defined to be exactly the same shape as the Win32 <code>TEXTRANGE</code>
549 and <code>CHARRANGE</code>, so that older code that treats Scintilla as a RichEdit will
550 work.</p>
551 <pre>
552 struct Sci_CharacterRange {
553 long cpMin;
554 long cpMax;
557 struct Sci_TextRange {
558 struct Sci_CharacterRange chrg;
559 char *lpstrText;
561 </pre>
563 <h3 id="EncodedAccess">GTK+-specific: Access to encoded text</h3>
565 <p><b id="SCI_TARGETASUTF8">SCI_TARGETASUTF8(&lt;unused&gt;, char *s)</b><br />
566 This method retrieves the value of the target encoded as UTF-8 which is the default
567 encoding of GTK+ so is useful for retrieving text for use in other parts of the user interface,
568 such as find and replace dialogs. The length of the encoded text in bytes is returned.
569 </p>
571 <p><b id="SCI_ENCODEDFROMUTF8">SCI_ENCODEDFROMUTF8(const char *utf8, char *encoded)</b><br />
572 <b id="SCI_SETLENGTHFORENCODE">SCI_SETLENGTHFORENCODE(int bytes)</b><br />
573 <code>SCI_ENCODEDFROMUTF8</code> converts a UTF-8 string into the document's
574 encoding which is useful for taking the results of a find dialog, for example, and receiving
575 a string of bytes that can be searched for in the document. Since the text can contain nul bytes,
576 the <code>SCI_SETLENGTHFORENCODE</code> method can be used to set the
577 length that will be converted. If set to -1, the length is determined by finding a nul byte.
578 The length of the converted string is returned.
579 </p>
582 <h2 id="Searching">Searching</h2>
584 There are methods to search for text and for regular expressions. The regular expression support
585 is limited and should only be used for simple cases and initial development. A different regular expression
586 library can be <a class="jump" href="#AlternativeRegEx">integrated into Scintilla</a>
587 or can be called from the container using direct access to the buffer contents through
588 <a class="message" href="#SCI_GETCHARACTERPOINTER">SCI_GETCHARACTERPOINTER</a>.
589 </p>
590 <code><a class="message" href="#SCI_FINDTEXT">SCI_FINDTEXT(int flags, Sci_TextToFind
591 *ttf)</a><br />
592 <a class="message" href="#SCI_SEARCHANCHOR">SCI_SEARCHANCHOR</a><br />
593 <a class="message" href="#SCI_SEARCHNEXT">SCI_SEARCHNEXT(int searchFlags, const char
594 *text)</a><br />
595 <a class="message" href="#SCI_SEARCHPREV">SCI_SEARCHPREV(int searchFlags, const char
596 *text)</a><br />
597 <a class="jump" href="#SearchAndReplaceUsingTheTarget">Search and replace using the
598 target</a><br />
599 </code>
601 <p><b id="searchFlags"><code>searchFlags</code></b><br />
602 Several of the search routines use flag options, which include a simple regular expression
603 search. Combine the flag options by adding them:</p>
605 <table border="0" summary="Search flags">
606 <tbody>
607 <tr>
608 <td><code>SCFIND_MATCHCASE</code></td>
610 <td>A match only occurs with text that matches the case of the search string.</td>
611 </tr>
613 <tr>
614 <td><code>SCFIND_WHOLEWORD</code></td>
616 <td>A match only occurs if the characters before and after are not word characters.</td>
617 </tr>
619 <tr>
620 <td><code>SCFIND_WORDSTART</code></td>
622 <td>A match only occurs if the character before is not a word character.</td>
623 </tr>
625 <tr>
626 <td><code>SCFIND_REGEXP</code></td>
628 <td>The search string should be interpreted as a regular expression.</td>
629 </tr>
630 <tr>
631 <td><code>SCFIND_POSIX</code></td>
633 <td>Treat regular expression in a more POSIX compatible manner
634 by interpreting bare ( and ) for tagged sections rather than \( and \).</td>
635 </tr>
636 </tbody>
637 </table>
639 <p>You can
640 search backwards to find the previous occurrence of a search string by setting the end of the
641 search range before the start.</p>
643 <p>In a regular expression, special characters interpreted are:</p>
645 <table border="0" summary="Regular expression synopsis">
646 <tbody>
647 <tr>
648 <td><code>.</code></td>
650 <td>Matches any character</td>
651 </tr>
653 <tr>
654 <td><code>\(</code></td>
656 <td>This marks the start of a region for tagging a match.</td>
657 </tr>
659 <tr>
660 <td><code>\)</code></td>
662 <td>This marks the end of a tagged region.</td>
663 </tr>
665 <tr>
666 <td><code>\n</code></td>
668 <td>Where <code>n</code> is 1 through 9 refers to the first through ninth tagged region
669 when replacing. For example, if the search string was <code>Fred\([1-9]\)XXX</code> and
670 the replace string was <code>Sam\1YYY</code>, when applied to <code>Fred2XXX</code> this
671 would generate <code>Sam2YYY</code>.
672 <code>\0</code> refers to all of the matching text.</td>
673 </tr>
675 <tr>
676 <td><code>\&lt;</code></td>
678 <td>This matches the start of a word using Scintilla's definitions of words.</td>
679 </tr>
681 <tr>
682 <td><code>\&gt;</code></td>
684 <td>This matches the end of a word using Scintilla's definition of words.</td>
685 </tr>
687 <tr>
688 <td><code>\x</code></td>
690 <td>This allows you to use a character x that would otherwise have a special meaning. For
691 example, \[ would be interpreted as [ and not as the start of a character set.</td>
692 </tr>
694 <tr>
695 <td><code>[...]</code></td>
697 <td>This indicates a set of characters, for example, [abc] means any of the characters a,
698 b or c. You can also use ranges, for example [a-z] for any lower case character.</td>
699 </tr>
701 <tr>
702 <td><code>[^...]</code></td>
704 <td>The complement of the characters in the set. For example, [^A-Za-z] means any
705 character except an alphabetic character.</td>
706 </tr>
708 <tr>
709 <td><code>^</code></td>
711 <td>This matches the start of a line (unless used inside a set, see above).</td>
712 </tr>
714 <tr>
715 <td><code>$</code></td>
717 <td>This matches the end of a line.</td>
718 </tr>
720 <tr>
721 <td><code>*</code></td>
723 <td>This matches 0 or more times. For example, <code>Sa*m</code> matches <code>Sm</code>,
724 <code>Sam</code>, <code>Saam</code>, <code>Saaam</code> and so on.</td>
725 </tr>
727 <tr>
728 <td><code>+</code></td>
730 <td>This matches 1 or more times. For example, <code>Sa+m</code> matches
731 <code>Sam</code>, <code>Saam</code>, <code>Saaam</code> and so on.</td>
732 </tr>
733 </tbody>
734 </table>
736 <p>Regular expressions will only match ranges within a single line, never matching over multiple lines.</p>
738 <p><b id="SCI_FINDTEXT">SCI_FINDTEXT(int searchFlags, <a class="jump"
739 href="#Sci_TextToFind">Sci_TextToFind</a> *ttf)</b><br />
740 This message searches for text in the document. It does not use or move the current selection.
741 The <a class="jump" href="#searchFlags"><code>searchFlags</code></a> argument controls the
742 search type, which includes regular expression searches.</p>
744 <p>The <code>Sci_TextToFind</code> structure is defined in <code>Scintilla.h</code>; set
745 <code>chrg.cpMin</code> and <code>chrg.cpMax</code> with the range of positions in the document
746 to search. You can search backwards by
747 setting <code>chrg.cpMax</code> less than <code>chrg.cpMin</code>.
748 Set the <code>lpstrText</code> member of <code>Sci_TextToFind</code> to point at a zero terminated
749 text string holding the search pattern. If your language makes the use of <code>Sci_TextToFind</code>
750 difficult, you should consider using <code>SCI_SEARCHINTARGET</code> instead.</p>
752 <p>The return value is -1 if the search fails or the position of the start of the found text if
753 it succeeds. The <code>chrgText.cpMin</code> and <code>chrgText.cpMax</code> members of
754 <code>Sci_TextToFind</code> are filled in with the start and end positions of the found text.</p>
756 <p>See also: <code><a class="message"
757 href="#SCI_SEARCHINTARGET">SCI_SEARCHINTARGET</a></code></p>
759 <p><b id="Sci_TextToFind">Sci_TextToFind</b><br />
760 This structure is defined to have exactly the same shape as the Win32 structure
761 <code>FINDTEXTEX</code> for old code that treated Scintilla as a RichEdit control.</p>
762 <pre>
763 struct Sci_TextToFind {
764 struct <a class="jump" href="#Sci_CharacterRange">Sci_CharacterRange</a> chrg; // range to search
765 char *lpstrText; // the search pattern (zero terminated)
766 struct Sci_CharacterRange chrgText; // returned as position of matching text
768 </pre>
770 <p><b id="SCI_SEARCHANCHOR">SCI_SEARCHANCHOR</b><br />
771 <b id="SCI_SEARCHNEXT">SCI_SEARCHNEXT(int searchFlags, const char *text)</b><br />
772 <b id="SCI_SEARCHPREV">SCI_SEARCHPREV(int searchFlags, const char *text)</b><br />
773 These messages provide relocatable search support. This allows multiple incremental
774 interactive searches to be macro recorded while still setting the selection to found text so
775 the find/select operation is self-contained. These three messages send <a class="message"
776 href="#SCN_MACRORECORD"><code>SCN_MACRORECORD</code></a> <a class="jump"
777 href="#Notifications">notifications</a> if macro recording is enabled.</p>
779 <p><code>SCI_SEARCHANCHOR</code> sets the search start point used by
780 <code>SCI_SEARCHNEXT</code> and <code>SCI_SEARCHPREV</code> to the start of the current
781 selection, that is, the end of the selection that is nearer to the start of the document. You
782 should always call this before calling either of <code>SCI_SEARCHNEXT</code> or
783 <code>SCI_SEARCHPREV</code>.</p>
785 <p><code>SCI_SEARCHNEXT</code> and <code>SCI_SEARCHPREV</code> search for the next and previous
786 occurrence of the zero terminated search string pointed at by text. The search is modified by
787 the <a class="jump" href="#searchFlags"><code>searchFlags</code></a>. </p>
789 <p>The return value is -1 if nothing is found, otherwise the return value is the start position
790 of the matching text. The selection is updated to show the matched text, but is not scrolled
791 into view.</p>
793 <p>See also: <a class="message" href="#SCI_SEARCHINTARGET"><code>SCI_SEARCHINTARGET</code></a>,
794 <a class="message" href="#SCI_FINDTEXT"><code>SCI_FINDTEXT</code></a></p>
796 <h3 id="SearchAndReplaceUsingTheTarget">Search and replace using the target</h3>
798 <p>Using <a class="message" href="#SCI_REPLACESEL"><code>SCI_REPLACESEL</code></a>,
799 modifications cause scrolling and other visible changes, which may take some time and cause
800 unwanted display updates. If performing many changes, such as a replace all command, the target
801 can be used instead. First, set the target, ie. the range to be replaced. Then call
802 <code>SCI_REPLACETARGET</code> or <code>SCI_REPLACETARGETRE</code>.</p>
804 <p>Searching can be performed within the target range with <code>SCI_SEARCHINTARGET</code>,
805 which uses a counted string to allow searching for null characters. It returns the
806 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
807 <code>SCI_SEARCHINTARGET</code> such as <code>SCFIND_MATCHCASE</code>,
808 <code>SCFIND_WHOLEWORD</code>, <code>SCFIND_WORDSTART</code>, and <code>SCFIND_REGEXP</code>
809 can be set with <code>SCI_SETSEARCHFLAGS</code>. <code>SCI_SEARCHINTARGET</code> may be simpler
810 for some clients to use than <a class="message"
811 href="#SCI_FINDTEXT"><code>SCI_FINDTEXT</code></a>, as that requires using a pointer to a
812 structure.</p>
813 <code><a class="message" href="#SCI_SETTARGETSTART">SCI_SETTARGETSTART(int pos)</a><br />
814 <a class="message" href="#SCI_GETTARGETSTART">SCI_GETTARGETSTART</a><br />
815 <a class="message" href="#SCI_SETTARGETEND">SCI_SETTARGETEND(int pos)</a><br />
816 <a class="message" href="#SCI_GETTARGETEND">SCI_GETTARGETEND</a><br />
817 <a class="message" href="#SCI_TARGETFROMSELECTION">SCI_TARGETFROMSELECTION</a><br />
818 <a class="message" href="#SCI_SETSEARCHFLAGS">SCI_SETSEARCHFLAGS(int searchFlags)</a><br />
819 <a class="message" href="#SCI_GETSEARCHFLAGS">SCI_GETSEARCHFLAGS</a><br />
820 <a class="message" href="#SCI_SEARCHINTARGET">SCI_SEARCHINTARGET(int length, const char
821 *text)</a><br />
822 <a class="message" href="#SCI_REPLACETARGET">SCI_REPLACETARGET(int length, const char
823 *text)</a><br />
824 <a class="message" href="#SCI_REPLACETARGETRE">SCI_REPLACETARGETRE(int length, const char
825 *text)</a><br />
826 <a class="message" href="#SCI_GETTAG">SCI_GETTAG(int tagNumber, char *tagValue)</a><br />
827 </code>
829 <p><b id="SCI_SETTARGETSTART">SCI_SETTARGETSTART(int pos)</b><br />
830 <b id="SCI_GETTARGETSTART">SCI_GETTARGETSTART</b><br />
831 <b id="SCI_SETTARGETEND">SCI_SETTARGETEND(int pos)</b><br />
832 <b id="SCI_GETTARGETEND">SCI_GETTARGETEND</b><br />
833 These functions set and return the start and end of the target. When searching in non-regular
834 expression mode, you can set start greater than end to find the last matching text in the
835 target rather than the first matching text. The target is also set by a successful
836 <code>SCI_SEARCHINTARGET</code>.</p>
838 <p><b id="SCI_TARGETFROMSELECTION">SCI_TARGETFROMSELECTION</b><br />
839 Set the target start and end to the start and end positions of the selection.</p>
841 <p><b id="SCI_SETSEARCHFLAGS">SCI_SETSEARCHFLAGS(int searchFlags)</b><br />
842 <b id="SCI_GETSEARCHFLAGS">SCI_GETSEARCHFLAGS</b><br />
843 These get and set the <a class="jump" href="#searchFlags"><code>searchFlags</code></a> used by
844 <code>SCI_SEARCHINTARGET</code>. There are several option flags including a simple regular
845 expression search.</p>
847 <p><b id="SCI_SEARCHINTARGET">SCI_SEARCHINTARGET(int length, const char *text)</b><br />
848 This searches for the first occurrence of a text string in the target defined by
849 <code>SCI_SETTARGETSTART</code> and <code>SCI_SETTARGETEND</code>. The text string is not zero
850 terminated; the size is set by <code>length</code>. The search is modified by the search flags
851 set by <code>SCI_SETSEARCHFLAGS</code>. If the search succeeds, the target is set to the found
852 text and the return value is the position of the start of the matching text. If the search
853 fails, the result is -1.</p>
855 <p><b id="SCI_REPLACETARGET">SCI_REPLACETARGET(int length, const char *text)</b><br />
856 If <code>length</code> is -1, <code>text</code> is a zero terminated string, otherwise
857 <code>length</code> sets the number of character to replace the target with.
858 After replacement, the target range refers to the replacement text.
859 The return value
860 is the length of the replacement string.<br />
861 Note that the recommended way to delete text in the document is to set the target to the text to be removed,
862 and to perform a replace target with an empty string.</p>
864 <p><b id="SCI_REPLACETARGETRE">SCI_REPLACETARGETRE(int length, const char *text)</b><br />
865 This replaces the target using regular expressions. If <code>length</code> is -1,
866 <code>text</code> is a zero terminated string, otherwise <code>length</code> is the number of
867 characters to use. The replacement string is formed from the text string with any sequences of
868 <code>\1</code> through <code>\9</code> replaced by tagged matches from the most recent regular
869 expression search. <code>\0</code> is replaced with all the matched text from the most recent search.
870 After replacement, the target range refers to the replacement text.
871 The return value is the length of the replacement string.</p>
873 <p><b id="SCI_GETTAG">SCI_GETTAG(int tagNumber, char *tagValue)</b><br />
874 Discover what text was matched by tagged expressions in a regular expression search.
875 This is useful if the application wants to interpret the replacement string itself.</p>
877 <p>See also: <a class="message" href="#SCI_FINDTEXT"><code>SCI_FINDTEXT</code></a></p>
879 <h2 id="Overtype">Overtype</h2>
881 <p><b id="SCI_SETOVERTYPE">SCI_SETOVERTYPE(bool overType)</b><br />
882 <b id="SCI_GETOVERTYPE">SCI_GETOVERTYPE</b><br />
883 When overtype is enabled, each typed character replaces the character to the right of the text
884 caret. When overtype is disabled, characters are inserted at the caret.
885 <code>SCI_GETOVERTYPE</code> returns <code>TRUE</code> (1) if overtyping is active, otherwise
886 <code>FALSE</code> (0) will be returned. Use <code>SCI_SETOVERTYPE</code> to set the overtype
887 mode.</p>
889 <h2 id="CutCopyAndPaste">Cut, copy and paste</h2>
891 <code><a class="message" href="#SCI_CUT">SCI_CUT</a><br />
892 <a class="message" href="#SCI_COPY">SCI_COPY</a><br />
893 <a class="message" href="#SCI_PASTE">SCI_PASTE</a><br />
894 <a class="message" href="#SCI_CLEAR">SCI_CLEAR</a><br />
895 <a class="message" href="#SCI_CANPASTE">SCI_CANPASTE</a><br />
896 <a class="message" href="#SCI_COPYRANGE">SCI_COPYRANGE(int start, int end)</a><br />
897 <a class="message" href="#SCI_COPYTEXT">SCI_COPYTEXT(int length,
898 const char *text)</a><br />
899 <a class="message" href="#SCI_COPYALLOWLINE">SCI_COPYALLOWLINE</a><br />
900 <a class="message" href="#SCI_SETPASTECONVERTENDINGS">SCI_SETPASTECONVERTENDINGS(bool convert)</a><br />
901 <a class="message" href="#SCI_GETPASTECONVERTENDINGS">SCI_GETPASTECONVERTENDINGS</a><br />
902 </code>
904 <p><b id="SCI_CUT">SCI_CUT</b><br />
905 <b id="SCI_COPY">SCI_COPY</b><br />
906 <b id="SCI_PASTE">SCI_PASTE</b><br />
907 <b id="SCI_CLEAR">SCI_CLEAR</b><br />
908 <b id="SCI_CANPASTE">SCI_CANPASTE</b><br />
909 <b id="SCI_COPYALLOWLINE">SCI_COPYALLOWLINE</b><br />
910 These commands perform the standard tasks of cutting and copying data to the clipboard,
911 pasting from the clipboard into the document, and clearing the document.
912 <code>SCI_CANPASTE</code> returns non-zero if the document isn't read-only and if the selection
913 doesn't contain protected text. If you need a "can copy" or "can cut", use
914 <code>SCI_GETSELECTIONSTART()-SCI_GETSELECTIONEND()</code>, which will be non-zero if you can
915 copy or cut to the clipboard.</p>
917 <p>GTK+ does not really support <code>SCI_CANPASTE</code> and always returns <code>TRUE</code>
918 unless the document is read-only.</p>
920 <p>On X, the clipboard is asynchronous and may require several messages between
921 the destination and source applications. Data from SCI_PASTE will not arrive in the
922 document immediately.</p>
924 <p><code>SCI_COPYALLOWLINE</code> works the same as SCI_COPY except that if the
925 selection is empty then the current line is copied. On Windows, an extra "MSDEVLineSelect" marker
926 is added to the clipboard which is then used in <code>SCI_PASTE</code> to paste
927 the whole line before the current line.</p>
929 <b id="SCI_COPYRANGE">SCI_COPYRANGE(int start, int end)</b><br />
930 <b id="SCI_COPYTEXT">SCI_COPYTEXT(int length, const char *text)</b><br />
931 <p><code>SCI_COPYRANGE</code> copies a range of text from the document to
932 the system clipboard and <code>SCI_COPYTEXT</code> copies a supplied piece of
933 text to the system clipboard.</p>
935 <p><b id="SCI_SETPASTECONVERTENDINGS">SCI_SETPASTECONVERTENDINGS(bool convert)</b><br />
936 <b id="SCI_GETPASTECONVERTENDINGS">SCI_GETPASTECONVERTENDINGS</b><br />
937 If this property is set then when text is pasted any line ends are converted to match the document's
938 end of line mode as set with
939 <a class="message" href="#SCI_SETEOLMODE">SCI_SETEOLMODE</a>.
940 Currently only changeable on Windows. On GTK+ pasted text is always converted.</p>
942 <h2 id="ErrorHandling">Error handling</h2>
944 <p><b id="SCI_SETSTATUS">SCI_SETSTATUS(int status)</b><br />
945 <b id="SCI_GETSTATUS">SCI_GETSTATUS</b><br />
946 If an error occurs, Scintilla may set an internal error number that can be retrieved with
947 <code>SCI_GETSTATUS</code>.
948 To clear the error status call <code>SCI_SETSTATUS(0)</code>.
949 The currently defined statuses are:
950 </p>
952 <table cellpadding="1" cellspacing="2" border="0" summary="Status values">
953 <tbody valign="top">
954 <tr>
955 <th align="left">SC_STATUS_OK</th>
956 <td>0</td>
957 <td>No failures</td>
958 </tr>
960 <tr>
961 <th align="left">SC_STATUS_FAILURE</th>
962 <td>1</td>
963 <td>Generic failure</td>
964 </tr>
966 <tr>
967 <th align="left">SC_STATUS_BADALLOC</th>
968 <td>2</td>
969 <td>Memory is exhausted</td>
970 </tr>
972 </tbody>
973 </table>
975 <h2 id="UndoAndRedo">Undo and Redo</h2>
977 <p>Scintilla has multiple level undo and redo. It will continue to collect undoable actions
978 until memory runs out. Scintilla saves actions that change the document. Scintilla does not
979 save caret and selection movements, view scrolling and the like. Sequences of typing or
980 deleting are compressed into single transactions to make it easier to undo and redo at a sensible
981 level of detail. Sequences of actions can be combined into transactions that are undone as a unit.
982 These sequences occur between <code>SCI_BEGINUNDOACTION</code> and
983 <code>SCI_ENDUNDOACTION</code> messages. These transactions can be nested and only the top-level
984 sequences are undone as units.</p>
985 <code><a class="message" href="#SCI_UNDO">SCI_UNDO</a><br />
986 <a class="message" href="#SCI_CANUNDO">SCI_CANUNDO</a><br />
987 <a class="message" href="#SCI_EMPTYUNDOBUFFER">SCI_EMPTYUNDOBUFFER</a><br />
988 <a class="message" href="#SCI_REDO">SCI_REDO</a><br />
989 <a class="message" href="#SCI_CANREDO">SCI_CANREDO</a><br />
990 <a class="message" href="#SCI_SETUNDOCOLLECTION">SCI_SETUNDOCOLLECTION(bool
991 collectUndo)</a><br />
992 <a class="message" href="#SCI_GETUNDOCOLLECTION">SCI_GETUNDOCOLLECTION</a><br />
993 <a class="message" href="#SCI_BEGINUNDOACTION">SCI_BEGINUNDOACTION</a><br />
994 <a class="message" href="#SCI_ENDUNDOACTION">SCI_ENDUNDOACTION</a><br />
995 <a class="message" href="#SCI_ADDUNDOACTION">SCI_ADDUNDOACTION(int token, int flags)</a><br />
996 </code>
998 <p><b id="SCI_UNDO">SCI_UNDO</b><br />
999 <b id="SCI_CANUNDO">SCI_CANUNDO</b><br />
1000 <code>SCI_UNDO</code> undoes one action, or if the undo buffer has reached a
1001 <code>SCI_ENDUNDOACTION</code> point, all the actions back to the corresponding
1002 <code>SCI_BEGINUNDOACTION</code>.</p>
1004 <p><code>SCI_CANUNDO</code> returns 0 if there is nothing to undo, and 1 if there is. You would
1005 typically use the result of this message to enable/disable the Edit menu Undo command.</p>
1007 <p><b id="SCI_REDO">SCI_REDO</b><br />
1008 <b id="SCI_CANREDO">SCI_CANREDO</b><br />
1009 <code>SCI_REDO</code> undoes the effect of the last <code>SCI_UNDO</code> operation.</p>
1011 <p><code>SCI_CANREDO</code> returns 0 if there is no action to redo and 1 if there are undo
1012 actions to redo. You could typically use the result of this message to enable/disable the Edit
1013 menu Redo command.</p>
1015 <p><b id="SCI_EMPTYUNDOBUFFER">SCI_EMPTYUNDOBUFFER</b><br />
1016 This command tells Scintilla to forget any saved undo or redo history. It also sets the save
1017 point to the start of the undo buffer, so the document will appear to be unmodified. This does
1018 not cause the <code><a class="message"
1019 href="#SCN_SAVEPOINTREACHED">SCN_SAVEPOINTREACHED</a></code> notification to be sent to the
1020 container.</p>
1022 <p>See also: <a class="message" href="#SCI_SETSAVEPOINT"><code>SCI_SETSAVEPOINT</code></a></p>
1024 <p><b id="SCI_SETUNDOCOLLECTION">SCI_SETUNDOCOLLECTION(bool collectUndo)</b><br />
1025 <b id="SCI_GETUNDOCOLLECTION">SCI_GETUNDOCOLLECTION</b><br />
1026 You can control whether Scintilla collects undo information with
1027 <code>SCI_SETUNDOCOLLECTION</code>. Pass in <code>true</code> (1) to collect information and
1028 <code>false</code> (0) to stop collecting. If you stop collection, you should also use
1029 <code>SCI_EMPTYUNDOBUFFER</code> to avoid the undo buffer being unsynchronized with the data in
1030 the buffer.</p>
1032 <p>You might wish to turn off saving undo information if you use the Scintilla to store text
1033 generated by a program (a Log view) or in a display window where text is often deleted and
1034 regenerated.</p>
1036 <p><b id="SCI_BEGINUNDOACTION">SCI_BEGINUNDOACTION</b><br />
1037 <b id="SCI_ENDUNDOACTION">SCI_ENDUNDOACTION</b><br />
1038 Send these two messages to Scintilla to mark the beginning and end of a set of operations that
1039 you want to undo all as one operation but that you have to generate as several operations.
1040 Alternatively, you can use these to mark a set of operations that you do not want to have
1041 combined with the preceding or following operations if they are undone.</p>
1043 <p><b id="SCI_ADDUNDOACTION">SCI_ADDUNDOACTION(int token, int flags)</b><br />
1044 The container can add its own actions into the undo stack by calling
1045 <code>SCI_ADDUNDOACTION</code> and an <code>SCN_MODIFIED</code>
1046 notification will be sent to the container with the
1047 <a class="message" href="#SC_MOD_CONTAINER"><code>SC_MOD_CONTAINER</code></a>
1048 flag when it is time to undo (<code>SC_PERFORMED_UNDO</code>) or
1049 redo (<code>SC_PERFORMED_REDO</code>) the action. The token argument supplied is
1050 returned in the <code>token</code> field of the notification.</p>
1051 <p>For example, if the container wanted to allow undo and redo of a 'toggle bookmark' command then
1052 it could call <code>SCI_ADDUNDOACTION(line, 0)</code> each time the command is performed.
1053 Then when it receives a notification to undo or redo it toggles a bookmark on the line given by
1054 the token field. If there are different types of commands or parameters that need to be stored into the undo
1055 stack then the container should maintain a stack of its own for the document and use the current
1056 position in that stack as the argument to <code>SCI_ADDUNDOACTION(line)</code>.
1057 <code>SCI_ADDUNDOACTION</code> commands are not combined together
1058 into a single undo transaction unless grouped with <code>SCI_BEGINUNDOACTION</code>
1059 and <code>SCI_ENDUNDOACTION</code>.</p>
1061 <p>The flags argument can be <code>UNDO_MAY_COALESCE</code> (1) if the container action may be
1062 coalesced along with any insertion and deletion actions into a single compound action, otherwise 0.
1063 Coalescing treats coalescible container actions as transparent so will still only group together insertions that
1064 look like typing or deletions that look like multiple uses of the Backspace or Delete keys.
1065 </p>
1066 <h2 id="SelectionAndInformation">Selection and information</h2>
1068 <p>Scintilla maintains a selection that stretches between two points, the anchor and the
1069 current position. If the anchor and the current position are the same, there is no selected
1070 text. Positions in the document range from 0 (before the first character), to the document size
1071 (after the last character). If you use messages, there is nothing to stop you setting a
1072 position that is in the middle of a CRLF pair, or in the middle of a 2 byte character. However,
1073 keyboard commands will not move the caret into such positions.</p>
1074 <code><a class="message" href="#SCI_GETTEXTLENGTH">SCI_GETTEXTLENGTH</a><br />
1075 <a class="message" href="#SCI_GETLENGTH">SCI_GETLENGTH</a><br />
1076 <a class="message" href="#SCI_GETLINECOUNT">SCI_GETLINECOUNT</a><br />
1077 <a class="message" href="#SCI_SETFIRSTVISIBLELINE">SCI_SETFIRSTVISIBLELINE(int lineDisplay)</a><br />
1078 <a class="message" href="#SCI_GETFIRSTVISIBLELINE">SCI_GETFIRSTVISIBLELINE</a><br />
1079 <a class="message" href="#SCI_LINESONSCREEN">SCI_LINESONSCREEN</a><br />
1080 <a class="message" href="#SCI_GETMODIFY">SCI_GETMODIFY</a><br />
1081 <a class="message" href="#SCI_SETSEL">SCI_SETSEL(int anchorPos, int currentPos)</a><br />
1082 <a class="message" href="#SCI_GOTOPOS">SCI_GOTOPOS(int position)</a><br />
1083 <a class="message" href="#SCI_GOTOLINE">SCI_GOTOLINE(int line)</a><br />
1084 <a class="message" href="#SCI_SETCURRENTPOS">SCI_SETCURRENTPOS(int position)</a><br />
1085 <a class="message" href="#SCI_GETCURRENTPOS">SCI_GETCURRENTPOS</a><br />
1086 <a class="message" href="#SCI_SETANCHOR">SCI_SETANCHOR(int position)</a><br />
1087 <a class="message" href="#SCI_GETANCHOR">SCI_GETANCHOR</a><br />
1088 <a class="message" href="#SCI_SETSELECTIONSTART">SCI_SETSELECTIONSTART(int position)</a><br />
1089 <a class="message" href="#SCI_GETSELECTIONSTART">SCI_GETSELECTIONSTART</a><br />
1090 <a class="message" href="#SCI_SETSELECTIONEND">SCI_SETSELECTIONEND(int position)</a><br />
1091 <a class="message" href="#SCI_GETSELECTIONEND">SCI_GETSELECTIONEND</a><br />
1092 <a class="message" href="#SCI_SETEMPTYSELECTION">SCI_SETEMPTYSELECTION(int pos)</a><br />
1093 <a class="message" href="#SCI_SELECTALL">SCI_SELECTALL</a><br />
1094 <a class="message" href="#SCI_LINEFROMPOSITION">SCI_LINEFROMPOSITION(int position)</a><br />
1095 <a class="message" href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(int line)</a><br />
1096 <a class="message" href="#SCI_GETLINEENDPOSITION">SCI_GETLINEENDPOSITION(int line)</a><br />
1097 <a class="message" href="#SCI_LINELENGTH">SCI_LINELENGTH(int line)</a><br />
1098 <a class="message" href="#SCI_GETCOLUMN">SCI_GETCOLUMN(int position)</a><br />
1099 <a class="message" href="#SCI_FINDCOLUMN">SCI_FINDCOLUMN(int line, int column)</a><br />
1100 <a class="message" href="#SCI_POSITIONFROMPOINT">SCI_POSITIONFROMPOINT(int x, int y)</a><br />
1101 <a class="message" href="#SCI_POSITIONFROMPOINTCLOSE">SCI_POSITIONFROMPOINTCLOSE(int x, int
1102 y)</a><br />
1103 <a class="message" href="#SCI_CHARPOSITIONFROMPOINT">SCI_CHARPOSITIONFROMPOINT(int x, int y)</a><br />
1104 <a class="message" href="#SCI_CHARPOSITIONFROMPOINTCLOSE">SCI_CHARPOSITIONFROMPOINTCLOSE(int x, int
1105 y)</a><br />
1106 <a class="message" href="#SCI_POINTXFROMPOSITION">SCI_POINTXFROMPOSITION(&lt;unused&gt;, int
1107 position)</a><br />
1108 <a class="message" href="#SCI_POINTYFROMPOSITION">SCI_POINTYFROMPOSITION(&lt;unused&gt;, int
1109 position)</a><br />
1110 <a class="message" href="#SCI_HIDESELECTION">SCI_HIDESELECTION(bool hide)</a><br />
1111 <a class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT(&lt;unused&gt;, char *text)</a><br />
1112 <a class="message" href="#SCI_GETCURLINE">SCI_GETCURLINE(int textLen, char *text)</a><br />
1113 <a class="message" href="#SCI_SELECTIONISRECTANGLE">SCI_SELECTIONISRECTANGLE</a><br />
1114 <a class="message" href="#SCI_SETSELECTIONMODE">SCI_SETSELECTIONMODE(int mode)</a><br />
1115 <a class="message" href="#SCI_GETSELECTIONMODE">SCI_GETSELECTIONMODE</a><br />
1116 <a class="message" href="#SCI_GETLINESELSTARTPOSITION">SCI_GETLINESELSTARTPOSITION(int line)</a><br />
1117 <a class="message" href="#SCI_GETLINESELENDPOSITION">SCI_GETLINESELENDPOSITION(int line)</a><br />
1118 <a class="message" href="#SCI_MOVECARETINSIDEVIEW">SCI_MOVECARETINSIDEVIEW</a><br />
1119 <a class="message" href="#SCI_WORDENDPOSITION">SCI_WORDENDPOSITION(int position, bool
1120 onlyWordCharacters)</a><br />
1121 <a class="message" href="#SCI_WORDSTARTPOSITION">SCI_WORDSTARTPOSITION(int position, bool
1122 onlyWordCharacters)</a><br />
1123 <a class="message" href="#SCI_POSITIONBEFORE">SCI_POSITIONBEFORE(int position)</a><br />
1124 <a class="message" href="#SCI_POSITIONAFTER">SCI_POSITIONAFTER(int position)</a><br />
1125 <a class="message" href="#SCI_COUNTCHARACTERS">SCI_COUNTCHARACTERS(int startPos, int endPos)</a><br />
1126 <a class="message" href="#SCI_TEXTWIDTH">SCI_TEXTWIDTH(int styleNumber, const char *text)</a><br />
1127 <a class="message" href="#SCI_TEXTHEIGHT">SCI_TEXTHEIGHT(int line)</a><br />
1128 <a class="message" href="#SCI_CHOOSECARETX">SCI_CHOOSECARETX</a><br />
1129 <a class="message" href="#SCI_MOVESELECTEDLINESUP">SCI_MOVESELECTEDLINESUP</a><br />
1130 <a class="message" href="#SCI_MOVESELECTEDLINESDOWN">SCI_MOVESELECTEDLINESDOWN</a><br />
1131 </code>
1133 <p><b id="SCI_GETTEXTLENGTH">SCI_GETTEXTLENGTH</b><br />
1134 <b id="SCI_GETLENGTH">SCI_GETLENGTH</b><br />
1135 Both these messages return the length of the document in bytes.</p>
1137 <p><b id="SCI_GETLINECOUNT">SCI_GETLINECOUNT</b><br />
1138 This returns the number of lines in the document. An empty document contains 1 line. A
1139 document holding only an end of line sequence has 2 lines.</p>
1141 <p><b id="SCI_SETFIRSTVISIBLELINE">SCI_SETFIRSTVISIBLELINE(int lineDisplay)</b><br />
1142 <b id="SCI_GETFIRSTVISIBLELINE">SCI_GETFIRSTVISIBLELINE</b><br />
1143 These messages retrieve and set the line number of the first visible line in the Scintilla view. The first line
1144 in the document is numbered 0. The value is a visible line rather than a document line.</p>
1146 <p><b id="SCI_LINESONSCREEN">SCI_LINESONSCREEN</b><br />
1147 This returns the number of complete lines visible on the screen. With a constant line height,
1148 this is the vertical space available divided by the line separation. Unless you arrange to size
1149 your window to an integral number of lines, there may be a partial line visible at the bottom
1150 of the view.</p>
1152 <p><b id="SCI_GETMODIFY">SCI_GETMODIFY</b><br />
1153 This returns non-zero if the document is modified and 0 if it is unmodified. The modified
1154 status of a document is determined by the undo position relative to the save point. The save
1155 point is set by <a class="message" href="#SCI_SETSAVEPOINT"><code>SCI_SETSAVEPOINT</code></a>,
1156 usually when you have saved data to a file.</p>
1158 <p>If you need to be notified when the document becomes modified, Scintilla notifies the
1159 container that it has entered or left the save point with the <a class="message"
1160 href="#SCN_SAVEPOINTREACHED"><code>SCN_SAVEPOINTREACHED</code></a> and <a class="message"
1161 href="#SCN_SAVEPOINTLEFT"><code>SCN_SAVEPOINTLEFT</code></a> <a class="jump"
1162 href="#Notifications">notification messages</a>.</p>
1164 <p><b id="SCI_SETSEL">SCI_SETSEL(int anchorPos, int currentPos)</b><br />
1165 This message sets both the anchor and the current position. If <code>currentPos</code> is
1166 negative, it means the end of the document. If <code>anchorPos</code> is negative, it means
1167 remove any selection (i.e. set the anchor to the same position as <code>currentPos</code>). The
1168 caret is scrolled into view after this operation.</p>
1170 <p><b id="SCI_GOTOPOS">SCI_GOTOPOS(int pos)</b><br />
1171 This removes any selection, sets the caret at <code>pos</code> and scrolls the view to make
1172 the caret visible, if necessary. It is equivalent to
1173 <code>SCI_SETSEL(pos, pos)</code>. The anchor position is set the same as the current
1174 position.</p>
1176 <p><b id="SCI_GOTOLINE">SCI_GOTOLINE(int line)</b><br />
1177 This removes any selection and sets the caret at the start of line number <code>line</code>
1178 and scrolls the view (if needed) to make it visible. The anchor position is set the same as the
1179 current position. If <code>line</code> is outside the lines in the document (first line is 0),
1180 the line set is the first or last.</p>
1182 <p><b id="SCI_SETCURRENTPOS">SCI_SETCURRENTPOS(int pos)</b><br />
1183 This sets the current position and creates a selection between the anchor and the current
1184 position. The caret is not scrolled into view.</p>
1186 <p>See also: <a class="message" href="#SCI_SCROLLCARET"><code>SCI_SCROLLCARET</code></a></p>
1188 <p><b id="SCI_GETCURRENTPOS">SCI_GETCURRENTPOS</b><br />
1189 This returns the current position.</p>
1191 <p><b id="SCI_SETANCHOR">SCI_SETANCHOR(int pos)</b><br />
1192 This sets the anchor position and creates a selection between the anchor position and the
1193 current position. The caret is not scrolled into view.</p>
1195 <p>See also: <a class="message" href="#SCI_SCROLLCARET"><code>SCI_SCROLLCARET</code></a></p>
1197 <p><b id="SCI_GETANCHOR">SCI_GETANCHOR</b><br />
1198 This returns the current anchor position.</p>
1200 <p><b id="SCI_SETSELECTIONSTART">SCI_SETSELECTIONSTART(int pos)</b><br />
1201 <b id="SCI_SETSELECTIONEND">SCI_SETSELECTIONEND(int pos)</b><br />
1202 These set the selection based on the assumption that the anchor position is less than the
1203 current position. They do not make the caret visible. The table shows the positions of the
1204 anchor and the current position after using these messages.</p>
1206 <table cellpadding="3" cellspacing="0" border="1" summary="SetSelection caret positioning">
1207 <thead align="center">
1208 <tr>
1209 <th>
1210 </th>
1212 <th>anchor</th>
1214 <th>current</th>
1215 </tr>
1216 </thead>
1218 <tbody align="center">
1219 <tr>
1220 <th><code>SCI_SETSELECTIONSTART</code></th>
1222 <td><code>pos</code></td>
1224 <td><code>Max(pos, current)</code></td>
1225 </tr>
1227 <tr>
1228 <th><code>SCI_SETSELECTIONEND</code></th>
1230 <td><code>Min(anchor, pos)</code></td>
1232 <td><code>pos</code></td>
1233 </tr>
1234 </tbody>
1235 </table>
1237 <p>See also: <a class="message" href="#SCI_SCROLLCARET"><code>SCI_SCROLLCARET</code></a></p>
1239 <p><b id="SCI_GETSELECTIONSTART">SCI_GETSELECTIONSTART</b><br />
1240 <b id="SCI_GETSELECTIONEND">SCI_GETSELECTIONEND</b><br />
1241 These return the start and end of the selection without regard to which end is the current
1242 position and which is the anchor. <code>SCI_GETSELECTIONSTART</code> returns the smaller of the
1243 current position or the anchor position. <code>SCI_GETSELECTIONEND</code> returns the larger of
1244 the two values.</p>
1246 <p><b id="SCI_SETEMPTYSELECTION">SCI_SETEMPTYSELECTION(int pos)</b><br />
1247 This removes any selection and sets the caret at <code>pos</code>. The caret is not scrolled into view.</p>
1249 <p><b id="SCI_SELECTALL">SCI_SELECTALL</b><br />
1250 This selects all the text in the document. The current position is not scrolled into view.</p>
1252 <p><b id="SCI_LINEFROMPOSITION">SCI_LINEFROMPOSITION(int pos)</b><br />
1253 This message returns the line that contains the position <code>pos</code> in the document. The
1254 return value is 0 if <code>pos</code> &lt;= 0. The return value is the last line if
1255 <code>pos</code> is beyond the end of the document.</p>
1257 <p><b id="SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(int line)</b><br />
1258 This returns the document position that corresponds with the start of the line. If
1259 <code>line</code> is negative, the position of the line holding the start of the selection is
1260 returned. If <code>line</code> is greater than the lines in the document, the return value is
1261 -1. If <code>line</code> is equal to the number of lines in the document (i.e. 1 line past the
1262 last line), the return value is the end of the document.</p>
1264 <p><b id="SCI_GETLINEENDPOSITION">SCI_GETLINEENDPOSITION(int line)</b><br />
1265 This returns the position at the end of the line, before any line end characters. If <code>line</code>
1266 is the last line in the document (which does not have any end of line characters), the result is the size of the
1267 document. If <code>line</code> is negative or <code>line</code> &gt;= <a class="message"
1268 href="#SCI_GETLINECOUNT"><code>SCI_GETLINECOUNT()</code></a>, the result is undefined.</p>
1270 <p><b id="SCI_LINELENGTH">SCI_LINELENGTH(int line)</b><br />
1271 This returns the length of the line, including any line end characters. If <code>line</code>
1272 is negative or beyond the last line in the document, the result is 0. If you want the length of
1273 the line not including any end of line characters, use <a class="message"
1274 href="#SCI_GETLINEENDPOSITION"><code>SCI_GETLINEENDPOSITION(line)</code></a> - <a class="message"
1275 href="#SCI_POSITIONFROMLINE"><code>SCI_POSITIONFROMLINE(line)</code></a>.</p>
1277 <p><b id="SCI_GETSELTEXT">SCI_GETSELTEXT(&lt;unused&gt;, char *text)</b><br />
1278 This copies the currently selected text and a terminating 0 byte to the <code>text</code>
1279 buffer. The buffer size should be determined by calling with a NULL pointer for the <code>text</code> argument
1280 <code>SCI_GETSELTEXT(0,0)</code>.
1281 This allows for rectangular and discontiguous selections as well as simple selections.
1282 See <a class="toc" href="#MultipleSelectionAndVirtualSpace">Multiple Selection</a> for information on
1283 how multiple and rectangular selections and virtual space are copied.</p>
1285 <p>See also: <code><a class="message" href="#SCI_GETCURLINE">SCI_GETCURLINE</a>,
1286 <a class="message" href="#SCI_GETLINE">SCI_GETLINE</a>,
1287 <a class="message" href="#SCI_GETTEXT">SCI_GETTEXT</a>,
1288 <a class="message" href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>,
1289 <a class="message" href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a>
1290 </code></p>
1292 <p><b id="SCI_GETCURLINE">SCI_GETCURLINE(int textLen, char *text)</b><br />
1293 This retrieves the text of the line containing the caret and returns the position within the
1294 line of the caret. Pass in <code>char* text</code> pointing at a buffer large enough to hold
1295 the text you wish to retrieve and a terminating 0 character.
1296 Set <code>textLen</code> to the
1297 length of the buffer which must be at least 1 to hold the terminating 0 character.
1298 If the text argument is 0 then the length that should be allocated
1299 to store the entire current line is returned.</p>
1301 <p>See also: <code><a class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>, <a
1302 class="message" href="#SCI_GETLINE">SCI_GETLINE</a>, <a class="message"
1303 href="#SCI_GETTEXT">SCI_GETTEXT</a>, <a class="message"
1304 href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>, <a class="message"
1305 href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a></code></p>
1307 <p><b id="SCI_SELECTIONISRECTANGLE">SCI_SELECTIONISRECTANGLE</b><br />
1308 This returns 1 if the current selection is in rectangle mode, 0 if not.</p>
1310 <p><b id="SCI_SETSELECTIONMODE">SCI_SETSELECTIONMODE(int mode)</b><br />
1311 <b id="SCI_GETSELECTIONMODE">SCI_GETSELECTIONMODE</b><br />
1312 The two functions set and get the selection mode, which can be
1313 stream (<code>SC_SEL_STREAM</code>=0) or
1314 rectangular (<code>SC_SEL_RECTANGLE</code>=1) or
1315 by lines (<code>SC_SEL_LINES</code>=2)
1316 or thin rectangular (<code>SC_SEL_THIN</code>=3).
1317 When set in these modes, regular caret moves will extend or reduce the selection,
1318 until the mode is cancelled by a call with same value or with <code>SCI_CANCEL</code>.
1319 The get function returns the current mode even if the selection was made by mouse
1320 or with regular extended moves.
1321 <code>SC_SEL_THIN</code> is the mode after a rectangular selection has been typed into and ensures
1322 that no characters are selected.</p>
1324 <p><b id="SCI_GETLINESELSTARTPOSITION">SCI_GETLINESELSTARTPOSITION(int line)</b><br />
1325 <b id="SCI_GETLINESELENDPOSITION">SCI_GETLINESELENDPOSITION(int line)</b><br />
1326 Retrieve the position of the start and end of the selection at the given line with
1327 INVALID_POSITION returned if no selection on this line.</p>
1329 <p><b id="SCI_MOVECARETINSIDEVIEW">SCI_MOVECARETINSIDEVIEW</b><br />
1330 If the caret is off the top or bottom of the view, it is moved to the nearest line that is
1331 visible to its current position. Any selection is lost.</p>
1333 <p><b id="SCI_WORDENDPOSITION">SCI_WORDENDPOSITION(int position, bool
1334 onlyWordCharacters)</b><br />
1335 <b id="SCI_WORDSTARTPOSITION">SCI_WORDSTARTPOSITION(int position, bool
1336 onlyWordCharacters)</b><br />
1337 These messages return the start and end of words using the same definition of words as used
1338 internally within Scintilla. You can set your own list of characters that count as words with
1339 <a class="message" href="#SCI_SETWORDCHARS"><code>SCI_SETWORDCHARS</code></a>. The position
1340 sets the start or the search, which is forwards when searching for the end and backwards when
1341 searching for the start.</p>
1343 <p>Set <code>onlyWordCharacters</code> to <code>true</code> (1) to stop searching at the first
1344 non-word character in the search direction. If <code>onlyWordCharacters</code> is
1345 <code>false</code> (0), the first character in the search direction sets the type of the search
1346 as word or non-word and the search stops at the first non-matching character. Searches are also
1347 terminated by the start or end of the document.</p>
1349 <p>If "w" represents word characters and "." represents non-word characters and "|" represents
1350 the position and <code>true</code> or <code>false</code> is the state of
1351 <code>onlyWordCharacters</code>:</p>
1353 <table cellpadding="3" cellspacing="0" border="1" summary="Word start and end positions">
1354 <thead align="center">
1355 <tr>
1356 <th>Initial state</th>
1358 <th>end, true</th>
1360 <th>end, false</th>
1362 <th>start, true</th>
1364 <th>start, false</th>
1365 </tr>
1366 </thead>
1368 <tbody align="center">
1369 <tr>
1370 <td>..ww..|..ww..</td>
1372 <td>..ww..|..ww..</td>
1374 <td>..ww....|ww..</td>
1376 <td>..ww..|..ww..</td>
1378 <td>..ww|....ww..</td>
1379 </tr>
1381 <tr>
1382 <td>....ww|ww....</td>
1384 <td>....wwww|....</td>
1386 <td>....wwww|....</td>
1388 <td>....|wwww....</td>
1390 <td>....|wwww....</td>
1391 </tr>
1393 <tr>
1394 <td>..ww|....ww..</td>
1396 <td>..ww|....ww..</td>
1398 <td>..ww....|ww..</td>
1400 <td>..|ww....ww..</td>
1402 <td>..|ww....ww..</td>
1403 </tr>
1405 <tr>
1406 <td>..ww....|ww..</td>
1408 <td>..ww....ww|..</td>
1410 <td>..ww....ww|..</td>
1412 <td>..ww....|ww..</td>
1414 <td>..ww|....ww..</td>
1415 </tr>
1416 </tbody>
1417 </table>
1419 <p><b id="SCI_POSITIONBEFORE">SCI_POSITIONBEFORE(int position)</b><br />
1420 <b id="SCI_POSITIONAFTER">SCI_POSITIONAFTER(int position)</b><br />
1421 These messages return the position before and after another position
1422 in the document taking into account the current code page. The minimum
1423 position returned is 0 and the maximum is the last position in the document.
1424 If called with a position within a multi byte character will return the position
1425 of the start/end of that character.</p>
1427 <p><b id="SCI_COUNTCHARACTERS">SCI_COUNTCHARACTERS(int startPos, int endPos)</b><br />
1428 Returns the number of whole characters between two positions..</p>
1430 <p><b id="SCI_TEXTWIDTH">SCI_TEXTWIDTH(int styleNumber, const char *text)</b><br />
1431 This returns the pixel width of a string drawn in the given <code>styleNumber</code> which can
1432 be used, for example, to decide how wide to make the line number margin in order to display a
1433 given number of numerals.</p>
1435 <p><b id="SCI_TEXTHEIGHT">SCI_TEXTHEIGHT(int line)</b><br />
1436 This returns the height in pixels of a particular line. Currently all lines are the same
1437 height.</p>
1439 <p><b id="SCI_GETCOLUMN">SCI_GETCOLUMN(int pos)</b><br />
1440 This message returns the column number of a position <code>pos</code> within the document
1441 taking the width of tabs into account. This returns the column number of the last tab on the
1442 line before <code>pos</code>, plus the number of characters between the last tab and
1443 <code>pos</code>. If there are no tab characters on the line, the return value is the number of
1444 characters up to the position on the line. In both cases, double byte characters count as a
1445 single character. This is probably only useful with monospaced fonts.</p>
1447 <p><b id="SCI_FINDCOLUMN">SCI_FINDCOLUMN(int line, int column)</b><br />
1448 This message returns the position of a <code>column</code> on a <code>line</code>
1449 taking the width of tabs into account. It treats a multi-byte character as a single column.
1450 Column numbers, like lines start at 0.</p>
1452 <p><b id="SCI_POSITIONFROMPOINT">SCI_POSITIONFROMPOINT(int x, int y)</b><br />
1453 <b id="SCI_POSITIONFROMPOINTCLOSE">SCI_POSITIONFROMPOINTCLOSE(int x, int y)</b><br />
1454 <code>SCI_POSITIONFROMPOINT</code> finds the closest character position to a point and
1455 <code>SCI_POSITIONFROMPOINTCLOSE</code> is similar but returns -1 if the point is outside the
1456 window or not close to any characters.</p>
1458 <p><b id="SCI_CHARPOSITIONFROMPOINT">SCI_CHARPOSITIONFROMPOINT(int x, int y)</b><br />
1459 <b id="SCI_CHARPOSITIONFROMPOINTCLOSE">SCI_CHARPOSITIONFROMPOINTCLOSE(int x, int y)</b><br />
1460 <code>SCI_CHARPOSITIONFROMPOINT</code> finds the closest character to a point and
1461 <code>SCI_CHARPOSITIONFROMPOINTCLOSE</code> is similar but returns -1 if the point is outside the
1462 window or not close to any characters. This is similar to the previous methods but finds characters rather than
1463 inter-character positions.</p>
1465 <p><b id="SCI_POINTXFROMPOSITION">SCI_POINTXFROMPOSITION(&lt;unused&gt;, int pos)</b><br />
1466 <b id="SCI_POINTYFROMPOSITION">SCI_POINTYFROMPOSITION(&lt;unused&gt;, int pos)</b><br />
1467 These messages return the x and y display pixel location of text at position <code>pos</code>
1468 in the document.</p>
1470 <p><b id="SCI_HIDESELECTION">SCI_HIDESELECTION(bool hide)</b><br />
1471 The normal state is to make the selection visible by drawing it as set by <a class="message"
1472 href="#SCI_SETSELFORE"><code>SCI_SETSELFORE</code></a> and <a class="message"
1473 href="#SCI_SETSELBACK"><code>SCI_SETSELBACK</code></a>. However, if you hide the selection, it
1474 is drawn as normal text.</p>
1476 <p><b id="SCI_CHOOSECARETX">SCI_CHOOSECARETX</b><br />
1477 Scintilla remembers the x value of the last position horizontally moved to explicitly by the
1478 user and this value is then used when moving vertically such as by using the up and down keys.
1479 This message sets the current x position of the caret as the remembered value.</p>
1481 <p><b id="SCI_MOVESELECTEDLINESUP">SCI_MOVESELECTEDLINESUP</b><br />
1482 Move the selected lines up one line, shifting the line above after the selection.
1483 The selection will be automatically extended to the beginning of the selection's first line and the end of the seletion's last line.
1484 If nothing was selected, the line the cursor is currently at will be selected.</p>
1486 <p><b id="SCI_MOVESELECTEDLINESDOWN">SCI_MOVESELECTEDLINESDOWN</b><br />
1487 Move the selected lines down one line, shifting the line below before the selection.
1488 The selection will be automatically extended to the beginning of the selection's first line and the end of the seletion's last line.
1489 If nothing was selected, the line the cursor is currently at will be selected.</p>
1491 <h2 id="MultipleSelectionAndVirtualSpace">Multiple Selection and Virtual Space</h2>
1493 <code>
1494 <a class="message" href="#SCI_SETMULTIPLESELECTION">SCI_SETMULTIPLESELECTION(bool multipleSelection)</a><br />
1495 <a class="message" href="#SCI_GETMULTIPLESELECTION">SCI_GETMULTIPLESELECTION</a><br />
1496 <a class="message" href="#SCI_SETADDITIONALSELECTIONTYPING">SCI_SETADDITIONALSELECTIONTYPING(bool additionalSelectionTyping)</a><br />
1497 <a class="message" href="#SCI_GETADDITIONALSELECTIONTYPING">SCI_GETADDITIONALSELECTIONTYPING</a><br />
1498 <a class="message" href="#SCI_SETMULTIPASTE">SCI_SETMULTIPASTE(int multiPaste)</a><br />
1499 <a class="message" href="#SCI_GETMULTIPASTE">SCI_GETMULTIPASTE</a><br />
1500 <a class="message" href="#SCI_SETVIRTUALSPACEOPTIONS">SCI_SETVIRTUALSPACEOPTIONS(int virtualSpaceOptions)</a><br />
1501 <a class="message" href="#SCI_GETVIRTUALSPACEOPTIONS">SCI_GETVIRTUALSPACEOPTIONS</a><br />
1502 <a class="message" href="#SCI_SETRECTANGULARSELECTIONMODIFIER">SCI_SETRECTANGULARSELECTIONMODIFIER(int modifier)</a><br />
1503 <a class="message" href="#SCI_GETRECTANGULARSELECTIONMODIFIER">SCI_GETRECTANGULARSELECTIONMODIFIER</a><br />
1504 <br />
1506 <a class="message" href="#SCI_GETSELECTIONS">SCI_GETSELECTIONS</a><br />
1507 <a class="message" href="#SCI_CLEARSELECTIONS">SCI_CLEARSELECTIONS</a><br />
1508 <a class="message" href="#SCI_SETSELECTION">SCI_SETSELECTION(int caret, int anchor)</a><br />
1509 <a class="message" href="#SCI_ADDSELECTION">SCI_ADDSELECTION(int caret, int anchor)</a><br />
1510 <a class="message" href="#SCI_SETMAINSELECTION">SCI_SETMAINSELECTION(int selection)</a><br />
1511 <a class="message" href="#SCI_GETMAINSELECTION">SCI_GETMAINSELECTION</a><br />
1512 <br />
1514 <a class="message" href="#SCI_SETSELECTIONNCARET">SCI_SETSELECTIONNCARET(int selection, int pos)</a><br />
1515 <a class="message" href="#SCI_GETSELECTIONNCARET">SCI_GETSELECTIONNCARET(int selection)</a><br />
1516 <a class="message" href="#SCI_SETSELECTIONNCARETVIRTUALSPACE">SCI_SETSELECTIONNCARETVIRTUALSPACE(int selection, int space)</a><br />
1517 <a class="message" href="#SCI_GETSELECTIONNCARETVIRTUALSPACE">SCI_GETSELECTIONNCARETVIRTUALSPACE(int selection)</a><br />
1518 <a class="message" href="#SCI_SETSELECTIONNANCHOR">SCI_SETSELECTIONNANCHOR(int selection, int posAnchor)</a><br />
1519 <a class="message" href="#SCI_GETSELECTIONNANCHOR">SCI_GETSELECTIONNANCHOR(int selection)</a><br />
1520 <a class="message" href="#SCI_SETSELECTIONNANCHORVIRTUALSPACE">SCI_SETSELECTIONNANCHORVIRTUALSPACE(int selection, int space)</a><br />
1521 <a class="message" href="#SCI_GETSELECTIONNANCHORVIRTUALSPACE">SCI_GETSELECTIONNANCHORVIRTUALSPACE(int selection)</a><br />
1522 <a class="message" href="#SCI_SETSELECTIONNSTART">SCI_SETSELECTIONNSTART(int selection, int pos)</a><br />
1523 <a class="message" href="#SCI_GETSELECTIONNSTART">SCI_GETSELECTIONNSTART(int selection)</a><br />
1524 <a class="message" href="#SCI_SETSELECTIONNEND">SCI_SETSELECTIONNEND(int selection, int pos)</a><br />
1525 <a class="message" href="#SCI_GETSELECTIONNEND">SCI_GETSELECTIONNEND(int selection)</a><br />
1526 <br />
1528 <a class="message" href="#SCI_SETRECTANGULARSELECTIONCARET">SCI_SETRECTANGULARSELECTIONCARET(int pos)</a><br />
1529 <a class="message" href="#SCI_GETRECTANGULARSELECTIONCARET">SCI_GETRECTANGULARSELECTIONCARET</a><br />
1530 <a class="message" href="#SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE">SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE(int space)</a><br />
1531 <a class="message" href="#SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE">SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE</a><br />
1532 <a class="message" href="#SCI_SETRECTANGULARSELECTIONANCHOR">SCI_SETRECTANGULARSELECTIONANCHOR(int posAnchor)</a><br />
1533 <a class="message" href="#SCI_GETRECTANGULARSELECTIONANCHOR">SCI_GETRECTANGULARSELECTIONANCHOR</a><br />
1534 <a class="message" href="#SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE">SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE(int space)</a><br />
1535 <a class="message" href="#SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE">SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE</a><br />
1536 <br />
1538 <a class="message" href="#SCI_SETADDITIONALSELALPHA">SCI_SETADDITIONALSELALPHA(int alpha)</a><br />
1539 <a class="message" href="#SCI_GETADDITIONALSELALPHA">SCI_GETADDITIONALSELALPHA</a><br />
1540 <a class="message" href="#SCI_SETADDITIONALSELFORE">SCI_SETADDITIONALSELFORE(int colour)</a><br />
1541 <a class="message" href="#SCI_SETADDITIONALSELBACK">SCI_SETADDITIONALSELBACK(int colour)</a><br />
1542 <a class="message" href="#SCI_SETADDITIONALCARETFORE">SCI_SETADDITIONALCARETFORE(int colour)</a><br />
1543 <a class="message" href="#SCI_GETADDITIONALCARETFORE">SCI_GETADDITIONALCARETFORE</a><br />
1544 <a class="message" href="#SCI_SETADDITIONALCARETSBLINK">SCI_SETADDITIONALCARETSBLINK(bool additionalCaretsBlink)</a><br />
1545 <a class="message" href="#SCI_GETADDITIONALCARETSBLINK">SCI_GETADDITIONALCARETSBLINK</a><br />
1546 <a class="message" href="#SCI_SETADDITIONALCARETSVISIBLE">SCI_SETADDITIONALCARETSVISIBLE(bool additionalCaretsVisible)</a><br />
1547 <a class="message" href="#SCI_GETADDITIONALCARETSVISIBLE">SCI_GETADDITIONALCARETSVISIBLE</a><br />
1548 <br />
1550 <a class="message" href="#SCI_SWAPMAINANCHORCARET">SCI_SWAPMAINANCHORCARET</a><br />
1551 <a class="message" href="#SCI_ROTATESELECTION">SCI_ROTATESELECTION</a><br />
1552 </code>
1555 There may be multiple selections active at one time.
1556 More selections are made by holding down the Ctrl key while dragging with the mouse.
1557 The most recent selection is the main selection and determines which part of the document is shown automatically.
1558 Any selection apart from the main selection is called an additional selection.
1559 The calls in the previous section operate on the main selection.
1560 There is always at least one selection.
1561 </p>
1564 Rectangular selections are handled as multiple selections although the original rectangular range is remembered so that
1565 subsequent operations may be handled differently for rectangular selections. For example, pasting a rectangular selection
1566 places each piece in a vertical column.
1567 </p>
1570 Virtual space is space beyond the end of each line. The caret may be moved into virtual space but no real space will be
1571 added to the document until there is some text typed or some other text insertion command is used.
1572 </p>
1574 <p>When discontiguous selections are copied to the clipboard, each selection is added to the clipboard text
1575 in order with no delimiting characters.
1576 For rectangular selections the document's line end is added after each line's text. Rectangular selections
1577 are always copied from top line to bottom, not in the in order of selection.Virtual space is not copied.</p>
1580 <b id="SCI_SETMULTIPLESELECTION">SCI_SETMULTIPLESELECTION(bool multipleSelection)</b><br />
1581 <b id="SCI_GETMULTIPLESELECTION">SCI_GETMULTIPLESELECTION</b><br />
1582 Enable or disable multiple selection. When multiple selection is disabled, it is not possible to select
1583 multiple ranges by holding down the Ctrl key while dragging with the mouse.</p>
1586 <b id="SCI_SETADDITIONALSELECTIONTYPING">SCI_SETADDITIONALSELECTIONTYPING(bool additionalSelectionTyping)</b><br />
1587 <b id="SCI_GETADDITIONALSELECTIONTYPING">SCI_GETADDITIONALSELECTIONTYPING</b><br />
1588 Whether typing, backspace, or delete works with multiple selections simultaneously.</p>
1591 <b id="SCI_SETMULTIPASTE">SCI_SETMULTIPASTE(int multiPaste)</b><br />
1592 <b id="SCI_GETMULTIPASTE">SCI_GETMULTIPASTE</b><br />
1593 When pasting into multiple selections, the pasted text can go into just the main selection with <code>SC_MULTIPASTE_ONCE</code>=0
1594 or into each selection with <code>SC_MULTIPASTE_EACH</code>=1. <code>SC_MULTIPASTE_ONCE</code> is the default.</p>
1597 <b id="SCI_SETVIRTUALSPACEOPTIONS">SCI_SETVIRTUALSPACEOPTIONS(int virtualSpace)</b><br />
1598 <b id="SCI_GETVIRTUALSPACEOPTIONS">SCI_GETVIRTUALSPACEOPTIONS</b><br />
1599 Virtual space can be enabled or disabled for rectangular selections or in other circumstances or in both.
1600 There are two bit flags <code>SCVS_RECTANGULARSELECTION</code>=1 and
1601 <code>SCVS_USERACCESSIBLE</code>=2 which can be set independently.
1602 <code>SCVS_NONE</code>=0, the default, disables all use of virtual space.</p>
1605 <b id="SCI_SETRECTANGULARSELECTIONMODIFIER">SCI_SETRECTANGULARSELECTIONMODIFIER(int modifier)</b><br />
1606 <b id="SCI_GETRECTANGULARSELECTIONMODIFIER">SCI_GETRECTANGULARSELECTIONMODIFIER</b><br />
1607 On GTK+, the key used to indicate that a rectangular selection should be created when combined with a mouse drag can be set.
1608 The three possible values are <code>SCMOD_CTRL</code>=2 (default), <code>SCMOD_ALT</code>=4 or <code>SCMOD_SUPER</code>=8.
1609 Since <code>SCMOD_ALT</code> is often already used by a window manager, the window manager may need configuring to allow this choice.
1610 <code>SCMOD_SUPER</code> is often a system dependent modifier key such as the Left Windows key on a Windows keyboard or the
1611 Command key on a Mac.</p>
1614 <b id="SCI_GETSELECTIONS">SCI_GETSELECTIONS</b><br />
1615 Return the number of selections currently active.</p>
1618 <b id="SCI_CLEARSELECTIONS">SCI_CLEARSELECTIONS</b><br />
1619 Set a single empty selection at 0 as the only selection.</p>
1622 <b id="SCI_SETSELECTION">SCI_SETSELECTION(int caret, int anchor)</b><br />
1623 Set a single selection from <code>anchor</code> to <code>caret</code> as the only selection.</p>
1626 <b id="SCI_ADDSELECTION">SCI_ADDSELECTION(int caret, int anchor)</b><br />
1627 Add a new selection from <code>anchor</code> to <code>caret</code> as the main selection retaining all other
1628 selections as additional selections.
1629 Since there is always at least one selection, to set a list of selections, the first selection should be
1630 added with <code>SCI_SETSELECTION</code> and later selections added with <code>SCI_ADDSELECTION</code></p>
1633 <b id="SCI_SETMAINSELECTION">SCI_SETMAINSELECTION(int selection)</b><br />
1634 <b id="SCI_GETMAINSELECTION">SCI_GETMAINSELECTION</b><br />
1635 One of the selections is the main selection which is used to determine what range of text is automatically visible.
1636 The main selection may be displayed in different colours or with a differently styled caret.
1637 Only an already existing selection can be made main.</p>
1640 <b id="SCI_SETSELECTIONNCARET">SCI_SETSELECTIONNCARET(int selection, int pos)</b><br />
1641 <b id="SCI_GETSELECTIONNCARET">SCI_GETSELECTIONNCARET(int selection)</b><br />
1642 <b id="SCI_SETSELECTIONNCARETVIRTUALSPACE">SCI_SETSELECTIONNCARETVIRTUALSPACE(int selection, int space)</b><br />
1643 <b id="SCI_GETSELECTIONNCARETVIRTUALSPACE">SCI_GETSELECTIONNCARETVIRTUALSPACE(int selection)</b><br />
1644 <b id="SCI_SETSELECTIONNANCHOR">SCI_SETSELECTIONNANCHOR(int selection, int posAnchor)</b><br />
1645 <b id="SCI_GETSELECTIONNANCHOR">SCI_GETSELECTIONNANCHOR(int selection)</b><br />
1646 <b id="SCI_SETSELECTIONNANCHORVIRTUALSPACE">SCI_SETSELECTIONNANCHORVIRTUALSPACE(int selection, int space)</b><br />
1647 <b id="SCI_GETSELECTIONNANCHORVIRTUALSPACE">SCI_GETSELECTIONNANCHORVIRTUALSPACE(int selection)</b><br />
1648 Set or query the position and amount of virtual space for the caret and anchor of each already existing selection.</p>
1651 <b id="SCI_SETSELECTIONNSTART">SCI_SETSELECTIONNSTART(int selection, int pos)</b><br />
1652 <b id="SCI_GETSELECTIONNSTART">SCI_GETSELECTIONNSTART(int selection)</b><br />
1653 <b id="SCI_SETSELECTIONNEND">SCI_SETSELECTIONNEND(int selection, int pos)</b><br />
1654 <b id="SCI_GETSELECTIONNEND">SCI_GETSELECTIONNEND(int selection)</b><br />
1655 Set or query the start and end position of each already existing selection.
1656 Mostly of use to query each range for its text.</p>
1659 <b id="SCI_SETRECTANGULARSELECTIONCARET">SCI_SETRECTANGULARSELECTIONCARET(int pos)</b><br />
1660 <b id="SCI_GETRECTANGULARSELECTIONCARET">SCI_GETRECTANGULARSELECTIONCARET</b><br />
1661 <b id="SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE">SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE(int space)</b><br />
1662 <b id="SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE">SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE</b><br />
1663 <b id="SCI_SETRECTANGULARSELECTIONANCHOR">SCI_SETRECTANGULARSELECTIONANCHOR(int posAnchor)</b><br />
1664 <b id="SCI_GETRECTANGULARSELECTIONANCHOR">SCI_GETRECTANGULARSELECTIONANCHOR</b><br />
1665 <b id="SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE">SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE(int space)</b><br />
1666 <b id="SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE">SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE</b><br />
1667 Set or query the position and amount of virtual space for the caret and anchor of the rectangular selection.
1668 After setting the rectangular selection, this is broken down into multiple selections, one for each line.</p>
1671 <b id="SCI_SETADDITIONALSELALPHA">SCI_SETADDITIONALSELALPHA(int alpha)</b><br />
1672 <b id="SCI_GETADDITIONALSELALPHA">SCI_GETADDITIONALSELALPHA</b><br />
1673 <b id="SCI_SETADDITIONALSELFORE">SCI_SETADDITIONALSELFORE(int <a class="jump" href="#colour">colour</a>)</b><br />
1674 <b id="SCI_SETADDITIONALSELBACK">SCI_SETADDITIONALSELBACK(int <a class="jump" href="#colour">colour</a>)</b><br />
1675 Modify the appearence of additional selections so that they can be differentiated from the main selection which has its appearence set with
1676 <a class="message" href="#SCI_SETSELALPHA"><code>SCI_SETSELALPHA</code></a>,
1677 <a class="message" href="#SCI_GETSELALPHA"><code>SCI_GETSELALPHA</code></a>,
1678 <a class="message" href="#SCI_SETSELFORE"><code>SCI_SETSELFORE</code></a>, and
1679 <a class="message" href="#SCI_SETSELBACK"><code>SCI_SETSELBACK</code></a>.</p>
1682 <b id="SCI_SETADDITIONALCARETFORE">SCI_SETADDITIONALCARETFORE(int <a class="jump" href="#colour">colour</a>)</b><br />
1683 <b id="SCI_GETADDITIONALCARETFORE">SCI_GETADDITIONALCARETFORE</b><br />
1684 <b id="SCI_SETADDITIONALCARETSBLINK">SCI_SETADDITIONALCARETSBLINK(bool additionalCaretsBlink)</b><br />
1685 <b id="SCI_GETADDITIONALCARETSBLINK">SCI_GETADDITIONALCARETSBLINK</b><br />
1686 Modify the appearence of additional carets so that they can be differentiated from the main caret which has its appearence set with
1687 <a class="message" href="#SCI_SETCARETFORE"><code>SCI_SETCARETFORE</code></a>,
1688 <a class="message" href="#SCI_GETCARETFORE"><code>SCI_GETCARETFORE</code></a>,
1689 <a class="message" href="#SCI_SETCARETPERIOD"><code>SCI_SETCARETPERIOD</code></a>, and
1690 <a class="message" href="#SCI_GETCARETPERIOD"><code>SCI_GETCARETPERIOD</code></a>.</p>
1693 <b id="SCI_SETADDITIONALCARETSVISIBLE">SCI_SETADDITIONALCARETSVISIBLE(bool additionalCaretsVisible)</b><br />
1694 <b id="SCI_GETADDITIONALCARETSVISIBLE">SCI_GETADDITIONALCARETSVISIBLE</b><br />
1695 Determine whether to show additional carets (defaults to <code>true</code>).</p>
1698 <b id="SCI_SWAPMAINANCHORCARET">SCI_SWAPMAINANCHORCARET</b><br />
1699 <b id="SCI_ROTATESELECTION">SCI_ROTATESELECTION</b><br />
1700 These commands may be assigned to keys to make it possible to manipulate multiple selections.
1701 <code>SCI_SWAPMAINANCHORCARET</code> moves the caret to the opposite end of the main selection.
1702 <code>SCI_ROTATESELECTION</code> makes the next selection be the main selection.
1703 </p>
1705 <h2 id="ScrollingAndAutomaticScrolling">Scrolling and automatic scrolling</h2>
1706 <code><a class="message" href="#SCI_LINESCROLL">SCI_LINESCROLL(int column, int line)</a><br />
1707 <a class="message" href="#SCI_SCROLLCARET">SCI_SCROLLCARET</a><br />
1708 <a class="message" href="#SCI_SETXCARETPOLICY">SCI_SETXCARETPOLICY(int caretPolicy, int
1709 caretSlop)</a><br />
1710 <a class="message" href="#SCI_SETYCARETPOLICY">SCI_SETYCARETPOLICY(int caretPolicy, int
1711 caretSlop)</a><br />
1712 <a class="message" href="#SCI_SETVISIBLEPOLICY">SCI_SETVISIBLEPOLICY(int caretPolicy, int
1713 caretSlop)</a><br />
1714 <a class="message" href="#SCI_SETHSCROLLBAR">SCI_SETHSCROLLBAR(bool visible)</a><br />
1715 <a class="message" href="#SCI_GETHSCROLLBAR">SCI_GETHSCROLLBAR</a><br />
1716 <a class="message" href="#SCI_SETVSCROLLBAR">SCI_SETVSCROLLBAR(bool visible)</a><br />
1717 <a class="message" href="#SCI_GETVSCROLLBAR">SCI_GETVSCROLLBAR</a><br />
1718 <a class="message" href="#SCI_GETXOFFSET">SCI_GETXOFFSET</a><br />
1719 <a class="message" href="#SCI_SETXOFFSET">SCI_SETXOFFSET(int xOffset)</a><br />
1720 <a class="message" href="#SCI_SETSCROLLWIDTH">SCI_SETSCROLLWIDTH(int pixelWidth)</a><br />
1721 <a class="message" href="#SCI_GETSCROLLWIDTH">SCI_GETSCROLLWIDTH</a><br />
1722 <a class="message" href="#SCI_SETSCROLLWIDTHTRACKING">SCI_SETSCROLLWIDTHTRACKING(bool tracking)</a><br />
1723 <a class="message" href="#SCI_GETSCROLLWIDTHTRACKING">SCI_GETSCROLLWIDTHTRACKING</a><br />
1724 <a class="message" href="#SCI_SETENDATLASTLINE">SCI_SETENDATLASTLINE(bool
1725 endAtLastLine)</a><br />
1726 <a class="message" href="#SCI_GETENDATLASTLINE">SCI_GETENDATLASTLINE</a><br />
1727 </code>
1729 <p><b id="SCI_LINESCROLL">SCI_LINESCROLL(int column, int line)</b><br />
1730 This will attempt to scroll the display by the number of columns and lines that you specify.
1731 Positive line values increase the line number at the top of the screen (i.e. they move the text
1732 upwards as far as the user is concerned), Negative line values do the reverse.</p>
1734 <p>The column measure is the width of a space in the default style. Positive values increase
1735 the column at the left edge of the view (i.e. they move the text leftwards as far as the user
1736 is concerned). Negative values do the reverse.</p>
1738 <p>See also: <a class="message" href="#SCI_SETXOFFSET"><code>SCI_SETXOFFSET</code></a></p>
1740 <p><b id="SCI_SCROLLCARET">SCI_SCROLLCARET</b><br />
1741 If the current position (this is the caret if there is no selection) is not visible, the view
1742 is scrolled to make it visible according to the current caret policy.</p>
1744 <p><b id="SCI_SETXCARETPOLICY">SCI_SETXCARETPOLICY(int caretPolicy, int caretSlop)</b><br />
1745 <b id="SCI_SETYCARETPOLICY">SCI_SETYCARETPOLICY(int caretPolicy, int caretSlop)</b><br />
1746 These set the caret policy. The value of <code>caretPolicy</code> is a combination of
1747 <code>CARET_SLOP</code>, <code>CARET_STRICT</code>, <code>CARET_JUMPS</code> and
1748 <code>CARET_EVEN</code>.</p>
1750 <table cellpadding="1" cellspacing="2" border="0" summary="Caret policy">
1751 <tbody valign="top">
1752 <tr>
1753 <th align="left"><code>CARET_SLOP</code></th>
1755 <td>If set, we can define a slop value: <code>caretSlop</code>. This value defines an
1756 unwanted zone (UZ) where the caret is... unwanted. This zone is defined as a number of
1757 pixels near the vertical margins, and as a number of lines near the horizontal margins.
1758 By keeping the caret away from the edges, it is seen within its context. This makes it
1759 likely that the identifier that the caret is on can be completely seen, and that the
1760 current line is seen with some of the lines following it, which are often dependent on
1761 that line.</td>
1762 </tr>
1764 <tr>
1765 <th align="left"><code>CARET_STRICT</code></th>
1767 <td>If set, the policy set by <code>CARET_SLOP</code> is enforced... strictly. The caret
1768 is centred on the display if <code>caretSlop</code> is not set, and cannot go in the UZ
1769 if <code>caretSlop</code> is set.</td>
1770 </tr>
1772 <tr>
1773 <th align="left"><code>CARET_JUMPS</code></th>
1775 <td>If set, the display is moved more energetically so the caret can move in the same
1776 direction longer before the policy is applied again. '3UZ' notation is used to indicate
1777 three time the size of the UZ as a distance to the margin.</td>
1778 </tr>
1780 <tr>
1781 <th align="left"><code>CARET_EVEN</code></th>
1783 <td>If not set, instead of having symmetrical UZs, the left and bottom UZs are extended
1784 up to right and top UZs respectively. This way, we favour the displaying of useful
1785 information: the beginning of lines, where most code reside, and the lines after the
1786 caret, for example, the body of a function.</td>
1787 </tr>
1788 </tbody>
1789 </table>
1791 <table cellpadding="3" cellspacing="0" border="1" summary="Caret positioning">
1792 <thead align="center">
1793 <tr>
1794 <th>slop</th>
1796 <th>strict</th>
1798 <th>jumps</th>
1800 <th>even</th>
1802 <th>Caret can go to the margin</th>
1804 <th>On reaching limit (going out of visibility<br />
1805 or going into the UZ) display is...</th>
1806 </tr>
1807 </thead>
1809 <tbody align="center">
1810 <tr>
1811 <td>0</td>
1813 <td>0</td>
1815 <td>0</td>
1817 <td>0</td>
1819 <td>Yes</td>
1821 <td>moved to put caret on top/on right</td>
1822 </tr>
1824 <tr>
1825 <td>0</td>
1827 <td>0</td>
1829 <td>0</td>
1831 <td>1</td>
1833 <td>Yes</td>
1835 <td>moved by one position</td>
1836 </tr>
1838 <tr>
1839 <td>0</td>
1841 <td>0</td>
1843 <td>1</td>
1845 <td>0</td>
1847 <td>Yes</td>
1849 <td>moved to put caret on top/on right</td>
1850 </tr>
1852 <tr>
1853 <td>0</td>
1855 <td>0</td>
1857 <td>1</td>
1859 <td>1</td>
1861 <td>Yes</td>
1863 <td>centred on the caret</td>
1864 </tr>
1866 <tr>
1867 <td>0</td>
1869 <td>1</td>
1871 <td>-</td>
1873 <td>0</td>
1875 <td>Caret is always on top/on right of display</td>
1877 <td>-</td>
1878 </tr>
1880 <tr>
1881 <td>0</td>
1883 <td>1</td>
1885 <td>-</td>
1887 <td>1</td>
1889 <td>No, caret is always centred</td>
1891 <td>-</td>
1892 </tr>
1894 <tr>
1895 <td>1</td>
1897 <td>0</td>
1899 <td>0</td>
1901 <td>0</td>
1903 <td>Yes</td>
1905 <td>moved to put caret out of the asymmetrical UZ</td>
1906 </tr>
1908 <tr>
1909 <td>1</td>
1911 <td>0</td>
1913 <td>0</td>
1915 <td>1</td>
1917 <td>Yes</td>
1919 <td>moved to put caret out of the UZ</td>
1920 </tr>
1922 <tr>
1923 <td>1</td>
1925 <td>0</td>
1927 <td>1</td>
1929 <td>0</td>
1931 <td>Yes</td>
1933 <td>moved to put caret at 3UZ of the top or right margin</td>
1934 </tr>
1936 <tr>
1937 <td>1</td>
1939 <td>0</td>
1941 <td>1</td>
1943 <td>1</td>
1945 <td>Yes</td>
1947 <td>moved to put caret at 3UZ of the margin</td>
1948 </tr>
1950 <tr>
1951 <td>1</td>
1953 <td>1</td>
1955 <td>-</td>
1957 <td>0</td>
1959 <td>Caret is always at UZ of top/right margin</td>
1961 <td>-</td>
1962 </tr>
1964 <tr>
1965 <td>1</td>
1967 <td>1</td>
1969 <td>0</td>
1971 <td>1</td>
1973 <td>No, kept out of UZ</td>
1975 <td>moved by one position</td>
1976 </tr>
1978 <tr>
1979 <td>1</td>
1981 <td>1</td>
1983 <td>1</td>
1985 <td>0</td>
1987 <td>No, kept out of UZ</td>
1989 <td>moved to put caret at 3UZ of the margin</td>
1990 </tr>
1991 </tbody>
1992 </table>
1994 <p><b id="SCI_SETVISIBLEPOLICY">SCI_SETVISIBLEPOLICY(int caretPolicy, int caretSlop)</b><br />
1995 This determines how the vertical positioning is determined when <a class="message"
1996 href="#SCI_ENSUREVISIBLEENFORCEPOLICY"><code>SCI_ENSUREVISIBLEENFORCEPOLICY</code></a> is
1997 called. It takes <code>VISIBLE_SLOP</code> and <code>VISIBLE_STRICT</code> flags for the policy
1998 parameter. It is similar in operation to <a class="message"
1999 href="#SCI_SETYCARETPOLICY"><code>SCI_SETYCARETPOLICY(int caretPolicy, int
2000 caretSlop)</code></a>.</p>
2002 <p><b id="SCI_SETHSCROLLBAR">SCI_SETHSCROLLBAR(bool visible)</b><br />
2003 <b id="SCI_GETHSCROLLBAR">SCI_GETHSCROLLBAR</b><br />
2004 The horizontal scroll bar is only displayed if it is needed for the assumed width.
2005 If you never wish to see it, call
2006 <code>SCI_SETHSCROLLBAR(0)</code>. Use <code>SCI_SETHSCROLLBAR(1)</code> to enable it again.
2007 <code>SCI_GETHSCROLLBAR</code> returns the current state. The default state is to display it
2008 when needed.</p>
2009 <p>See also: <a class="message" href="#SCI_SETSCROLLWIDTH">SCI_SETSCROLLWIDTH</a>.</p>
2011 <p><b id="SCI_SETVSCROLLBAR">SCI_SETVSCROLLBAR(bool visible)</b><br />
2012 <b id="SCI_GETVSCROLLBAR">SCI_GETVSCROLLBAR</b><br />
2013 By default, the vertical scroll bar is always displayed when required. You can choose to hide
2014 or show it with <code>SCI_SETVSCROLLBAR</code> and get the current state with
2015 <code>SCI_GETVSCROLLBAR</code>.</p>
2017 <p><b id="SCI_SETXOFFSET">SCI_SETXOFFSET(int xOffset)</b><br />
2018 <b id="SCI_GETXOFFSET">SCI_GETXOFFSET</b><br />
2019 The <code>xOffset</code> is the horizontal scroll position in pixels of the start of the text
2020 view. A value of 0 is the normal position with the first text column visible at the left of the
2021 view.</p>
2023 <p>See also: <a class="message" href="#SCI_LINESCROLL"><code>SCI_LINESCROLL</code></a></p>
2025 <p><b id="SCI_SETSCROLLWIDTH">SCI_SETSCROLLWIDTH(int pixelWidth)</b><br />
2026 <b id="SCI_GETSCROLLWIDTH">SCI_GETSCROLLWIDTH</b><br />
2027 For performance, Scintilla does not measure the display width of the document to determine
2028 the properties of the horizontal scroll bar. Instead, an assumed width is used.
2029 These messages set and get the document width in pixels assumed by Scintilla.
2030 The default value is 2000.
2031 To ensure the width of the currently visible lines can be scrolled use
2032 <a class="message" href="#SCI_SETSCROLLWIDTHTRACKING"><code>SCI_SETSCROLLWIDTHTRACKING</code></a></p>
2034 <p><b id="SCI_SETSCROLLWIDTHTRACKING">SCI_SETSCROLLWIDTHTRACKING(bool tracking)</b><br />
2035 <b id="SCI_GETSCROLLWIDTHTRACKING">SCI_GETSCROLLWIDTHTRACKING</b><br />
2036 If scroll width tracking is enabled then the scroll width is adjusted to ensure that all of the lines currently
2037 displayed can be completely scrolled. This mode never adjusts the scroll width to be narrower.</p>
2039 <p><b id="SCI_SETENDATLASTLINE">SCI_SETENDATLASTLINE(bool endAtLastLine)</b><br />
2040 <b id="SCI_GETENDATLASTLINE">SCI_GETENDATLASTLINE</b><br />
2041 <code>SCI_SETENDATLASTLINE</code> sets the scroll range so that maximum scroll position has
2042 the last line at the bottom of the view (default). Setting this to <code>false</code> allows
2043 scrolling one page below the last line.</p>
2045 <h2 id="WhiteSpace">White space</h2>
2046 <code><a class="message" href="#SCI_SETVIEWWS">SCI_SETVIEWWS(int wsMode)</a><br />
2047 <a class="message" href="#SCI_GETVIEWWS">SCI_GETVIEWWS</a><br />
2048 <a class="message" href="#SCI_SETWHITESPACEFORE">SCI_SETWHITESPACEFORE(bool
2049 useWhitespaceForeColour, int colour)</a><br />
2050 <a class="message" href="#SCI_SETWHITESPACEBACK">SCI_SETWHITESPACEBACK(bool
2051 useWhitespaceBackColour, int colour)</a><br />
2052 <a class="message" href="#SCI_SETWHITESPACESIZE">SCI_SETWHITESPACESIZE(int
2053 size)</a><br />
2054 <a class="message" href="#SCI_GETWHITESPACESIZE">SCI_GETWHITESPACESIZE</a><br />
2055 <a class="message" href="#SCI_SETEXTRAASCENT">SCI_SETEXTRAASCENT(int extraAscent)</a><br />
2056 <a class="message" href="#SCI_GETEXTRAASCENT">SCI_GETEXTRAASCENT</a><br />
2057 <a class="message" href="#SCI_SETEXTRADESCENT">SCI_SETEXTRADESCENT(int extraDescent)</a><br />
2058 <a class="message" href="#SCI_GETEXTRADESCENT">SCI_GETEXTRADESCENT</a><br />
2059 </code>
2061 <p><b id="SCI_SETVIEWWS">SCI_SETVIEWWS(int wsMode)</b><br />
2062 <b id="SCI_GETVIEWWS">SCI_GETVIEWWS</b><br />
2063 White space can be made visible which may be useful for languages in which white space is
2064 significant, such as Python. Space characters appear as small centred dots and tab characters
2065 as light arrows pointing to the right. There are also ways to control the display of <a
2066 class="jump" href="#LineEndings">end of line characters</a>. The two messages set and get the
2067 white space display mode. The <code>wsMode</code> argument can be one of:</p>
2069 <table cellpadding="1" cellspacing="2" border="0" summary="White space policy">
2070 <tbody valign="top">
2071 <tr>
2072 <th align="left"><code>SCWS_INVISIBLE</code></th>
2074 <td>0</td>
2076 <td>The normal display mode with white space displayed as an empty background
2077 colour.</td>
2078 </tr>
2080 <tr>
2081 <th align="left"><code>SCWS_VISIBLEALWAYS</code></th>
2083 <td>1</td>
2085 <td>White space characters are drawn as dots and arrows,</td>
2086 </tr>
2088 <tr>
2089 <th align="left"><code>SCWS_VISIBLEAFTERINDENT</code></th>
2091 <td>2</td>
2093 <td>White space used for indentation is displayed normally but after the first visible
2094 character, it is shown as dots and arrows.</td>
2095 </tr>
2096 </tbody>
2097 </table>
2099 <p>The effect of using any other <code>wsMode</code> value is undefined.</p>
2101 <p><b id="SCI_SETWHITESPACEFORE">SCI_SETWHITESPACEFORE(bool useWhitespaceForeColour, int <a
2102 class="jump" href="#colour">colour</a>)</b><br />
2103 <b id="SCI_SETWHITESPACEBACK">SCI_SETWHITESPACEBACK(bool useWhitespaceBackColour, int <a
2104 class="jump" href="#colour">colour</a>)</b><br />
2105 By default, the colour of visible white space is determined by the lexer in use. The
2106 foreground and/or background colour of all visible white space can be set globally, overriding
2107 the lexer's colours with <code>SCI_SETWHITESPACEFORE</code> and
2108 <code>SCI_SETWHITESPACEBACK</code>.</p>
2110 <p><b id="SCI_SETWHITESPACESIZE">SCI_SETWHITESPACESIZE(int size)</b><br />
2111 <b id="SCI_GETWHITESPACESIZE">SCI_GETWHITESPACESIZE</b><br />
2112 <code>SCI_SETWHITESPACESIZE</code> sets the size of the dots used for mark space characters.
2113 The <code>SCI_GETWHITESPACESIZE</code> message retrieves the current size.
2114 </p>
2117 <b id="SCI_SETEXTRAASCENT">SCI_SETEXTRAASCENT(int extraAscent)</b><br />
2118 <b id="SCI_GETEXTRAASCENT">SCI_GETEXTRAASCENT</b><br />
2119 <b id="SCI_SETEXTRADESCENT">SCI_SETEXTRADESCENT(int extraDescent)</b><br />
2120 <b id="SCI_GETEXTRADESCENT">SCI_GETEXTRADESCENT</b><br />
2121 Text is drawn with the base of each character on a 'baseline'. The height of a line is found from the maximum
2122 that any style extends above the baseline (its 'ascent'), added to the maximum that any style extends below the
2123 baseline (its 'descent').
2124 Space may be added to the maximum ascent (<code>SCI_SETEXTRAASCENT</code>) and the
2125 maximum descent (<code>SCI_SETEXTRADESCENT</code>) to allow for more space between lines.
2126 This may done to make the text easier to read or to accomodate underlines or highlights.
2127 </p>
2129 <h2 id="Cursor">Cursor</h2>
2131 <p><b id="SCI_SETCURSOR">SCI_SETCURSOR(int curType)</b><br />
2132 <b id="SCI_GETCURSOR">SCI_GETCURSOR</b><br />
2133 The cursor is normally chosen in a context sensitive way, so it will be different over the
2134 margin than when over the text. When performing a slow action, you may wish to change to a wait
2135 cursor. You set the cursor type with <code>SCI_SETCURSOR</code>. The <code>curType</code>
2136 argument can be:</p>
2138 <table cellpadding="1" cellspacing="2" border="0" summary="Mouse cursors">
2139 <tbody valign="top">
2140 <tr>
2141 <th align="left"><code>SC_CURSORNORMAL</code></th>
2143 <td>-1</td>
2145 <td>The normal cursor is displayed.</td>
2146 </tr>
2148 <tr>
2149 <th align="left"><code>SC_CURSORWAIT</code></th>
2151 <td>&nbsp;4</td>
2153 <td>The wait cursor is displayed when the mouse is over or owned by the Scintilla
2154 window.</td>
2155 </tr>
2156 </tbody>
2157 </table>
2159 <p>Cursor values 1 through 7 have defined cursors, but only <code>SC_CURSORWAIT</code> is
2160 usefully controllable. Other values of <code>curType</code> cause a pointer to be displayed.
2161 The <code>SCI_GETCURSOR</code> message returns the last cursor type you set, or
2162 <code>SC_CURSORNORMAL</code> (-1) if you have not set a cursor type.</p>
2164 <h2 id="MouseCapture">Mouse capture</h2>
2166 <p><b id="SCI_SETMOUSEDOWNCAPTURES">SCI_SETMOUSEDOWNCAPTURES(bool captures)</b><br />
2167 <b id="SCI_GETMOUSEDOWNCAPTURES">SCI_GETMOUSEDOWNCAPTURES</b><br />
2168 When the mouse is pressed inside Scintilla, it is captured so future mouse movement events are
2169 sent to Scintilla. This behavior may be turned off with
2170 <code>SCI_SETMOUSEDOWNCAPTURES(0)</code>.</p>
2172 <h2 id="LineEndings">Line endings</h2>
2174 <p>Scintilla can interpret any of the three major line end conventions, Macintosh (\r), Unix
2175 (\n) and CP/M / DOS / Windows (\r\n). When the user presses the Enter key, one of these line
2176 end strings is inserted into the buffer. The default is \r\n in Windows and \n in Unix, but
2177 this can be changed with the <code>SCI_SETEOLMODE</code> message. You can also convert the
2178 entire document to one of these line endings with <code>SCI_CONVERTEOLS</code>. Finally, you
2179 can choose to display the line endings with <code>SCI_SETVIEWEOL</code>.</p>
2180 <code><a class="message" href="#SCI_SETEOLMODE">SCI_SETEOLMODE(int eolMode)</a><br />
2181 <a class="message" href="#SCI_GETEOLMODE">SCI_GETEOLMODE</a><br />
2182 <a class="message" href="#SCI_CONVERTEOLS">SCI_CONVERTEOLS(int eolMode)</a><br />
2183 <a class="message" href="#SCI_SETVIEWEOL">SCI_SETVIEWEOL(bool visible)</a><br />
2184 <a class="message" href="#SCI_GETVIEWEOL">SCI_GETVIEWEOL</a><br />
2185 </code>
2187 <p><b id="SCI_SETEOLMODE">SCI_SETEOLMODE(int eolMode)</b><br />
2188 <b id="SCI_GETEOLMODE">SCI_GETEOLMODE</b><br />
2189 <code>SCI_SETEOLMODE</code> sets the characters that are added into the document when the user
2190 presses the Enter key. You can set <code>eolMode</code> to one of <code>SC_EOL_CRLF</code> (0),
2191 <code>SC_EOL_CR</code> (1), or <code>SC_EOL_LF</code> (2). The <code>SCI_GETEOLMODE</code>
2192 message retrieves the current state.</p>
2194 <p><b id="SCI_CONVERTEOLS">SCI_CONVERTEOLS(int eolMode)</b><br />
2195 This message changes all the end of line characters in the document to match
2196 <code>eolMode</code>. Valid values are: <code>SC_EOL_CRLF</code> (0), <code>SC_EOL_CR</code>
2197 (1), or <code>SC_EOL_LF</code> (2).</p>
2199 <p><b id="SCI_SETVIEWEOL">SCI_SETVIEWEOL(bool visible)</b><br />
2200 <b id="SCI_GETVIEWEOL">SCI_GETVIEWEOL</b><br />
2201 Normally, the end of line characters are hidden, but <code>SCI_SETVIEWEOL</code> allows you to
2202 display (or hide) them by setting <code>visible</code> <code>true</code> (or
2203 <code>false</code>). The visible rendering of the end of line characters is similar to
2204 <code>(CR)</code>, <code>(LF)</code>, or <code>(CR)(LF)</code>. <code>SCI_GETVIEWEOL</code>
2205 returns the current state.</p>
2207 <h2 id="Styling">Styling</h2>
2209 <p>The styling messages allow you to assign styles to text. The standard Scintilla settings
2210 divide the 8 style bits available for each character into 5 bits (0 to 4 = <a class="jump"
2211 href="#StyleDefinition">styles 0 to 31</a>) that set a style and three bits (5 to 7) that
2212 define <a class="jump" href="#Indicators">indicators</a>. You can change the balance between
2213 styles and indicators with <a class="message"
2214 href="#SCI_SETSTYLEBITS"><code>SCI_SETSTYLEBITS</code></a>. If your styling needs can be met by
2215 one of the standard lexers, or if you can write your own, then a lexer is probably the easiest
2216 way to style your document. If you choose to use the container to do the styling you can use
2217 the <a class="message" href="#SCI_SETLEXER"><code>SCI_SETLEXER</code></a> command to select
2218 <code>SCLEX_CONTAINER</code>, in which case the container is sent a <a class="message"
2219 href="#SCN_STYLENEEDED"><code>SCN_STYLENEEDED</code></a> <a class="jump"
2220 href="#Notifications">notification</a> each time text needs styling for display. As another
2221 alternative, you might use idle time to style the document. Even if you use a lexer, you might
2222 use the styling commands to mark errors detected by a compiler. The following commands can be
2223 used.</p>
2224 <code><a class="message" href="#SCI_GETENDSTYLED">SCI_GETENDSTYLED</a><br />
2225 <a class="message" href="#SCI_STARTSTYLING">SCI_STARTSTYLING(int position, int mask)</a><br />
2226 <a class="message" href="#SCI_SETSTYLING">SCI_SETSTYLING(int length, int style)</a><br />
2227 <a class="message" href="#SCI_SETSTYLINGEX">SCI_SETSTYLINGEX(int length, const char
2228 *styles)</a><br />
2229 <a class="message" href="#SCI_SETLINESTATE">SCI_SETLINESTATE(int line, int value)</a><br />
2230 <a class="message" href="#SCI_GETLINESTATE">SCI_GETLINESTATE(int line)</a><br />
2231 <a class="message" href="#SCI_GETMAXLINESTATE">SCI_GETMAXLINESTATE</a><br />
2232 </code>
2234 <p><b id="SCI_GETENDSTYLED">SCI_GETENDSTYLED</b><br />
2235 Scintilla keeps a record of the last character that is likely to be styled correctly. This is
2236 moved forwards when characters after it are styled and moved backwards if changes are made to
2237 the text of the document before it. Before drawing text, this position is checked to see if any
2238 styling is needed and, if so, a <code><a class="message"
2239 href="#SCN_STYLENEEDED">SCN_STYLENEEDED</a></code> notification message is sent to the
2240 container. The container can send <code>SCI_GETENDSTYLED</code> to work out where it needs to
2241 start styling. Scintilla will always ask to style whole lines.</p>
2243 <p><b id="SCI_STARTSTYLING">SCI_STARTSTYLING(int pos, int mask)</b><br />
2244 This prepares for styling by setting the styling position <code>pos</code> to start at and a
2245 <code>mask</code> indicating which bits of the style bytes can be set. The mask allows styling
2246 to occur over several passes, with, for example, basic styling done on an initial pass to
2247 ensure that the text of the code is seen quickly and correctly, and then a second slower pass,
2248 detecting syntax errors and using indicators to show where these are. For example, with the
2249 standard settings of 5 style bits and 3 indicator bits, you would use a <code>mask</code> value
2250 of 31 (0x1f) if you were setting text styles and did not want to change the indicators. After
2251 <code>SCI_STARTSTYLING</code>, send multiple <code>SCI_SETSTYLING</code> messages for each
2252 lexical entity to style.</p>
2254 <p><b id="SCI_SETSTYLING">SCI_SETSTYLING(int length, int style)</b><br />
2255 This message sets the style of <code>length</code> characters starting at the styling position
2256 and then increases the styling position by <code>length</code>, ready for the next call. If
2257 <code>sCell</code> is the style byte, the operation is:<br />
2258 <code>if ((sCell &amp; mask) != style) sCell = (sCell &amp; ~mask) | (style &amp;
2259 mask);</code><br />
2260 </p>
2262 <p><b id="SCI_SETSTYLINGEX">SCI_SETSTYLINGEX(int length, const char *styles)</b><br />
2263 As an alternative to <code>SCI_SETSTYLING</code>, which applies the same style to each byte,
2264 you can use this message which specifies the styles for each of <code>length</code> bytes from
2265 the styling position and then increases the styling position by <code>length</code>, ready for
2266 the next call. The <code>length</code> styling bytes pointed at by <code>styles</code> should
2267 not contain any bits not set in mask.</p>
2269 <p><b id="SCI_SETLINESTATE">SCI_SETLINESTATE(int line, int value)</b><br />
2270 <b id="SCI_GETLINESTATE">SCI_GETLINESTATE(int line)</b><br />
2271 As well as the 8 bits of lexical state stored for each character there is also an integer
2272 stored for each line. This can be used for longer lived parse states such as what the current
2273 scripting language is in an ASP page. Use <code>SCI_SETLINESTATE</code> to set the integer
2274 value and <code>SCI_GETLINESTATE</code> to get the value.
2275 Changing the value produces a <a class="message" href="#SC_MOD_CHANGELINESTATE">SC_MOD_CHANGELINESTATE</a> notification.
2276 </p>
2278 <p><b id="SCI_GETMAXLINESTATE">SCI_GETMAXLINESTATE</b><br />
2279 This returns the last line that has any line state.</p>
2281 <h2 id="StyleDefinition">Style definition</h2>
2283 <p>While the style setting messages mentioned above change the style numbers associated with
2284 text, these messages define how those style numbers are interpreted visually. There are 256
2285 lexer styles that can be set, numbered 0 to <code>STYLE_MAX</code> (255). Unless you use <a
2286 class="message" href="#SCI_SETSTYLEBITS"><code>SCI_SETSTYLEBITS</code></a> to change the number
2287 of style bits, styles 0 to 31 are used to set the text attributes. There are also some
2288 predefined numbered styles starting at 32, The following <code>STYLE_</code>* constants are
2289 defined.</p>
2291 <table cellpadding="1" cellspacing="2" border="0" summary="Preset styles">
2292 <tbody valign="top">
2293 <tr>
2294 <th align="left"><code>STYLE_DEFAULT</code></th>
2296 <td>32</td>
2298 <td>This style defines the attributes that all styles receive when the
2299 <code>SCI_STYLECLEARALL</code> message is used.</td>
2300 </tr>
2302 <tr>
2303 <th align="left"><code>STYLE_LINENUMBER</code></th>
2305 <td>33</td>
2307 <td>This style sets the attributes of the text used to display line numbers in a line
2308 number margin. The background colour set for this style also sets the background colour
2309 for all margins that do not have any folding mask bits set. That is, any margin for which
2310 <code>mask &amp; SC_MASK_FOLDERS</code> is 0. See <a class="message"
2311 href="#SCI_SETMARGINMASKN"><code>SCI_SETMARGINMASKN</code></a> for more about masks.</td>
2312 </tr>
2314 <tr>
2315 <th align="left"><code>STYLE_BRACELIGHT</code></th>
2317 <td>34</td>
2319 <td>This style sets the attributes used when highlighting braces with the <a
2320 class="message" href="#BraceHighlighting"><code>SCI_BRACEHIGHLIGHT</code></a> message and
2321 when highlighting the corresponding indentation with <a class="message"
2322 href="#SCI_SETHIGHLIGHTGUIDE"><code>SCI_SETHIGHLIGHTGUIDE</code></a>.</td>
2323 </tr>
2325 <tr>
2326 <th align="left"><code>STYLE_BRACEBAD</code></th>
2328 <td>35</td>
2330 <td>This style sets the display attributes used when marking an unmatched brace with the
2331 <a class="message" href="#BraceHighlighting"><code>SCI_BRACEBADLIGHT</code></a>
2332 message.</td>
2333 </tr>
2335 <tr>
2336 <th align="left"><code>STYLE_CONTROLCHAR</code></th>
2338 <td>36</td>
2340 <td>This style sets the font used when drawing control characters.
2341 Only the font, size, bold, italics, and character set attributes are used and not
2342 the colour attributes. See
2343 also: <a class="message"
2344 href="#SCI_SETCONTROLCHARSYMBOL"><code>SCI_SETCONTROLCHARSYMBOL</code></a>.</td>
2345 </tr>
2347 <tr>
2348 <th align="left"><code>STYLE_INDENTGUIDE</code></th>
2350 <td>37</td>
2352 <td>This style sets the foreground and background colours used when drawing the
2353 indentation guides.</td>
2354 </tr>
2356 <tr>
2357 <th align="left"><code>STYLE_CALLTIP</code></th>
2359 <td>38</td>
2361 <td> Call tips normally use the font attributes defined by <code>STYLE_DEFAULT</code>.
2362 Use of <a class="message" href="#SCI_CALLTIPUSESTYLE"><code>SCI_CALLTIPUSESTYLE</code></a>
2363 causes call tips to use this style instead. Only the font face name, font size,
2364 foreground and background colours and character set attributes are used.</td>
2365 </tr>
2367 <tr>
2368 <th align="left"><code>STYLE_LASTPREDEFINED</code></th>
2370 <td>39</td>
2372 <td>To make it easier for client code to discover the range of styles that are
2373 predefined, this is set to the style number of the last predefined style. This is
2374 currently set to 39 and the last style with an identifier is 38, which reserves space
2375 for one future predefined style.</td>
2376 </tr>
2378 <tr>
2379 <th align="left"><code>STYLE_MAX</code></th>
2381 <td>255</td>
2383 <td>This is not a style but is the number of the maximum style that can be set. Styles
2384 between <code>STYLE_LASTPREDEFINED</code> and <code>STYLE_MAX</code> would be appropriate
2385 if you used <a class="message" href="#SCI_SETSTYLEBITS"><code>SCI_SETSTYLEBITS</code></a>
2386 to set more than 5 style bits.</td>
2387 </tr>
2388 </tbody>
2389 </table>
2391 <p>For each style you can set the font name, size and use of bold, italic and underline,
2392 foreground and background colour and the character set. You can also choose to hide text with a
2393 given style, display all characters as upper or lower case and fill from the last character on
2394 a line to the end of the line (for embedded languages). There is also an experimental attribute
2395 to make text read-only.</p>
2397 <p>It is entirely up to you how you use styles. If you want to use syntax colouring you might
2398 use style 0 for white space, style 1 for numbers, style 2 for keywords, style 3 for strings,
2399 style 4 for preprocessor, style 5 for operators, and so on.</p>
2400 <code><a class="message" href="#SCI_STYLERESETDEFAULT">SCI_STYLERESETDEFAULT</a><br />
2401 <a class="message" href="#SCI_STYLECLEARALL">SCI_STYLECLEARALL</a><br />
2402 <a class="message" href="#SCI_STYLESETFONT">SCI_STYLESETFONT(int styleNumber, char
2403 *fontName)</a><br />
2404 <a class="message" href="#SCI_STYLEGETFONT">SCI_STYLEGETFONT(int styleNumber, char *fontName)</a><br />
2405 <a class="message" href="#SCI_STYLESETSIZE">SCI_STYLESETSIZE(int styleNumber, int
2406 sizeInPoints)</a><br />
2407 <a class="message" href="#SCI_STYLEGETSIZE">SCI_STYLEGETSIZE(int styleNumber)</a><br />
2408 <a class="message" href="#SCI_STYLESETSIZEFRACTIONAL">SCI_STYLESETSIZEFRACTIONAL(int styleNumber, int
2409 sizeInHundredthPoints)</a><br />
2410 <a class="message" href="#SCI_STYLEGETSIZEFRACTIONAL">SCI_STYLEGETSIZEFRACTIONAL(int styleNumber)</a><br />
2411 <a class="message" href="#SCI_STYLESETBOLD">SCI_STYLESETBOLD(int styleNumber, bool
2412 bold)</a><br />
2413 <a class="message" href="#SCI_STYLEGETBOLD">SCI_STYLEGETBOLD(int styleNumber)</a><br />
2414 <a class="message" href="#SCI_STYLESETWEIGHT">SCI_STYLESETWEIGHT(int styleNumber, int
2415 weight)</a><br />
2416 <a class="message" href="#SCI_STYLEGETWEIGHT">SCI_STYLEGETWEIGHT(int styleNumber)</a><br />
2417 <a class="message" href="#SCI_STYLESETITALIC">SCI_STYLESETITALIC(int styleNumber, bool
2418 italic)</a><br />
2419 <a class="message" href="#SCI_STYLEGETITALIC">SCI_STYLEGETITALIC(int styleNumber)</a><br />
2420 <a class="message" href="#SCI_STYLESETUNDERLINE">SCI_STYLESETUNDERLINE(int styleNumber, bool
2421 underline)</a><br />
2422 <a class="message" href="#SCI_STYLEGETUNDERLINE">SCI_STYLEGETUNDERLINE(int styleNumber)</a><br />
2423 <a class="message" href="#SCI_STYLESETFORE">SCI_STYLESETFORE(int styleNumber, int
2424 colour)</a><br />
2425 <a class="message" href="#SCI_STYLEGETFORE">SCI_STYLEGETFORE(int styleNumber)</a><br />
2426 <a class="message" href="#SCI_STYLESETBACK">SCI_STYLESETBACK(int styleNumber, int
2427 colour)</a><br />
2428 <a class="message" href="#SCI_STYLEGETBACK">SCI_STYLEGETBACK(int styleNumber)</a><br />
2429 <a class="message" href="#SCI_STYLESETEOLFILLED">SCI_STYLESETEOLFILLED(int styleNumber, bool
2430 eolFilled)</a><br />
2431 <a class="message" href="#SCI_STYLEGETEOLFILLED">SCI_STYLEGETEOLFILLED(int styleNumber)</a><br />
2432 <a class="message" href="#SCI_STYLESETCHARACTERSET">SCI_STYLESETCHARACTERSET(int styleNumber,
2433 int charSet)</a><br />
2434 <a class="message" href="#SCI_STYLEGETCHARACTERSET">SCI_STYLEGETCHARACTERSET(int styleNumber)</a><br />
2435 <a class="message" href="#SCI_STYLESETCASE">SCI_STYLESETCASE(int styleNumber, int
2436 caseMode)</a><br />
2437 <a class="message" href="#SCI_STYLEGETCASE">SCI_STYLEGETCASE(int styleNumber)</a><br />
2438 <a class="message" href="#SCI_STYLESETVISIBLE">SCI_STYLESETVISIBLE(int styleNumber, bool
2439 visible)</a><br />
2440 <a class="message" href="#SCI_STYLEGETVISIBLE">SCI_STYLEGETVISIBLE(int styleNumber)</a><br />
2441 <a class="message" href="#SCI_STYLESETCHANGEABLE">SCI_STYLESETCHANGEABLE(int styleNumber, bool
2442 changeable)</a><br />
2443 <a class="message" href="#SCI_STYLEGETCHANGEABLE">SCI_STYLEGETCHANGEABLE(int styleNumber)</a><br />
2444 <a class="message" href="#SCI_STYLESETHOTSPOT">SCI_STYLESETHOTSPOT(int styleNumber, bool
2445 hotspot)</a><br />
2446 <a class="message" href="#SCI_STYLEGETHOTSPOT">SCI_STYLEGETHOTSPOT(int styleNumber)</a><br />
2447 </code>
2449 <p><b id="SCI_STYLERESETDEFAULT">SCI_STYLERESETDEFAULT</b><br />
2450 This message resets <code>STYLE_DEFAULT</code> to its state when Scintilla was
2451 initialised.</p>
2453 <p><b id="SCI_STYLECLEARALL">SCI_STYLECLEARALL</b><br />
2454 This message sets all styles to have the same attributes as <code>STYLE_DEFAULT</code>. If you
2455 are setting up Scintilla for syntax colouring, it is likely that the lexical styles you set
2456 will be very similar. One way to set the styles is to:<br />
2457 1. Set <code>STYLE_DEFAULT</code> to the common features of all styles.<br />
2458 2. Use <code>SCI_STYLECLEARALL</code> to copy this to all styles.<br />
2459 3. Set the style attributes that make your lexical styles different.</p>
2461 <p><b id="SCI_STYLESETFONT">SCI_STYLESETFONT(int styleNumber, const char *fontName)</b><br />
2462 <b id="SCI_STYLEGETFONT">SCI_STYLEGETFONT(int styleNumber, char *fontName)</b><br />
2463 <b id="SCI_STYLESETSIZE">SCI_STYLESETSIZE(int styleNumber, int sizeInPoints)</b><br />
2464 <b id="SCI_STYLEGETSIZE">SCI_STYLEGETSIZE(int styleNumber)</b><br />
2465 <b id="SCI_STYLESETSIZEFRACTIONAL">SCI_STYLESETSIZEFRACTIONAL(int styleNumber, int sizeInHundredthPoints)</b><br />
2466 <b id="SCI_STYLEGETSIZEFRACTIONAL">SCI_STYLEGETSIZEFRACTIONAL(int styleNumber)</b><br />
2467 <b id="SCI_STYLESETBOLD">SCI_STYLESETBOLD(int styleNumber, bool bold)</b><br />
2468 <b id="SCI_STYLEGETBOLD">SCI_STYLEGETBOLD(int styleNumber)</b><br />
2469 <b id="SCI_STYLESETWEIGHT">SCI_STYLESETWEIGHT(int styleNumber, int weight)</b><br />
2470 <b id="SCI_STYLEGETWEIGHT">SCI_STYLEGETWEIGHT(int styleNumber)</b><br />
2471 <b id="SCI_STYLESETITALIC">SCI_STYLESETITALIC(int styleNumber, bool italic)</b><br />
2472 <b id="SCI_STYLEGETITALIC">SCI_STYLEGETITALIC(int styleNumber)</b><br />
2473 These messages (plus <a class="message"
2474 href="#SCI_STYLESETCHARACTERSET"><code>SCI_STYLESETCHARACTERSET</code></a>) set the font
2475 attributes that are used to match the fonts you request to those available. The
2476 <code>fontName</code> is a zero terminated string holding the name of a font. Under Windows,
2477 only the first 32 characters of the name are used and the name is not case sensitive. For
2478 internal caching, Scintilla tracks fonts by name and does care about the casing of font names,
2479 so please be consistent. On GTK+, Pango is used to display text.</p>
2480 <p>Sizes can be set to a whole number of points with <code>SCI_STYLESETSIZE</code>
2481 or to a fractional point size in hundredths of a point with <code>SCI_STYLESETSIZEFRACTIONAL</code>
2482 by multiplying the size by 100 (<code>SC_FONT_SIZE_MULTIPLIER</code>).
2483 For example, a text size of 9.4 points is set with <code>SCI_STYLESETSIZEFRACTIONAL(&lt;style&gt;, 940)</code>.
2484 </p>
2485 <p>The weight or boldness of a font can be set with <code>SCI_STYLESETBOLD</code>
2486 or <code>SCI_STYLESETWEIGHT</code>. The weight is a number between 1 and 999 with 1 being very light
2487 and 999 very heavy. While any value can be used, fonts often only support between 2 and 4 weights with three weights
2488 being common enough to have symbolic names:
2489 <code>SC_WEIGHT_NORMAL</code> (400),
2490 <code>SC_WEIGHT_SEMIBOLD</code> (600), and
2491 <code>SC_WEIGHT_BOLD</code> (700).
2492 The <code>SCI_STYLESETBOLD</code> message takes a boolean argument with 0 choosing <code>SC_WEIGHT_NORMAL</code>
2493 and 1 <code>SC_WEIGHT_BOLD</code>.
2494 </p>
2496 <p><b id="SCI_STYLESETUNDERLINE">SCI_STYLESETUNDERLINE(int styleNumber, bool
2497 underline)</b><br />
2498 <b id="SCI_STYLEGETUNDERLINE">SCI_STYLEGETUNDERLINE(int styleNumber)</b><br />
2499 You can set a style to be underlined. The underline is drawn in the foreground colour. All
2500 characters with a style that includes the underline attribute are underlined, even if they are
2501 white space.</p>
2503 <p><b id="SCI_STYLESETFORE">SCI_STYLESETFORE(int styleNumber, int <a class="jump"
2504 href="#colour">colour</a>)</b><br />
2505 <b id="SCI_STYLEGETFORE">SCI_STYLEGETFORE(int styleNumber)</b><br />
2506 <b id="SCI_STYLESETBACK">SCI_STYLESETBACK(int styleNumber, int <a class="jump"
2507 href="#colour">colour</a>)</b><br />
2508 <b id="SCI_STYLEGETBACK">SCI_STYLEGETBACK(int styleNumber)</b><br />
2509 Text is drawn in the foreground colour. The space in each character cell that is not occupied
2510 by the character is drawn in the background colour.</p>
2512 <p><b id="SCI_STYLESETEOLFILLED">SCI_STYLESETEOLFILLED(int styleNumber, bool
2513 eolFilled)</b><br />
2514 <b id="SCI_STYLEGETEOLFILLED">SCI_STYLEGETEOLFILLED(int styleNumber)</b><br />
2515 If the last character in the line has a style with this attribute set, the remainder of the
2516 line up to the right edge of the window is filled with the background colour set for the last
2517 character. This is useful when a document contains embedded sections in another language such
2518 as HTML pages with embedded JavaScript. By setting <code>eolFilled</code> to <code>true</code>
2519 and a consistent background colour (different from the background colour set for the HTML
2520 styles) to all JavaScript styles then JavaScript sections will be easily distinguished from
2521 HTML.</p>
2523 <p><b id="SCI_STYLESETCHARACTERSET">SCI_STYLESETCHARACTERSET(int styleNumber, int
2524 charSet)</b><br />
2525 <b id="SCI_STYLEGETCHARACTERSET">SCI_STYLEGETCHARACTERSET(int styleNumber)</b><br />
2526 You can set a style to use a different character set than the default. The places where such
2527 characters sets are likely to be useful are comments and literal strings. For example,
2528 <code>SCI_STYLESETCHARACTERSET(SCE_C_STRING, SC_CHARSET_RUSSIAN)</code> would ensure that
2529 strings in Russian would display correctly in C and C++ (<code>SCE_C_STRING</code> is the style
2530 number used by the C and C++ lexer to display literal strings; it has the value 6). This
2531 feature works differently on Windows and GTK+.</p>
2533 <p>The character sets supported on Windows are:<br />
2534 <code>SC_CHARSET_ANSI</code>, <code>SC_CHARSET_ARABIC</code>, <code>SC_CHARSET_BALTIC</code>,
2535 <code>SC_CHARSET_CHINESEBIG5</code>, <code>SC_CHARSET_DEFAULT</code>,
2536 <code>SC_CHARSET_EASTEUROPE</code>, <code>SC_CHARSET_GB2312</code>,
2537 <code>SC_CHARSET_GREEK</code>, <code>SC_CHARSET_HANGUL</code>, <code>SC_CHARSET_HEBREW</code>,
2538 <code>SC_CHARSET_JOHAB</code>, <code>SC_CHARSET_MAC</code>, <code>SC_CHARSET_OEM</code>,
2539 <code>SC_CHARSET_RUSSIAN</code> (code page 1251),
2540 <code>SC_CHARSET_SHIFTJIS</code>, <code>SC_CHARSET_SYMBOL</code>, <code>SC_CHARSET_THAI</code>,
2541 <code>SC_CHARSET_TURKISH</code>, and <code>SC_CHARSET_VIETNAMESE</code>.</p>
2543 <p>The character sets supported on GTK+ are:<br />
2544 <code>SC_CHARSET_ANSI</code>, <code>SC_CHARSET_CYRILLIC</code> (code page 1251),
2545 <code>SC_CHARSET_EASTEUROPE</code>,
2546 <code>SC_CHARSET_GB2312</code>, <code>SC_CHARSET_HANGUL</code>,
2547 <code>SC_CHARSET_RUSSIAN</code> (KOI8-R), <code>SC_CHARSET_SHIFTJIS</code>, and
2548 <code>SC_CHARSET_8859_15</code>.</p>
2550 <p><b id="SCI_STYLESETCASE">SCI_STYLESETCASE(int styleNumber, int caseMode)</b><br />
2551 <b id="SCI_STYLEGETCASE">SCI_STYLEGETCASE(int styleNumber)</b><br />
2552 The value of caseMode determines how text is displayed. You can set upper case
2553 (<code>SC_CASE_UPPER</code>, 1) or lower case (<code>SC_CASE_LOWER</code>, 2) or display
2554 normally (<code>SC_CASE_MIXED</code>, 0). This does not change the stored text, only how it is
2555 displayed.</p>
2557 <p><b id="SCI_STYLESETVISIBLE">SCI_STYLESETVISIBLE(int styleNumber, bool visible)</b><br />
2558 <b id="SCI_STYLEGETVISIBLE">SCI_STYLEGETVISIBLE(int styleNumber)</b><br />
2559 Text is normally visible. However, you can completely hide it by giving it a style with the
2560 <code>visible</code> set to 0. This could be used to hide embedded formatting instructions or
2561 hypertext keywords in HTML or XML.</p>
2563 <p><b id="SCI_STYLESETCHANGEABLE">SCI_STYLESETCHANGEABLE(int styleNumber, bool
2564 changeable)</b><br />
2565 <b id="SCI_STYLEGETCHANGEABLE">SCI_STYLEGETCHANGEABLE(int styleNumber)</b><br />
2566 This is an experimental and incompletely implemented style attribute. The default setting is
2567 <code>changeable</code> set <code>true</code> but when set <code>false</code> it makes text
2568 read-only. Currently it only stops the caret from being within not-changeable text and does not
2569 yet stop deleting a range that contains not-changeable text.</p>
2571 <p><b id="SCI_STYLESETHOTSPOT">SCI_STYLESETHOTSPOT(int styleNumber, bool
2572 hotspot)</b><br />
2573 <b id="SCI_STYLEGETHOTSPOT">SCI_STYLEGETHOTSPOT(int styleNumber)</b><br />
2574 This style is used to mark ranges of text that can detect mouse clicks.
2575 The cursor changes to a hand over hotspots, and the foreground, and background colours
2576 may change and an underline appear to indicate that these areas are sensitive to clicking.
2577 This may be used to allow hyperlinks to other documents.</p>
2579 <h2 id="CaretAndSelectionStyles">Caret, selection, and hotspot styles</h2>
2581 <p>The selection is shown by changing the foreground and/or background colours. If one of these
2582 is not set then that attribute is not changed for the selection. The default is to show the
2583 selection by changing the background to light gray and leaving the foreground the same as when
2584 it was not selected. When there is no selection, the current insertion point is marked by the
2585 text caret. This is a vertical line that is normally blinking on and off to attract the users
2586 attention.</p>
2587 <code><a class="message" href="#SCI_SETSELFORE">SCI_SETSELFORE(bool useSelectionForeColour, int colour)</a><br />
2588 <a class="message" href="#SCI_SETSELBACK">SCI_SETSELBACK(bool useSelectionBackColour, int colour)</a><br />
2589 <a class="message" href="#SCI_SETSELALPHA">SCI_SETSELALPHA(int alpha)</a><br />
2590 <a class="message" href="#SCI_GETSELALPHA">SCI_GETSELALPHA</a><br />
2591 <a class="message" href="#SCI_SETSELEOLFILLED">SCI_SETSELEOLFILLED(bool filled)</a><br />
2592 <a class="message" href="#SCI_GETSELEOLFILLED">SCI_GETSELEOLFILLED</a><br />
2593 <a class="message" href="#SCI_SETCARETFORE">SCI_SETCARETFORE(int colour)</a><br />
2594 <a class="message" href="#SCI_GETCARETFORE">SCI_GETCARETFORE</a><br />
2595 <a class="message" href="#SCI_SETCARETLINEVISIBLE">SCI_SETCARETLINEVISIBLE(bool show)</a><br />
2596 <a class="message" href="#SCI_GETCARETLINEVISIBLE">SCI_GETCARETLINEVISIBLE</a><br />
2597 <a class="message" href="#SCI_SETCARETLINEBACK">SCI_SETCARETLINEBACK(int colour)</a><br />
2598 <a class="message" href="#SCI_GETCARETLINEBACK">SCI_GETCARETLINEBACK</a><br />
2599 <a class="message" href="#SCI_SETCARETLINEBACKALPHA">SCI_SETCARETLINEBACKALPHA(int alpha)</a><br />
2600 <a class="message" href="#SCI_GETCARETLINEBACKALPHA">SCI_GETCARETLINEBACKALPHA</a><br />
2601 <a class="message" href="#SCI_SETCARETPERIOD">SCI_SETCARETPERIOD(int milliseconds)</a><br />
2602 <a class="message" href="#SCI_GETCARETPERIOD">SCI_GETCARETPERIOD</a><br />
2603 <a class="message" href="#SCI_SETCARETSTYLE">SCI_SETCARETSTYLE(int style)</a><br />
2604 <a class="message" href="#SCI_GETCARETSTYLE">SCI_GETCARETSTYLE</a><br />
2605 <a class="message" href="#SCI_SETCARETWIDTH">SCI_SETCARETWIDTH(int pixels)</a><br />
2606 <a class="message" href="#SCI_GETCARETWIDTH">SCI_GETCARETWIDTH</a><br />
2607 <a class="message" href="#SCI_SETHOTSPOTACTIVEFORE">SCI_SETHOTSPOTACTIVEFORE(bool useSetting, int colour)</a><br />
2608 <a class="message" href="#SCI_GETHOTSPOTACTIVEFORE">SCI_GETHOTSPOTACTIVEFORE</a><br />
2609 <a class="message" href="#SCI_SETHOTSPOTACTIVEBACK">SCI_SETHOTSPOTACTIVEBACK(bool useSetting, int colour)</a><br />
2610 <a class="message" href="#SCI_GETHOTSPOTACTIVEBACK">SCI_GETHOTSPOTACTIVEBACK</a><br />
2611 <a class="message" href="#SCI_SETHOTSPOTACTIVEUNDERLINE">SCI_SETHOTSPOTACTIVEUNDERLINE(bool underline)</a><br />
2612 <a class="message" href="#SCI_GETHOTSPOTACTIVEUNDERLINE">SCI_GETHOTSPOTACTIVEUNDERLINE</a><br />
2613 <a class="message" href="#SCI_SETHOTSPOTSINGLELINE">SCI_SETHOTSPOTSINGLELINE(bool singleLine)</a><br />
2614 <a class="message" href="#SCI_GETHOTSPOTSINGLELINE">SCI_GETHOTSPOTSINGLELINE</a><br />
2615 <a class="message" href="#SCI_SETCONTROLCHARSYMBOL">SCI_SETCONTROLCHARSYMBOL(int symbol)</a><br />
2616 <a class="message" href="#SCI_GETCONTROLCHARSYMBOL">SCI_GETCONTROLCHARSYMBOL</a><br />
2617 <a class="message" href="#SCI_SETCARETSTICKY">SCI_SETCARETSTICKY(int useCaretStickyBehaviour)</a><br />
2618 <a class="message" href="#SCI_GETCARETSTICKY">SCI_GETCARETSTICKY</a><br />
2619 <a class="message" href="#SCI_TOGGLECARETSTICKY">SCI_TOGGLECARETSTICKY</a><br />
2620 </code>
2622 <p><b id="SCI_SETSELFORE">SCI_SETSELFORE(bool useSelectionForeColour, int <a class="jump"
2623 href="#colour">colour</a>)</b><br />
2624 <b id="SCI_SETSELBACK">SCI_SETSELBACK(bool useSelectionBackColour, int <a class="jump"
2625 href="#colour">colour</a>)</b><br />
2626 You can choose to override the default selection colouring with these two messages. The colour
2627 you provide is used if you set <code>useSelection*Colour</code> to <code>true</code>. If it is
2628 set to <code>false</code>, the default styled colouring is used and the <code>colour</code>
2629 argument has no effect.</p>
2630 <p><b id="SCI_SETSELALPHA">SCI_SETSELALPHA(int <a class="jump" href="#alpha">alpha</a>)</b><br />
2631 <b id="SCI_GETSELALPHA">SCI_GETSELALPHA</b><br />
2632 The selection can be drawn translucently in the selection background colour by
2633 setting an alpha value.</p>
2635 <p><b id="SCI_SETSELEOLFILLED">SCI_SETSELEOLFILLED(bool filled)</b><br />
2636 <b id="SCI_GETSELEOLFILLED">SCI_GETSELEOLFILLED</b><br />
2637 The selection can be drawn up to the right hand border by setting this property.</p>
2639 <p><b id="SCI_SETCARETFORE">SCI_SETCARETFORE(int <a class="jump"
2640 href="#colour">colour</a>)</b><br />
2641 <b id="SCI_GETCARETFORE">SCI_GETCARETFORE</b><br />
2642 The colour of the caret can be set with <code>SCI_SETCARETFORE</code> and retrieved with
2643 <code>SCI_GETCARETFORE</code>.</p>
2645 <p><b id="SCI_SETCARETLINEVISIBLE">SCI_SETCARETLINEVISIBLE(bool show)</b><br />
2646 <b id="SCI_GETCARETLINEVISIBLE">SCI_GETCARETLINEVISIBLE</b><br />
2647 <b id="SCI_SETCARETLINEBACK">SCI_SETCARETLINEBACK(int <a class="jump"
2648 href="#colour">colour</a>)</b><br />
2649 <b id="SCI_GETCARETLINEBACK">SCI_GETCARETLINEBACK</b><br />
2650 <b id="SCI_SETCARETLINEBACKALPHA">SCI_SETCARETLINEBACKALPHA(int <a class="jump" href="#alpha">alpha</a>)</b><br />
2651 <b id="SCI_GETCARETLINEBACKALPHA">SCI_GETCARETLINEBACKALPHA</b><br />
2652 You can choose to make the background colour of the line containing the caret different with
2653 these messages. To do this, set the desired background colour with
2654 <code>SCI_SETCARETLINEBACK</code>, then use <code>SCI_SETCARETLINEVISIBLE(true)</code> to
2655 enable the effect. You can cancel the effect with <code>SCI_SETCARETLINEVISIBLE(false)</code>.
2656 The two <code>SCI_GETCARET*</code> functions return the state and the colour. This form of
2657 background colouring has highest priority when a line has markers that would otherwise change
2658 the background colour.
2659 The caret line may also be drawn translucently which allows other background colours to show
2660 through. This is done by setting the alpha (translucency) value by calling
2661 SCI_SETCARETLINEBACKALPHA. When the alpha is not SC_ALPHA_NOALPHA,
2662 the caret line is drawn after all other features so will affect the colour of all other features.
2663 </p>
2665 <p><b id="SCI_SETCARETPERIOD">SCI_SETCARETPERIOD(int milliseconds)</b><br />
2666 <b id="SCI_GETCARETPERIOD">SCI_GETCARETPERIOD</b><br />
2667 The rate at which the caret blinks can be set with <code>SCI_SETCARETPERIOD</code> which
2668 determines the time in milliseconds that the caret is visible or invisible before changing
2669 state. Setting the period to 0 stops the caret blinking. The default value is 500 milliseconds.
2670 <code>SCI_GETCARETPERIOD</code> returns the current setting.</p>
2672 <p><b id="SCI_SETCARETSTYLE">SCI_SETCARETSTYLE(int style)</b><br />
2673 <b id="SCI_GETCARETSTYLE">SCI_GETCARETSTYLE</b><br />
2674 The style of the caret can be set with <code>SCI_SETCARETSTYLE</code> to be a line caret
2675 (CARETSTYLE_LINE=1), a block caret (CARETSTYLE_BLOCK=2) or to not draw at all
2676 (CARETSTYLE_INVISIBLE=0). The default value is the line caret (CARETSTYLE_LINE=1).
2677 You can determine the current caret style setting using <code>SCI_GETCARETSTYLE</code>.</p>
2679 <p>The block character draws most combining and multibyte character sequences successfully,
2680 though some fonts like Thai Fonts (and possibly others) can sometimes appear strange when
2681 the cursor is positioned at these characters, which may result in only drawing a part of the
2682 cursor character sequence. This is most notable on Windows platforms.</p>
2684 <p><b id="SCI_SETCARETWIDTH">SCI_SETCARETWIDTH(int pixels)</b><br />
2685 <b id="SCI_GETCARETWIDTH">SCI_GETCARETWIDTH</b><br />
2686 The width of the line caret can be set with <code>SCI_SETCARETWIDTH</code> to a value of
2687 0, 1, 2 or 3 pixels. The default width is 1 pixel. You can read back the current width with
2688 <code>SCI_GETCARETWIDTH</code>. A width of 0 makes the caret invisible (added at version
2689 1.50), similar to setting the caret style to CARETSTYLE_INVISIBLE (though not interchangable).
2690 This setting only affects the width of the cursor when the cursor style is set to line caret
2691 mode, it does not affect the width for a block caret.</p>
2693 <p><b id="SCI_SETHOTSPOTACTIVEFORE">SCI_SETHOTSPOTACTIVEFORE(bool useHotSpotForeColour, int <a class="jump"
2694 href="#colour">colour</a>)</b><br />
2695 <b id="SCI_GETHOTSPOTACTIVEFORE">SCI_GETHOTSPOTACTIVEFORE</b><br />
2696 <b id="SCI_SETHOTSPOTACTIVEBACK">SCI_SETHOTSPOTACTIVEBACK(bool useHotSpotBackColour, int <a class="jump"
2697 href="#colour">colour</a>)</b><br />
2698 <b id="SCI_GETHOTSPOTACTIVEBACK">SCI_GETHOTSPOTACTIVEBACK</b><br />
2699 <b id="SCI_SETHOTSPOTACTIVEUNDERLINE">SCI_SETHOTSPOTACTIVEUNDERLINE(bool underline)</b><br />
2700 <b id="SCI_GETHOTSPOTACTIVEUNDERLINE">SCI_GETHOTSPOTACTIVEUNDERLINE</b><br />
2701 <b id="SCI_SETHOTSPOTSINGLELINE">SCI_SETHOTSPOTSINGLELINE(bool singleLine)</b><br />
2702 <b id="SCI_GETHOTSPOTSINGLELINE">SCI_GETHOTSPOTSINGLELINE</b><br />
2703 While the cursor hovers over text in a style with the hotspot attribute set,
2704 the default colouring can be modified and an underline drawn with these settings.
2705 Single line mode stops a hotspot from wrapping onto next line.</p>
2707 <p><b id="SCI_SETCONTROLCHARSYMBOL">SCI_SETCONTROLCHARSYMBOL(int symbol)</b><br />
2708 <b id="SCI_GETCONTROLCHARSYMBOL">SCI_GETCONTROLCHARSYMBOL</b><br />
2709 By default, Scintilla displays control characters (characters with codes less than 32) in a
2710 rounded rectangle as ASCII mnemonics: "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
2711 "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", "DLE", "DC1", "DC2", "DC3", "DC4", "NAK",
2712 "SYN", "ETB", "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US". These mnemonics come from the
2713 early days of signaling, though some are still used (LF = Line Feed, BS = Back Space, CR =
2714 Carriage Return, for example).</p>
2716 <p>You can choose to replace these mnemonics by a nominated symbol with an ASCII code in the
2717 range 32 to 255. If you set a symbol value less than 32, all control characters are displayed
2718 as mnemonics. The symbol you set is rendered in the font of the style set for the character.
2719 You can read back the current symbol with the <code>SCI_GETCONTROLCHARSYMBOL</code> message.
2720 The default symbol value is 0.</p>
2722 <p><b id="SCI_SETCARETSTICKY">SCI_SETCARETSTICKY(int useCaretStickyBehaviour)</b><br />
2723 <b id="SCI_GETCARETSTICKY">SCI_GETCARETSTICKY</b><br />
2724 <b id="SCI_TOGGLECARETSTICKY">SCI_TOGGLECARETSTICKY</b><br />
2725 These messages set, get or toggle the caretSticky setting which controls when the last position
2726 of the caret on the line is saved.</p>
2728 <p>When set to <code>SC_CARETSTICKY_OFF</code> (0), the sticky flag is off; all text changes
2729 (and all caret position changes) will remember the
2730 caret's new horizontal position when moving to different lines. This is the default.</p>
2732 <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
2733 horizontal caret position is moving the caret with mouse or keyboard (left/right arrow keys, home/end keys, etc). </p>
2735 <p>When set to <code>SC_CARETSTICKY_WHITESPACE</code> (2), the caret acts like mode 0 (sticky off) except under one
2736 special case; when space or tab characters are inserted. (Including pasting <b>only space/tabs</b> -- undo, redo,
2737 etc. do not exhibit this behavior..).</p>
2739 <p><code>SCI_TOGGLECARETSTICKY</code> switches from <code>SC_CARETSTICKY_ON</code> and <code>SC_CARETSTICKY_WHITESPACE</code>
2740 to <code>SC_CARETSTICKY_OFF</code> and from <code>SC_CARETSTICKY_OFF</code> to <code>SC_CARETSTICKY_ON</code>.</p>
2742 <h2 id="Margins">Margins</h2>
2744 <p>There may be up to five margins to the left of the text display, plus a gap either side of
2745 the text. Each margin can be set to display only symbols, line numbers, or text with <a
2746 class="message" href="#SCI_SETMARGINTYPEN"><code>SCI_SETMARGINTYPEN</code></a>.
2747 Textual margins may also display symbols.
2748 The markers
2749 that can be displayed in each margin are set with <a class="message"
2750 href="#SCI_SETMARGINMASKN"><code>SCI_SETMARGINMASKN</code></a>. Any markers not associated with
2751 a visible margin will be displayed as changes in background colour in the text. A width in
2752 pixels can be set for each margin. Margins with a zero width are ignored completely. You can
2753 choose if a mouse click in a margin sends a <a class="message"
2754 href="#SCN_MARGINCLICK"><code>SCN_MARGINCLICK</code></a> notification to the container or
2755 selects a line of text.</p>
2757 <p>The margins are numbered 0 to 4. Using a margin number outside the valid range has no
2758 effect. By default, margin 0 is set to display line numbers, but is given a width of 0, so it
2759 is hidden. Margin 1 is set to display non-folding symbols and is given a width of 16 pixels, so
2760 it is visible. Margin 2 is set to display the folding symbols, but is given a width of 0, so it
2761 is hidden. Of course, you can set the margins to be whatever you wish.</p>
2763 <p>Styled text margins used to show revision and blame information:</p>
2764 <p><img src="styledmargin.png" alt="Styled text margins used to show revision and blame information" /></p>
2766 <code><a class="message" href="#SCI_SETMARGINTYPEN">SCI_SETMARGINTYPEN(int margin, int
2767 type)</a><br />
2768 <a class="message" href="#SCI_GETMARGINTYPEN">SCI_GETMARGINTYPEN(int margin)</a><br />
2769 <a class="message" href="#SCI_SETMARGINWIDTHN">SCI_SETMARGINWIDTHN(int margin, int
2770 pixelWidth)</a><br />
2771 <a class="message" href="#SCI_GETMARGINWIDTHN">SCI_GETMARGINWIDTHN(int margin)</a><br />
2772 <a class="message" href="#SCI_SETMARGINMASKN">SCI_SETMARGINMASKN(int margin, int
2773 mask)</a><br />
2774 <a class="message" href="#SCI_GETMARGINMASKN">SCI_GETMARGINMASKN(int margin)</a><br />
2775 <a class="message" href="#SCI_SETMARGINSENSITIVEN">SCI_SETMARGINSENSITIVEN(int margin, bool
2776 sensitive)</a><br />
2777 <a class="message" href="#SCI_GETMARGINSENSITIVEN">SCI_GETMARGINSENSITIVEN(int
2778 margin)</a><br />
2779 <a class="message" href="#SCI_SETMARGINCURSORN">SCI_SETMARGINCURSORN(int margin, int
2780 cursor)</a><br />
2781 <a class="message" href="#SCI_GETMARGINCURSORN">SCI_GETMARGINCURSORN(int
2782 margin)</a><br />
2783 <a class="message" href="#SCI_SETMARGINLEFT">SCI_SETMARGINLEFT(&lt;unused&gt;, int
2784 pixels)</a><br />
2785 <a class="message" href="#SCI_GETMARGINLEFT">SCI_GETMARGINLEFT</a><br />
2786 <a class="message" href="#SCI_SETMARGINRIGHT">SCI_SETMARGINRIGHT(&lt;unused&gt;, int
2787 pixels)</a><br />
2788 <a class="message" href="#SCI_GETMARGINRIGHT">SCI_GETMARGINRIGHT</a><br />
2789 <a class="message" href="#SCI_SETFOLDMARGINCOLOUR">SCI_SETFOLDMARGINCOLOUR(bool useSetting, int colour)</a><br />
2790 <a class="message" href="#SCI_SETFOLDMARGINHICOLOUR">SCI_SETFOLDMARGINHICOLOUR(bool useSetting, int colour)</a><br />
2791 <a class="message" href="#SCI_MARGINSETTEXT">SCI_MARGINSETTEXT(int line, char *text)</a><br />
2792 <a class="message" href="#SCI_MARGINGETTEXT">SCI_MARGINGETTEXT(int line, char *text)</a><br />
2793 <a class="message" href="#SCI_MARGINSETSTYLE">SCI_MARGINSETSTYLE(int line, int style)</a><br />
2794 <a class="message" href="#SCI_MARGINGETSTYLE">SCI_MARGINGETSTYLE(int line)</a><br />
2795 <a class="message" href="#SCI_MARGINSETSTYLES">SCI_MARGINSETSTYLES(int line, char *styles)</a><br />
2796 <a class="message" href="#SCI_MARGINGETSTYLES">SCI_MARGINGETSTYLES(int line, char *styles)</a><br />
2797 <a class="message" href="#SCI_MARGINTEXTCLEARALL">SCI_MARGINTEXTCLEARALL</a><br />
2798 <a class="message" href="#SCI_MARGINSETSTYLEOFFSET">SCI_MARGINSETSTYLEOFFSET(int style)</a><br />
2799 <a class="message" href="#SCI_MARGINGETSTYLEOFFSET">SCI_MARGINGETSTYLEOFFSET</a><br />
2800 <a class="message" href="#SCI_SETMARGINOPTIONS">SCI_SETMARGINOPTIONS(int marginOptions)</a><br />
2801 <a class="message" href="#SCI_GETMARGINOPTIONS">SCI_GETMARGINOPTIONS</a><br />
2802 </code>
2804 <p><b id="SCI_SETMARGINTYPEN">SCI_SETMARGINTYPEN(int margin, int iType)</b><br />
2805 <b id="SCI_GETMARGINTYPEN">SCI_GETMARGINTYPEN(int margin)</b><br />
2806 These two routines set and get the type of a margin. The margin argument should be 0, 1, 2, 3 or 4.
2807 You can use the predefined constants <code>SC_MARGIN_SYMBOL</code> (0) and
2808 <code>SC_MARGIN_NUMBER</code> (1) to set a margin as either a line number or a symbol margin.
2809 A margin with application defined text may use <code>SC_MARGIN_TEXT</code> (4) or
2810 <code>SC_MARGIN_RTEXT</code> (5) to right justify the text.
2811 By convention, margin 0 is used for line numbers and the next two are used for symbols. You can
2812 also use the constants <code>SC_MARGIN_BACK</code> (2) and <code>SC_MARGIN_FORE</code> (3) for
2813 symbol margins that set their background colour to match the STYLE_DEFAULT background and
2814 foreground colours.</p>
2816 <p><b id="SCI_SETMARGINWIDTHN">SCI_SETMARGINWIDTHN(int margin, int pixelWidth)</b><br />
2817 <b id="SCI_GETMARGINWIDTHN">SCI_GETMARGINWIDTHN(int margin)</b><br />
2818 These routines set and get the width of a margin in pixels. A margin with zero width is
2819 invisible. By default, Scintilla sets margin 1 for symbols with a width of 16 pixels, so this
2820 is a reasonable guess if you are not sure what would be appropriate. Line number margins widths
2821 should take into account the number of lines in the document and the line number style. You
2822 could use something like <a class="message"
2823 href="#SCI_TEXTWIDTH"><code>SCI_TEXTWIDTH(STYLE_LINENUMBER, "_99999")</code></a> to get a
2824 suitable width.</p>
2826 <p><b id="SCI_SETMARGINMASKN">SCI_SETMARGINMASKN(int margin, int mask)</b><br />
2827 <b id="SCI_GETMARGINMASKN">SCI_GETMARGINMASKN(int margin)</b><br />
2828 The mask is a 32-bit value. Each bit corresponds to one of 32 logical symbols that can be
2829 displayed in a margin that is enabled for symbols. There is a useful constant,
2830 <code>SC_MASK_FOLDERS</code> (0xFE000000 or -33554432), that is a mask for the 7 logical
2831 symbols used to denote folding. You can assign a wide range of symbols and colours to each of
2832 the 32 logical symbols, see <a href="#Markers">Markers</a> for more information. If <code>(mask
2833 &amp; SC_MASK_FOLDERS)==0</code>, the margin background colour is controlled by style 33 (<a
2834 class="message" href="#StyleDefinition"><code>STYLE_LINENUMBER</code></a>).</p>
2836 <p>You add logical markers to a line with <a class="message"
2837 href="#SCI_MARKERADD"><code>SCI_MARKERADD</code></a>. If a line has an associated marker that
2838 does not appear in the mask of any margin with a non-zero width, the marker changes the
2839 background colour of the line. For example, suppose you decide to use logical marker 10 to mark
2840 lines with a syntax error and you want to show such lines by changing the background colour.
2841 The mask for this marker is 1 shifted left 10 times (1&lt;&lt;10) which is 0x400. If you make
2842 sure that no symbol margin includes 0x400 in its mask, any line with the marker gets the
2843 background colour changed.</p>
2845 <p>To set a non-folding margin 1 use <code>SCI_SETMARGINMASKN(1, ~SC_MASK_FOLDERS)</code>
2846 which is the default set by Scintilla.
2847 To set a folding margin 2 use <code>SCI_SETMARGINMASKN(2, SC_MASK_FOLDERS)</code>.
2848 <code>~SC_MASK_FOLDERS</code> is 0x1FFFFFF in hexadecimal or 33554431
2849 decimal. Of course, you may need to display all 32 symbols in a margin, in which case use
2850 <code>SCI_SETMARGINMASKN(margin, -1)</code>.</p>
2852 <p><b id="SCI_SETMARGINSENSITIVEN">SCI_SETMARGINSENSITIVEN(int margin, bool
2853 sensitive)</b><br />
2854 <b id="SCI_GETMARGINSENSITIVEN">SCI_GETMARGINSENSITIVEN(int margin)</b><br />
2855 Each of the five margins can be set sensitive or insensitive to mouse clicks. A click in a
2856 sensitive margin sends a <a class="message"
2857 href="#SCN_MARGINCLICK"><code>SCN_MARGINCLICK</code></a> <a class="jump"
2858 href="#Notifications">notification</a> to the container. Margins that are not sensitive act as
2859 selection margins which make it easy to select ranges of lines. By default, all margins are
2860 insensitive.</p>
2862 <p><b id="SCI_SETMARGINCURSORN">SCI_SETMARGINCURSORN(int margin, int
2863 cursor)</b><br />
2864 <b id="SCI_GETMARGINCURSORN">SCI_GETMARGINCURSORN(int margin)</b><br />
2865 A reversed arrow cursor is normally shown over all margins. This may be changed to a normal arrow with
2866 <code>SCI_SETMARGINCURSORN(margin, SC_CURSORARROW)</code> or restored to a
2867 reversed arrow with
2868 <code>SCI_SETMARGINCURSORN(margin, SC_CURSORREVERSEARROW)</code>.</p>
2870 <p><b id="SCI_SETMARGINLEFT">SCI_SETMARGINLEFT(&lt;unused&gt;, int pixels)</b><br />
2871 <b id="SCI_GETMARGINLEFT">SCI_GETMARGINLEFT</b><br />
2872 <b id="SCI_SETMARGINRIGHT">SCI_SETMARGINRIGHT(&lt;unused&gt;, int pixels)</b><br />
2873 <b id="SCI_GETMARGINRIGHT">SCI_GETMARGINRIGHT</b><br />
2874 These messages set and get the width of the blank margin on both sides of the text in pixels.
2875 The default is to one pixel on each side.</p>
2877 <p><b id="SCI_SETFOLDMARGINCOLOUR">SCI_SETFOLDMARGINCOLOUR(bool useSetting, int colour)</b><br />
2878 <b id="SCI_SETFOLDMARGINHICOLOUR">SCI_SETFOLDMARGINHICOLOUR(bool useSetting, int colour)</b><br />
2879 These messages allow changing the colour of the fold margin and fold margin highlight.
2880 On Windows the fold margin colour defaults to ::GetSysColor(COLOR_3DFACE) and the fold margin highlight
2881 colour to ::GetSysColor(COLOR_3DHIGHLIGHT).</p>
2884 <b id="SCI_MARGINSETTEXT">SCI_MARGINSETTEXT(int line, char *text)</b><br />
2885 <b id="SCI_MARGINGETTEXT">SCI_MARGINGETTEXT(int line, char *text)</b><br />
2886 <b id="SCI_MARGINSETSTYLE">SCI_MARGINSETSTYLE(int line, int style)</b><br />
2887 <b id="SCI_MARGINGETSTYLE">SCI_MARGINGETSTYLE(int line)</b><br />
2888 <b id="SCI_MARGINSETSTYLES">SCI_MARGINSETSTYLES(int line, char *styles)</b><br />
2889 <b id="SCI_MARGINGETSTYLES">SCI_MARGINGETSTYLES(int line, char *styles)</b><br />
2890 <b id="SCI_MARGINTEXTCLEARALL">SCI_MARGINTEXTCLEARALL</b><br />
2891 Text margins are created with the type SC_MARGIN_TEXT or SC_MARGIN_RTEXT.
2892 A different string may be set for each line with <code>SCI_MARGINSETTEXT</code>.
2893 The whole of the text margin on a line may be displayed in a particular style with
2894 <code>SCI_MARGINSETSTYLE</code> or each character may be individually styled with
2895 <code>SCI_MARGINSETSTYLES</code> which uses an array of bytes with each byte setting the style
2896 of the corresponding text byte similar to <code>SCI_SETSTYLINGEX</code>.
2897 Setting a text margin will cause a
2898 <a class="message" href="#SC_MOD_CHANGEMARGIN"><code>SC_MOD_CHANGEMARGIN</code></a>
2899 notification to be sent.
2900 </p>
2902 Only some style attributes are active in text margins: font, size/sizeFractional, bold/weight, italics, fore, back, and characterSet.
2903 </p>
2905 <b id="SCI_MARGINSETSTYLEOFFSET">SCI_MARGINSETSTYLEOFFSET(int style)</b><br />
2906 <b id="SCI_MARGINGETSTYLEOFFSET">SCI_MARGINGETSTYLEOFFSET</b><br />
2907 Margin styles may be completely separated from standard text styles by setting a style offset. For example,
2908 <code>SCI_MARGINSETSTYLEOFFSET(256)</code> would allow the margin styles to be numbered from
2909 256 upto 511 so they do not overlap styles set by lexers. Each style number set with <code>SCI_MARGINSETSTYLE</code>
2910 or <code>SCI_MARGINSETSTYLES</code> has the offset added before looking up the style.
2911 </p>
2913 <b id="SCI_SETMARGINOPTIONS">SCI_SETMARGINOPTIONS(int marginOptions)</b><br />
2914 <b id="SCI_GETMARGINOPTIONS">SCI_GETMARGINOPTIONS</b><br />
2915 Define margin options by enabling appropriate bit flags. At the moment, only one flag is available
2916 <code>SC_MARGINOPTION_SUBLINESELECT</code>=1, which controls how wrapped lines are selected when clicking
2917 on margin in front of them. If <code>SC_MARGINOPTION_SUBLINESELECT</code> is set only sub line of wrapped
2918 line is selected, otherwise whole wrapped line is selected. Margin options are set to
2919 <code>SC_MARGINOPTION_NONE</code>=0 by default.
2920 </p>
2922 <h2 id="Annotations">Annotations</h2>
2924 <p>Annotations are read-only lines of text underneath each line of editable text.
2925 An annotation may consist of multiple lines separated by '\n'.
2926 Annotations can be used to display an assembler version of code for debugging or to show diagnostic messages inline or to
2927 line up different versions of text in a merge tool.</p>
2928 <p>Annotations used for inline diagnostics:</p>
2929 <p><img src="annotations.png" alt="Annotations used for inline diagnostics" /></p>
2931 <code>
2932 <a class="message" href="#SCI_ANNOTATIONSETTEXT">SCI_ANNOTATIONSETTEXT(int line, char *text)</a><br />
2933 <a class="message" href="#SCI_ANNOTATIONGETTEXT">SCI_ANNOTATIONGETTEXT(int line, char *text)</a><br />
2934 <a class="message" href="#SCI_ANNOTATIONSETSTYLE">SCI_ANNOTATIONSETSTYLE(int line, int style)</a><br />
2935 <a class="message" href="#SCI_ANNOTATIONGETSTYLE">SCI_ANNOTATIONGETSTYLE(int line)</a><br />
2936 <a class="message" href="#SCI_ANNOTATIONSETSTYLES">SCI_ANNOTATIONSETSTYLES(int line, char *styles)</a><br />
2937 <a class="message" href="#SCI_ANNOTATIONGETSTYLES">SCI_ANNOTATIONGETSTYLES(int line, char *styles)</a><br />
2938 <a class="message" href="#SCI_ANNOTATIONGETLINES">SCI_ANNOTATIONGETLINES(int line)</a><br />
2939 <a class="message" href="#SCI_ANNOTATIONCLEARALL">SCI_ANNOTATIONCLEARALL</a><br />
2940 <a class="message" href="#SCI_ANNOTATIONSETVISIBLE">SCI_ANNOTATIONSETVISIBLE(int visible)</a><br />
2941 <a class="message" href="#SCI_ANNOTATIONGETVISIBLE">SCI_ANNOTATIONGETVISIBLE</a><br />
2942 <a class="message" href="#SCI_ANNOTATIONSETSTYLEOFFSET">SCI_ANNOTATIONSETSTYLEOFFSET(int style)</a><br />
2943 <a class="message" href="#SCI_ANNOTATIONGETSTYLEOFFSET">SCI_ANNOTATIONGETSTYLEOFFSET</a><br />
2944 </code>
2947 <b id="SCI_ANNOTATIONSETTEXT">SCI_ANNOTATIONSETTEXT(int line, char *text)</b><br />
2948 <b id="SCI_ANNOTATIONGETTEXT">SCI_ANNOTATIONGETTEXT(int line, char *text)</b><br />
2949 <b id="SCI_ANNOTATIONSETSTYLE">SCI_ANNOTATIONSETSTYLE(int line, int style)</b><br />
2950 <b id="SCI_ANNOTATIONGETSTYLE">SCI_ANNOTATIONGETSTYLE(int line)</b><br />
2951 <b id="SCI_ANNOTATIONSETSTYLES">SCI_ANNOTATIONSETSTYLES(int line, char *styles)</b><br />
2952 <b id="SCI_ANNOTATIONGETSTYLES">SCI_ANNOTATIONGETSTYLES(int line, char *styles)</b><br />
2953 <b id="SCI_ANNOTATIONGETLINES">SCI_ANNOTATIONGETLINES(int line)</b><br />
2954 <b id="SCI_ANNOTATIONCLEARALL">SCI_ANNOTATIONCLEARALL</b><br />
2955 A different string may be set for each line with <code>SCI_ANNOTATIONSETTEXT</code>.
2956 To clear annotations call <code>SCI_ANNOTATIONSETTEXT</code> with a NULL pointer.
2957 The whole of the text ANNOTATION on a line may be displayed in a particular style with
2958 <code>SCI_ANNOTATIONSETSTYLE</code> or each character may be individually styled with
2959 <code>SCI_ANNOTATIONSETSTYLES</code> which uses an array of bytes with each byte setting the style
2960 of the corresponding text byte similar to <code>SCI_SETSTYLINGEX</code>. The text must be set first as it
2961 specifies how long the annotation is so how many bytes of styling to read.
2962 Setting an annotation will cause a
2963 <a class="message" href="#SC_MOD_CHANGEANNOTATION"><code>SC_MOD_CHANGEANNOTATION</code></a>
2964 notification to be sent.
2965 </p>
2967 The number of lines annotating a line can be retrieved with <code>SCI_ANNOTATIONGETLINES</code>.
2968 All the lines can be cleared of annotations with <code>SCI_ANNOTATIONCLEARALL</code>
2969 which is equivalent to clearing each line (setting to 0) and then deleting other memory used for this feature.
2970 </p>
2972 Only some style attributes are active in annotations: font, size/sizeFractional, bold/weight, italics, fore, back, and characterSet.
2973 </p>
2975 <b id="SCI_ANNOTATIONSETVISIBLE">SCI_ANNOTATIONSETVISIBLE(int visible)</b><br />
2976 <b id="SCI_ANNOTATIONGETVISIBLE">SCI_ANNOTATIONGETVISIBLE</b><br />
2977 Annotations can be made visible in a view and there is a choice of display style when visible.
2978 The two messages set and get the annotation display mode. The <code>visible</code>
2979 argument can be one of:</p>
2981 <table cellpadding="1" cellspacing="2" border="0" summary="Annotation visibility">
2982 <tbody valign="top">
2983 <tr>
2984 <th align="left"><code>ANNOTATION_HIDDEN</code></th>
2986 <td>0</td>
2988 <td>Annotations are not displayed.</td>
2989 </tr>
2991 <tr>
2992 <th align="left"><code>ANNOTATION_STANDARD</code></th>
2994 <td>1</td>
2996 <td>Annotations are drawn left justified with no adornment.</td>
2997 </tr>
2999 <tr>
3000 <th align="left"><code>ANNOTATION_BOXED</code></th>
3002 <td>2</td>
3004 <td>Annotations are indented to match the text and are surrounded by a box.</td>
3005 </tr>
3006 </tbody>
3007 </table>
3010 <b id="SCI_ANNOTATIONSETSTYLEOFFSET">SCI_ANNOTATIONSETSTYLEOFFSET(int style)</b><br />
3011 <b id="SCI_ANNOTATIONGETSTYLEOFFSET">SCI_ANNOTATIONGETSTYLEOFFSET</b><br />
3012 Annotation styles may be completely separated from standard text styles by setting a style offset. For example,
3013 <code>SCI_ANNOTATIONSETSTYLEOFFSET(512)</code> would allow the annotation styles to be numbered from
3014 512 upto 767 so they do not overlap styles set by lexers (or margins if margins offset is 256).
3015 Each style number set with <code>SCI_ANNOTATIONSETSTYLE</code>
3016 or <code>SCI_ANNOTATIONSETSTYLES</code> has the offset added before looking up the style.
3017 </p>
3019 <h2 id="OtherSettings">Other settings</h2>
3020 <code><a class="message" href="#SCI_SETUSEPALETTE">SCI_SETUSEPALETTE(bool
3021 allowPaletteUse)</a><br />
3022 <a class="message" href="#SCI_GETUSEPALETTE">SCI_GETUSEPALETTE</a><br />
3023 <a class="message" href="#SCI_SETBUFFEREDDRAW">SCI_SETBUFFEREDDRAW(bool isBuffered)</a><br />
3024 <a class="message" href="#SCI_GETBUFFEREDDRAW">SCI_GETBUFFEREDDRAW</a><br />
3025 <a class="message" href="#SCI_SETTWOPHASEDRAW">SCI_SETTWOPHASEDRAW(bool twoPhase)</a><br />
3026 <a class="message" href="#SCI_GETTWOPHASEDRAW">SCI_GETTWOPHASEDRAW</a><br />
3027 <a class="message" href="#SCI_SETTECHNOLOGY">SCI_SETTECHNOLOGY(int technology)</a><br />
3028 <a class="message" href="#SCI_GETTECHNOLOGY">SCI_GETTECHNOLOGY</a><br />
3029 <a class="message" href="#SCI_SETFONTQUALITY">SCI_SETFONTQUALITY(int fontQuality)</a><br />
3030 <a class="message" href="#SCI_GETFONTQUALITY">SCI_GETFONTQUALITY</a><br />
3031 <a class="message" href="#SCI_SETCODEPAGE">SCI_SETCODEPAGE(int codePage)</a><br />
3032 <a class="message" href="#SCI_GETCODEPAGE">SCI_GETCODEPAGE</a><br />
3033 <a class="message" href="#SCI_SETKEYSUNICODE">SCI_SETKEYSUNICODE(bool keysUnicode)</a><br />
3034 <a class="message" href="#SCI_GETKEYSUNICODE">SCI_GETKEYSUNICODE</a><br />
3035 <a class="message" href="#SCI_SETWORDCHARS">SCI_SETWORDCHARS(&lt;unused&gt;, const char *characters)</a><br />
3036 <a class="message" href="#SCI_GETWORDCHARS">SCI_GETWORDCHARS(&lt;unused&gt;, char *characters)</a><br />
3037 <a class="message" href="#SCI_SETWHITESPACECHARS">SCI_SETWHITESPACECHARS(&lt;unused&gt;, const char *characters)</a><br />
3038 <a class="message" href="#SCI_GETWHITESPACECHARS">SCI_GETWHITESPACECHARS(&lt;unused&gt;, char *characters)</a><br />
3039 <a class="message" href="#SCI_SETPUNCTUATIONCHARS">SCI_SETPUNCTUATIONCHARS(&lt;unused&gt;, const char *characters)</a><br />
3040 <a class="message" href="#SCI_GETPUNCTUATIONCHARS">SCI_GETPUNCTUATIONCHARS(&lt;unused&gt;, char *characters)</a><br />
3041 <a class="message" href="#SCI_SETCHARSDEFAULT">SCI_SETCHARSDEFAULT</a><br />
3042 <a class="message" href="#SCI_GRABFOCUS">SCI_GRABFOCUS</a><br />
3043 <a class="message" href="#SCI_SETFOCUS">SCI_SETFOCUS(bool focus)</a><br />
3044 <a class="message" href="#SCI_GETFOCUS">SCI_GETFOCUS</a><br />
3045 </code>
3047 <p>To forward a message <code>(WM_XXXX, WPARAM, LPARAM)</code> to Scintilla, you can use
3048 <code>SendMessage(hScintilla, WM_XXXX, WPARAM, LPARAM)</code> where <code>hScintilla</code> is
3049 the handle to the Scintilla window you created as your editor.</p>
3051 <p>While we are on the subject of forwarding messages in Windows, the top level window should
3052 forward any <code>WM_SETTINGCHANGE</code> messages to Scintilla (this is currently used to
3053 collect changes to mouse settings, but could be used for other user interface items in the
3054 future).</p>
3056 <p><b id="SCI_SETBUFFEREDDRAW">SCI_SETBUFFEREDDRAW(bool isBuffered)</b><br />
3057 <b id="SCI_GETBUFFEREDDRAW">SCI_GETBUFFEREDDRAW</b><br />
3058 These messages turn buffered drawing on or off and report the buffered drawing state. Buffered
3059 drawing draws each line into a bitmap rather than directly to the screen and then copies the
3060 bitmap to the screen. This avoids flickering although it does take longer. The default is for
3061 drawing to be buffered.</p>
3063 <p><b id="SCI_SETTWOPHASEDRAW">SCI_SETTWOPHASEDRAW(bool twoPhase)</b><br />
3064 <b id="SCI_GETTWOPHASEDRAW">SCI_GETTWOPHASEDRAW</b><br />
3065 Two phase drawing is a better but slower way of drawing text.
3066 In single phase drawing each run of characters in one style is drawn along with its background.
3067 If a character overhangs the end of a run, such as in "<i>V</i>_" where the
3068 "<i>V</i>" is in a different style from the "_", then this can cause the right hand
3069 side of the "<i>V</i>" to be overdrawn by the background of the "_" which
3070 cuts it off. Two phase drawing
3071 fixes this by drawing all the backgrounds first and then drawing the text in
3072 transparent mode. Two phase drawing may flicker more than single phase
3073 unless buffered drawing is on. The default is for drawing to be two phase.</p>
3075 <p><b id="SCI_SETTECHNOLOGY">SCI_SETTECHNOLOGY(int technology)</b><br />
3076 <b id="SCI_GETTECHNOLOGY">SCI_GETTECHNOLOGY</b><br />
3077 The technology property allows choosing between different drawing APIs and options.
3078 On most platforms, the only choice is <code>SC_TECHNOLOGY_DEFAULT</code> (0).
3079 On Windows Vista or later, <code>SC_TECHNOLOGY_DIRECTWRITE</code> (1)
3080 can be chosen to use the Direct2D and DirectWrite APIs for higher quality antialiased drawing.
3081 Since Direct2D buffers drawing, Scintilla's buffering can be turned off with
3082 <code>SCI_SETBUFFEREDDRAW(0)</code>.</p>
3084 <p><b id="SCI_SETFONTQUALITY">SCI_SETFONTQUALITY(int fontQuality)</b><br />
3085 <b id="SCI_GETFONTQUALITY">SCI_GETFONTQUALITY</b><br />
3086 Manage font quality (antialiasing method). Currently, the following values are available on Windows:
3087 <code>SC_EFF_QUALITY_DEFAULT</code> (backward compatible),
3088 <code>SC_EFF_QUALITY_NON_ANTIALIASED</code>,
3089 <code>SC_EFF_QUALITY_ANTIALIASED</code>,
3090 <code>SC_EFF_QUALITY_LCD_OPTIMIZED</code>.</p>
3091 <p>In case it is necessary to squeeze more options into this property, only a limited number of bits defined
3092 by SC_EFF_QUALITY_MASK (0xf) will be used for quality.</p>
3094 <p><b id="SCI_SETCODEPAGE">SCI_SETCODEPAGE(int codePage)</b><br />
3095 <b id="SCI_GETCODEPAGE">SCI_GETCODEPAGE</b><br />
3096 Scintilla has some support for Japanese, Chinese and Korean DBCS. Use this message with
3097 <code>codePage</code> set to the code page number to set Scintilla to use code page information
3098 to ensure double byte characters are treated as one character rather than two. This also stops
3099 the caret from moving between the two bytes in a double byte character.
3100 Do not use this message to choose between different single byte character sets: it doesn't do that.
3101 Call with
3102 <code>codePage</code> set to zero to disable DBCS support. The default is
3103 <code>SCI_SETCODEPAGE(0)</code>.</p>
3105 <p>Code page <code>SC_CP_UTF8</code> (65001) sets Scintilla into Unicode mode with the document
3106 treated as a sequence of characters expressed in UTF-8. The text is converted to the platform's
3107 normal Unicode encoding before being drawn by the OS and thus can display Hebrew, Arabic,
3108 Cyrillic, and Han characters. Languages which can use two characters stacked vertically in one
3109 horizontal space, such as Thai, will mostly work but there are some issues where the characters
3110 are drawn separately leading to visual glitches. Bi-directional text is not supported. </p>
3112 <p>Code page can be set to 932 (Japanese Shift-JIS), 936 (Simplified Chinese GBK),
3113 949 (Korean Unified Hangul Code), 950 (Traditional Chinese Big5), or 1361 (Korean Johab)
3114 although these may require installation of language specific support.</p>
3116 <p><b id="SCI_SETKEYSUNICODE">SCI_SETKEYSUNICODE(bool keysUnicode)</b><br />
3117 <b id="SCI_GETKEYSUNICODE">SCI_GETKEYSUNICODE</b><br />
3118 On Windows, character keys are normally handled differently depending on whether Scintilla is a wide
3119 or narrow character window with character messages treated as Unicode when wide and as 8 bit otherwise.
3120 Set this property to always treat as Unicode. This option is needed for Delphi.</p>
3122 <p><b id="SCI_SETWORDCHARS">SCI_SETWORDCHARS(&lt;unused&gt;, const char *characters)</b><br />
3123 Scintilla has several functions that operate on words, which are defined to be contiguous
3124 sequences of characters from a particular set of characters. This message defines which
3125 characters are members of that set. The character sets are set to default values before processing this
3126 function.
3127 For example, if you don't allow '_' in your set of characters
3128 use:<br />
3129 <code>SCI_SETWORDCHARS(0, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")</code>;</p>
3131 <p><b id="SCI_GETWORDCHARS">SCI_GETWORDCHARS(&lt;unused&gt;, char *characters)</b><br />
3132 This fills the characters parameter with all the characters included in words.
3133 The characters parameter must be large enough to hold all of the characters.
3134 If the characters parameter is 0 then the length that should be allocated
3135 to store the entire set is returned.</p>
3137 <p><b id="SCI_SETWHITESPACECHARS">SCI_SETWHITESPACECHARS(&lt;unused&gt;, const char *characters)</b><br />
3138 <b id="SCI_GETWHITESPACECHARS">SCI_GETWHITESPACECHARS(&lt;unused&gt;, char *characters)</b><br />
3139 Similar to <code>SCI_SETWORDCHARS</code>, this message allows the user to define which chars Scintilla considers
3140 as whitespace. Setting the whitespace chars allows the user to fine-tune Scintilla's behaviour doing
3141 such things as moving the cursor to the start or end of a word; for example, by defining punctuation chars
3142 as whitespace, they will be skipped over when the user presses ctrl+left or ctrl+right.
3143 This function should be called after <code>SCI_SETWORDCHARS</code> as it will
3144 reset the whitespace characters to the default set.
3145 <code>SCI_GETWHITESPACECHARS</code> behaves similarly to <code>SCI_GETWORDCHARS</code>.</p>
3147 <p><b id="SCI_SETPUNCTUATIONCHARS">SCI_SETPUNCTUATIONCHARS(&lt;unused&gt;, const char *characters)</b><br />
3148 <b id="SCI_GETPUNCTUATIONCHARS">SCI_GETPUNCTUATIONCHARS(&lt;unused&gt;, char *characters)</b><br />
3149 Similar to <code>SCI_SETWORDCHARS</code> and <code>SCI_SETWHITESPACECHARS</code>, this message
3150 allows the user to define which chars Scintilla considers as punctuation.
3151 <code>SCI_GETPUNCTUATIONCHARS</code> behaves similarly to <code>SCI_GETWORDCHARS</code>.</p>
3153 <p><b id="SCI_SETCHARSDEFAULT">SCI_SETCHARSDEFAULT</b><br />
3154 Use the default sets of word and whitespace characters. This sets whitespace to space, tab and other
3155 characters with codes less than 0x20, with word characters set to alphanumeric and '_'.
3156 </p>
3159 <p><b id="SCI_GRABFOCUS">SCI_GRABFOCUS</b><br />
3160 <b id="SCI_SETFOCUS">SCI_SETFOCUS(bool focus)</b><br />
3161 <b id="SCI_GETFOCUS">SCI_GETFOCUS</b><br />
3162 Scintilla can be told to grab the focus with this message. This is needed more on GTK+ where
3163 focus handling is more complicated than on Windows.</p>
3165 <p>The internal focus flag can be set with <code>SCI_SETFOCUS</code>. This is used by clients
3166 that have complex focus requirements such as having their own window that gets the real focus
3167 but with the need to indicate that Scintilla has the logical focus.</p>
3169 <h2 id="BraceHighlighting">Brace highlighting</h2>
3170 <code><a class="message" href="#SCI_BRACEHIGHLIGHT">SCI_BRACEHIGHLIGHT(int pos1, int
3171 pos2)</a><br />
3172 <a class="message" href="#SCI_BRACEBADLIGHT">SCI_BRACEBADLIGHT(int pos1)</a><br />
3173 <a class="message" href="#SCI_BRACEHIGHLIGHTINDICATOR">SCI_BRACEHIGHLIGHTINDICATOR(bool useBraceHighlightIndicator, int indicatorNumber)</a><br />
3174 <a class="message" href="#SCI_BRACEBADLIGHTINDICATOR">SCI_BRACEBADLIGHTINDICATOR(bool useBraceBadLightIndicator, int indicatorNumber)</a><br />
3175 <a class="message" href="#SCI_BRACEMATCH">SCI_BRACEMATCH(int position, int
3176 maxReStyle)</a><br />
3177 </code>
3179 <p><b id="SCI_BRACEHIGHLIGHT">SCI_BRACEHIGHLIGHT(int pos1, int pos2)</b><br />
3180 Up to two characters can be highlighted in a 'brace highlighting style', which is defined as
3181 style number <a class="message" href="#StyleDefinition"><code>STYLE_BRACELIGHT</code></a> (34).
3182 If you have enabled indent guides, you may also wish to highlight the indent that corresponds
3183 with the brace. You can locate the column with <a class="message"
3184 href="#SCI_GETCOLUMN"><code>SCI_GETCOLUMN</code></a> and highlight the indent with <a
3185 class="message" href="#SCI_SETHIGHLIGHTGUIDE"><code>SCI_SETHIGHLIGHTGUIDE</code></a>.</p>
3187 <p><b id="SCI_BRACEBADLIGHT">SCI_BRACEBADLIGHT(int pos1)</b><br />
3188 If there is no matching brace then the <a class="jump" href="#StyleDefinition">brace
3189 badlighting style</a>, style <code>STYLE_BRACEBAD</code> (35), can be used to show the brace
3190 that is unmatched. Using a position of <code>INVALID_POSITION</code> (-1) removes the
3191 highlight.</p>
3193 <p><b id="#SCI_BRACEHIGHLIGHTINDICATOR">SCI_BRACEHIGHLIGHTINDICATOR(bool useBraceHighlightIndicator, int indicatorNumber)</b><br />
3194 Use specified indicator to highlight matching braces instead of changing their style.</p>
3196 <p><b id="#SCI_BRACEBADLIGHTINDICATOR">SCI_BRACEBADLIGHTINDICATOR(bool useBraceBadLightIndicator, int indicatorNumber)</b><br />
3197 Use specified indicator to highlight non matching brace instead of changing its style.</p>
3199 <p><b id="SCI_BRACEMATCH">SCI_BRACEMATCH(int pos, int maxReStyle)</b><br />
3200 The <code>SCI_BRACEMATCH</code> message finds a corresponding matching brace given
3201 <code>pos</code>, the position of one brace. The brace characters handled are '(', ')', '[',
3202 ']', '{', '}', '&lt;', and '&gt;'. The search is forwards from an opening brace and backwards
3203 from a closing brace. If the character at position is not a brace character, or a matching
3204 brace cannot be found, the return value is -1. Otherwise, the return value is the position of
3205 the matching brace.</p>
3207 <p>A match only occurs if the style of the matching brace is the same as the starting brace or
3208 the matching brace is beyond the end of styling. Nested braces are handled correctly. The
3209 <code>maxReStyle</code> parameter must currently be 0 - it may be used in the future to limit
3210 the length of brace searches.</p>
3212 <h2 id="TabsAndIndentationGuides">Tabs and Indentation Guides</h2>
3214 <p>Indentation (the white space at the start of a line) is often used by programmers to clarify
3215 program structure and in some languages, for example Python, it may be part of the language
3216 syntax. Tabs are normally used in editors to insert a tab character or to pad text with spaces
3217 up to the next tab.</p>
3219 <p>Scintilla can be set to treat tab and backspace in the white space at the start of a line in
3220 a special way: inserting a tab indents the line to the next indent position rather than just
3221 inserting a tab at the current character position and backspace unindents the line rather than
3222 deleting a character. Scintilla can also display indentation guides (vertical lines) to help
3223 you to generate code.</p>
3224 <code><a class="message" href="#SCI_SETTABWIDTH">SCI_SETTABWIDTH(int widthInChars)</a><br />
3225 <a class="message" href="#SCI_GETTABWIDTH">SCI_GETTABWIDTH</a><br />
3226 <a class="message" href="#SCI_SETUSETABS">SCI_SETUSETABS(bool useTabs)</a><br />
3227 <a class="message" href="#SCI_GETUSETABS">SCI_GETUSETABS</a><br />
3228 <a class="message" href="#SCI_SETINDENT">SCI_SETINDENT(int widthInChars)</a><br />
3229 <a class="message" href="#SCI_GETINDENT">SCI_GETINDENT</a><br />
3230 <a class="message" href="#SCI_SETTABINDENTS">SCI_SETTABINDENTS(bool tabIndents)</a><br />
3231 <a class="message" href="#SCI_GETTABINDENTS">SCI_GETTABINDENTS</a><br />
3232 <a class="message" href="#SCI_SETBACKSPACEUNINDENTS">SCI_SETBACKSPACEUNINDENTS(bool
3233 bsUnIndents)</a><br />
3234 <a class="message" href="#SCI_GETBACKSPACEUNINDENTS">SCI_GETBACKSPACEUNINDENTS</a><br />
3235 <a class="message" href="#SCI_SETLINEINDENTATION">SCI_SETLINEINDENTATION(int line, int
3236 indentation)</a><br />
3237 <a class="message" href="#SCI_GETLINEINDENTATION">SCI_GETLINEINDENTATION(int line)</a><br />
3238 <a class="message" href="#SCI_GETLINEINDENTPOSITION">SCI_GETLINEINDENTPOSITION(int
3239 line)</a><br />
3240 <a class="message" href="#SCI_SETINDENTATIONGUIDES">SCI_SETINDENTATIONGUIDES(int indentView)</a><br />
3241 <a class="message" href="#SCI_GETINDENTATIONGUIDES">SCI_GETINDENTATIONGUIDES</a><br />
3242 <a class="message" href="#SCI_SETHIGHLIGHTGUIDE">SCI_SETHIGHLIGHTGUIDE(int column)</a><br />
3243 <a class="message" href="#SCI_GETHIGHLIGHTGUIDE">SCI_GETHIGHLIGHTGUIDE</a><br />
3244 </code>
3246 <p><b id="SCI_SETTABWIDTH">SCI_SETTABWIDTH(int widthInChars)</b><br />
3247 <b id="SCI_GETTABWIDTH">SCI_GETTABWIDTH</b><br />
3248 <code>SCI_SETTABWIDTH</code> sets the size of a tab as a multiple of the size of a space
3249 character in <code>STYLE_DEFAULT</code>. The default tab width is 8 characters. There are no
3250 limits on tab sizes, but values less than 1 or large values may have undesirable effects.</p>
3252 <p><b id="SCI_SETUSETABS">SCI_SETUSETABS(bool useTabs)</b><br />
3253 <b id="SCI_GETUSETABS">SCI_GETUSETABS</b><br />
3254 <code>SCI_SETUSETABS</code> determines whether indentation should be created out of a mixture
3255 of tabs and spaces or be based purely on spaces. Set <code>useTabs</code> to <code>false</code>
3256 (0) to create all tabs and indents out of spaces. The default is <code>true</code>. You can use
3257 <a class="message" href="#SCI_GETCOLUMN"><code>SCI_GETCOLUMN</code></a> to get the column of a
3258 position taking the width of a tab into account.</p>
3259 <p><b id="SCI_SETINDENT">SCI_SETINDENT(int widthInChars)</b><br />
3260 <b id="SCI_GETINDENT">SCI_GETINDENT</b><br />
3261 <code>SCI_SETINDENT</code> sets the size of indentation in terms of the width of a space in <a
3262 class="message" href="#StyleDefinition"><code>STYLE_DEFAULT</code></a>. If you set a width of
3263 0, the indent size is the same as the tab size. There are no limits on indent sizes, but values
3264 less than 0 or large values may have undesirable effects.
3265 </p>
3267 <p><b id="SCI_SETTABINDENTS">SCI_SETTABINDENTS(bool tabIndents)</b><br />
3268 <b id="SCI_GETTABINDENTS">SCI_GETTABINDENTS</b><br />
3269 <b id="SCI_SETBACKSPACEUNINDENTS">SCI_SETBACKSPACEUNINDENTS(bool bsUnIndents)</b><br />
3270 <b id="SCI_GETBACKSPACEUNINDENTS">SCI_GETBACKSPACEUNINDENTS</b><br />
3271 </p>
3273 <p>Inside indentation white space, the tab and backspace keys can be made to indent and
3274 unindent rather than insert a tab character or delete a character with the
3275 <code>SCI_SETTABINDENTS</code> and <code>SCI_SETBACKSPACEUNINDENTS</code> functions.</p>
3277 <p><b id="SCI_SETLINEINDENTATION">SCI_SETLINEINDENTATION(int line, int indentation)</b><br />
3278 <b id="SCI_GETLINEINDENTATION">SCI_GETLINEINDENTATION(int line)</b><br />
3279 The amount of indentation on a line can be discovered and set with
3280 <code>SCI_GETLINEINDENTATION</code> and <code>SCI_SETLINEINDENTATION</code>. The indentation is
3281 measured in character columns, which correspond to the width of space characters.</p>
3283 <p><b id="SCI_GETLINEINDENTPOSITION">SCI_GETLINEINDENTPOSITION(int line)</b><br />
3284 This returns the position at the end of indentation of a line.</p>
3286 <p><b id="SCI_SETINDENTATIONGUIDES">SCI_SETINDENTATIONGUIDES(int indentView)</b><br />
3287 <b id="SCI_GETINDENTATIONGUIDES">SCI_GETINDENTATIONGUIDES</b><br />
3288 Indentation guides are dotted vertical lines that appear within indentation white space every
3289 indent size columns. They make it easy to see which constructs line up especially when they
3290 extend over multiple pages. Style <a class="message"
3291 href="#StyleDefinition"><code>STYLE_INDENTGUIDE</code></a> (37) is used to specify the
3292 foreground and background colour of the indentation guides.</p>
3294 <p>There are 4 indentation guide views.
3295 SC_IV_NONE turns the feature off but the other 3 states determine how far the guides appear on
3296 empty lines. </p>
3297 <table border="0" summary="Search flags">
3298 <tbody>
3299 <tr>
3300 <td><code>SC_IV_NONE</code></td>
3301 <td>No indentation guides are shown.</td>
3302 </tr>
3304 <tr>
3305 <td><code>SC_IV_REAL</code></td>
3306 <td>Indentation guides are shown inside real indentation white space.</td>
3307 </tr>
3309 <tr>
3310 <td><code>SC_IV_LOOKFORWARD</code></td>
3311 <td>Indentation guides are shown beyond the actual indentation up to the level of the
3312 next non-empty line.
3313 If the previous non-empty line was a fold header then indentation guides are shown for
3314 one more level of indent than that line. This setting is good for Python.</td>
3315 </tr>
3317 <tr>
3318 <td><code>SC_IV_LOOKBOTH</code></td>
3319 <td>Indentation guides are shown beyond the actual indentation up to the level of the
3320 next non-empty line or previous non-empty line whichever is the greater.
3321 This setting is good for most languages.</td>
3322 </tr>
3324 </tbody>
3325 </table>
3327 <p><b id="SCI_SETHIGHLIGHTGUIDE">SCI_SETHIGHLIGHTGUIDE(int column)</b><br />
3328 <b id="SCI_GETHIGHLIGHTGUIDE">SCI_GETHIGHLIGHTGUIDE</b><br />
3329 When brace highlighting occurs, the indentation guide corresponding to the braces may be
3330 highlighted with the brace highlighting style, <a class="message"
3331 href="#StyleDefinition"><code>STYLE_BRACELIGHT</code></a> (34). Set <code>column</code> to 0 to
3332 cancel this highlight.</p>
3334 <h2 id="Markers">Markers</h2>
3336 <p>There are 32 markers, numbered 0 to <code>MARKER_MAX</code> (31), and you can assign any combination of them to each
3337 line in the document. Markers appear in the <a class="jump" href="#Margins">selection
3338 margin</a> to the left of the text. If the selection margin is set to zero width, the
3339 background colour of the whole line is changed instead. Marker numbers 25 to 31 are used by
3340 Scintilla in folding margins, and have symbolic names of the form <code>SC_MARKNUM_</code>*,
3341 for example <code>SC_MARKNUM_FOLDEROPEN</code>.</p>
3343 <p>Marker numbers 0 to 24 have no pre-defined function; you can use them to mark syntax errors
3344 or the current point of execution, break points, or whatever you need marking. If you do not
3345 need folding, you can use all 32 for any purpose you wish.</p>
3347 <p>Each marker number has a symbol associated with it. You can also set the foreground and
3348 background colour for each marker number, so you can use the same symbol more than once with
3349 different colouring for different uses. Scintilla has a set of symbols you can assign
3350 (<code>SC_MARK_</code>*) or you can use characters. By default, all 32 markers are set to
3351 <code>SC_MARK_CIRCLE</code> with a black foreground and a white background.</p>
3353 <p>The markers are drawn in the order of their numbers, so higher numbered markers appear on
3354 top of lower numbered ones. Markers try to move with their text by tracking where the start of
3355 their line moves. When a line is deleted, its markers are combined, by an <code>OR</code>
3356 operation, with the markers of the previous line.</p>
3357 <code><a class="message" href="#SCI_MARKERDEFINE">SCI_MARKERDEFINE(int markerNumber, int
3358 markerSymbols)</a><br />
3359 <a class="message" href="#SCI_MARKERDEFINEPIXMAP">SCI_MARKERDEFINEPIXMAP(int markerNumber,
3360 const char *xpm)</a><br />
3361 <a class="message" href="#SCI_RGBAIMAGESETWIDTH">SCI_RGBAIMAGESETWIDTH(int width)</a><br />
3362 <a class="message" href="#SCI_RGBAIMAGESETHEIGHT">SCI_RGBAIMAGESETHEIGHT(int height)</a><br />
3363 <a class="message" href="#SCI_MARKERDEFINERGBAIMAGE">SCI_MARKERDEFINERGBAIMAGE(int markerNumber,
3364 const char *pixels)</a><br />
3365 <a class="message" href="#SCI_MARKERSYMBOLDEFINED">SCI_MARKERSYMBOLDEFINED(int markerNumber)
3366 </a><br />
3367 <a class="message" href="#SCI_MARKERSETFORE">SCI_MARKERSETFORE(int markerNumber, int
3368 colour)</a><br />
3369 <a class="message" href="#SCI_MARKERSETBACK">SCI_MARKERSETBACK(int markerNumber, int
3370 colour)</a><br />
3371 <a class="message" href="#SCI_MARKERSETBACKSELECTED">SCI_MARKERSETBACKSELECTED(int markerNumber, int
3372 colour)</a><br />
3373 <a class="message" href="#SCI_MARKERENABLEHIGHLIGHT">SCI_MARKERENABLEHIGHLIGHT(int enabled)</a><br />
3374 <a class="message" href="#SCI_MARKERSETALPHA">SCI_MARKERSETALPHA(int markerNumber, int
3375 alpha)</a><br />
3376 <a class="message" href="#SCI_MARKERADD">SCI_MARKERADD(int line, int markerNumber)</a><br />
3377 <a class="message" href="#SCI_MARKERADDSET">SCI_MARKERADDSET(int line, int markerMask)</a><br />
3378 <a class="message" href="#SCI_MARKERDELETE">SCI_MARKERDELETE(int line, int
3379 markerNumber)</a><br />
3380 <a class="message" href="#SCI_MARKERDELETEALL">SCI_MARKERDELETEALL(int markerNumber)</a><br />
3381 <a class="message" href="#SCI_MARKERGET">SCI_MARKERGET(int line)</a><br />
3382 <a class="message" href="#SCI_MARKERNEXT">SCI_MARKERNEXT(int lineStart, int
3383 markerMask)</a><br />
3384 <a class="message" href="#SCI_MARKERPREVIOUS">SCI_MARKERPREVIOUS(int lineStart, int
3385 markerMask)</a><br />
3386 <a class="message" href="#SCI_MARKERLINEFROMHANDLE">SCI_MARKERLINEFROMHANDLE(int
3387 handle)</a><br />
3388 <a class="message" href="#SCI_MARKERDELETEHANDLE">SCI_MARKERDELETEHANDLE(int handle)</a><br />
3389 </code>
3391 <p><b id="SCI_MARKERDEFINE">SCI_MARKERDEFINE(int markerNumber, int markerSymbols)</b><br />
3392 This message associates a marker number in the range 0 to 31 with one of the marker symbols or
3393 an ASCII character. The general-purpose marker symbols currently available are:<br />
3394 <code>SC_MARK_CIRCLE</code>, <code>SC_MARK_ROUNDRECT</code>, <code>SC_MARK_ARROW</code>,
3395 <code>SC_MARK_SMALLRECT</code>, <code>SC_MARK_SHORTARROW</code>, <code>SC_MARK_EMPTY</code>,
3396 <code>SC_MARK_ARROWDOWN</code>, <code>SC_MARK_MINUS</code>, <code>SC_MARK_PLUS</code>,
3397 <code>SC_MARK_ARROWS</code>, <code>SC_MARK_DOTDOTDOT</code>,
3398 <code>SC_MARK_BACKGROUND</code>, <code>SC_MARK_LEFTRECT</code>,
3399 <code>SC_MARK_FULLRECT</code>, and <code>SC_MARK_UNDERLINE</code>.</p>
3401 <p>The <code>SC_MARK_BACKGROUND</code> marker changes the background colour of the line only.
3402 The <code>SC_MARK_FULLRECT</code> symbol mirrors this, changing only the margin background colour.
3403 <code>SC_MARK_UNDERLINE</code> draws an underline across the text.
3404 The <code>SC_MARK_EMPTY</code> symbol is invisible, allowing client code to track the movement
3405 of lines. You would also use it if you changed the folding style and wanted one or more of the
3406 <code>SC_FOLDERNUM_</code>* markers to have no associated symbol.</p>
3408 <p>Applications may use the marker symbol <code>SC_MARK_AVAILABLE</code> to indicate that
3409 plugins may allocate that marker number.
3410 </p>
3412 <p>There are also marker symbols designed for use in the folding margin in a flattened tree
3413 style.<br />
3414 <code>SC_MARK_BOXMINUS</code>, <code>SC_MARK_BOXMINUSCONNECTED</code>,
3415 <code>SC_MARK_BOXPLUS</code>, <code>SC_MARK_BOXPLUSCONNECTED</code>,
3416 <code>SC_MARK_CIRCLEMINUS</code>, <code>SC_MARK_CIRCLEMINUSCONNECTED</code>,
3417 <code>SC_MARK_CIRCLEPLUS</code>, <code>SC_MARK_CIRCLEPLUSCONNECTED</code>,
3418 <code>SC_MARK_LCORNER</code>, <code>SC_MARK_LCORNERCURVE</code>, <code>SC_MARK_TCORNER</code>,
3419 <code>SC_MARK_TCORNERCURVE</code>, and <code>SC_MARK_VLINE</code>.</p>
3420 Characters can be used as markers by adding the ASCII value of the character to
3421 <code>SC_MARK_CHARACTER</code> (10000). For example, to use 'A' (ASCII code 65) as marker
3422 number 1 use:<br />
3423 <code>SCI_MARKERDEFINE(1, SC_MARK_CHARACTER+65)</code>. <br />
3425 <p>The marker numbers <code>SC_MARKNUM_FOLDER</code> and <code>SC_MARKNUM_FOLDEROPEN</code> are
3426 used for showing that a fold is present and open or closed. Any symbols may be assigned for
3427 this purpose although the (<code>SC_MARK_PLUS</code>, <code>SC_MARK_MINUS</code>) pair or the
3428 (<code>SC_MARK_ARROW</code>, <code>SC_MARK_ARROWDOWN</code>) pair are good choices. As well as
3429 these two, more assignments are needed for the flattened tree style:
3430 <code>SC_MARKNUM_FOLDEREND</code>, <code>SC_MARKNUM_FOLDERMIDTAIL</code>,
3431 <code>SC_MARKNUM_FOLDEROPENMID</code>, <code>SC_MARKNUM_FOLDERSUB</code>, and
3432 <code>SC_MARKNUM_FOLDERTAIL</code>. The bits used for folding are specified by
3433 <code>SC_MASK_FOLDERS</code>, which is commonly used as an argument to
3434 <code>SCI_SETMARGINMASKN</code> when defining a margin to be used for folding.</p>
3436 <p>This table shows which <code>SC_MARK_</code>* symbols should be assigned to which
3437 <code>SC_MARKNUM_</code>* marker numbers to obtain four folding styles: Arrow (mimics
3438 Macintosh), plus/minus shows folded lines as '+' and opened folds as '-', Circle tree, Box
3439 tree.</p>
3441 <table cellpadding="1" cellspacing="2" border="0" summary="Markers used for folding">
3442 <thead align="left">
3443 <tr>
3444 <th><code>SC_MARKNUM_</code>*</th>
3446 <th>Arrow</th>
3448 <th>Plus/minus</th>
3450 <th>Circle tree</th>
3452 <th>Box tree</th>
3453 </tr>
3454 </thead>
3456 <tbody valign="top">
3457 <tr>
3458 <th align="left"><code>FOLDEROPEN</code></th>
3460 <td><code>ARROWDOWN</code></td>
3462 <td><code>MINUS</code></td>
3464 <td><code>CIRCLEMINUS</code></td>
3466 <td><code>BOXMINUS</code></td>
3467 </tr>
3469 <tr>
3470 <th align="left"><code>FOLDER</code></th>
3472 <td><code>ARROW</code></td>
3474 <td><code>PLUS</code></td>
3476 <td><code>CIRCLEPLUS</code></td>
3478 <td><code>BOXPLUS</code></td>
3479 </tr>
3481 <tr>
3482 <th align="left"><code>FOLDERSUB</code></th>
3484 <td><code>EMPTY</code></td>
3486 <td><code>EMPTY</code></td>
3488 <td><code>VLINE</code></td>
3490 <td><code>VLINE</code></td>
3491 </tr>
3493 <tr>
3494 <th align="left"><code>FOLDERTAIL</code></th>
3496 <td><code>EMPTY</code></td>
3498 <td><code>EMPTY</code></td>
3500 <td><code>LCORNERCURVE</code></td>
3502 <td><code>LCORNER</code></td>
3503 </tr>
3505 <tr>
3506 <th align="left"><code>FOLDEREND</code></th>
3508 <td><code>EMPTY</code></td>
3510 <td><code>EMPTY</code></td>
3512 <td><code>CIRCLEPLUSCONNECTED</code></td>
3514 <td><code>BOXPLUSCONNECTED</code></td>
3515 </tr>
3517 <tr>
3518 <th align="left"><code>FOLDEROPENMID</code></th>
3520 <td><code>EMPTY</code></td>
3522 <td><code>EMPTY</code></td>
3524 <td><code>CIRCLEMINUSCONNECTED</code></td>
3526 <td><code>BOXMINUSCONNECTED</code></td>
3527 </tr>
3529 <tr>
3530 <th align="left"><code>FOLDERMIDTAIL</code></th>
3532 <td><code>EMPTY</code></td>
3534 <td><code>EMPTY</code></td>
3536 <td><code>TCORNERCURVE</code></td>
3538 <td><code>TCORNER</code></td>
3539 </tr>
3540 </tbody>
3541 </table>
3543 <p><b id="SCI_MARKERDEFINEPIXMAP">SCI_MARKERDEFINEPIXMAP(int markerNumber, const char
3544 *xpm)</b><br />
3545 Markers can be set to pixmaps with this message. The
3546 <a class="jump" href="#XPM">XPM format</a> is used for the pixmap.
3547 Pixmaps use the <code>SC_MARK_PIXMAP</code> marker symbol. </p>
3550 <b id="SCI_RGBAIMAGESETWIDTH">SCI_RGBAIMAGESETWIDTH(int width)</b><br />
3551 <b id="SCI_RGBAIMAGESETHEIGHT">SCI_RGBAIMAGESETHEIGHT(int height)</b><br />
3552 <b id="SCI_MARKERDEFINERGBAIMAGE">SCI_MARKERDEFINERGBAIMAGE(int markerNumber, const char *pixels)</b><br />
3553 Markers can be set to translucent pixmaps with this message. The
3554 <a class="jump" href="#RGBA">RGBA format</a> is used for the pixmap.
3555 The width and height must previously been set with the <code>SCI_RGBAIMAGESETWIDTH</code> and
3556 <code>SCI_RGBAIMAGESETHEIGHT</code> messages.
3557 Pixmaps use the <code>SC_MARK_RGBAIMAGE</code> marker symbol. </p>
3559 <p><b id="SCI_MARKERSYMBOLDEFINED">SCI_MARKERSYMBOLDEFINED(int markerNumber)</b><br />
3560 Returns the symbol defined for a markerNumber with <code>SCI_MARKERDEFINE</code>
3561 or <code>SC_MARK_PIXMAP</code> if defined with <code>SCI_MARKERDEFINEPIXMAP</code>
3562 or <code>SC_MARK_RGBAIMAGE</code> if defined with <code>SCI_MARKERDEFINERGBAIMAGE</code>.</p>
3564 <p><b id="SCI_MARKERSETFORE">SCI_MARKERSETFORE(int markerNumber, int <a class="jump"
3565 href="#colour">colour</a>)</b><br />
3566 <b id="SCI_MARKERSETBACK">SCI_MARKERSETBACK(int markerNumber, int <a class="jump"
3567 href="#colour">colour</a>)</b><br />
3568 These two messages set the foreground and background colour of a marker number.<br />
3569 <b id="SCI_MARKERSETBACKSELECTED">SCI_MARKERSETBACKSELECTED(int markerNumber, int <a class="jump"
3570 href="#colour">colour</a>)</b><br />
3571 This message sets the highlight background colour of a marker number when its folding block is selected. The default colour is #FF0000.</p>
3572 <p><b id="SCI_MARKERENABLEHIGHLIGHT">SCI_MARKERENABLEHIGHLIGHT(bool enabled)</b><br />
3573 This message allows to enable/disable the highlight folding block when it is selected. (i.e. block that contains the caret)</p>
3574 <p><b id="SCI_MARKERSETALPHA">SCI_MARKERSETALPHA(int markerNumber, int <a class="jump"
3575 href="#alpha">alpha</a>)</b><br />
3576 When markers are drawn in the content area, either because there is no margin for them or
3577 they are of <code>SC_MARK_BACKGROUND</code> or <code>SC_MARK_UNDERLINE</code> types, they may be drawn translucently by
3578 setting an alpha value.</p>
3580 <p><b id="SCI_MARKERADD">SCI_MARKERADD(int line, int markerNumber)</b><br />
3581 This message adds marker number <code>markerNumber</code> to a line. The message returns -1 if
3582 this fails (illegal line number, out of memory) or it returns a marker handle number that
3583 identifies the added marker. You can use this returned handle with <a class="message"
3584 href="#SCI_MARKERLINEFROMHANDLE"><code>SCI_MARKERLINEFROMHANDLE</code></a> to find where a
3585 marker is after moving or combining lines and with <a class="message"
3586 href="#SCI_MARKERDELETEHANDLE"><code>SCI_MARKERDELETEHANDLE</code></a> to delete the marker
3587 based on its handle. The message does not check the value of markerNumber, nor does it
3588 check if the line already contains the marker.</p>
3590 <p><b id="SCI_MARKERADDSET">SCI_MARKERADDSET(int line, int markerMask)</b><br />
3591 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
3592 <a class="message" href="#SCI_MARKERGET"><code>SCI_MARKERGET</code></a>
3593 (and used by the mask-based marker search functions
3594 <a class="message" href="#SCI_MARKERNEXT"><code>SCI_MARKERNEXT</code></a> and
3595 <a class="message" href="#SCI_MARKERPREVIOUS"><code>SCI_MARKERPREVIOUS</code></a>).
3596 As with
3597 <a class="message" href="#SCI_MARKERADD"><code>SCI_MARKERADD</code></a>, no check is made
3598 to see if any of the markers are already present on the targeted line.</p>
3600 <p><b id="SCI_MARKERDELETE">SCI_MARKERDELETE(int line, int markerNumber)</b><br />
3601 This searches the given line number for the given marker number and deletes it if it is
3602 present. If you added the same marker more than once to the line, this will delete one copy
3603 each time it is used. If you pass in a marker number of -1, all markers are deleted from the
3604 line.</p>
3606 <p><b id="SCI_MARKERDELETEALL">SCI_MARKERDELETEALL(int markerNumber)</b><br />
3607 This removes markers of the given number from all lines. If markerNumber is -1, it deletes all
3608 markers from all lines.</p>
3610 <p><b id="SCI_MARKERGET">SCI_MARKERGET(int line)</b><br />
3611 This returns a 32-bit integer that indicates which markers were present on the line. Bit 0 is
3612 set if marker 0 is present, bit 1 for marker 1 and so on.</p>
3614 <p><b id="SCI_MARKERNEXT">SCI_MARKERNEXT(int lineStart, int markerMask)</b><br />
3615 <b id="SCI_MARKERPREVIOUS">SCI_MARKERPREVIOUS(int lineStart, int markerMask)</b><br />
3616 These messages search efficiently for lines that include a given set of markers. The search
3617 starts at line number <code>lineStart</code> and continues forwards to the end of the file
3618 (<code>SCI_MARKERNEXT</code>) or backwards to the start of the file
3619 (<code>SCI_MARKERPREVIOUS</code>). The <code>markerMask</code> argument should have one bit set
3620 for each marker you wish to find. Set bit 0 to find marker 0, bit 1 for marker 1 and so on. The
3621 message returns the line number of the first line that contains one of the markers in
3622 <code>markerMask</code> or -1 if no marker is found.</p>
3624 <p><b id="SCI_MARKERLINEFROMHANDLE">SCI_MARKERLINEFROMHANDLE(int markerHandle)</b><br />
3625 The <code>markerHandle</code> argument is an identifier for a marker returned by <a
3626 class="message" href="#SCI_MARKERADD"><code>SCI_MARKERADD</code></a>. This function searches
3627 the document for the marker with this handle and returns the line number that contains it or -1
3628 if it is not found.</p>
3630 <p><b id="SCI_MARKERDELETEHANDLE">SCI_MARKERDELETEHANDLE(int markerHandle)</b><br />
3631 The <code>markerHandle</code> argument is an identifier for a marker returned by <a
3632 class="message" href="#SCI_MARKERADD"><code>SCI_MARKERADD</code></a>. This function searches
3633 the document for the marker with this handle and deletes the marker if it is found.</p>
3635 <h2 id="Indicators">Indicators</h2>
3637 <p>Indicators are used to display additional information over the top of styling.
3638 They can be used to show, for example, syntax errors, deprecated names and bad indentation
3639 by drawing underlines under text or boxes around text. Originally, Scintilla stored indicator information in
3640 the style bytes but this has proved limiting, so now up to 32 separately stored indicators may be used.
3641 While style byte indicators currently still work, they will soon be removed so all the bits in each style
3642 byte can be used for lexical states.</p>
3644 <p>Indicators may be displayed as simple underlines, squiggly underlines, a
3645 line of small 'T' shapes, a line of diagonal hatching, a strike-out or a rectangle around the text.</p>
3647 <p>The <code>SCI_INDIC*</code> messages allow you to get and set the visual appearance of the
3648 indicators. They all use an <code>indicatorNumber</code> argument in the range 0 to INDIC_MAX(31)
3649 to set the indicator to style. To prevent interference the set of indicators is divided up into a range for use
3650 by lexers (0..7) and a range for use by containers
3651 (8=<code>INDIC_CONTAINER</code> .. 31=<code>INDIC_MAX</code>).</p>
3653 <code><a class="message" href="#SCI_INDICSETSTYLE">SCI_INDICSETSTYLE(int indicatorNumber, int
3654 indicatorStyle)</a><br />
3655 <a class="message" href="#SCI_INDICGETSTYLE">SCI_INDICGETSTYLE(int indicatorNumber)</a><br />
3656 <a class="message" href="#SCI_INDICSETFORE">SCI_INDICSETFORE(int indicatorNumber, int
3657 colour)</a><br />
3658 <a class="message" href="#SCI_INDICGETFORE">SCI_INDICGETFORE(int indicatorNumber)</a><br />
3659 <a class="message" href="#SCI_INDICSETALPHA">SCI_INDICSETALPHA(int indicatorNumber, int alpha)</a><br />
3660 <a class="message" href="#SCI_INDICGETALPHA">SCI_INDICGETALPHA(int indicatorNumber)</a><br />
3661 <a class="message" href="#SCI_INDICSETOUTLINEALPHA">SCI_INDICSETOUTLINEALPHA(int indicatorNumber, int alpha)</a><br />
3662 <a class="message" href="#SCI_INDICGETOUTLINEALPHA">SCI_INDICGETOUTLINEALPHA(int indicatorNumber)</a><br />
3663 <a class="message" href="#SCI_INDICSETUNDER">SCI_INDICSETUNDER(int indicatorNumber, bool under)</a><br />
3664 <a class="message" href="#SCI_INDICGETUNDER">SCI_INDICGETUNDER(int indicatorNumber)</a><br />
3665 </code>
3667 <p><b id="SCI_INDICSETSTYLE">SCI_INDICSETSTYLE(int indicatorNumber, int
3668 indicatorStyle)</b><br />
3669 <b id="SCI_INDICGETSTYLE">SCI_INDICGETSTYLE(int indicatorNumber)</b><br />
3670 These two messages set and get the style for a particular indicator. The indicator styles
3671 currently available are:</p>
3673 <table cellpadding="1" cellspacing="2" border="0" summary="Indicators">
3674 <tbody>
3675 <tr>
3676 <th align="left">Symbol</th>
3678 <th>Value</th>
3680 <th align="left">Visual effect</th>
3681 </tr>
3682 </tbody>
3684 <tbody valign="top">
3685 <tr>
3686 <td align="left"><code>INDIC_PLAIN</code></td>
3688 <td align="center">0</td>
3690 <td>Underlined with a single, straight line.</td>
3691 </tr>
3693 <tr>
3694 <td align="left"><code>INDIC_SQUIGGLE</code></td>
3696 <td align="center">1</td>
3698 <td>A squiggly underline. Requires 3 pixels of descender space.</td>
3699 </tr>
3701 <tr>
3702 <td align="left"><code>INDIC_TT</code></td>
3704 <td align="center">2</td>
3706 <td>A line of small T shapes.</td>
3707 </tr>
3709 <tr>
3710 <td align="left"><code>INDIC_DIAGONAL</code></td>
3712 <td align="center">3</td>
3714 <td>Diagonal hatching.</td>
3715 </tr>
3717 <tr>
3718 <td align="left"><code>INDIC_STRIKE</code></td>
3720 <td align="center">4</td>
3722 <td>Strike out.</td>
3723 </tr>
3725 <tr>
3726 <td align="left"><code>INDIC_HIDDEN</code></td>
3728 <td align="center">5</td>
3730 <td>An indicator with no visual effect.</td>
3731 </tr>
3733 <tr>
3734 <td align="left"><code>INDIC_BOX</code></td>
3736 <td align="center">6</td>
3738 <td>A rectangle around the text.</td>
3739 </tr>
3741 <tr>
3742 <td align="left"><code>INDIC_ROUNDBOX</code></td>
3744 <td align="center">7</td>
3746 <td>A rectangle with rounded corners around the text using translucent drawing with the
3747 interior usually more transparent than the border. You can use
3748 <a class="message" href="#SCI_INDICSETALPHA">SCI_INDICSETALPHA</a> and
3749 <a class="message" href="#SCI_INDICSETOUTLINEALPHA">SCI_INDICSETOUTLINEALPHA</a>
3750 to control the alpha transparency values. The default alpha values are 30 for fill colour and 50 for outline colour.</td>
3751 </tr>
3753 <tr>
3754 <td align="left"><code>INDIC_STRAIGHTBOX</code></td>
3756 <td align="center">8</td>
3758 <td>A rectangle around the text using translucent drawing with the
3759 interior usually more transparent than the border. You can use
3760 <a class="message" href="#SCI_INDICSETALPHA">SCI_INDICSETALPHA</a> and
3761 <a class="message" href="#SCI_INDICSETOUTLINEALPHA">SCI_INDICSETOUTLINEALPHA</a>
3762 to control the alpha transparency values. The default alpha values are 30 for fill colour and 50 for outline colour.</td>
3763 </tr>
3765 <tr>
3766 <td align="left"><code>INDIC_DASH</code></td>
3768 <td align="center">9</td>
3770 <td>A dashed underline.</td>
3771 </tr>
3773 <tr>
3774 <td align="left"><code>INDIC_DOTS</code></td>
3776 <td align="center">10</td>
3778 <td>A dotted underline.</td>
3779 </tr>
3781 <tr>
3782 <td align="left"><code>INDIC_SQUIGGLELOW</code></td>
3784 <td align="center">11</td>
3786 <td>Similar to <code>INDIC_SQUIGGLE</code> but only using 2 vertical pixels
3787 so will fit under small fonts.</td>
3788 </tr>
3790 <tr>
3791 <td align="left"><code>INDIC_DOTBOX</code></td>
3793 <td align="center">12</td>
3795 <td>A dotted rectangle around the text using translucent drawing.
3796 Translucency alternates between the alpha and outline alpha settings with the top-left pixel using the alpha setting.
3797 <a class="message" href="#SCI_INDICSETALPHA">SCI_INDICSETALPHA</a> and
3798 <a class="message" href="#SCI_INDICSETOUTLINEALPHA">SCI_INDICSETOUTLINEALPHA</a>
3799 control the alpha transparency values. The default values are 30 for alpha and 50 for outline alpha.
3800 To avoid excessive memory allocation the maximum width of a dotted box is 4000 pixels.
3801 Not available for OS X Carbon.</td>
3802 </tr>
3804 </tbody>
3805 </table>
3807 <p>The default indicator styles are equivalent to:<br />
3808 <code>SCI_INDICSETSTYLE(0, INDIC_SQUIGGLE);</code><br />
3809 <code>SCI_INDICSETSTYLE(1, INDIC_TT);</code><br />
3810 <code>SCI_INDICSETSTYLE(2, INDIC_PLAIN);</code></p>
3812 <p><b id="SCI_INDICSETFORE">SCI_INDICSETFORE(int indicatorNumber, int <a class="jump" href="#colour">colour</a>)</b><br />
3813 <b id="SCI_INDICGETFORE">SCI_INDICGETFORE(int indicatorNumber)</b><br />
3814 These two messages set and get the colour used to draw an indicator. The default indicator
3815 colours are equivalent to:<br />
3816 <code>SCI_INDICSETFORE(0, 0x007f00);</code> (dark green)<br />
3817 <code>SCI_INDICSETFORE(1, 0xff0000);</code> (light blue)<br />
3818 <code>SCI_INDICSETFORE(2, 0x0000ff);</code> (light red)</p>
3820 <p><b id="SCI_INDICSETALPHA">SCI_INDICSETALPHA(int indicatorNumber, int alpha)</b><br />
3821 <b id="SCI_INDICGETALPHA">SCI_INDICGETALPHA(int indicatorNumber)</b><br />
3822 These two messages set and get the alpha transparency used for drawing the
3823 fill colour of the INDIC_ROUNDBOX and INDIC_STRAIGHTBOX rectangle. The alpha value can range from
3824 0 (completely transparent) to 255 (no transparency).
3825 </p>
3827 <p><b id="SCI_INDICSETOUTLINEALPHA">SCI_INDICSETOUTLINEALPHA(int indicatorNumber, int alpha)</b><br />
3828 <b id="SCI_INDICGETOUTLINEALPHA">SCI_INDICGETOUTLINEALPHA(int indicatorNumber)</b><br />
3829 These two messages set and get the alpha transparency used for drawing the
3830 outline colour of the INDIC_ROUNDBOX and INDIC_STRAIGHTBOX rectangle. The alpha value can range from
3831 0 (completely transparent) to 255 (no transparency).
3832 </p>
3834 <p><b id="SCI_INDICSETUNDER">SCI_INDICSETUNDER(int indicatorNumber, bool under)</b><br />
3835 <b id="SCI_INDICGETUNDER">SCI_INDICGETUNDER(int indicatorNumber)</b><br />
3836 These two messages set and get whether an indicator is drawn under text or over(default).
3837 Drawing under text works only for modern indicators when <a class="message" href="#SCI_SETTWOPHASEDRAW">two phase drawing</a>
3838 is enabled.</p>
3840 <h3 id="ModernIndicators">Modern Indicators</h3>
3842 <p>Modern indicators are stored in a format similar to run length encoding which is efficient in both
3843 speed and storage for sparse information.</p>
3844 <p>An indicator may store different values for each range but currently all values are drawn the same.
3845 In the future, it may be possible to draw different values in different styles.</p>
3847 <b id="SCI_SETINDICATORCURRENT">SCI_SETINDICATORCURRENT(int indicator)</b><br />
3848 <b id="SCI_GETINDICATORCURRENT">SCI_GETINDICATORCURRENT</b><br />
3849 These two messages set and get the indicator that will be affected by calls to
3850 <a class="message" href="#SCI_INDICATORFILLRANGE">SCI_INDICATORFILLRANGE(int position, int fillLength)</a> and
3851 <a class="message" href="#SCI_INDICATORCLEARRANGE">SCI_INDICATORCLEARRANGE(int position, int clearLength)</a>.
3852 </p>
3855 <b id="SCI_SETINDICATORVALUE">SCI_SETINDICATORVALUE(int value)</b><br />
3856 <b id="SCI_GETINDICATORVALUE">SCI_GETINDICATORVALUE</b><br />
3857 These two messages set and get the value that will be set by calls to
3858 <a class="message" href="#SCI_INDICATORFILLRANGE">SCI_INDICATORFILLRANGE</a>.
3859 </p>
3862 <b id="SCI_INDICATORFILLRANGE">SCI_INDICATORFILLRANGE(int position, int fillLength)</b><br />
3863 <b id="SCI_INDICATORCLEARRANGE">SCI_INDICATORCLEARRANGE(int position, int clearLength)</b><br />
3864 These two messages fill or clear a range for the current indicator.
3865 <code>SCI_INDICATORFILLRANGE</code> fills with the
3866 the current value.
3867 </p>
3870 <b id="SCI_INDICATORALLONFOR">SCI_INDICATORALLONFOR(int position)</b><br />
3871 Retrieve a bitmap value representing which indicators are non-zero at a position.
3872 </p>
3875 <b id="SCI_INDICATORVALUEAT">SCI_INDICATORVALUEAT(int indicator, int position)</b><br />
3876 Retrieve the value of a particular indicator at a position.
3877 </p>
3880 <b id="SCI_INDICATORSTART">SCI_INDICATORSTART(int indicator, int position)</b><br />
3881 <b id="SCI_INDICATOREND">SCI_INDICATOREND(int indicator, int position)</b><br />
3882 Find the start or end of a range with one value from a position within the range.
3883 Can be used to iterate through the document to discover all the indicator positions.
3884 </p>
3886 <h3 id="FindIndicators">OS X Find Indicator</h3>
3888 <p>On OS X search matches are highlighted with an animated gold rounded rectangle.
3889 The indicator shows, then briefly grows 25% and shrinks to the original size to draw the user's attention.
3890 While this feature is currently only implemented on OS X, it may be implemented on other platforms
3891 in the future.</p>
3893 <p><b id="SCI_FINDINDICATORSHOW">SCI_FINDINDICATORSHOW(int start, int end)</b><br />
3894 <b id="SCI_FINDINDICATORFLASH">SCI_FINDINDICATORFLASH(int start, int end)</b><br />
3895 These two messages show and animate the find indicator. The indicator remains visible with
3896 <code>SCI_FINDINDICATORSHOW</code> and fades out after showing for half a second with
3897 <code>SCI_FINDINDICATORFLASH</code>.
3898 <code>SCI_FINDINDICATORSHOW</code> behaves similarly to the OS X TextEdit and Safari applications
3899 and is best suited to editing documentation where the search target is often a word.
3900 <code>SCI_FINDINDICATORFLASH</code> is similar to Xcode and is suited to editing source code
3901 where the match will often be located next to operators which would otherwise be hidden under the indicator's
3902 padding.
3903 </p>
3905 <p><b id="SCI_FINDINDICATORHIDE">SCI_FINDINDICATORHIDE</b><br />
3906 This message hides the find indicator.
3907 </p>
3909 <h3 id="StyleByteIndicators">Style Byte Indicators (deprecated)</h3>
3910 <p>By default, Scintilla organizes the style byte associated with each text byte as 5 bits of
3911 style information (for 32 styles) and 3 bits of indicator information for 3 independent
3912 indicators so that, for example, syntax errors, deprecated names and bad indentation could all
3913 be displayed at once.</p>
3915 <p>The indicators are set using <a class="message"
3916 href="#SCI_STARTSTYLING"><code>SCI_STARTSTYLING</code></a> with a <code>INDICS_MASK</code> mask
3917 and <a class="message" href="#SCI_SETSTYLING"><code>SCI_SETSTYLING</code></a> with the values
3918 <code>INDIC0_MASK</code>, <code>INDIC1_MASK</code> and <code>INDIC2_MASK</code>.</p>
3920 <p>If you are using indicators in a buffer that has a lexer active
3921 (see <a class="message" href="#SCI_SETLEXER"><code>SCI_SETLEXER</code></a>),
3922 you must save lexing state information before setting any indicators and restore it afterwards.
3923 Use <a class="message" href="#SCI_GETENDSTYLED"><code>SCI_GETENDSTYLED</code></a>
3924 to retrieve the current "styled to" position and
3925 <a class="message" href="#SCI_STARTSTYLING"><code>SCI_STARTSTYLING</code></a>
3926 to reset the styling position and mask (<code>0x1f </code> in the default layout of 5 style bits and 3 indicator bits)
3927 when you are done.</p>
3929 <p>The number of bits used for styles can be altered with <a class="message"
3930 href="#SCI_SETSTYLEBITS"><code>SCI_SETSTYLEBITS</code></a> from 0 to 8 bits. The remaining bits
3931 can be used for indicators, so there can be from 1 to 8 indicators. However, the
3932 <code>INDIC*_MASK</code> constants defined in <code>Scintilla.h</code> all assume 5 bits of
3933 styling information and 3 indicators. If you use a different arrangement, you must define your
3934 own constants.</p>
3937 <h2 id="Autocompletion">Autocompletion</h2>
3939 <p>Autocompletion displays a list box showing likely identifiers based upon the user's typing.
3940 The user chooses the currently selected item by pressing the tab character or another character
3941 that is a member of the fillup character set defined with <code>SCI_AUTOCSETFILLUPS</code>.
3942 Autocompletion is triggered by your application. For example, in C if you detect that the user
3943 has just typed <code>fred.</code> you could look up <code>fred</code>, and if it has a known
3944 list of members, you could offer them in an autocompletion list. Alternatively, you could
3945 monitor the user's typing and offer a list of likely items once their typing has narrowed down
3946 the choice to a reasonable list. As yet another alternative, you could define a key code to
3947 activate the list.</p>
3949 <p>When the user makes a selection from the list the container is sent a <code><a class="message"
3950 href="#SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</a></code> <a class="jump"
3951 href="#Notifications">notification message</a>. On return from the notification Scintilla will insert
3952 the selected text unless the autocompletion list has been cancelled, for example by the container sending
3953 <code><a class="message" href="#SCI_AUTOCCANCEL">SCI_AUTOCCANCEL</a></code>.</p>
3955 <p>To make use of autocompletion you must monitor each character added to the document. See
3956 <code>SciTEBase::CharAdded()</code> in SciTEBase.cxx for an example of autocompletion.</p>
3957 <code><a class="message" href="#SCI_AUTOCSHOW">SCI_AUTOCSHOW(int lenEntered, const char
3958 *list)</a><br />
3959 <a class="message" href="#SCI_AUTOCCANCEL">SCI_AUTOCCANCEL</a><br />
3960 <a class="message" href="#SCI_AUTOCACTIVE">SCI_AUTOCACTIVE</a><br />
3961 <a class="message" href="#SCI_AUTOCPOSSTART">SCI_AUTOCPOSSTART</a><br />
3962 <a class="message" href="#SCI_AUTOCCOMPLETE">SCI_AUTOCCOMPLETE</a><br />
3963 <a class="message" href="#SCI_AUTOCSTOPS">SCI_AUTOCSTOPS(&lt;unused&gt;, const char
3964 *chars)</a><br />
3965 <a class="message" href="#SCI_AUTOCSETSEPARATOR">SCI_AUTOCSETSEPARATOR(char
3966 separator)</a><br />
3967 <a class="message" href="#SCI_AUTOCGETSEPARATOR">SCI_AUTOCGETSEPARATOR</a><br />
3968 <a class="message" href="#SCI_AUTOCSELECT">SCI_AUTOCSELECT(&lt;unused&gt;, const char
3969 *select)</a><br />
3970 <a class="message" href="#SCI_AUTOCGETCURRENT">SCI_AUTOCGETCURRENT</a><br />
3971 <a class="message" href="#SCI_AUTOCGETCURRENTTEXT">SCI_AUTOCGETCURRENTTEXT(&lt;unused&gt;,
3972 char *text)</a><br />
3973 <a class="message" href="#SCI_AUTOCSETCANCELATSTART">SCI_AUTOCSETCANCELATSTART(bool
3974 cancel)</a><br />
3975 <a class="message" href="#SCI_AUTOCGETCANCELATSTART">SCI_AUTOCGETCANCELATSTART</a><br />
3976 <a class="message" href="#SCI_AUTOCSETFILLUPS">SCI_AUTOCSETFILLUPS(&lt;unused&gt;, const char
3977 *chars)</a><br />
3978 <a class="message" href="#SCI_AUTOCSETCHOOSESINGLE">SCI_AUTOCSETCHOOSESINGLE(bool
3979 chooseSingle)</a><br />
3980 <a class="message" href="#SCI_AUTOCGETCHOOSESINGLE">SCI_AUTOCGETCHOOSESINGLE</a><br />
3981 <a class="message" href="#SCI_AUTOCSETIGNORECASE">SCI_AUTOCSETIGNORECASE(bool
3982 ignoreCase)</a><br />
3983 <a class="message" href="#SCI_AUTOCGETIGNORECASE">SCI_AUTOCGETIGNORECASE</a><br />
3984 <a class="message" href="#SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR">SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR(int behaviour)</a><br>
3985 <a class="message" href="#SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR">SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR</a><br>
3986 <a class="message" href="#SCI_AUTOCSETAUTOHIDE">SCI_AUTOCSETAUTOHIDE(bool autoHide)</a><br />
3987 <a class="message" href="#SCI_AUTOCGETAUTOHIDE">SCI_AUTOCGETAUTOHIDE</a><br />
3988 <a class="message" href="#SCI_AUTOCSETDROPRESTOFWORD">SCI_AUTOCSETDROPRESTOFWORD(bool
3989 dropRestOfWord)</a><br />
3990 <a class="message" href="#SCI_AUTOCGETDROPRESTOFWORD">SCI_AUTOCGETDROPRESTOFWORD</a><br />
3991 <a class="message" href="#SCI_REGISTERIMAGE">SCI_REGISTERIMAGE(int type, const char *xpmData)</a><br />
3992 <a class="message" href="#SCI_REGISTERRGBAIMAGE">SCI_REGISTERRGBAIMAGE(int type, const char *pixels)</a><br />
3993 <a class="message" href="#SCI_CLEARREGISTEREDIMAGES">SCI_CLEARREGISTEREDIMAGES</a><br />
3994 <a class="message" href="#SCI_AUTOCSETTYPESEPARATOR">SCI_AUTOCSETTYPESEPARATOR(char separatorCharacter)</a><br />
3995 <a class="message" href="#SCI_AUTOCGETTYPESEPARATOR">SCI_AUTOCGETTYPESEPARATOR</a><br />
3996 <a class="message" href="#SCI_AUTOCSETMAXHEIGHT">SCI_AUTOCSETMAXHEIGHT(int rowCount)</a><br />
3997 <a class="message" href="#SCI_AUTOCGETMAXHEIGHT">SCI_AUTOCGETMAXHEIGHT</a><br />
3998 <a class="message" href="#SCI_AUTOCSETMAXWIDTH">SCI_AUTOCSETMAXWIDTH(int characterCount)</a><br />
3999 <a class="message" href="#SCI_AUTOCGETMAXWIDTH">SCI_AUTOCGETMAXWIDTH</a><br />
4000 </code>
4002 <p><b id="SCI_AUTOCSHOW">SCI_AUTOCSHOW(int lenEntered, const char *list)</b><br />
4003 This message causes a list to be displayed. <code>lenEntered</code> is the number of
4004 characters of the word already entered and <code>list</code> is the list of words separated by
4005 separator characters. The initial separator character is a space but this can be set or got
4006 with <a class="message" href="#SCI_AUTOCSETSEPARATOR"><code>SCI_AUTOCSETSEPARATOR</code></a>
4007 and <a class="message"
4008 href="#SCI_AUTOCGETSEPARATOR"><code>SCI_AUTOCGETSEPARATOR</code></a>.</p>
4010 <p>The list of words should be in sorted order. If set to ignore case mode with <a class="message" href="#SCI_AUTOCSETIGNORECASE"><code>SCI_AUTOCSETIGNORECASE</code></a>, then
4011 strings are matched after being converted to upper case. One result of this is that the list
4012 should be sorted with the punctuation characters '[', '\', ']', '^', '_', and '`' sorted after
4013 letters.</p>
4015 <p><b id="SCI_AUTOCCANCEL">SCI_AUTOCCANCEL</b><br />
4016 This message cancels any displayed autocompletion list. When in autocompletion mode, the list
4017 should disappear when the user types a character that can not be part of the autocompletion,
4018 such as '.', '(' or '[' when typing an identifier. A set of characters that will cancel
4019 autocompletion can be specified with <a class="message"
4020 href="#SCI_AUTOCSTOPS"><code>SCI_AUTOCSTOPS</code></a>.</p>
4022 <p><b id="SCI_AUTOCACTIVE">SCI_AUTOCACTIVE</b><br />
4023 This message returns non-zero if there is an active autocompletion list and zero if there is
4024 not.</p>
4026 <p><b id="SCI_AUTOCPOSSTART">SCI_AUTOCPOSSTART</b><br />
4027 This returns the value of the current position when <code>SCI_AUTOCSHOW</code> started display
4028 of the list.</p>
4030 <p><b id="SCI_AUTOCCOMPLETE">SCI_AUTOCCOMPLETE</b><br />
4031 This message triggers autocompletion. This has the same effect as the tab key.</p>
4033 <p><b id="SCI_AUTOCSTOPS">SCI_AUTOCSTOPS(&lt;unused&gt;, const char *chars)</b><br />
4034 The <code>chars</code> argument is a string containing a list of characters that will
4035 automatically cancel the autocompletion list. When you start the editor, this list is
4036 empty.</p>
4038 <p><b id="SCI_AUTOCSETSEPARATOR">SCI_AUTOCSETSEPARATOR(char separator)</b><br />
4039 <b id="SCI_AUTOCGETSEPARATOR">SCI_AUTOCGETSEPARATOR</b><br />
4040 These two messages set and get the separator character used to separate words in the
4041 <code>SCI_AUTOCSHOW</code> list. The default is the space character.</p>
4043 <p><b id="SCI_AUTOCSELECT">SCI_AUTOCSELECT(&lt;unused&gt;, const char *select)</b><br />
4044 <b id="SCI_AUTOCGETCURRENT">SCI_AUTOCGETCURRENT</b><br />
4045 This message selects an item in the autocompletion list. It searches the list of words for the
4046 first that matches <code>select</code>. By default, comparisons are case sensitive, but you can
4047 change this with <a class="message"
4048 href="#SCI_AUTOCSETIGNORECASE"><code>SCI_AUTOCSETIGNORECASE</code></a>. The match is character
4049 by character for the length of the <code>select</code> string. That is, if select is "Fred" it
4050 will match "Frederick" if this is the first item in the list that begins with "Fred". If an
4051 item is found, it is selected. If the item is not found, the autocompletion list closes if
4052 auto-hide is true (see <a class="message"
4053 href="#SCI_AUTOCSETAUTOHIDE"><code>SCI_AUTOCSETAUTOHIDE</code></a>).<br />
4054 The current selection index can be retrieved with <code>SCI_AUTOCGETCURRENT</code>.</p>
4056 <p><b id="SCI_AUTOCGETCURRENTTEXT">SCI_AUTOCGETCURRENTTEXT(&lt;unused&gt;, char *text)</b><br />
4057 This message retrieves the current selected text in the autocompletion list. Normally the
4058 <a class="message" href="#SCN_AUTOCSELECTION"><code>SCN_AUTOCSELECTION</code></a> notification
4059 is used instead.</p>
4061 <p>The value is copied to the <code>text</code> buffer, returning the length (not including the
4062 terminating 0). If not found, an empty string is copied to the buffer and 0 is returned.</p>
4064 <p>If the value argument is 0 then the length that should be allocated to store the value is
4065 returned; again, the terminating 0 is not included.</p>
4067 <p><b id="SCI_AUTOCSETCANCELATSTART">SCI_AUTOCSETCANCELATSTART(bool cancel)</b><br />
4068 <b id="SCI_AUTOCGETCANCELATSTART">SCI_AUTOCGETCANCELATSTART</b><br />
4069 The default behavior is for the list to be cancelled if the caret moves to the location it
4070 was at when the list was displayed. By calling this message with a <code>false</code> argument,
4071 the list is not cancelled until the caret moves at least one character before the word being
4072 completed.</p>
4074 <p><b id="SCI_AUTOCSETFILLUPS">SCI_AUTOCSETFILLUPS(&lt;unused&gt;, const char *chars)</b><br />
4075 If a fillup character is typed with an autocompletion list active, the currently selected item
4076 in the list is added into the document, then the fillup character is added. Common fillup
4077 characters are '(', '[' and '.' but others are possible depending on the language. By default,
4078 no fillup characters are set.</p>
4080 <p><b id="SCI_AUTOCSETCHOOSESINGLE">SCI_AUTOCSETCHOOSESINGLE(bool chooseSingle)</b><br />
4081 <b id="SCI_AUTOCGETCHOOSESINGLE">SCI_AUTOCGETCHOOSESINGLE</b><br />
4082 If you use <code>SCI_AUTOCSETCHOOSESINGLE(1)</code> and a list has only one item, it is
4083 automatically added and no list is displayed. The default is to display the list even if there
4084 is only a single item.</p>
4086 <p><b id="SCI_AUTOCSETIGNORECASE">SCI_AUTOCSETIGNORECASE(bool ignoreCase)</b><br />
4087 <b id="SCI_AUTOCGETIGNORECASE">SCI_AUTOCGETIGNORECASE</b><br />
4088 By default, matching of characters to list members is case sensitive. These messages let you
4089 set and get case sensitivity.</p>
4091 <p><b id="SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR">SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR(int behaviour)</b><br>
4092 <b id="SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR">SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR</b><br>
4093 When autocompletion is set to ignore case (<code>SCI_AUTOCSETIGNORECASE</code>), by default it will
4094 nonetheless select the first list member that matches in a case sensitive way to entered characters.
4095 This corresponds to a behaviour property of <code>SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE</code> (0).
4096 If you want autocompletion to ignore case at all, choose <code>SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE</code> (1).</p>
4098 <p><b id="SCI_AUTOCSETAUTOHIDE">SCI_AUTOCSETAUTOHIDE(bool autoHide)</b><br />
4099 <b id="SCI_AUTOCGETAUTOHIDE">SCI_AUTOCGETAUTOHIDE</b><br />
4100 By default, the list is cancelled if there are no viable matches (the user has typed
4101 characters that no longer match a list entry). If you want to keep displaying the original
4102 list, set <code>autoHide</code> to <code>false</code>. This also effects <a class="message"
4103 href="#SCI_AUTOCSELECT"><code>SCI_AUTOCSELECT</code></a>.</p>
4105 <p><b id="SCI_AUTOCSETDROPRESTOFWORD">SCI_AUTOCSETDROPRESTOFWORD(bool dropRestOfWord)</b><br />
4106 <b id="SCI_AUTOCGETDROPRESTOFWORD">SCI_AUTOCGETDROPRESTOFWORD</b><br />
4107 When an item is selected, any word characters following the caret are first erased if
4108 <code>dropRestOfWord</code> is set <code>true</code>. The default is <code>false</code>.</p>
4111 <b id="SCI_REGISTERIMAGE">SCI_REGISTERIMAGE(int type, const char *xpmData)</b><br />
4112 <b id="SCI_REGISTERRGBAIMAGE">SCI_REGISTERRGBAIMAGE(int type, const char *pixels)</b><br />
4113 <b id="SCI_CLEARREGISTEREDIMAGES">SCI_CLEARREGISTEREDIMAGES</b><br />
4114 <b id="SCI_AUTOCSETTYPESEPARATOR">SCI_AUTOCSETTYPESEPARATOR(char separatorCharacter)</b><br />
4115 <b id="SCI_AUTOCGETTYPESEPARATOR">SCI_AUTOCGETTYPESEPARATOR</b><br />
4117 Autocompletion list items may display an image as well as text. Each image is first registered with an integer
4118 type. Then this integer is included in the text of the list separated by a '?' from the text. For example,
4119 "fclose?2 fopen" displays image 2 before the string "fclose" and no image before "fopen".
4120 The images are in either the <a class="jump" href="#XPM">XPM format</a> (<code>SCI_REGISTERIMAGE</code>) or
4121 <a class="jump" href="#RGBA">RGBA format</a> (<code>SCI_REGISTERRGBAIMAGE</code>).
4122 For <code>SCI_REGISTERRGBAIMAGE</code> the width and height must previously been set with
4123 the <a class="message" href="#SCI_RGBAIMAGESETWIDTH"><code>SCI_RGBAIMAGESETWIDTH</code></a> and
4124 <a class="message" href="#SCI_RGBAIMAGESETHEIGHT"><code>SCI_RGBAIMAGESETHEIGHT</code></a> messages.
4125 The set of registered images can be cleared with <code>SCI_CLEARREGISTEREDIMAGES</code> and the '?' separator changed
4126 with <code>SCI_AUTOCSETTYPESEPARATOR</code>.
4127 </p>
4130 <b id="SCI_AUTOCSETMAXHEIGHT">SCI_AUTOCSETMAXHEIGHT(int rowCount)</b><br />
4131 <b id="SCI_AUTOCGETMAXHEIGHT">SCI_AUTOCGETMAXHEIGHT</b><br />
4133 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
4134 scrollbar is shown. The default is 5.
4135 </p>
4138 <b id="SCI_AUTOCSETMAXWIDTH">SCI_AUTOCSETMAXWIDTH(int characterCount)</b><br />
4139 <b id="SCI_AUTOCGETMAXWIDTH">SCI_AUTOCGETMAXWIDTH</b><br />
4141 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.
4142 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
4143 the available width are indicated by the presence of ellipsis.
4144 </p>
4146 <h2 id="UserLists">User lists</h2>
4148 <p>User lists use the same internal mechanisms as autocompletion lists, and all the calls
4149 listed for autocompletion work on them; you cannot display a user list at the same time as an
4150 autocompletion list is active. They differ in the following respects:</p>
4152 <p>o The <code><a class="message"
4153 href="#SCI_AUTOCSETCHOOSESINGLE">SCI_AUTOCSETCHOOSESINGLE</a></code> message has no
4154 effect.<br />
4155 o When the user makes a selection you are sent a <code><a class="message"
4156 href="#SCN_USERLISTSELECTION">SCN_USERLISTSELECTION</a></code> <a class="jump"
4157 href="#Notifications">notification message</a> rather than <code><a class="message"
4158 href="#SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</a></code>.</p>
4160 <p>BEWARE: if you have set fillup characters or stop characters, these will still be active
4161 with the user list, and may result in items being selected or the user list cancelled due to
4162 the user typing into the editor.</p>
4164 <p><b id="SCI_USERLISTSHOW">SCI_USERLISTSHOW(int listType, const char *list)</b><br />
4165 The <code>listType</code> parameter is returned to the container as the <code>wParam</code>
4166 field of the <a class="message" href="#SCNotification"><code>SCNotification</code></a>
4167 structure. It must be greater than 0 as this is how Scintilla tells the difference between an
4168 autocompletion list and a user list. If you have different types of list, for example a list of
4169 buffers and a list of macros, you can use <code>listType</code> to tell which one has returned
4170 a selection. </p>
4172 <h2 id="CallTips">Call tips</h2>
4174 <p>Call tips are small windows displaying the arguments to a function and are displayed after
4175 the user has typed the name of the function. They normally display characters using the font
4176 facename, size and character set defined by
4177 <code><a class="message" href="#StyleDefinition">STYLE_DEFAULT</a></code>. You can choose to
4178 use <code><a class="message" href="#StyleDefinition">STYLE_CALLTIP</a></code> to define the
4179 facename, size, foreground and background colours and character set with
4180 <code><a class="message" href="#SCI_CALLTIPUSESTYLE">SCI_CALLTIPUSESTYLE</a></code>.
4181 This also enables support for Tab characters.
4183 There is some interaction between call tips and autocompletion lists in that showing a
4184 call tip cancels any active autocompletion list, and vice versa.</p>
4186 <p>Call tips can highlight part of the text within them. You could use this to highlight the
4187 current argument to a function by counting the number of commas (or whatever separator your
4188 language uses). See <code>SciTEBase::CharAdded()</code> in <code>SciTEBase.cxx</code> for an
4189 example of call tip use.</p>
4191 <p>The mouse may be clicked on call tips and this causes a
4192 <code><a class="message" href="#SCN_CALLTIPCLICK">SCN_CALLTIPCLICK</a></code>
4193 notification to be sent to the container. Small up and down arrows may be displayed within
4194 a call tip by, respectively, including the characters '\001', or '\002'. This is useful
4195 for showing that there are overloaded variants of one function name and that the user can
4196 click on the arrows to cycle through the overloads.</p>
4198 <p>Alternatively, call tips can be displayed when you leave the mouse pointer for a while over
4199 a word in response to the <code><a class="message"
4200 href="#SCN_DWELLSTART">SCN_DWELLSTART</a></code> <a class="jump"
4201 href="#Notifications">notification</a> and cancelled in response to <code><a class="message"
4202 href="#SCN_DWELLEND">SCN_DWELLEND</a></code>. This method could be used in a debugger to give
4203 the value of a variable, or during editing to give information about the word under the
4204 pointer.</p>
4205 <code><a class="message" href="#SCI_CALLTIPSHOW">SCI_CALLTIPSHOW(int posStart, const char
4206 *definition)</a><br />
4207 <a class="message" href="#SCI_CALLTIPCANCEL">SCI_CALLTIPCANCEL</a><br />
4208 <a class="message" href="#SCI_CALLTIPACTIVE">SCI_CALLTIPACTIVE</a><br />
4209 <a class="message" href="#SCI_CALLTIPPOSSTART">SCI_CALLTIPPOSSTART</a><br />
4210 <a class="message" href="#SCI_CALLTIPSETHLT">SCI_CALLTIPSETHLT(int highlightStart, int
4211 highlightEnd)</a><br />
4212 <a class="message" href="#SCI_CALLTIPSETBACK">SCI_CALLTIPSETBACK(int colour)</a><br />
4213 <a class="message" href="#SCI_CALLTIPSETFORE">SCI_CALLTIPSETFORE(int colour)</a><br />
4214 <a class="message" href="#SCI_CALLTIPSETFOREHLT">SCI_CALLTIPSETFOREHLT(int colour)</a><br />
4215 <a class="message" href="#SCI_CALLTIPUSESTYLE">SCI_CALLTIPUSESTYLE(int tabsize)</a><br />
4216 <a class="message" href="#SCI_CALLTIPSETPOSITION">SCI_CALLTIPSETPOSITION(bool above)</a><br />
4217 </code>
4219 <p><b id="SCI_CALLTIPSHOW">SCI_CALLTIPSHOW(int posStart, const char *definition)</b><br />
4220 This message starts the process by displaying the call tip window. If a call tip is already
4221 active, this has no effect.<br />
4222 <code>posStart</code> is the position in the document at which to align the call tip. The call
4223 tip text is aligned to start 1 line below this character unless you have included up and/or
4224 down arrows in the call tip text in which case the tip is aligned to the right-hand edge of
4225 the rightmost arrow. The assumption is that you will start the text with something like
4226 "\001 1 of 3 \002".<br />
4227 <code>definition</code> is the call tip text. This can contain multiple lines separated by
4228 '\n' (Line Feed, ASCII code 10) characters. Do not include '\r' (Carriage Return, ASCII
4229 code 13), as this will most likely print as an empty box. '\t' (Tab, ASCII code 9) is
4230 supported if you set a tabsize with
4231 <code><a class="message" href="#SCI_CALLTIPUSESTYLE">SCI_CALLTIPUSESTYLE</a></code>.<br /></p>
4233 <p><b id="SCI_CALLTIPCANCEL">SCI_CALLTIPCANCEL</b><br />
4234 This message cancels any displayed call tip. Scintilla will also cancel call tips for you if
4235 you use any keyboard commands that are not compatible with editing the argument list of a
4236 function.</p>
4238 <p><b id="SCI_CALLTIPACTIVE">SCI_CALLTIPACTIVE</b><br />
4239 This returns 1 if a call tip is active and 0 if it is not active.</p>
4241 <p><b id="SCI_CALLTIPPOSSTART">SCI_CALLTIPPOSSTART</b><br />
4242 This message returns the value of the current position when <code>SCI_CALLTIPSHOW</code>
4243 started to display the tip.</p>
4245 <p><b id="SCI_CALLTIPSETHLT">SCI_CALLTIPSETHLT(int hlStart, int hlEnd)</b><br />
4246 This sets the region of the call tips text to display in a highlighted style.
4247 <code>hlStart</code> is the zero-based index into the string of the first character to
4248 highlight and <code>hlEnd</code> is the index of the first character after the highlight.
4249 <code>hlEnd</code> must be greater than <code>hlStart</code>; <code>hlEnd-hlStart</code> is the
4250 number of characters to highlight. Highlights can extend over line ends if this is
4251 required.</p>
4253 <p>Unhighlighted text is drawn in a mid gray. Selected text is drawn in a dark blue. The
4254 background is white. These can be changed with
4255 <code>SCI_CALLTIPSETBACK</code>,
4256 <code>SCI_CALLTIPSETFORE</code>, and
4257 <code>SCI_CALLTIPSETFOREHLT</code>.
4258 </p>
4260 <p><b id="SCI_CALLTIPSETBACK">SCI_CALLTIPSETBACK(int colour)</b><br />
4261 The background colour of call tips can be set with this message; the default colour is white.
4262 It is not a good idea to set a dark colour as the background as the default colour for normal
4263 calltip text is mid gray and the defaultcolour for highlighted text is dark blue. This also
4264 sets the background colour of <code>STYLE_CALLTIP</code>.</p>
4266 <p><b id="SCI_CALLTIPSETFORE">SCI_CALLTIPSETFORE(int colour)</b><br />
4267 The colour of call tip text can be set with this message; the default colour is mid gray.
4268 This also sets the foreground colour of <code>STYLE_CALLTIP</code>.</p>
4270 <p><b id="SCI_CALLTIPSETFOREHLT">SCI_CALLTIPSETFOREHLT(int colour)</b><br />
4271 The colour of highlighted call tip text can be set with this message; the default colour
4272 is dark blue.</p>
4274 <p><b id="SCI_CALLTIPUSESTYLE">SCI_CALLTIPUSESTYLE(int tabsize)</b><br />
4275 This message changes the style used for call tips from <code>STYLE_DEFAULT</code> to
4276 <code>STYLE_CALLTIP</code> and sets a tab size in screen pixels. If <code>tabsize</code> is
4277 less than 1, Tab characters are not treated specially. Once this call has been used, the
4278 call tip foreground and background colours are also taken from the style.</p>
4280 <p><b id="SCI_CALLTIPSETPOSITION">SCI_CALLTIPSETPOSITION(bool above)</b><br />
4281 By default the calltip is displayed below the text, setting above to <code>true</code>
4282 (1) will display it above the text.</p>
4285 <h2 id="KeyboardCommands">Keyboard commands</h2>
4287 <p>To allow the container application to perform any of the actions available to the user with
4288 keyboard, all the keyboard actions are messages. They do not take any parameters. These
4289 commands are also used when redefining the key bindings with the <a class="message"
4290 href="#SCI_ASSIGNCMDKEY"><code>SCI_ASSIGNCMDKEY</code></a> message.</p>
4292 <table border="0" summary="Keyboard commands">
4293 <tbody>
4294 <tr>
4295 <td><code>SCI_LINEDOWN</code></td>
4297 <td><code>SCI_LINEDOWNEXTEND</code></td>
4299 <td><code>SCI_LINEDOWNRECTEXTEND</code></td>
4301 <td><code>SCI_LINESCROLLDOWN</code></td>
4302 </tr>
4304 <tr>
4305 <td><code>SCI_LINEUP</code></td>
4307 <td><code>SCI_LINEUPEXTEND</code></td>
4309 <td><code>SCI_LINEUPRECTEXTEND</code></td>
4311 <td><code>SCI_LINESCROLLUP</code></td>
4312 </tr>
4314 <tr>
4315 <td><code>SCI_PARADOWN</code></td>
4317 <td><code>SCI_PARADOWNEXTEND</code></td>
4319 <td><code>SCI_PARAUP</code></td>
4321 <td><code>SCI_PARAUPEXTEND</code></td>
4322 </tr>
4324 <tr>
4325 <td><code>SCI_CHARLEFT</code></td>
4327 <td><code>SCI_CHARLEFTEXTEND</code></td>
4329 <td><code>SCI_CHARLEFTRECTEXTEND</code></td>
4330 </tr>
4332 <tr>
4333 <td><code>SCI_CHARRIGHT</code></td>
4335 <td><code>SCI_CHARRIGHTEXTEND</code></td>
4337 <td><code>SCI_CHARRIGHTRECTEXTEND</code></td>
4338 </tr>
4340 <tr>
4341 <td><code>SCI_WORDLEFT</code></td>
4343 <td><code>SCI_WORDLEFTEXTEND</code></td>
4345 <td><code>SCI_WORDRIGHT</code></td>
4347 <td><code>SCI_WORDRIGHTEXTEND</code></td>
4348 </tr>
4350 <tr>
4351 <td><code>SCI_WORDLEFTEND</code></td>
4353 <td><code>SCI_WORDLEFTENDEXTEND</code></td>
4355 <td><code>SCI_WORDRIGHTEND</code></td>
4357 <td><code>SCI_WORDRIGHTENDEXTEND</code></td>
4358 </tr>
4360 <tr>
4361 <td><code>SCI_WORDPARTLEFT</code></td>
4363 <td><code>SCI_WORDPARTLEFTEXTEND</code></td>
4365 <td><code>SCI_WORDPARTRIGHT</code></td>
4367 <td><code>SCI_WORDPARTRIGHTEXTEND</code></td>
4368 </tr>
4370 <tr>
4371 <td><code>SCI_HOME</code></td>
4373 <td><code>SCI_HOMEEXTEND</code></td>
4375 <td><code>SCI_HOMERECTEXTEND</code></td>
4376 </tr>
4378 <tr>
4379 <td><code>SCI_HOMEDISPLAY</code></td>
4381 <td><code>SCI_HOMEDISPLAYEXTEND</code></td>
4383 <td><code>SCI_HOMEWRAP</code></td>
4385 <td><code>SCI_HOMEWRAPEXTEND</code></td>
4386 </tr>
4388 <tr>
4389 <td><code>SCI_VCHOME</code></td>
4391 <td><code>SCI_VCHOMEEXTEND</code></td>
4393 <td><code>SCI_VCHOMERECTEXTEND</code></td>
4394 </tr>
4396 <tr>
4397 <td><code>SCI_VCHOMEWRAP</code></td>
4399 <td><code>SCI_VCHOMEWRAPEXTEND</code></td>
4400 </tr>
4402 <tr>
4403 <td><code>SCI_LINEEND</code></td>
4405 <td><code>SCI_LINEENDEXTEND</code></td>
4407 <td><code>SCI_LINEENDRECTEXTEND</code></td>
4408 </tr>
4410 <tr>
4411 <td><code>SCI_LINEENDDISPLAY</code></td>
4413 <td><code>SCI_LINEENDDISPLAYEXTEND</code></td>
4415 <td><code>SCI_LINEENDWRAP</code></td>
4417 <td><code>SCI_LINEENDWRAPEXTEND</code></td>
4418 </tr>
4420 <tr>
4421 <td><code>SCI_DOCUMENTSTART</code></td>
4423 <td><code>SCI_DOCUMENTSTARTEXTEND</code></td>
4425 <td><code>SCI_DOCUMENTEND</code></td>
4427 <td><code>SCI_DOCUMENTENDEXTEND</code></td>
4428 </tr>
4430 <tr>
4431 <td><code>SCI_PAGEUP</code></td>
4433 <td><code>SCI_PAGEUPEXTEND</code></td>
4435 <td><code>SCI_PAGEUPRECTEXTEND</code></td>
4436 </tr>
4438 <tr>
4439 <td><code>SCI_PAGEDOWN</code></td>
4441 <td><code>SCI_PAGEDOWNEXTEND</code></td>
4443 <td><code>SCI_PAGEDOWNRECTEXTEND</code></td>
4444 </tr>
4447 <tr>
4448 <td><code>SCI_STUTTEREDPAGEUP</code></td>
4450 <td><code>SCI_STUTTEREDPAGEUPEXTEND</code></td>
4451 </tr>
4453 <tr>
4454 <td><code>SCI_STUTTEREDPAGEDOWN</code></td>
4456 <td><code>SCI_STUTTEREDPAGEDOWNEXTEND</code></td>
4457 </tr>
4459 <tr>
4460 <td><code>SCI_DELETEBACK</code></td>
4462 <td><code>SCI_DELETEBACKNOTLINE</code></td>
4463 </tr>
4465 <tr>
4466 <td><code>SCI_DELWORDLEFT</code></td>
4468 <td><code>SCI_DELWORDRIGHT</code></td>
4470 <td><code>SCI_DELWORDRIGHTEND</code></td>
4471 </tr>
4473 <tr>
4474 <td><code>SCI_DELLINELEFT</code></td>
4476 <td><code>SCI_DELLINERIGHT</code></td>
4478 <td><code>SCI_LINEDELETE</code></td>
4479 </tr>
4481 <tr>
4482 <td><code>SCI_LINECUT</code></td>
4484 <td><code>SCI_LINECOPY</code></td>
4486 <td><code>SCI_LINETRANSPOSE</code></td>
4488 <td><code>SCI_LINEDUPLICATE</code></td>
4489 </tr>
4491 <tr>
4492 <td><code>SCI_LOWERCASE</code></td>
4494 <td><code>SCI_UPPERCASE</code></td>
4496 <td><code>SCI_CANCEL</code></td>
4498 <td><code>SCI_EDITTOGGLEOVERTYPE</code></td>
4499 </tr>
4501 <tr>
4502 <td><code>SCI_NEWLINE</code></td>
4504 <td><code>SCI_FORMFEED</code></td>
4506 <td><code>SCI_TAB</code></td>
4508 <td><code>SCI_BACKTAB</code></td>
4509 </tr>
4511 <tr>
4512 <td><code>SCI_SELECTIONDUPLICATE</code></td>
4514 <td><code>SCI_VERTICALCENTRECARET</code></td>
4516 </tr>
4518 <tr>
4519 <td><code>SCI_MOVESELECTEDLINESUP</code></td>
4521 <td><code>SCI_MOVESELECTEDLINESDOWN</code></td>
4522 </tr>
4524 <tr>
4525 <td><code>SCI_SCROLLTOSTART</code></td>
4527 <td><code>SCI_SCROLLTOEND</code></td>
4528 </tr>
4529 </tbody>
4530 </table>
4532 <p>The <code>SCI_*EXTEND</code> messages extend the selection.</p>
4534 <p>The <code>SCI_*RECTEXTEND</code> messages extend the rectangular selection
4535 (and convert regular selection to rectangular one, if any).</p>
4537 <p>The <code>SCI_WORDPART*</code> commands are used to move between word segments marked by
4538 capitalisation (aCamelCaseIdentifier) or underscores (an_under_bar_ident).</p>
4540 <p>The <code>SCI_HOME*</code> commands move the caret to the start of the line, while the
4541 <code>SCI_VCHOME*</code> commands move the caret to the first non-blank character of the line
4542 (ie. just after the indentation) unless it is already there; in this case, it acts as SCI_HOME*.</p>
4544 <p>The <code>SCI_[HOME|LINEEND]DISPLAY*</code> commands are used when in line wrap mode to
4545 allow movement to the start or end of display lines as opposed to the normal
4546 <code>SCI_[HOME|LINEEND]</code> commands which move to the start or end of document lines.</p>
4548 <p>The <code>SCI_[[VC]HOME|LINEEND]WRAP*</code> commands are like their namesakes
4549 <code>SCI_[[VC]HOME|LINEEND]*</code> except they behave differently when word-wrap is enabled:
4550 They go first to the start / end of the display line, like <code>SCI_[HOME|LINEEND]DISPLAY*</code>,
4551 but if the cursor is already at the point, it goes on to the start or end of the document line,
4552 as appropriate for <code>SCI_[[VC]HOME|LINEEND]*</code>.
4553 </p>
4555 <p>The <code>SCI_SCROLLTO[START|END]</code> commands scroll the document to the start
4556 or end without changing the selection. These commands match OS X platform conventions for the behaviour of the
4557 <code>home</code> and <code>end</code> keys. Scintilla can be made to match OS X applications
4558 by binding the <code>home</code> and <code>end</code> keys to these commands.
4559 </p>
4561 <h2 id="KeyBindings">Key bindings</h2>
4563 <p>There is a default binding of keys to commands that is defined in the Scintilla source in
4564 the file <code>KeyMap.cxx</code> by the constant <code>KeyMap::MapDefault[]</code>. This table
4565 maps key definitions to <code>SCI_*</code> messages with no parameters (mostly the <a
4566 class="jump" href="#KeyboardCommands">keyboard commands</a> discussed above, but any Scintilla
4567 command that has no arguments can be mapped). You can change the mapping to suit your own
4568 requirements.</p>
4569 <code><a class="message" href="#SCI_ASSIGNCMDKEY">SCI_ASSIGNCMDKEY(int keyDefinition, int
4570 sciCommand)</a><br />
4571 <a class="message" href="#SCI_CLEARCMDKEY">SCI_CLEARCMDKEY(int keyDefinition)</a><br />
4572 <a class="message" href="#SCI_CLEARALLCMDKEYS">SCI_CLEARALLCMDKEYS</a><br />
4573 <a class="message" href="#SCI_NULL">SCI_NULL</a><br />
4574 </code>
4576 <p><b id="keyDefinition">keyDefinition</b><br />
4577 A key definition contains the key code in the low 16-bits and the key modifiers in the high
4578 16-bits. To combine <code>keyCode</code> and <code>keyMod</code> set:<br />
4579 <br />
4580 <code>keyDefinition = keyCode + (keyMod &lt;&lt; 16)</code></p>
4582 <p>The key code is a visible or control character or a key from the <code>SCK_*</code>
4583 enumeration, which contains:<br />
4584 <code>SCK_ADD</code>, <code>SCK_BACK</code>, <code>SCK_DELETE</code>, <code>SCK_DIVIDE</code>,
4585 <code>SCK_DOWN</code>, <code>SCK_END</code>, <code>SCK_ESCAPE</code>, <code>SCK_HOME</code>,
4586 <code>SCK_INSERT</code>, <code>SCK_LEFT</code>, <code>SCK_MENU</code>, <code>SCK_NEXT</code> (Page Down),
4587 <code>SCK_PRIOR</code> (Page Up), <code>SCK_RETURN</code>, <code>SCK_RIGHT</code>,
4588 <code>SCK_RWIN</code>,
4589 <code>SCK_SUBTRACT</code>, <code>SCK_TAB</code>, <code>SCK_UP</code>, and
4590 <code>SCK_WIN</code>.</p>
4592 <p>The modifiers are a combination of zero or more of <code>SCMOD_ALT</code>,
4593 <code>SCMOD_CTRL</code>, <code>SCMOD_SHIFT</code>, and <code>SCMOD_META</code>.
4594 On OS X, the Command key is mapped to <code>SCMOD_CTRL</code> and the Control key to
4595 <code>SCMOD_META</code>.
4596 If you are building a table, you might
4597 want to use <code>SCMOD_NORM</code>, which has the value 0, to mean no modifiers.</p>
4599 <p><b id="SCI_ASSIGNCMDKEY">SCI_ASSIGNCMDKEY(int <a class="jump"
4600 href="#keyDefinition">keyDefinition</a>, int sciCommand)</b><br />
4601 This assigns the given key definition to a Scintilla command identified by
4602 <code>sciCommand</code>. <code>sciCommand</code> can be any <code>SCI_*</code> command that has
4603 no arguments.</p>
4605 <p><b id="SCI_CLEARCMDKEY">SCI_CLEARCMDKEY(int <a class="jump"
4606 href="#keyDefinition">keyDefinition</a>)</b><br />
4607 This makes the given key definition do nothing by assigning the action <code>SCI_NULL</code>
4608 to it.</p>
4610 <p><b id="SCI_CLEARALLCMDKEYS">SCI_CLEARALLCMDKEYS</b><br />
4611 This command removes all keyboard command mapping by setting an empty mapping table.</p>
4613 <p><b id="SCI_NULL">SCI_NULL</b><br />
4614 The <code>SCI_NULL</code> does nothing and is the value assigned to keys that perform no
4615 action. SCI_NULL ensures that keys do not propagate to the parent window as that may
4616 cause focus to move. If you want the standard platform behaviour use the constant 0 instead.</p>
4618 <h2 id="PopupEditMenu">Popup edit menu</h2>
4620 <p><b id="SCI_USEPOPUP">SCI_USEPOPUP(bool bEnablePopup)</b><br />
4621 Clicking the wrong button on the mouse pops up a short default editing menu. This may be
4622 turned off with <code>SCI_USEPOPUP(0)</code>. If you turn it off, context menu commands (in
4623 Windows, <code>WM_CONTEXTMENU</code>) will not be handled by Scintilla, so the parent of the
4624 Scintilla window will have the opportunity to handle the message.</p>
4626 <h2 id="MacroRecording">Macro recording</h2>
4628 <p>Start and stop macro recording mode. In macro recording mode, actions are reported to the
4629 container through <code><a class="message" href="#SCN_MACRORECORD">SCN_MACRORECORD</a></code>
4630 <a class="jump" href="#Notifications">notifications</a>. It is then up to the container to
4631 record these actions for future replay.</p>
4633 <p><b id="SCI_STARTRECORD">SCI_STARTRECORD</b><br />
4634 <b id="SCI_STOPRECORD">SCI_STOPRECORD</b><br />
4635 These two messages turn macro recording on and off.</p>
4637 <h2 id="Printing">Printing</h2>
4639 <p><code>SCI_FORMATRANGE</code> can be used to draw the text onto a display surface
4640 which can include a printer display surface. Printed output shows text styling as on the
4641 screen, but it hides all margins except a line number margin. All special marker effects are
4642 removed and the selection and caret are hidden.</p>
4644 <p>Different platforms use different display surface ID types to print on. On Windows, these are
4645 <code>HDC</code>s., on GTK+ 3.x <code>cairo_t *</code>,
4646 and on Cocoa <code>CGContextRef</code> is used.</p>
4648 <code><a class="message" href="#SCI_FORMATRANGE">SCI_FORMATRANGE(bool bDraw, Sci_RangeToFormat
4649 *pfr)</a><br />
4650 <a class="message" href="#SCI_SETPRINTMAGNIFICATION">SCI_SETPRINTMAGNIFICATION(int
4651 magnification)</a><br />
4652 <a class="message" href="#SCI_GETPRINTMAGNIFICATION">SCI_GETPRINTMAGNIFICATION</a><br />
4653 <a class="message" href="#SCI_SETPRINTCOLOURMODE">SCI_SETPRINTCOLOURMODE(int mode)</a><br />
4654 <a class="message" href="#SCI_GETPRINTCOLOURMODE">SCI_GETPRINTCOLOURMODE</a><br />
4655 <a class="message" href="#SCI_SETPRINTWRAPMODE">SCI_SETPRINTWRAPMODE</a><br />
4656 <a class="message" href="#SCI_GETPRINTWRAPMODE">SCI_GETPRINTWRAPMODE</a><br />
4657 </code>
4659 <p><b id="SCI_FORMATRANGE">SCI_FORMATRANGE(bool bDraw, Sci_RangeToFormat *pfr)</b><br />
4660 This call renders a range of text into a device context. If you use
4661 this for printing, you will probably want to arrange a page header and footer; Scintilla does
4662 not do this for you. See <code>SciTEWin::Print()</code> in <code>SciTEWinDlg.cxx</code> for an
4663 example. Each use of this message renders a range of text into a rectangular area and returns
4664 the position in the document of the next character to print.</p>
4666 <p><code>bDraw</code> controls if any output is done. Set this to false if you are paginating
4667 (for example, if you use this with MFC you will need to paginate in
4668 <code>OnBeginPrinting()</code> before you output each page.</p>
4669 <pre>
4670 struct Sci_Rectangle { int left; int top; int right; int bottom; };
4672 struct Sci_RangeToFormat {
4673 Sci_SurfaceID hdc; // The Surface ID we print to
4674 Sci_SurfaceID hdcTarget; // The Surface ID we use for measuring (may be same as hdc)
4675 Sci_Rectangle rc; // Rectangle in which to print
4676 Sci_Rectangle rcPage; // Physically printable page size
4677 Sci_CharacterRange chrg; // Range of characters to print
4679 </pre>
4681 <p>On Windows, <code>hdc</code> and <code>hdcTarget</code> should both be set to the device context handle
4682 of the output device (usually a printer). If you print to a metafile these will not be the same
4683 as Windows metafiles (unlike extended metafiles) do not implement the full API for returning
4684 information. In this case, set <code>hdcTarget</code> to the screen DC.<br />
4685 <code>rcPage</code> is the rectangle <code>{0, 0, maxX, maxY}</code> where <code>maxX+1</code>
4686 and <code>maxY+1</code> are the number of physically printable pixels in x and y.<br />
4687 <code>rc</code> is the rectangle to render the text in (which will, of course, fit within the
4688 rectangle defined by rcPage).<br />
4689 <code>chrg.cpMin</code> and <code>chrg.cpMax</code> define the start position and maximum
4690 position of characters to output. All of each line within this character range is drawn.</p>
4692 <p>On Cocoa, the surface IDs for printing (<code>bDraw=1</code>) should be the graphics port of the current context
4693 (<code>(CGContextRef) [[NSGraphicsContext currentContext] graphicsPort]</code>) when the view's drawRect method is called.
4694 The Surface IDs are not really used for measurement (<code>bDraw=0</code>) but can be set
4695 to a bitmap context (created with <code>CGBitmapContextCreate</code>) to avoid runtime warnings.</p>
4697 <p>On GTK+, the surface IDs to use can be found from the printing context with
4698 <code>gtk_print_context_get_cairo_context(context)</code>.</p>
4700 <code>chrg.cpMin</code> and <code>chrg.cpMax</code> define the start position and maximum
4701 position of characters to output. All of each line within this character range is drawn.</p>
4703 <p>When printing, the most tedious part is always working out what the margins should be to
4704 allow for the non-printable area of the paper and printing a header and footer. If you look at
4705 the printing code in SciTE, you will find that most of it is taken up with this. The loop that
4706 causes Scintilla to render text is quite simple if you strip out all the margin, non-printable
4707 area, header and footer code.</p>
4709 <p><b id="SCI_SETPRINTMAGNIFICATION">SCI_SETPRINTMAGNIFICATION(int magnification)</b><br />
4710 <b id="SCI_GETPRINTMAGNIFICATION">SCI_GETPRINTMAGNIFICATION</b><br />
4711 <code>SCI_GETPRINTMAGNIFICATION</code> lets you to print at a different size than the screen
4712 font. <code>magnification</code> is the number of points to add to the size of each screen
4713 font. A value of -3 or -4 gives reasonably small print. You can get this value with
4714 <code>SCI_GETPRINTMAGNIFICATION</code>.</p>
4716 <p><b id="SCI_SETPRINTCOLOURMODE">SCI_SETPRINTCOLOURMODE(int mode)</b><br />
4717 <b id="SCI_GETPRINTCOLOURMODE">SCI_GETPRINTCOLOURMODE</b><br />
4718 These two messages set and get the method used to render coloured text on a printer that is
4719 probably using white paper. It is especially important to consider the treatment of colour if
4720 you use a dark or black screen background. Printing white on black uses up toner and ink very
4721 many times faster than the other way around. You can set the mode to one of:</p>
4723 <table cellpadding="1" cellspacing="2" border="0" summary="Colour printing modes">
4724 <tbody>
4725 <tr>
4726 <th align="left">Symbol</th>
4728 <th>Value</th>
4730 <th align="left">Purpose</th>
4731 </tr>
4732 </tbody>
4734 <tbody valign="top">
4735 <tr>
4736 <td align="left"><code>SC_PRINT_NORMAL</code></td>
4738 <td align="center">0</td>
4740 <td>Print using the current screen colours. This is the default.</td>
4741 </tr>
4743 <tr>
4744 <td align="left"><code>SC_PRINT_INVERTLIGHT</code></td>
4746 <td align="center">1</td>
4748 <td>If you use a dark screen background this saves ink by inverting the light value of
4749 all colours and printing on a white background.</td>
4750 </tr>
4752 <tr>
4753 <td align="left"><code>SC_PRINT_BLACKONWHITE</code></td>
4755 <td align="center">2</td>
4757 <td>Print all text as black on a white background.</td>
4758 </tr>
4760 <tr>
4761 <td align="left"><code>SC_PRINT_COLOURONWHITE</code></td>
4763 <td align="center">3</td>
4765 <td>Everything prints in its own colour on a white background.</td>
4766 </tr>
4768 <tr>
4769 <td align="left"><code>SC_PRINT_COLOURONWHITEDEFAULTBG</code></td>
4771 <td align="center">4</td>
4773 <td>Everything prints in its own colour on a white background except that line numbers
4774 use their own background colour.</td>
4775 </tr>
4776 </tbody>
4777 </table>
4779 <p><b id="SCI_SETPRINTWRAPMODE">SCI_SETPRINTWRAPMODE(int wrapMode)</b><br />
4780 <b id="SCI_GETPRINTWRAPMODE">SCI_GETPRINTWRAPMODE</b><br />
4781 These two functions get and set the printer wrap mode. <code>wrapMode</code> can be
4782 set to <code>SC_WRAP_NONE</code> (0), <code>SC_WRAP_WORD</code> (1) or
4783 <code>SC_WRAP_CHAR</code> (2). The default is
4784 <code>SC_WRAP_WORD</code>, which wraps printed output so that all characters fit
4785 into the print rectangle. If you set <code>SC_WRAP_NONE</code>, each line of text
4786 generates one line of output and the line is truncated if it is too long to fit
4787 into the print area.<br />
4788 <code>SC_WRAP_WORD</code> tries to wrap only between words as indicated by
4789 white space or style changes although if a word is longer than a line, it will be wrapped before
4790 the line end. <code>SC_WRAP_CHAR</code> is preferred to
4791 <code>SC_WRAP_WORD</code> for Asian languages where there is no white space
4792 between words.</p>
4794 <h2 id="DirectAccess">Direct access</h2>
4795 <code><a class="message" href="#SCI_GETDIRECTFUNCTION">SCI_GETDIRECTFUNCTION</a><br />
4796 <a class="message" href="#SCI_GETDIRECTPOINTER">SCI_GETDIRECTPOINTER</a><br />
4797 <a class="message" href="#SCI_GETCHARACTERPOINTER">SCI_GETCHARACTERPOINTER</a><br />
4798 <a class="message" href="#SCI_GETRANGEPOINTER">SCI_GETRANGEPOINTER(int position, int rangeLength)</a><br />
4799 <a class="message" href="#SCI_GETGAPPOSITION">SCI_GETGAPPOSITION</a><br />
4800 </code>
4802 <p>On Windows, the message-passing scheme used to communicate between the container and
4803 Scintilla is mediated by the operating system <code>SendMessage</code> function and can lead to
4804 bad performance when calling intensively. To avoid this overhead, Scintilla provides messages
4805 that allow you to call the Scintilla message function directly. The code to do this in C/C++ is
4806 of the form:</p>
4807 <pre>
4808 #include "Scintilla.h"
4809 SciFnDirect pSciMsg = (SciFnDirect)SendMessage(hSciWnd, SCI_GETDIRECTFUNCTION, 0, 0);
4810 sptr_t pSciWndData = (sptr_t)SendMessage(hSciWnd, SCI_GETDIRECTPOINTER, 0, 0);
4812 // now a wrapper to call Scintilla directly
4813 sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
4814 return pSciMsg(pSciWndData, iMessage, wParam, lParam);
4816 </pre>
4818 <p><code>SciFnDirect</code>, <code>sptr_t</code> and <code>uptr_t</code> are declared in
4819 <code>Scintilla.h</code>. <code>hSciWnd</code> is the window handle returned when you created
4820 the Scintilla window.</p>
4822 <p>While faster, this direct calling will cause problems if performed from a different thread
4823 to the native thread of the Scintilla window in which case <code>SendMessage(hSciWnd, SCI_*,
4824 wParam, lParam)</code> should be used to synchronize with the window's thread.</p>
4826 <p>This feature also works on GTK+ but has no significant impact on speed.</p>
4828 <p>From version 1.47 on Windows, Scintilla exports a function called
4829 <code>Scintilla_DirectFunction</code> that can be used the same as the function returned by
4830 <code>SCI_GETDIRECTFUNCTION</code>. This saves you the call to
4831 <code>SCI_GETDIRECTFUNCTION</code> and the need to call Scintilla indirectly via the function
4832 pointer.</p>
4834 <p><b id="SCI_GETDIRECTFUNCTION">SCI_GETDIRECTFUNCTION</b><br />
4835 This message returns the address of the function to call to handle Scintilla messages without
4836 the overhead of passing through the Windows messaging system. You need only call this once,
4837 regardless of the number of Scintilla windows you create.</p>
4839 <p><b id="SCI_GETDIRECTPOINTER">SCI_GETDIRECTPOINTER</b><br />
4840 This returns a pointer to data that identifies which Scintilla window is in use. You must call
4841 this once for each Scintilla window you create. When you call the direct function, you must
4842 pass in the direct pointer associated with the target window.</p>
4844 <p><b id="SCI_GETCHARACTERPOINTER">SCI_GETCHARACTERPOINTER</b><br />
4845 <b id="SCI_GETRANGEPOINTER">SCI_GETRANGEPOINTER(int position, int rangeLength)</b><br />
4846 <b id="SCI_GETGAPPOSITION">SCI_GETGAPPOSITION</b><br />
4847 Grant temporary direct read-only access to the memory used by Scintilla to store
4848 the document.</p>
4849 <p><code>SCI_GETCHARACTERPOINTER</code> moves the gap within Scintilla so that the
4850 text of the document is stored consecutively
4851 and ensure there is a NUL character after the text, then returns a pointer to the first character.
4852 Applications may then pass this to a function that accepts a character pointer such as a regular
4853 expression search or a parser. The pointer should <em>not</em> be written to as that may desynchronize
4854 the internal state of Scintilla.</p>
4855 <p>Since any action in Scintilla may change its internal state
4856 this pointer becomes invalid after any call or by allowing user interface activity. The application
4857 should reacquire the pointer after making any call to Scintilla or performing any user-interface calls such
4858 as modifying a progress indicator.</p>
4859 <p>This call takes similar time to inserting a character at the end of the document and this may
4860 include moving the document contents. Specifically, all the characters after the document gap
4861 are moved to before the gap. This compacted state should persist over calls and user interface
4862 actions that do not change the document contents so reacquiring the pointer afterwards is very
4863 quick. If this call is used to implement a global replace operation, then each replacement will
4864 move the gap so if <code>SCI_GETCHARACTERPOINTER</code> is called after
4865 each replacement then the operation will become O(n^2) rather than O(n). Instead, all
4866 matches should be found and remembered, then all the replacements performed.</p>
4868 <p><code>SCI_GETRANGEPOINTER</code> provides direct access to just the
4869 range requested. The gap is not moved unless it is within the requested range so this call
4870 can be faster than <code>SCI_GETCHARACTERPOINTER</code>.
4871 This can be used by application code that is able to act on blocks of text or ranges of lines.</p>
4873 <p><code>SCI_GETGAPPOSITION</code> returns the current gap position.
4874 This is a hint that applications can use to avoid calling <code>SCI_GETRANGEPOINTER</code>
4875 with a range that contains the gap and consequent costs of moving the gap.</p>
4877 <h2 id="MultipleViews">Multiple views</h2>
4879 <p>A Scintilla window and the document that it displays are separate entities. When you create
4880 a new window, you also create a new, empty document. Each document has a reference count that
4881 is initially set to 1. The document also has a list of the Scintilla windows that are linked to
4882 it so when any window changes the document, all other windows in which it appears are notified
4883 to cause them to update. The system is arranged in this way so that you can work with many
4884 documents in a single Scintilla window and so you can display a single document in multiple
4885 windows (for use with splitter windows).</p>
4887 <p>Although these messages use <code>document *pDoc</code>, to ensure compatibility with future
4888 releases of Scintilla you should treat <code>pDoc</code> as an opaque <code>void*</code>. That
4889 is, you can use and store the pointer as described in this section but you should not
4890 dereference it.</p>
4891 <code><a class="message" href="#SCI_GETDOCPOINTER">SCI_GETDOCPOINTER</a><br />
4892 <a class="message" href="#SCI_SETDOCPOINTER">SCI_SETDOCPOINTER(&lt;unused&gt;, document
4893 *pDoc)</a><br />
4894 <a class="message" href="#SCI_CREATEDOCUMENT">SCI_CREATEDOCUMENT</a><br />
4895 <a class="message" href="#SCI_ADDREFDOCUMENT">SCI_ADDREFDOCUMENT(&lt;unused&gt;, document
4896 *pDoc)</a><br />
4897 <a class="message" href="#SCI_RELEASEDOCUMENT">SCI_RELEASEDOCUMENT(&lt;unused&gt;, document
4898 *pDoc)</a><br />
4899 </code>
4901 <p><b id="SCI_GETDOCPOINTER">SCI_GETDOCPOINTER</b><br />
4902 This returns a pointer to the document currently in use by the window. It has no other
4903 effect.</p>
4905 <p><b id="SCI_SETDOCPOINTER">SCI_SETDOCPOINTER(&lt;unused&gt;, document *pDoc)</b><br />
4906 This message does the following:<br />
4907 1. It removes the current window from the list held by the current document.<br />
4908 2. It reduces the reference count of the current document by 1.<br />
4909 3. If the reference count reaches 0, the document is deleted.<br />
4910 4. <code>pDoc</code> is set as the new document for the window.<br />
4911 5. If <code>pDoc</code> was 0, a new, empty document is created and attached to the
4912 window.<br />
4913 6. If <code>pDoc</code> was not 0, its reference count is increased by 1.</p>
4915 <p><b id="SCI_CREATEDOCUMENT">SCI_CREATEDOCUMENT</b><br />
4916 This message creates a new, empty document and returns a pointer to it. This document is not
4917 selected into the editor and starts with a reference count of 1. This means that you have
4918 ownership of it and must either reduce its reference count by 1 after using
4919 <code>SCI_SETDOCPOINTER</code> so that the Scintilla window owns it or you must make sure that
4920 you reduce the reference count by 1 with <code>SCI_RELEASEDOCUMENT</code> before you close the
4921 application to avoid memory leaks.</p>
4923 <p><b id="SCI_ADDREFDOCUMENT">SCI_ADDREFDOCUMENT(&lt;unused&gt;, document *pDoc)</b><br />
4924 This increases the reference count of a document by 1. If you want to replace the current
4925 document in the Scintilla window and take ownership of the current document, for example if you
4926 are editing many documents in one window, do the following:<br />
4927 1. Use <code>SCI_GETDOCPOINTER</code> to get a pointer to the document,
4928 <code>pDoc</code>.<br />
4929 2. Use <code>SCI_ADDREFDOCUMENT(0, pDoc)</code> to increment the reference count.<br />
4930 3. Use <code>SCI_SETDOCPOINTER(0, pNewDoc)</code> to set a different document or
4931 <code>SCI_SETDOCPOINTER(0, 0)</code> to set a new, empty document.</p>
4933 <p><b id="SCI_RELEASEDOCUMENT">SCI_RELEASEDOCUMENT(&lt;unused&gt;, document *pDoc)</b><br />
4934 This message reduces the reference count of the document identified by <code>pDoc</code>. pDoc
4935 must be the result of <code>SCI_GETDOCPOINTER</code> or <code>SCI_CREATEDOCUMENT</code> and
4936 must point at a document that still exists. If you call this on a document with a reference
4937 count of 1 that is still attached to a Scintilla window, bad things will happen. To keep the
4938 world spinning in its orbit you must balance each call to <code>SCI_CREATEDOCUMENT</code> or
4939 <code>SCI_ADDREFDOCUMENT</code> with a call to <code>SCI_RELEASEDOCUMENT</code>.</p>
4941 <h2 id="BackgroundLoadSave">Background loading and saving</h2>
4943 <p>To ensure a responsive user interface, applications may decide to load and save documents using a separate thread
4944 from the user interface.</p>
4946 <h3 id="BackgroundLoad">Loading in the background</h2>
4948 <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
4949 into a Scintilla document on the user interface thread. That technique uses extra memory to store a complete copy of the
4950 file and also means that the time that Scintilla takes to perform initial line end discovery blocks the user interface.</p>
4952 <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>
4954 <p><b id="SCI_CREATELOADER">SCI_CREATELOADER(int bytes)</b><br />
4955 Create an object that supports the <code>ILoader</code> interface which can be used to load data and then
4956 be turned into a Scintilla document object for attachment to a view object.
4957 The <code>bytes</code> argument determines the initial memory allocation for the document as it is more efficient
4958 to allocate once rather than rely on the buffer growing as data is added.
4959 If <code>SCI_CREATELOADER</code> fails then 0 is returned.</p>
4961 <h4>ILoader</h4>
4963 <div class="highlighted">
4964 <span class="S5">class</span><span class="S0"> </span>ILoader<span class="S0"> </span><span class="S10">{</span><br />
4965 <span class="S5">public</span><span class="S10">:</span><br />
4966 <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 />
4967 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S2">// Returns a status code from SC_STATUS_*</span><br />
4968 <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 />
4969 <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 />
4970 <span class="S10">};</span><br />
4971 </div>
4973 <p>The application should call the <code>AddData</code> method with each block of data read from the file.
4974 <code>AddData</code> will return SC_STATUS_OK unless a failure, such as memory exhaustion occurs.
4975 If a failure occurs in <code>AddData</code> or in a file reading call then loading can be abandoned and the loader released with
4976 the <code>Release</code> call.
4977 When the whole file has been read, the <code>ConvertToDocument</code> method should be called to produce a Scintilla
4978 document pointer which can be used in the same way as a document pointer returned from
4979 <a class="message" href="#SCI_CREATEDOCUMENT">SCI_CREATEDOCUMENT</a>.
4980 There is no need to call <code>Release</code> after <code>ConvertToDocument</code>.</p>
4982 <h3 id="BackgroundSave">Saving in the background</h2>
4984 <p>An application that wants to save in the background should lock the document with <code>SCI_SETREADONLY(1)</code>
4985 to prevent modifications and retrieve a pointer to the unified document contents with
4986 <a class="message" href="#SCI_GETCHARACTERPOINTER">SCI_GETCHARACTERPOINTER</a></code>.
4987 The buffer of a locked document will not move so the pointer is valid until the application calls <code>SCI_SETREADONLY(0)</code>.</p>
4989 <p>If the user tries to performs a modification while the document is locked then a <code><a class="message"
4990 href="#SCN_MODIFYATTEMPTRO">SCN_MODIFYATTEMPTRO</a></code> notification is sent to the application.
4991 The application may then decide to ignore the modification or to terminate the background saving thread and reenable
4992 modification before returning from the notification.</p>
4994 <h2 id="Folding">Folding</h2>
4996 <p>The fundamental operation in folding is making lines invisible or visible. Line visibility
4997 is a property of the view rather than the document so each view may be displaying a different
4998 set of lines. From the point of view of the user, lines are hidden and displayed using fold
4999 points. Generally, the fold points of a document are based on the hierarchical structure of the
5000 document contents. In Python, the hierarchy is determined by indentation and in C++ by brace
5001 characters. This hierarchy can be represented within a Scintilla document object by attaching a
5002 numeric "fold level" to each line. The fold level is most easily set by a lexer, but you can
5003 also set it with messages.</p>
5005 <p>It is up to your code to set the connection between user actions and folding and unfolding.
5006 The best way to see how this is done is to search the SciTE source code for the messages used
5007 in this section of the documentation and see how they are used. You will also need to use
5008 markers and a folding margin to complete your folding implementation.
5009 The <code>"fold"</code> property should be set to <code>"1"</code> with
5010 <code>SCI_SETPROPERTY("fold", "1")</code> to enable folding. </p>
5011 <code><a class="message" href="#SCI_VISIBLEFROMDOCLINE">SCI_VISIBLEFROMDOCLINE(int
5012 docLine)</a><br />
5013 <a class="message" href="#SCI_DOCLINEFROMVISIBLE">SCI_DOCLINEFROMVISIBLE(int
5014 displayLine)</a><br />
5015 <a class="message" href="#SCI_SHOWLINES">SCI_SHOWLINES(int lineStart, int lineEnd)</a><br />
5016 <a class="message" href="#SCI_HIDELINES">SCI_HIDELINES(int lineStart, int lineEnd)</a><br />
5017 <a class="message" href="#SCI_GETLINEVISIBLE">SCI_GETLINEVISIBLE(int line)</a><br />
5018 <a class="message" href="#SCI_GETALLLINESVISIBLE">SCI_GETALLLINESVISIBLE</a><br />
5019 <a class="message" href="#SCI_SETFOLDLEVEL">SCI_SETFOLDLEVEL(int line, int level)</a><br />
5020 <a class="message" href="#SCI_GETFOLDLEVEL">SCI_GETFOLDLEVEL(int line)</a><br />
5021 <a class="message" href="#SCI_SETFOLDFLAGS">SCI_SETFOLDFLAGS(int flags)</a><br />
5022 <a class="message" href="#SCI_GETLASTCHILD">SCI_GETLASTCHILD(int line, int level)</a><br />
5023 <a class="message" href="#SCI_GETFOLDPARENT">SCI_GETFOLDPARENT(int line)</a><br />
5024 <a class="message" href="#SCI_SETFOLDEXPANDED">SCI_SETFOLDEXPANDED(int line, bool
5025 expanded)</a><br />
5026 <a class="message" href="#SCI_GETFOLDEXPANDED">SCI_GETFOLDEXPANDED(int line)</a><br />
5027 <a class="message" href="#SCI_CONTRACTEDFOLDNEXT">SCI_CONTRACTEDFOLDNEXT(int lineStart)</a><br />
5028 <a class="message" href="#SCI_TOGGLEFOLD">SCI_TOGGLEFOLD(int line)</a><br />
5029 <a class="message" href="#SCI_ENSUREVISIBLE">SCI_ENSUREVISIBLE(int line)</a><br />
5030 <a class="message" href="#SCI_ENSUREVISIBLEENFORCEPOLICY">SCI_ENSUREVISIBLEENFORCEPOLICY(int
5031 line)</a><br />
5032 </code>
5034 <p><b id="SCI_VISIBLEFROMDOCLINE">SCI_VISIBLEFROMDOCLINE(int docLine)</b><br />
5035 When some lines are folded, then a particular line in the document may be displayed at a
5036 different position to its document position. If no lines are folded, this message returns
5037 <code>docLine</code>. Otherwise, this returns the display line (counting the very first visible
5038 line as 0). The display line of an invisible line is the same as the previous visible line. The
5039 display line number of the first line in the document is 0. If there is folding and
5040 <code>docLine</code> is outside the range of lines in the document, the return value is -1.
5041 Lines can occupy more than one display line if they wrap.</p>
5043 <p><b id="SCI_DOCLINEFROMVISIBLE">SCI_DOCLINEFROMVISIBLE(int displayLine)</b><br />
5044 When some lines are hidden, then a particular line in the document may be displayed at a
5045 different position to its document position. This message returns the document line number that
5046 corresponds to a display line (counting the display line of the first line in the document as
5047 0). If <code>displayLine</code> is less than or equal to 0, the result is 0. If
5048 <code>displayLine</code> is greater than or equal to the number of displayed lines, the result
5049 is the number of lines in the document.</p>
5051 <p><b id="SCI_SHOWLINES">SCI_SHOWLINES(int lineStart, int lineEnd)</b><br />
5052 <b id="SCI_HIDELINES">SCI_HIDELINES(int lineStart, int lineEnd)</b><br />
5053 <b id="SCI_GETLINEVISIBLE">SCI_GETLINEVISIBLE(int line)</b><br />
5054 <b id="SCI_GETALLLINESVISIBLE">SCI_GETALLLINESVISIBLE</b><br />
5055 The first two messages mark a range of lines as visible or invisible and then redraw the
5056 display.
5057 <code>SCI_GETLINEVISIBLE</code> reports on the visible state of a line and returns 1 if it is
5058 visible and 0 if it is not visible.
5059 <code>SCI_GETALLLINESVISIBLE</code> returns 1 if all lines are visible and 0
5060 if some lines are hidden.
5061 These messages have no effect on fold levels or fold
5062 flags. The first line can not be hidden.</p>
5064 <p><b id="SCI_SETFOLDLEVEL">SCI_SETFOLDLEVEL(int line, int level)</b><br />
5065 <b id="SCI_GETFOLDLEVEL">SCI_GETFOLDLEVEL(int line)</b><br />
5066 These two messages set and get a 32-bit value that contains the fold level of a line and some
5067 flags associated with folding. The fold level is a number in the range 0 to
5068 <code>SC_FOLDLEVELNUMBERMASK</code> (4095). However, the initial fold level is set to
5069 <code>SC_FOLDLEVELBASE</code> (1024) to allow unsigned arithmetic on folding levels. There are
5070 two addition flag bits. <code>SC_FOLDLEVELWHITEFLAG</code> indicates that the line is blank and
5071 allows it to be treated slightly different then its level may indicate. For example, blank
5072 lines should generally not be fold points and will be considered part of the preceding section even though
5073 they may have a lesser fold level.
5074 <code>SC_FOLDLEVELHEADERFLAG</code> indicates that
5075 the line is a header (fold point).</p>
5077 <p>Use <code>SCI_GETFOLDLEVEL(line) &amp; SC_FOLDLEVELNUMBERMASK</code> to get the fold level
5078 of a line. Likewise, use <code>SCI_GETFOLDLEVEL(line) &amp; SC_FOLDLEVEL*FLAG</code> to get the
5079 state of the flags. To set the fold level you must or in the associated flags. For instance, to
5080 set the level to <code>thisLevel</code> and mark a line as being a fold point use:
5081 <code>SCI_SETFOLDLEVEL(line, thisLevel | SC_FOLDLEVELHEADERFLAG)</code>.</p>
5082 If you use a lexer, you should not need to use <code>SCI_SETFOLDLEVEL</code> as this is far
5083 better handled by the lexer. You will need to use <code>SCI_GETFOLDLEVEL</code> to decide how
5084 to handle user folding requests. If you do change the fold levels, the folding margin will
5085 update to match your changes.
5087 <p><b id="SCI_SETFOLDFLAGS">SCI_SETFOLDFLAGS(int flags)</b><br />
5088 In addition to showing markers in the folding margin, you can indicate folds to the user by
5089 drawing lines in the text area. The lines are drawn in the foreground colour set for <a
5090 class="message" href="#StyleDefinition"><code>STYLE_DEFAULT</code></a>. Bits set in
5091 <code>flags</code> determine where folding lines are drawn:<br />
5092 </p>
5094 <table cellpadding="1" cellspacing="2" border="0" summary="Fold flags">
5095 <tbody>
5096 <tr>
5097 <th align="left">Symbol</th>
5098 <th align="left">Value</th>
5099 <th align="left">Effect</th>
5100 </tr>
5101 </tbody>
5103 <tbody valign="top">
5104 <tr>
5105 <td align="left"></td>
5106 <td align="left">1</td>
5107 <td align="left">Experimental feature that has been removed.</td>
5108 </tr>
5110 <tr>
5111 <td align="left">SC_FOLDFLAG_LINEBEFORE_EXPANDED</td>
5112 <td align="left">2</td>
5114 <td align="left">Draw above if expanded</td>
5115 </tr>
5117 <tr>
5118 <td align="left">SC_FOLDFLAG_LINEBEFORE_CONTRACTED</td>
5119 <td align="left">4</td>
5121 <td align="left">Draw above if not expanded</td>
5122 </tr>
5124 <tr>
5125 <td align="left">SC_FOLDFLAG_LINEAFTER_EXPANDED</td>
5126 <td align="left">8</td>
5128 <td align="left">Draw below if expanded</td>
5129 </tr>
5131 <tr>
5132 <td align="left">SC_FOLDFLAG_LINEAFTER_CONTRACTED</td>
5133 <td align="left">16</td>
5135 <td align="left">Draw below if not expanded</td>
5136 </tr>
5138 <tr>
5139 <td align="left">SC_FOLDFLAG_LEVELNUMBERS</td>
5140 <td align="left">64</td>
5142 <td align="left">display hexadecimal fold levels in line margin to aid debugging of
5143 folding. The appearance of this feature may change in the future.</td>
5144 </tr>
5145 </tbody>
5146 </table>
5148 <p>This message causes the display to redraw.</p>
5150 <p><b id="SCI_GETLASTCHILD">SCI_GETLASTCHILD(int startLine, int level)</b><br />
5151 This message searches for the next line after <code>startLine</code>, that has a folding level
5152 that is less than or equal to <code>level</code> and then returns the previous line number. If
5153 you set <code>level</code> to -1, <code>level</code> is set to the folding level of line
5154 <code>startLine</code>. If <code>from</code> is a fold point, <code>SCI_GETLASTCHILD(from,
5155 -1)</code> returns the last line that would be in made visible or hidden by toggling the fold
5156 state.</p>
5158 <p><b id="SCI_GETFOLDPARENT">SCI_GETFOLDPARENT(int startLine)</b><br />
5159 This message returns the line number of the first line before <code>startLine</code> that is
5160 marked as a fold point with <code>SC_FOLDLEVELHEADERFLAG</code> and has a fold level less than
5161 the <code>startLine</code>. If no line is found, or if the header flags and fold levels are
5162 inconsistent, the return value is -1.</p>
5164 <p><b id="SCI_TOGGLEFOLD">SCI_TOGGLEFOLD(int line)</b><br />
5165 Each fold point may be either expanded, displaying all its child lines, or contracted, hiding
5166 all the child lines. This message toggles the folding state of the given line as long as it has
5167 the <code>SC_FOLDLEVELHEADERFLAG</code> set. This message takes care of folding or expanding
5168 all the lines that depend on the line. The display updates after this message.</p>
5170 <p><b id="SCI_SETFOLDEXPANDED">SCI_SETFOLDEXPANDED(int line, bool expanded)</b><br />
5171 <b id="SCI_GETFOLDEXPANDED">SCI_GETFOLDEXPANDED(int line)</b><br />
5172 These messages set and get the expanded state of a single line. The set message has no effect
5173 on the visible state of the line or any lines that depend on it. It does change the markers in
5174 the folding margin. If you ask for the expansion state of a line that is outside the document,
5175 the result is <code>false</code> (0).</p>
5177 <p>If you just want to toggle the fold state of one line and handle all the lines that are
5178 dependent on it, it is much easier to use <code>SCI_TOGGLEFOLD</code>. You would use the
5179 <code>SCI_SETFOLDEXPANDED</code> message to process many folds without updating the display
5180 until you had finished. See <code>SciTEBase::FoldAll()</code> and
5181 <code>SciTEBase::Expand()</code> for examples of the use of these messages.</p>
5183 <p><b id="SCI_CONTRACTEDFOLDNEXT">SCI_CONTRACTEDFOLDNEXT(int lineStart)</b><br />
5184 Search efficiently for lines that are contracted fold headers.
5185 This is useful when saving the user's folding when switching documents or saving folding with a file.
5186 The search starts at line number <code>lineStart</code> and continues forwards to the end of the file.
5187 <code>lineStart</code> is returned if it is a contracted fold header otherwise the next contracted
5188 fold header is returned. If there are no more contracted fold headers then -1 is returned.</p>
5190 <p><b id="SCI_ENSUREVISIBLE">SCI_ENSUREVISIBLE(int line)</b><br />
5191 <b id="SCI_ENSUREVISIBLEENFORCEPOLICY">SCI_ENSUREVISIBLEENFORCEPOLICY(int line)</b><br />
5192 A line may be hidden because more than one of its parent lines is contracted. Both these
5193 message travels up the fold hierarchy, expanding any contracted folds until they reach the top
5194 level. The line will then be visible. If you use <code>SCI_ENSUREVISIBLEENFORCEPOLICY</code>,
5195 the vertical caret policy set by <a class="message"
5196 href="#SCI_SETVISIBLEPOLICY"><code>SCI_SETVISIBLEPOLICY</code></a> is then applied.</p>
5198 <h2 id="LineWrapping">Line wrapping</h2>
5200 <code><a class="message" href="#SCI_SETWRAPMODE">SCI_SETWRAPMODE(int wrapMode)</a><br />
5201 <a class="message" href="#SCI_GETWRAPMODE">SCI_GETWRAPMODE</a><br />
5202 <a class="message" href="#SCI_SETWRAPVISUALFLAGS">SCI_SETWRAPVISUALFLAGS(int wrapVisualFlags)</a><br />
5203 <a class="message" href="#SCI_GETWRAPVISUALFLAGS">SCI_GETWRAPVISUALFLAGS</a><br />
5204 <a class="message" href="#SCI_SETWRAPVISUALFLAGSLOCATION">SCI_SETWRAPVISUALFLAGSLOCATION(int wrapVisualFlagsLocation)</a><br />
5205 <a class="message" href="#SCI_GETWRAPVISUALFLAGSLOCATION">SCI_GETWRAPVISUALFLAGSLOCATION</a><br />
5206 <a class="message" href="#SCI_SETWRAPINDENTMODE">SCI_SETWRAPINDENTMODE(int indentMode)</a><br />
5207 <a class="message" href="#SCI_GETWRAPINDENTMODE">SCI_GETWRAPINDENTMODE</a><br />
5208 <a class="message" href="#SCI_SETWRAPSTARTINDENT">SCI_SETWRAPSTARTINDENT(int indent)</a><br />
5209 <a class="message" href="#SCI_GETWRAPSTARTINDENT">SCI_GETWRAPSTARTINDENT</a><br />
5210 <a class="message" href="#SCI_SETLAYOUTCACHE">SCI_SETLAYOUTCACHE(int cacheMode)</a><br />
5211 <a class="message" href="#SCI_GETLAYOUTCACHE">SCI_GETLAYOUTCACHE</a><br />
5212 <a class="message" href="#SCI_SETPOSITIONCACHE">SCI_SETPOSITIONCACHE(int size)</a><br />
5213 <a class="message" href="#SCI_GETPOSITIONCACHE">SCI_GETPOSITIONCACHE</a><br />
5214 <a class="message" href="#SCI_LINESSPLIT">SCI_LINESSPLIT(int pixelWidth)</a><br />
5215 <a class="message" href="#SCI_LINESJOIN">SCI_LINESJOIN</a><br />
5216 <a class="message" href="#SCI_WRAPCOUNT">SCI_WRAPCOUNT(int docLine)</a><br />
5217 </code>
5219 <p>By default, Scintilla does not wrap lines of text. If you enable line wrapping, lines wider
5220 than the window width are continued on the following lines. Lines are broken after space or tab
5221 characters or between runs of different styles. If this is not possible because a word in one
5222 style is wider than the window then the break occurs after the last character that completely
5223 fits on the line. The horizontal scroll bar does not appear when wrap mode is on.</p>
5225 <p>For wrapped lines Scintilla can draw visual flags (little arrows) at end of a a subline of a
5226 wrapped line and at begin of the next subline. These can be enabled individually, but if Scintilla
5227 draws the visual flag at the beginning of the next subline this subline will be indented by one char.
5228 Independent from drawing a visual flag at the begin the subline can have an indention.</p>
5230 <p>Much of the time used by Scintilla is spent on laying out and drawing text. The same text
5231 layout calculations may be performed many times even when the data used in these calculations
5232 does not change. To avoid these unnecessary calculations in some circumstances, the line layout
5233 cache can store the results of the calculations. The cache is invalidated whenever the
5234 underlying data, such as the contents or styling of the document changes. Caching the layout of
5235 the whole document has the most effect, making dynamic line wrap as much as 20 times faster but
5236 this requires 7 times the memory required by the document contents plus around 80 bytes per
5237 line.</p>
5239 <p>Wrapping is not performed immediately there is a change but is delayed until the display
5240 is redrawn. This delay improves peformance by allowing a set of changes to be performed
5241 and then wrapped and displayed once. Because of this, some operations may not occur as
5242 expected. If a file is read and the scroll position moved to a particular line in the text,
5243 such as occurs when a container tries to restore a previous editing session, then
5244 the scroll position will have been determined before wrapping so an unexpected range
5245 of text will be displayed. To scroll to the position correctly, delay the scroll until the
5246 wrapping has been performed by waiting for an initial
5247 <a class="message" href="#SCN_PAINTED">SCN_PAINTED</a> notification.</p>
5249 <p><b id="SCI_SETWRAPMODE">SCI_SETWRAPMODE(int wrapMode)</b><br />
5250 <b id="SCI_GETWRAPMODE">SCI_GETWRAPMODE</b><br />
5251 Set wrapMode to <code>SC_WRAP_WORD</code> (1) to enable wrapping
5252 on word boundaries, <code>SC_WRAP_CHAR</code> (2) to enable wrapping
5253 between any characters, and to <code>SC_WRAP_NONE</code> (0) to disable line
5254 wrapping. <code>SC_WRAP_CHAR</code> is preferred to
5255 <code>SC_WRAP_WORD</code> for Asian languages where there is no white space
5256 between words.</p>
5259 <p><b id="SCI_SETWRAPVISUALFLAGS">SCI_SETWRAPVISUALFLAGS(int wrapVisualFlags)</b><br />
5260 <b id="SCI_GETWRAPVISUALFLAGS">SCI_GETWRAPVISUALFLAGS</b><br />
5261 You can enable the drawing of visual flags to indicate a line is wrapped. Bits set in
5262 wrapVisualFlags determine which visual flags are drawn.
5263 </p>
5264 <table cellpadding="1" cellspacing="2" border="0" summary="Wrap visual flags">
5265 <tbody>
5266 <tr>
5267 <th align="left">Symbol</th>
5268 <th>Value</th>
5269 <th align="left">Effect</th>
5270 </tr>
5271 </tbody>
5273 <tbody valign="top">
5274 <tr>
5275 <td align="left"><code>SC_WRAPVISUALFLAG_NONE</code></td>
5276 <td align="center">0</td>
5277 <td>No visual flags</td>
5278 </tr>
5280 <tr>
5281 <td align="left"><code>SC_WRAPVISUALFLAG_END</code></td>
5282 <td align="center">1</td>
5283 <td>Visual flag at end of subline of a wrapped line.</td>
5284 </tr>
5286 <tr>
5287 <td align="left"><code>SC_WRAPVISUALFLAG_START</code></td>
5288 <td align="center">2</td>
5289 <td>Visual flag at begin of subline of a wrapped line.<br />
5290 Subline is indented by at least 1 to make room for the flag.<br />
5291 </td>
5292 </tr>
5294 <tr>
5295 <td align="left"><code>SC_WRAPVISUALFLAG_MARGIN</code></td>
5296 <td align="center">4</td>
5297 <td>Visual flag in line number margin.</td>
5298 </tr>
5299 </tbody>
5300 </table>
5302 <p><b id="SCI_SETWRAPVISUALFLAGSLOCATION">SCI_SETWRAPVISUALFLAGSLOCATION(int wrapVisualFlagsLocation)</b><br />
5303 <b id="SCI_GETWRAPVISUALFLAGSLOCATION">SCI_GETWRAPVISUALFLAGSLOCATION</b><br />
5304 You can set whether the visual flags to indicate a line is wrapped are drawn near the border or near the text.
5305 Bits set in wrapVisualFlagsLocation set the location to near the text for the corresponding visual flag.
5306 </p>
5308 <table cellpadding="1" cellspacing="2" border="0" summary="Wrap visual flags locations">
5309 <tbody>
5310 <tr>
5311 <th align="left">Symbol</th>
5312 <th>Value</th>
5313 <th align="left">Effect</th>
5314 </tr>
5315 </tbody>
5317 <tbody valign="top">
5318 <tr>
5319 <td align="left"><code>SC_WRAPVISUALFLAGLOC_DEFAULT</code></td>
5320 <td align="center">0</td>
5321 <td>Visual flags drawn near border</td>
5322 </tr>
5324 <tr>
5325 <td align="left"><code>SC_WRAPVISUALFLAGLOC_END_BY_TEXT</code></td>
5326 <td align="center">1</td>
5327 <td>Visual flag at end of subline drawn near text</td>
5328 </tr>
5330 <tr>
5331 <td align="left"><code>SC_WRAPVISUALFLAGLOC_START_BY_TEXT</code></td>
5332 <td align="center">2</td>
5333 <td>Visual flag at beginning of subline drawn near text</td>
5334 </tr>
5335 </tbody>
5336 </table>
5338 <p><b id="SCI_SETWRAPINDENTMODE">SCI_SETWRAPINDENTMODE(int indentMode)</b><br />
5339 <b id="SCI_GETWRAPINDENTMODE">SCI_GETWRAPINDENTMODE</b><br />
5340 Wrapped sublines can be indented to the position of their first subline or one more indent level.
5341 The default is <code>SC_WRAPINDENT_FIXED</code>.
5342 The modes are:
5343 </p>
5345 <table cellpadding="1" cellspacing="2" border="0" summary="Wrap visual flags locations">
5346 <tbody>
5347 <tr>
5348 <th align="left">Symbol</th>
5349 <th>Value</th>
5350 <th align="left">Effect</th>
5351 </tr>
5352 </tbody>
5354 <tbody valign="top">
5355 <tr>
5356 <td align="left"><code>SC_WRAPINDENT_FIXED</code></td>
5357 <td align="center">0</td>
5358 <td>Wrapped sublines aligned to left of window plus amount set by
5359 <a class="message" href="#SCI_SETWRAPSTARTINDENT">SCI_SETWRAPSTARTINDENT</a></td>
5360 </tr>
5362 <tr>
5363 <td align="left"><code>SC_WRAPINDENT_SAME</code></td>
5364 <td align="center">1</td>
5365 <td>Wrapped sublines are aligned to first subline indent</td>
5366 </tr>
5368 <tr>
5369 <td align="left"><code>SC_WRAPINDENT_INDENT</code></td>
5370 <td align="center">2</td>
5371 <td>Wrapped sublines are aligned to first subline indent plus one more level of indentation</td>
5372 </tr>
5373 </tbody>
5374 </table>
5376 <p><b id="SCI_SETWRAPSTARTINDENT">SCI_SETWRAPSTARTINDENT(int indent)</b><br />
5377 <b id="SCI_GETWRAPSTARTINDENT">SCI_GETWRAPSTARTINDENT</b><br />
5378 <code>SCI_SETWRAPSTARTINDENT</code> sets the size of indentation of sublines for
5379 wrapped lines in terms of the average character width in
5380 <a class="message" href="#StyleDefinition"><code>STYLE_DEFAULT</code></a>.
5381 There are no limits on indent sizes, but values less than 0 or large values may have
5382 undesirable effects.<br />
5383 The indention of sublines is independent of visual flags, but if
5384 <code>SC_WRAPVISUALFLAG_START</code> is set an indent of at least 1 is used.
5385 </p>
5387 <p><b id="SCI_SETLAYOUTCACHE">SCI_SETLAYOUTCACHE(int cacheMode)</b><br />
5388 <b id="SCI_GETLAYOUTCACHE">SCI_GETLAYOUTCACHE</b><br />
5389 You can set <code>cacheMode</code> to one of the symbols in the table:</p>
5391 <table cellpadding="1" cellspacing="2" border="0" summary="Line caching styles">
5392 <tbody>
5393 <tr>
5394 <th align="left">Symbol</th>
5396 <th>Value</th>
5398 <th align="left">Layout cached for these lines</th>
5399 </tr>
5400 </tbody>
5402 <tbody valign="top">
5403 <tr>
5404 <td align="left"><code>SC_CACHE_NONE</code></td>
5406 <td align="center">0</td>
5408 <td>No lines are cached.</td>
5409 </tr>
5411 <tr>
5412 <td align="left"><code>SC_CACHE_CARET</code></td>
5414 <td align="center">1</td>
5416 <td>The line containing the text caret. This is the default.</td>
5417 </tr>
5419 <tr>
5420 <td align="left"><code>SC_CACHE_PAGE</code></td>
5422 <td align="center">2</td>
5424 <td>Visible lines plus the line containing the caret.</td>
5425 </tr>
5427 <tr>
5428 <td align="left"><code>SC_CACHE_DOCUMENT</code></td>
5430 <td align="center">3</td>
5432 <td>All lines in the document.</td>
5433 </tr>
5434 </tbody>
5435 </table>
5437 <p><b id="SCI_SETPOSITIONCACHE">SCI_SETPOSITIONCACHE(int size)</b><br />
5438 <b id="SCI_GETPOSITIONCACHE">SCI_GETPOSITIONCACHE</b><br />
5439 The position cache stores position information for short runs of text
5440 so that their layout can be determined more quickly if the run recurs.
5441 The size in entries of this cache can be set with <code>SCI_SETPOSITIONCACHE</code>.</p>
5443 <p><b id="SCI_LINESSPLIT">SCI_LINESSPLIT(int pixelWidth)</b><br />
5444 Split a range of lines indicated by the target into lines that are at most pixelWidth wide.
5445 Splitting occurs on word boundaries wherever possible in a similar manner to line wrapping.
5446 When <code>pixelWidth</code> is 0 then the width of the window is used.
5447 </p>
5449 <p><b id="SCI_LINESJOIN">SCI_LINESJOIN</b><br />
5450 Join a range of lines indicated by the target into one line by
5451 removing line end characters.
5452 Where this would lead to no space between words, an extra space is inserted.
5453 </p>
5455 <p><b id="SCI_WRAPCOUNT">SCI_WRAPCOUNT(int docLine)</b><br />
5456 Document lines can occupy more than one display line if they wrap and this
5457 returns the number of display lines needed to wrap a document line.</p>
5459 <h2 id="Zooming">Zooming</h2>
5461 <p>Scintilla incorporates a "zoom factor" that lets you make all the text in the document
5462 larger or smaller in steps of one point. The displayed point size never goes below 2, whatever
5463 zoom factor you set. You can set zoom factors in the range -10 to +20 points.</p>
5464 <code><a class="message" href="#SCI_ZOOMIN">SCI_ZOOMIN</a><br />
5465 <a class="message" href="#SCI_ZOOMOUT">SCI_ZOOMOUT</a><br />
5466 <a class="message" href="#SCI_SETZOOM">SCI_SETZOOM(int zoomInPoints)</a><br />
5467 <a class="message" href="#SCI_GETZOOM">SCI_GETZOOM</a><br />
5468 </code>
5470 <p><b id="SCI_ZOOMIN">SCI_ZOOMIN</b><br />
5471 <b id="SCI_ZOOMOUT">SCI_ZOOMOUT</b><br />
5472 <code>SCI_ZOOMIN</code> increases the zoom factor by one point if the current zoom factor is
5473 less than 20 points. <code>SCI_ZOOMOUT</code> decreases the zoom factor by one point if the
5474 current zoom factor is greater than -10 points.</p>
5476 <p><b id="SCI_SETZOOM">SCI_SETZOOM(int zoomInPoints)</b><br />
5477 <b id="SCI_GETZOOM">SCI_GETZOOM</b><br />
5478 These messages let you set and get the zoom factor directly. There is no limit set on the
5479 factors you can set, so limiting yourself to -10 to +20 to match the incremental zoom functions
5480 is a good idea.</p>
5482 <h2 id="LongLines">Long lines</h2>
5484 <p>You can choose to mark lines that exceed a given length by drawing a vertical line or by
5485 colouring the background of characters that exceed the set length.</p>
5486 <code><a class="message" href="#SCI_SETEDGEMODE">SCI_SETEDGEMODE(int mode)</a><br />
5487 <a class="message" href="#SCI_GETEDGEMODE">SCI_GETEDGEMODE</a><br />
5488 <a class="message" href="#SCI_SETEDGECOLUMN">SCI_SETEDGECOLUMN(int column)</a><br />
5489 <a class="message" href="#SCI_GETEDGECOLUMN">SCI_GETEDGECOLUMN</a><br />
5490 <a class="message" href="#SCI_SETEDGECOLOUR">SCI_SETEDGECOLOUR(int colour)</a><br />
5491 <a class="message" href="#SCI_GETEDGECOLOUR">SCI_GETEDGECOLOUR</a><br />
5492 </code>
5494 <p><b id="SCI_SETEDGEMODE">SCI_SETEDGEMODE(int edgeMode)</b><br />
5495 <b id="SCI_GETEDGEMODE">SCI_GETEDGEMODE</b><br />
5496 These two messages set and get the mode used to display long lines. You can set one of the
5497 values in the table:</p>
5499 <table cellpadding="1" cellspacing="2" border="0" summary="Long line styles">
5500 <tbody>
5501 <tr>
5502 <th align="left">Symbol</th>
5504 <th>Value</th>
5506 <th align="left">Long line display mode</th>
5507 </tr>
5508 </tbody>
5510 <tbody valign="top">
5511 <tr>
5512 <td align="left"><code>EDGE_NONE</code></td>
5514 <td align="center">0</td>
5516 <td>Long lines are not marked. This is the default state.</td>
5517 </tr>
5519 <tr>
5520 <td align="left"><code>EDGE_LINE</code></td>
5522 <td align="center">1</td>
5524 <td>A vertical line is drawn at the column number set by <code>SCI_SETEDGECOLUMN</code>.
5525 This works well for monospaced fonts. The line is drawn at a position based on the width
5526 of a space character in <a class="message"
5527 href="#StyleDefinition"><code>STYLE_DEFAULT</code></a>, so it may not work very well if
5528 your styles use proportional fonts or if your style have varied font sizes or you use a
5529 mixture of bold, italic and normal text.</td>
5530 </tr>
5532 <tr>
5533 <td align="left"><code>EDGE_BACKGROUND</code></td>
5535 <td align="center">2</td>
5537 <td>The background colour of characters after the column limit is changed to the colour
5538 set by <code>SCI_SETEDGECOLOUR</code>. This is recommended for proportional fonts.</td>
5539 </tr>
5540 </tbody>
5541 </table>
5543 <p><b id="SCI_SETEDGECOLUMN">SCI_SETEDGECOLUMN(int column)</b><br />
5544 <b id="SCI_GETEDGECOLUMN">SCI_GETEDGECOLUMN</b><br />
5545 These messages set and get the column number at which to display the long line marker. When
5546 drawing lines, the column sets a position in units of the width of a space character in
5547 <code>STYLE_DEFAULT</code>. When setting the background colour, the column is a character count
5548 (allowing for tabs) into the line.</p>
5550 <p><b id="SCI_SETEDGECOLOUR">SCI_SETEDGECOLOUR(int <a class="jump"
5551 href="#colour">colour</a>)</b><br />
5552 <b id="SCI_GETEDGECOLOUR">SCI_GETEDGECOLOUR</b><br />
5553 These messages set and get the colour of the marker used to show that a line has exceeded the
5554 length set by <code>SCI_SETEDGECOLUMN</code>.</p>
5556 <h2 id="Lexer">Lexer</h2>
5558 <p>If you define the symbol <code>SCI_LEXER</code> when building Scintilla, (this is sometimes
5559 called the SciLexer version of Scintilla), lexing support for a wide range of programming
5560 languages is included and the messages in this section are supported. If you want to set
5561 styling and fold points for an unsupported language you can either do this in the container or
5562 better still, write your own lexer following the pattern of one of the existing ones.</p>
5564 <p>Scintilla also supports external lexers. These are DLLs (on Windows) or .so modules (on GTK+/Linux) that export three
5565 functions: <code>GetLexerCount</code>, <code>GetLexerName</code>, and
5566 <code>GetLexerFactory</code>. See <code>externalLexer.cxx</code> for more.</p>
5567 <code><a class="message" href="#SCI_SETLEXER">SCI_SETLEXER(int lexer)</a><br />
5568 <a class="message" href="#SCI_GETLEXER">SCI_GETLEXER</a><br />
5569 <a class="message" href="#SCI_SETLEXERLANGUAGE">SCI_SETLEXERLANGUAGE(&lt;unused&gt;, const char
5570 *name)</a><br />
5571 <a class="message" href="#SCI_GETLEXERLANGUAGE">SCI_GETLEXERLANGUAGE(&lt;unused&gt;, char
5572 *name)</a><br />
5573 <a class="message" href="#SCI_LOADLEXERLIBRARY">SCI_LOADLEXERLIBRARY(&lt;unused&gt;, const char
5574 *path)</a><br />
5575 <a class="message" href="#SCI_COLOURISE">SCI_COLOURISE(int start, int end)</a><br />
5576 <a class="message" href="#SCI_CHANGELEXERSTATE">SCI_CHANGELEXERSTATE(int start, int end)</a><br />
5577 <a class="message" href="#SCI_PROPERTYNAMES">SCI_PROPERTYNAMES(&lt;unused&gt;, char *names)</a><br />
5578 <a class="message" href="#SCI_PROPERTYTYPE">SCI_PROPERTYTYPE(const char *name)</a><br />
5579 <a class="message" href="#SCI_DESCRIBEPROPERTY">SCI_DESCRIBEPROPERTY(const char *name, char *description)</a><br />
5580 <a class="message" href="#SCI_SETPROPERTY">SCI_SETPROPERTY(const char *key, const char *value)</a><br />
5581 <a class="message" href="#SCI_GETPROPERTY">SCI_GETPROPERTY(const char *key, char *value)</a><br />
5582 <a class="message" href="#SCI_GETPROPERTYEXPANDED">SCI_GETPROPERTYEXPANDED(const char *key, char *value)</a><br />
5583 <a class="message" href="#SCI_GETPROPERTYINT">SCI_GETPROPERTYINT(const char *key, int default)</a><br />
5584 <a class="message" href="#SCI_DESCRIBEKEYWORDSETS">SCI_DESCRIBEKEYWORDSETS(&lt;unused&gt;, char *descriptions)</a><br />
5585 <a class="message" href="#SCI_SETKEYWORDS">SCI_SETKEYWORDS(int keyWordSet, const char
5586 *keyWordList)</a><br />
5587 <a class="message" href="#SCI_GETSTYLEBITSNEEDED">SCI_GETSTYLEBITSNEEDED</a>
5588 <br />
5589 </code>
5591 <p><b id="SCI_SETLEXER">SCI_SETLEXER(int lexer)</b><br />
5592 <b id="SCI_GETLEXER">SCI_GETLEXER</b><br />
5593 You can select the lexer to use with an integer code from the <code>SCLEX_*</code> enumeration
5594 in <code>Scintilla.h</code>. There are two codes in this sequence that do not use lexers:
5595 <code>SCLEX_NULL</code> to select no lexing action and <code>SCLEX_CONTAINER</code> which sends
5596 the <code><a class="message" href="#SCN_STYLENEEDED">SCN_STYLENEEDED</a></code> notification to
5597 the container whenever a range of text needs to be styled. You cannot use the
5598 <code>SCLEX_AUTOMATIC</code> value; this identifies additional external lexers that Scintilla
5599 assigns unused lexer numbers to.</p>
5601 <p><b id="SCI_SETLEXERLANGUAGE">SCI_SETLEXERLANGUAGE(&lt;unused&gt;, const char *name)</b><br />
5602 <b id="SCI_GETLEXERLANGUAGE">SCI_GETLEXERLANGUAGE(&lt;unused&gt;, char *name)</b><br />
5603 <code>SCI_SETLEXERLANGUAGE</code> lets you select a lexer by name, and is the only method if you are using an
5604 external lexer or if you have written a lexer module for a language of your own and do not wish
5605 to assign it an explicit lexer number. To select an existing lexer, set <code>name</code> to
5606 match the (case sensitive) name given to the module, for example "ada" or "python", not "Ada"
5607 or "Python". To locate the name for the built-in lexers, open the relevant
5608 <code>Lex*.cxx</code> file and search for <code>LexerModule</code>. The third argument in the
5609 <code>LexerModule</code> constructor is the name to use.</p>
5611 <p>To test if your lexer assignment worked, use <a class="message"
5612 href="#SCI_GETLEXER"><code>SCI_GETLEXER</code></a> before and after setting the new lexer to
5613 see if the lexer number changed.</p>
5615 <p><code>SCI_GETLEXERLANGUAGE</code> retrieves the name of the lexer.</p>
5617 <p><b id="SCI_LOADLEXERLIBRARY">SCI_LOADLEXERLIBRARY(&lt;unused&gt;, const char *path)</b><br />
5618 Load a lexer implemented in a shared library. This is a .so file on GTK+/Linux or a .DLL file on Windows.
5619 </p>
5621 <p><b id="SCI_COLOURISE">SCI_COLOURISE(int startPos, int endPos)</b><br />
5622 This requests the current lexer or the container (if the lexer is set to
5623 <code>SCLEX_CONTAINER</code>) to style the document between <code>startPos</code> and
5624 <code>endPos</code>. If <code>endPos</code> is -1, the document is styled from
5625 <code>startPos</code> to the end. If the <code>"fold"</code> property is set to
5626 <code>"1"</code> and your lexer or container supports folding, fold levels are also set. This
5627 message causes a redraw.</p>
5629 <p><b id="SCI_CHANGELEXERSTATE">SCI_CHANGELEXERSTATE(int startPos, int endPos)</b><br />
5630 Indicate that the internal state of a lexer has changed over a range and therefore
5631 there may be a need to redraw.</p>
5633 <p><b id="SCI_PROPERTYNAMES">SCI_PROPERTYNAMES(&lt;unused&gt;, char *names)</b><br />
5634 <b id="SCI_PROPERTYTYPE">SCI_PROPERTYTYPE(const char *name)</b><br />
5635 <b id="SCI_DESCRIBEPROPERTY">SCI_DESCRIBEPROPERTY(const char *name, char *description)</b><br />
5636 Information may be retrieved about the properties that can be set for the current lexer.
5637 This information is only available for newer lexers.
5638 <code>SCI_PROPERTYNAMES</code> returns a string with all of the valid properties separated by "\n".
5639 If the lexer does not support this call then an empty string is returned.
5640 Properties may be boolean (<code>SC_TYPE_BOOLEAN</code>), integer (<code>SC_TYPE_INTEGER</code>),
5641 or string (<code>SC_TYPE_STRING</code>) and this is found with <code>SCI_PROPERTYTYPE</code>.
5642 A description of a property in English is returned by <code>SCI_DESCRIBEPROPERTY</code>.</p>
5644 <p><b id="SCI_SETPROPERTY">SCI_SETPROPERTY(const char *key, const char *value)</b><br />
5645 You can communicate settings to lexers with keyword:value string pairs. There is no limit to
5646 the number of keyword pairs you can set, other than available memory. <code>key</code> is a
5647 case sensitive keyword, <code>value</code> is a string that is associated with the keyword. If
5648 there is already a value string associated with the keyword, it is replaced. If you pass a zero
5649 length string, the message does nothing. Both <code>key</code> and <code>value</code> are used
5650 without modification; extra spaces at the beginning or end of <code>key</code> are
5651 significant.</p>
5653 <p>The <code>value</code> string can refer to other keywords. For example,
5654 <code>SCI_SETPROPERTY("foldTimes10", "$(fold)0")</code> stores the string
5655 <code>"$(fold)0"</code>, but when this is accessed, the <code>$(fold)</code> is replaced by the
5656 value of the <code>"fold"</code> keyword (or by nothing if this keyword does not exist).</p>
5658 <p>Currently the "fold" property is defined for most of the lexers to set the fold structure if
5659 set to "1". <code>SCLEX_PYTHON</code> understands <code>"tab.timmy.whinge.level"</code> as a
5660 setting that determines how to indicate bad indentation. Most keywords have values that are
5661 interpreted as integers. Search the lexer sources for <code>GetPropertyInt</code> to see how
5662 properties are used.</p>
5664 <p>There is a convention for naming properties used by lexers so that the set of properties can be found by scripts.
5665 Property names should start with "lexer.&lt;lexer&gt;." or "fold.&lt;lexer&gt;." when they apply to one
5666 lexer or start with "lexer." or "fold." if they apply to multiple lexers.</p>
5668 <p>Applications may discover the set of properties used by searching the source code of lexers for lines that contain
5669 <code>GetProperty</code> and a double quoted string and extract the value of the double quoted string as the property name.
5670 The <code>scintilla/src/LexGen.py</code> script does this and can be used as an example.
5671 Documentation for the property may be located above the call as a multi-line comment starting with
5672 <br/><code>// property &lt;property-name&gt;</code></p>
5674 <p><b id="SCI_GETPROPERTY">SCI_GETPROPERTY(const char *key, char *value)</b><br />
5675 Lookup a keyword:value pair using the specified key; if found, copy the value to the user-supplied
5676 buffer and return the length (not including the terminating 0). If not found, copy an empty string
5677 to the buffer and return 0.</p>
5679 <p>Note that "keyword replacement" as described in <a class="message" href="#SCI_SETPROPERTY">
5680 <code>SCI_SETPROPERTY</code></a> will not be performed.</p>
5682 <p>If the value argument is 0 then the length that should be allocated to store the value is returned;
5683 again, the terminating 0 is not included.</p>
5685 <p><b id="SCI_GETPROPERTYEXPANDED">SCI_GETPROPERTYEXPANDED(const char *key, char *value)</b><br />
5686 Lookup a keyword:value pair using the specified key; if found, copy the value to the user-supplied
5687 buffer and return the length (not including the terminating 0). If not found, copy an empty string
5688 to the buffer and return 0.</p>
5690 <p>Note that "keyword replacement" as described in <a class="message" href="#SCI_SETPROPERTY">
5691 <code>SCI_SETPROPERTY</code></a> will be performed.</p>
5693 <p>If the value argument is 0 then the length that should be allocated to store the value (including any indicated keyword replacement)
5694 is returned; again, the terminating 0 is not included.</p>
5696 <p><b id="SCI_GETPROPERTYINT">SCI_GETPROPERTYINT(const char *key, int default)</b><br />
5697 Lookup a keyword:value pair using the specified key; if found, interpret the value as an integer and return it.
5698 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
5699 a number, then return 0.</p>
5701 <p>Note that "keyword replacement" as described in <a class="message" href="#SCI_SETPROPERTY">
5702 <code>SCI_SETPROPERTY</code></a> will be performed before any numeric interpretation.</p>
5704 <p><b id="SCI_SETKEYWORDS">SCI_SETKEYWORDS(int keyWordSet, const char *keyWordList)</b><br />
5705 You can set up to 9 lists of keywords for use by the current lexer. This was increased from 6
5706 at revision 1.50. <code>keyWordSet</code> can be 0 to 8 (actually 0 to <code>KEYWORDSET_MAX</code>)
5707 and selects which keyword list to replace. <code>keyWordList</code> is a list of keywords
5708 separated by spaces, tabs, <code>"\n"</code> or <code>"\r"</code> or any combination of these.
5709 It is expected that the keywords will be composed of standard ASCII printing characters,
5710 but there is nothing to stop you using any non-separator character codes from 1 to 255
5711 (except common sense).</p>
5713 <p>How these keywords are used is entirely up to the lexer. Some languages, such as HTML may
5714 contain embedded languages, VBScript and JavaScript are common for HTML. For HTML, key word set
5715 0 is for HTML, 1 is for JavaScript and 2 is for VBScript, 3 is for Python, 4 is for PHP and 5
5716 is for SGML and DTD keywords. Review the lexer code to see examples of keyword list. A fully
5717 conforming lexer sets the fourth argument of the <code>LexerModule</code> constructor to be a
5718 list of strings that describe the uses of the keyword lists.</p>
5720 <p>Alternatively, you might use set 0 for general keywords, set 1 for keywords that cause
5721 indentation and set 2 for keywords that cause unindentation. Yet again, you might have a simple
5722 lexer that colours keywords and you could change languages by changing the keywords in set 0.
5723 There is nothing to stop you building your own keyword lists into the lexer, but this means
5724 that the lexer must be rebuilt if more keywords are added.</p>
5726 <p><b id="SCI_DESCRIBEKEYWORDSETS">SCI_DESCRIBEKEYWORDSETS(&lt;unused&gt;, char *descriptions)</b><br />
5727 A description of all of the keyword sets separated by "\n" is returned by <code>SCI_DESCRIBEKEYWORDSETS</code>.</p>
5729 <p><b id="SCI_GETSTYLEBITSNEEDED">SCI_GETSTYLEBITSNEEDED</b><br />
5730 Retrieve the number of bits the current lexer needs for styling. This should normally be the argument
5731 to <a class="message" href="#SCI_SETSTYLEBITS">SCI_SETSTYLEBITS</a>.
5732 </p>
5734 <h2 id="LexerObjects">Lexer Objects</h2>
5736 <p>Lexers are programmed as objects that implement the ILexer interface and that interact
5737 with the document they are lexing through the IDocument interface.
5738 Previously lexers were defined by providing lexing and folding functions but creating an object
5739 to handle the interaction of a lexer with a document allows the lexer to store state information that
5740 can be used during lexing. For example a C++ lexer may store a set of preprocessor definitions
5741 or variable declarations and style these depending on their role.</p>
5743 <p>A set of helper classes allows older lexers defined by functions to be used in Scintilla.</p>
5744 <h4>ILexer</h4>
5746 <div class="highlighted">
5747 <span class="S5">class</span><span class="S0"> </span>ILexer<span class="S0"> </span><span class="S10">{</span><br />
5748 <span class="S5">public</span><span class="S10">:</span><br />
5749 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5750 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
5751 <span class="S0"> </span>Version<span class="S10">()</span><span class="S0"> </span>
5752 <span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
5753 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5754 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5755 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
5756 <span class="S0"> </span>Release<span class="S10">()</span><span class="S0"> </span>
5757 <span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5758 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span>
5759 <span class="S5">const</span><span class="S0"> </span>
5760 <span class="S5">char</span><span class="S0"> </span>
5761 <span class="S10">*</span><span class="S0"> </span>
5762 SCI_METHOD<span class="S0"> </span>PropertyNames<span class="S10">()</span>
5763 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5764 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5765 <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 />
5766 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5767 <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 />
5768 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5769 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
5770 <span class="S0"> </span>PropertySet<span class="S10">(</span><span class="S5">const</span>
5771 <span class="S0"> </span><span class="S5">char</span>
5772 <span class="S0"> </span><span class="S10">*</span>key<span class="S10">,</span>
5773 <span class="S0"> </span><span class="S5">const</span><span class="S0"> </span>
5774 <span class="S5">char</span><span class="S0"> </span><span class="S10">*</span>val<span class="S10">)</span>
5775 <span class="S0"> </span><span class="S10">=</span>
5776 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5777 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span>
5778 <span class="S5">const</span><span class="S0"> </span><span class="S5">char</span><span class="S0"> </span>
5779 <span class="S10">*</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>DescribeWordListSets<span class="S10">()</span>
5780 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
5781 <span class="S4">0</span><span class="S10">;</span><br />
5782 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5783 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
5784 <span class="S0"> </span>WordListSet<span class="S10">(</span><span class="S5">int</span>
5785 <span class="S0"> </span>n<span class="S10">,</span>
5786 <span class="S0"> </span><span class="S5">const</span><span class="S0"> </span>
5787 <span class="S5">char</span><span class="S0"> </span><span class="S10">*</span>wl<span class="S10">)</span>
5788 <span class="S0"> </span><span class="S10">=</span>
5789 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5790 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5791 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
5792 <span class="S0"> </span>Lex<span class="S10">(</span><span class="S5">unsigned</span>
5793 <span class="S0"> </span><span class="S5">int</span>
5794 <span class="S0"> </span>startPos<span class="S10">,</span>
5795 <span class="S0"> </span><span class="S5">int</span>
5796 <span class="S0"> </span>lengthDoc<span class="S10">,</span><span class="S0">
5797 </span><span class="S5">int</span><span class="S0"> </span>initStyle<span class="S10">,</span>
5798 <span class="S0"> </span>IDocument<span class="S0">
5799 </span><span class="S10">*</span>pAccess<span class="S10">)</span>
5800 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
5801 <span class="S4">0</span><span class="S10">;</span><br />
5802 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5803 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
5804 <span class="S0"> </span>Fold<span class="S10">(</span><span class="S5">unsigned</span>
5805 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>startPos<span class="S10">,</span>
5806 <span class="S0"> </span><span class="S5">int</span>
5807 <span class="S0"> </span>lengthDoc<span class="S10">,</span><span class="S0">
5808 </span><span class="S5">int</span><span class="S0"> </span>initStyle<span class="S10">,</span>
5809 <span class="S0"> </span>IDocument<span class="S0">
5810 </span><span class="S10">*</span>pAccess<span class="S10">)</span>
5811 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
5812 <span class="S4">0</span><span class="S10">;</span><br />
5813 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5814 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>
5815 <span class="S10">*</span><span class="S0"> </span>SCI_METHOD<span class="S0">
5816 </span>PrivateCall<span class="S10">(</span><span class="S5">int</span>
5817 <span class="S0"> </span>operation<span class="S10">,</span><span class="S0">
5818 </span><span class="S5">void</span><span class="S0"> </span>
5819 <span class="S10">*</span>pointer<span class="S10">)</span><span class="S0"> </span>
5820 <span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5821 <span class="S10">};</span><br />
5822 </div>
5825 The return values from PropertySet and WordListSet are used to indicate whether the change requires
5826 performing lexing or folding over any of the document. It is the position at which to restart lexing and folding or -1
5827 if the change does not require any extra work on the document.
5828 A simple approach is to return 0 if there is any possibility that a change requires lexing the document again while an
5829 optimisation could be to remember where a setting first affects the document and return that position.
5830 </p>
5832 <p><code>Release</code> is called to destroy the lexer object.</p>
5834 <p><code>PrivateCall</code> allows for direct communication between the
5835 application and a lexer. An example would be where an application
5836 maintains a single large data structure containing symbolic information
5837 about system headers (like Windows.h) and provides this to the lexer
5838 where it can be applied to each document. This avoids the costs of
5839 constructing the system header information for each document. This is
5840 invoked with the <code>SCI_PRIVATELEXERCALL</code> API.</p>
5842 <p><code>Fold</code> is called with the exact range that needs folding.
5843 Previously, lexers were called with a range that started one line before the range that
5844 needs to be folded as this allowed fixing up the last line from the previous folding.
5845 The new approach allows the lexer to decide whether to backtrack or to handle this
5846 more efficiently.</p>
5848 <h4>IDocument</h4>
5850 <div class="highlighted">
5851 <span class="S5">class</span><span class="S0"> </span>IDocument
5852 <span class="S0"> </span><span class="S10">{</span><br />
5853 <span class="S5">public</span><span class="S10">:</span><br />
5854 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5855 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
5856 <span class="S0"> </span>Version<span class="S10">()</span><span class="S0"> </span>
5857 <span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
5858 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5859 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5860 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
5861 <span class="S0"> </span>SetErrorStatus<span class="S10">(</span><span class="S5">int</span>
5862 <span class="S0"> </span>status<span class="S10">)</span>
5863 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
5864 <span class="S4">0</span><span class="S10">;</span><br />
5865 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5866 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
5867 <span class="S0"> </span>Length<span class="S10">()</span><span class="S0"> </span>
5868 <span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
5869 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5870 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5871 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
5872 <span class="S0"> </span>GetCharRange<span class="S10">(</span><span class="S5">char</span>
5873 <span class="S0"> </span><span class="S10">*</span>buffer<span class="S10">,</span>
5874 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>
5875 position<span class="S10">,</span><span class="S0"> </span>
5876 <span class="S5">int</span><span class="S0"> </span>lengthRetrieve<span class="S10">)</span>
5877 <span class="S0"> </span><span class="S5">const</span>
5878 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
5879 <span class="S4">0</span><span class="S10">;</span><br />
5880 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5881 <span class="S0"> </span><span class="S5">char</span><span class="S0"> </span>SCI_METHOD
5882 <span class="S0"> </span>StyleAt<span class="S10">(</span><span class="S5">int</span>
5883 <span class="S0"> </span>position<span class="S10">)</span><span class="S0"> </span>
5884 <span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
5885 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5886 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5887 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
5888 <span class="S0"> </span>LineFromPosition<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>position<span class="S10">)</span>
5889 <span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
5890 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5891 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span>
5892 <span class="S5">int</span><span class="S0"> </span>SCI_METHOD
5893 <span class="S0"> </span>LineStart<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>line<span class="S10">)</span>
5894 <span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
5895 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5896 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span>
5897 <span class="S5">int</span><span class="S0"> </span>SCI_METHOD
5898 <span class="S0"> </span>GetLevel<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>line<span class="S10">)</span>
5899 <span class="S0"> </span>
5900 <span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
5901 <span class="S4">0</span><span class="S10">;</span><br />
5902 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span>
5903 <span class="S5">int</span><span class="S0"> </span>SCI_METHOD
5904 <span class="S0"> </span>SetLevel<span class="S10">(</span><span class="S5">int</span>
5905 <span class="S0"> </span>line<span class="S10">,</span><span class="S0"> </span>
5906 <span class="S5">int</span><span class="S0"> </span>level<span class="S10">)</span>
5907 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
5908 <span class="S4">0</span><span class="S10">;</span><br />
5909 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5910 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
5911 <span class="S0"> </span>GetLineState<span class="S10">(</span><span class="S5">int</span>
5912 <span class="S0"> </span>line<span class="S10">)</span>
5913 <span class="S0"> </span><span class="S5">const</span><span class="S0"> </span>
5914 <span class="S10">=</span><span class="S0"> </span><span class="S4">0</span>
5915 <span class="S10">;</span><br />
5916 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5917 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
5918 <span class="S0"> </span>SetLineState<span class="S10">(</span><span class="S5">int</span>
5919 <span class="S0"> </span>line<span class="S10">,</span>
5920 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>state<span class="S10">)</span>
5921 <span class="S0"> </span><span class="S10">=</span>
5922 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5923 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5924 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
5925 <span class="S0"> </span>StartStyling<span class="S10">(</span><span class="S5">int</span>
5926 <span class="S0"> </span>position<span class="S10">,</span>
5927 <span class="S0"> </span><span class="S5">char</span><span class="S0"> </span>mask<span class="S10">)</span>
5928 <span class="S0"> </span><span class="S10">=</span>
5929 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5930 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">bool</span>
5931 <span class="S0"> </span>SCI_METHOD
5932 <span class="S0"> </span>SetStyleFor<span class="S10">(</span><span class="S5">int</span>
5933 <span class="S0"> </span>length<span class="S10">,</span>
5934 <span class="S0"> </span><span class="S5">char</span><span class="S0"> </span>style<span class="S10">)</span>
5935 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span>
5936 <span class="S10">;</span><br />
5937 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5938 <span class="S0"> </span><span class="S5">bool</span><span class="S0"> </span>SCI_METHOD
5939 <span class="S0"> </span>SetStyles<span class="S10">(</span><span class="S5">int</span>
5940 <span class="S0"> </span>length<span class="S10">,</span><span class="S0"> </span>
5941 <span class="S5">const</span><span class="S0"> </span><span class="S5">char</span>
5942 <span class="S0"> </span><span class="S10">*</span>styles<span class="S10">)</span>
5943 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
5944 <span class="S4">0</span><span class="S10">;</span><br />
5945 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">void</span>
5946 <span class="S0"> </span>SCI_METHOD
5947 <span class="S0"> </span>DecorationSetCurrentIndicator<span class="S10">(</span><span class="S5">int</span>
5948 <span class="S0"> </span>indicator<span class="S10">)</span>
5949 <span class="S0"> </span><span class="S10">=</span>
5950 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5951 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5952 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
5953 <span class="S0"> </span>DecorationFillRange<span class="S10">(</span><span class="S5">int</span>
5954 <span class="S0"> </span>position<span class="S10">,</span>
5955 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>value<span class="S10">,</span>
5956 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>fillLength<span class="S10">)</span>
5957 <span class="S0">
5958 </span><span class="S10">=</span><span class="S0"> </span>
5959 <span class="S4">0</span><span class="S10">;</span><br />
5960 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5961 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
5962 <span class="S0"> </span>ChangeLexerState<span class="S10">(</span><span class="S5">int</span>
5963 <span class="S0"> </span>start<span class="S10">,</span>
5964 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>end<span class="S10">)</span>
5965 <span class="S0"> </span><span class="S10">=</span>
5966 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5967 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5968 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
5969 <span class="S0"> </span>CodePage<span class="S10">()</span><span class="S0">
5970 </span><span class="S5">const</span><span class="S0"> </span>
5971 <span class="S10">=</span><span class="S0"> </span><span class="S4">0</span>
5972 <span class="S10">;</span><br />
5973 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">bool</span>
5974 <span class="S0"> </span>SCI_METHOD
5975 <span class="S0"> </span>IsDBCSLeadByte<span class="S10">(</span><span class="S5">char</span>
5976 <span class="S0"> </span>ch<span class="S10">)</span>
5977 <span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
5978 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5979 <span class="S10">};</span><br />
5980 </div>
5982 <p>Scintilla tries to minimize the consequences of modifying text to
5983 only relex and redraw the line of the change where possible. Lexer
5984 objects contain their own private extra state which can affect later
5985 lines. For example, if the C++ lexer is greying out inactive code
5986 segments then changing the statement <code>#define BEOS 0</code> to <code>#define
5987 BEOS 1</code> may require restyling and redisplaying later parts of the
5988 document. The lexer can call <code>ChangeLexerState</code> to signal to
5989 the document that it should relex and display more.</p>
5991 <p><code>SetErrorStatus</code> is used to notify the document of
5992 exceptions. Exceptions should not be thrown over build boundaries as the
5993 two sides may be built with different compilers or incompatible
5994 exception options.</p>
5996 <p>The <code>ILexer</code> and <code>IDocument</code> interfaces may be
5997 expanded in the future with extended versions (<code>ILexer2</code>...).
5998 The <code>Version</code> method indicates which interface is
5999 implemented and thus which methods may be called.</p>
6001 <h2 id="Notifications">Notifications</h2>
6003 <p>Notifications are sent (fired) from the Scintilla control to its container when an event has
6004 occurred that may interest the container. Notifications are sent using the
6005 <code>WM_NOTIFY</code> message on Windows and the "notify" signal on GTK+. The container is
6006 passed a <code>SCNotification</code> structure containing information about the event.</p>
6007 <pre id="SCNotification">
6008 struct NotifyHeader { // This matches the Win32 NMHDR structure
6009 void *hwndFrom; // environment specific window handle/pointer
6010 uptr_t idFrom; // CtrlID of the window issuing the notification
6011 unsigned int code; // The SCN_* notification code
6014 struct SCNotification {
6015 struct Sci_NotifyHeader nmhdr;
6016 int position;
6017 /* SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_MARGINCLICK, */
6018 /* SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, SCN_CALLTIPCLICK, */
6019 /* SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK, */
6020 /* SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */
6021 /* SCN_USERLISTSELECTION, SCN_AUTOCSELECTION */
6023 int ch; /* SCN_CHARADDED, SCN_KEY */
6024 int modifiers;
6025 /* SCN_KEY, SCN_DOUBLECLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, */
6026 /* SCN_HOTSPOTRELEASECLICK, SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */
6028 int modificationType; /* SCN_MODIFIED */
6029 const char *text;
6030 /* SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION, SCN_URIDROPPED */
6032 int length; /* SCN_MODIFIED */
6033 int linesAdded; /* SCN_MODIFIED */
6034 int message; /* SCN_MACRORECORD */
6035 uptr_t wParam; /* SCN_MACRORECORD */
6036 sptr_t lParam; /* SCN_MACRORECORD */
6037 int line; /* SCN_MODIFIED */
6038 int foldLevelNow; /* SCN_MODIFIED */
6039 int foldLevelPrev; /* SCN_MODIFIED */
6040 int margin; /* SCN_MARGINCLICK */
6041 int listType; /* SCN_USERLISTSELECTION */
6042 int x; /* SCN_DWELLSTART, SCN_DWELLEND */
6043 int y; /* SCN_DWELLSTART, SCN_DWELLEND */
6044 int token; /* SCN_MODIFIED with SC_MOD_CONTAINER */
6045 int annotationLinesAdded; /* SCN_MODIFIED with SC_MOD_CHANGEANNOTATION */
6046 int updated; /* SCN_UPDATEUI */
6048 </pre>
6050 <p>The notification messages that your container can choose to handle and the messages
6051 associated with them are:</p>
6052 <code><a class="message" href="#SCN_STYLENEEDED">SCN_STYLENEEDED</a><br />
6053 <a class="message" href="#SCN_CHARADDED">SCN_CHARADDED</a><br />
6054 <a class="message" href="#SCN_SAVEPOINTREACHED">SCN_SAVEPOINTREACHED</a><br />
6055 <a class="message" href="#SCN_SAVEPOINTLEFT">SCN_SAVEPOINTLEFT</a><br />
6056 <a class="message" href="#SCN_MODIFYATTEMPTRO">SCN_MODIFYATTEMPTRO</a><br />
6057 <a class="message" href="#SCN_KEY">SCN_KEY</a><br />
6058 <a class="message" href="#SCN_DOUBLECLICK">SCN_DOUBLECLICK</a><br />
6059 <a class="message" href="#SCN_UPDATEUI">SCN_UPDATEUI</a><br />
6060 <a class="message" href="#SCN_MODIFIED">SCN_MODIFIED</a><br />
6061 <a class="message" href="#SCN_MACRORECORD">SCN_MACRORECORD</a><br />
6062 <a class="message" href="#SCN_MARGINCLICK">SCN_MARGINCLICK</a><br />
6063 <a class="message" href="#SCN_NEEDSHOWN">SCN_NEEDSHOWN</a><br />
6064 <a class="message" href="#SCN_PAINTED">SCN_PAINTED</a><br />
6065 <a class="message" href="#SCN_USERLISTSELECTION">SCN_USERLISTSELECTION</a><br />
6066 <a class="message" href="#SCN_URIDROPPED">SCN_URIDROPPED</a><br />
6067 <a class="message" href="#SCN_DWELLSTART">SCN_DWELLSTART</a><br />
6068 <a class="message" href="#SCN_DWELLEND">SCN_DWELLEND</a><br />
6069 <a class="message" href="#SCN_ZOOM">SCN_ZOOM</a><br />
6070 <a class="message" href="#SCN_HOTSPOTCLICK">SCN_HOTSPOTCLICK</a><br />
6071 <a class="message" href="#SCN_HOTSPOTDOUBLECLICK">SCN_HOTSPOTDOUBLECLICK</a><br />
6072 <a class="message" href="#SCN_HOTSPOTRELEASECLICK">SCN_HOTSPOTRELEASECLICK</a><br />
6073 <a class="message" href="#SCN_INDICATORCLICK">SCN_INDICATORCLICK</a><br />
6074 <a class="message" href="#SCN_INDICATORRELEASE">SCN_INDICATORRELEASE</a><br />
6075 <a class="message" href="#SCN_CALLTIPCLICK">SCN_CALLTIPCLICK</a><br />
6076 <a class="message" href="#SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</a><br />
6077 <a class="message" href="#SCN_AUTOCCANCELLED">SCN_AUTOCCANCELLED</a><br />
6078 <a class="message" href="#SCN_AUTOCCHARDELETED">SCN_AUTOCCHARDELETED</a><br />
6079 </code>
6081 <p>The following <code>SCI_*</code> messages are associated with these notifications:</p>
6082 <code><a class="message" href="#SCI_SETMODEVENTMASK">SCI_SETMODEVENTMASK(int eventMask)</a><br />
6083 <a class="message" href="#SCI_GETMODEVENTMASK">SCI_GETMODEVENTMASK</a><br />
6084 <a class="message" href="#SCI_SETMOUSEDWELLTIME">SCI_SETMOUSEDWELLTIME(int milliseconds)</a><br />
6085 <a class="message" href="#SCI_GETMOUSEDWELLTIME">SCI_GETMOUSEDWELLTIME</a><br />
6086 <a class="message" href="#SCI_SETIDENTIFIER">SCI_SETIDENTIFIER(int identifier)</a><br />
6087 <a class="message" href="#SCI_GETIDENTIFIER">SCI_GETIDENTIFIER</a><br />
6088 </code>
6090 <p>The following additional notifications are sent using the <code>WM_COMMAND</code> message on
6091 Windows and the "Command" signal on GTK+. This emulates the Windows Edit control. Only the lower
6092 16 bits of the control's ID is passed in these notifications.</p>
6093 <code><a class="message" href="#SCEN_CHANGE">SCEN_CHANGE</a><br />
6094 <a class="message" href="#SCEN_SETFOCUS">SCEN_SETFOCUS</a><br />
6095 <a class="message" href="#SCEN_KILLFOCUS">SCEN_KILLFOCUS</a><br />
6096 </code>
6098 <p><b id="SCI_SETIDENTIFIER">SCI_SETIDENTIFIER(int identifier)</b><br />
6099 <b id="SCI_GETIDENTIFIER">SCI_GETIDENTIFIER</b><br />
6100 These two messages set and get the identifier of the Scintilla instance which is included in notifications as the
6101 <code>idFrom</code> field.
6102 When an application creates multiple Scintilla widgets, this allows the source of each notification to be found.
6103 On Windows, this value is initialised in the <code>CreateWindow</code> call and stored as the
6104 <code>GWLP_ID</code> attribute of the window.
6105 The value should be small, preferrably less than 16 bits,
6106 rather than a pointer as some of the functions will only transmit 16 or 32 bits.
6107 </p>
6109 <p><b id="SCN_STYLENEEDED">SCN_STYLENEEDED</b><br />
6110 If you used <code><a class="message"
6111 href="#SCI_SETLEXER">SCI_SETLEXER</a>(SCLEX_CONTAINER)</code> to make the container act as the
6112 lexer, you will receive this notification when Scintilla is about to display or print text that
6113 requires styling. You are required to style the text from the line that contains the position
6114 returned by <a class="message" href="#SCI_GETENDSTYLED"><code>SCI_GETENDSTYLED</code></a> up to
6115 the position passed in <code>SCNotification.position</code>. Symbolically, you need code of the
6116 form:</p>
6117 <pre>
6118 startPos = <a class="message" href="#SCI_GETENDSTYLED">SCI_GETENDSTYLED</a>()
6119 lineNumber = <a class="message"
6120 href="#SCI_LINEFROMPOSITION">SCI_LINEFROMPOSITION</a>(startPos);
6121 startPos = <a class="message"
6122 href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE</a>(lineNumber);
6123 MyStyleRoutine(startPos, SCNotification.position);
6124 </pre>
6126 <p><b id="SCN_CHARADDED">SCN_CHARADDED</b><br />
6127 This is sent when the user types an ordinary text character (as opposed to a command
6128 character) that is entered into the text. The container can use this to decide to display a <a
6129 class="jump" href="#CallTips">call tip</a> or an <a class="jump" href="#Autocompletion">auto
6130 completion list</a>. The character is in <code>SCNotification.ch</code>.
6131 This notification is sent before the character has been styled so processing that depends on
6132 styling should instead be performed in the SCN_UPDATEUI notification.</p>
6134 <p><b id="SCN_SAVEPOINTREACHED">SCN_SAVEPOINTREACHED</b><br />
6135 <b id="SCN_SAVEPOINTLEFT">SCN_SAVEPOINTLEFT</b><br />
6136 Sent to the container when the save point is entered or left, allowing the container to
6137 display a "document dirty" indicator and change its menus.<br />
6138 See also: <a class="message" href="#SCI_SETSAVEPOINT"><code>SCI_SETSAVEPOINT</code></a>, <a
6139 class="message" href="#SCI_GETMODIFY"><code>SCI_GETMODIFY</code></a></p>
6141 <p><b id="SCN_MODIFYATTEMPTRO">SCN_MODIFYATTEMPTRO</b><br />
6142 When in read-only mode, this notification is sent to the container if the user tries to change
6143 the text. This can be used to check the document out of a version control system. You can set
6144 the read-only state of a document with <code><a class="message"
6145 href="#SCI_SETREADONLY">SCI_SETREADONLY</a></code>.</p>
6147 <p><b id="SCN_KEY">SCN_KEY</b><br />
6148 Reports all keys pressed but not consumed by Scintilla. Used on GTK+ because of
6149 some problems with keyboard focus and is not sent by the Windows version. <code>SCNotification.ch</code> holds the key code and
6150 <code>SCNotification.modifiers</code> holds the modifiers. This notification is sent if the
6151 modifiers include <code>SCMOD_ALT</code> or <code>SCMOD_CTRL</code> and the key code is less
6152 than 256.</p>
6154 <p><b id="SCN_DOUBLECLICK">SCN_DOUBLECLICK</b><br />
6155 The mouse button was double clicked in editor. The <code>position</code> field is set to the text position of the
6156 double click, the <code>line</code> field is set to the line of the double click, and
6157 the <code>modifiers</code> field is set to the key modifiers
6158 held down in a similar manner to <a class="message" href="#SCN_KEY">SCN_KEY</a>.</p>
6160 <p><b id="SCN_UPDATEUI">SCN_UPDATEUI</b><br />
6161 Either the text or styling of the document has changed or the selection range or scroll position has changed.
6162 Now would be a good time to update any container UI elements that depend on document or view state.
6163 The <code>updated</code> field is set to the bit set of things changed since the previous notification.</p>
6164 <table cellpadding="1" cellspacing="2" border="0" summary="Modify notification type flags">
6165 <tbody>
6166 <tr>
6167 <th align="left">Symbol</th>
6169 <th>Value</th>
6171 <th align="left">Meaning</th>
6173 </tr>
6174 </tbody>
6176 <tbody valign="top">
6177 <tr>
6178 <td align="left"><code>SC_UPDATE_CONTENT</code></td>
6180 <td align="center">0x01</td>
6182 <td>Contents, styling or markers have been changed.</td>
6184 </tr>
6186 <tr>
6187 <td align="left"><code>SC_UPDATE_SELECTION</code></td>
6189 <td align="center">0x02</td>
6191 <td>Selection has been changed.</td>
6193 </tr>
6195 <tr>
6196 <td align="left"><code>SC_UPDATE_V_SCROLL</code></td>
6198 <td align="center">0x04</td>
6200 <td>Scrolled vertically.</td>
6202 </tr>
6204 <tr>
6205 <td align="left"><code>SC_UPDATE_H_SCROLL</code></td>
6207 <td align="center">0x08</td>
6209 <td>Scrolled horizontally.</td>
6211 </tr>
6212 </tbody>
6213 </table>
6215 <p><b id="SCN_MODIFIED">SCN_MODIFIED</b><br />
6216 This notification is sent when the text or styling of the document changes or is about to
6217 change. You can set a mask for the notifications that are sent to the container with <a
6218 class="message" href="#SCI_SETMODEVENTMASK"><code>SCI_SETMODEVENTMASK</code></a>. The
6219 notification structure contains information about what changed, how the change occurred and
6220 whether this changed the number of lines in the document. No modifications may be performed
6221 while in a <code>SCN_MODIFIED</code> event. The <code>SCNotification</code> fields used
6222 are:</p>
6224 <table cellpadding="1" cellspacing="2" border="0" summary="Modify notification types">
6225 <tbody>
6226 <tr>
6227 <th align="left">Field</th>
6229 <th align="left">Usage</th>
6230 </tr>
6231 </tbody>
6233 <tbody valign="top">
6234 <tr>
6235 <td align="left"><code>modificationType</code></td>
6237 <td align="left">A set of flags that identify the change(s) made. See the next
6238 table.</td>
6239 </tr>
6241 <tr>
6242 <td align="left"><code>position</code></td>
6244 <td align="left">Start position of a text or styling change. Set to 0 if not used.</td>
6245 </tr>
6247 <tr>
6248 <td align="left"><code>length</code></td>
6250 <td align="left">Length of the change in cells or characters when the text or styling
6251 changes. Set to 0 if not used.</td>
6252 </tr>
6254 <tr>
6255 <td align="left"><code>linesAdded</code></td>
6257 <td align="left">Number of added lines. If negative, the number of deleted lines. Set to
6258 0 if not used or no lines added or deleted.</td>
6259 </tr>
6261 <tr>
6262 <td align="left"><code>text</code></td>
6264 <td align="left">Valid for text changes, not for style changes. If we are collecting undo
6265 information this holds a pointer to the text that is handed to the Undo system, otherwise
6266 it is zero. For user performed SC_MOD_BEFOREDELETE the text field is 0 and
6267 for user performed SC_MOD_BEFOREINSERT the text field points to an array of cells,
6268 not bytes and the length is the number of cells.</td>
6269 </tr>
6271 <tr>
6272 <td align="left"><code>line</code></td>
6274 <td align="left">The line number at which a fold level or marker change occurred. This is
6275 0 if unused and may be -1 if more than one line changed.</td>
6276 </tr>
6278 <tr>
6279 <td align="left"><code>foldLevelNow</code></td>
6281 <td align="left">The new fold level applied to the line or 0 if this field is
6282 unused.</td>
6283 </tr>
6285 <tr>
6286 <td align="left"><code>foldLevelPrev</code></td>
6288 <td align="left">The previous folding level of the line or 0 if this field is
6289 unused.</td>
6290 </tr>
6291 </tbody>
6292 </table>
6294 <p>The <code>SCNotification.modificationType</code> field has bits set to tell you what has
6295 been done. The <code>SC_MOD_*</code> bits correspond to actions. The
6296 <code>SC_PERFORMED_*</code> bits tell you if the action was done by the user, or the result of
6297 Undo or Redo of a previous action.</p>
6299 <table cellpadding="1" cellspacing="2" border="0" summary="Modify notification type flags">
6300 <tbody>
6301 <tr>
6302 <th align="left">Symbol</th>
6304 <th>Value</th>
6306 <th align="left">Meaning</th>
6308 <th align="left">SCNotification fields</th>
6309 </tr>
6310 </tbody>
6312 <tbody valign="top">
6313 <tr>
6314 <td align="left"><code>SC_MOD_INSERTTEXT</code></td>
6316 <td align="center">0x01</td>
6318 <td>Text has been inserted into the document.</td>
6320 <td><code>position, length, text, linesAdded</code></td>
6321 </tr>
6323 <tr>
6324 <td align="left"><code>SC_MOD_DELETETEXT</code></td>
6326 <td align="center">0x02</td>
6328 <td>Text has been removed from the document.</td>
6330 <td><code>position, length, text, linesAdded</code></td>
6331 </tr>
6333 <tr>
6334 <td align="left"><code>SC_MOD_CHANGESTYLE</code></td>
6336 <td align="center">0x04</td>
6338 <td>A style change has occurred.</td>
6340 <td><code>position, length</code></td>
6341 </tr>
6343 <tr>
6344 <td align="left"><code>SC_MOD_CHANGEFOLD</code></td>
6346 <td align="center">0x08</td>
6348 <td>A folding change has occurred.</td>
6350 <td><code>line, foldLevelNow, foldLevelPrev</code></td>
6351 </tr>
6353 <tr>
6354 <td align="left"><code>SC_PERFORMED_USER</code></td>
6356 <td align="center">0x10</td>
6358 <td>Information: the operation was done by the user.</td>
6360 <td>None</td>
6361 </tr>
6363 <tr>
6364 <td align="left"><code>SC_PERFORMED_UNDO</code></td>
6366 <td align="center">0x20</td>
6368 <td>Information: this was the result of an Undo.</td>
6370 <td>None</td>
6371 </tr>
6373 <tr>
6374 <td align="left"><code>SC_PERFORMED_REDO</code></td>
6376 <td align="center">0x40</td>
6378 <td>Information: this was the result of a Redo.</td>
6380 <td>None</td>
6381 </tr>
6383 <tr>
6384 <td align="left"><code>SC_MULTISTEPUNDOREDO</code></td>
6386 <td align="center">0x80</td>
6388 <td>This is part of a multi-step Undo or Redo transaction.</td>
6390 <td>None</td>
6391 </tr>
6393 <tr>
6394 <td align="left"><code>SC_LASTSTEPINUNDOREDO</code></td>
6396 <td align="center">0x100</td>
6398 <td>This is the final step in an Undo or Redo transaction.</td>
6400 <td>None</td>
6401 </tr>
6403 <tr>
6404 <td align="left"><code>SC_MOD_CHANGEMARKER</code></td>
6406 <td align="center">0x200</td>
6408 <td>One or more markers has changed in a line.</td>
6410 <td><code>line</code></td>
6411 </tr>
6413 <tr>
6414 <td align="left"><code>SC_MOD_BEFOREINSERT</code></td>
6416 <td align="center">0x400</td>
6418 <td>Text is about to be inserted into the document.</td>
6420 <td><code>position, if performed by user then text in cells, length in cells</code></td>
6421 </tr>
6423 <tr>
6424 <td align="left"><code>SC_MOD_BEFOREDELETE</code></td>
6426 <td align="center">0x800</td>
6428 <td>Text is about to be deleted from the document.</td>
6430 <td><code>position, length</code></td>
6431 </tr>
6433 <tr>
6434 <td align="left"><code>SC_MOD_CHANGEINDICATOR</code></td>
6436 <td align="center">0x4000</td>
6438 <td>An indicator has been added or removed from a range of text.</td>
6440 <td><code>position, length</code></td>
6441 </tr>
6443 <tr>
6444 <td align="left"><code id="SC_MOD_CHANGELINESTATE">SC_MOD_CHANGELINESTATE</code></td>
6446 <td align="center">0x8000</td>
6448 <td>A line state has changed because <a class="message" href="#SCI_SETLINESTATE">SCI_SETLINESTATE</a>
6449 was called.</td>
6451 <td><code>line</code></td>
6452 </tr>
6454 <tr>
6455 <td align="left"><code id="SC_MOD_LEXERSTATE">SC_MOD_LEXERSTATE</code></td>
6457 <td align="center">0x80000</td>
6459 <td>The internal state of a lexer has changed over a range.</td>
6461 <td><code>position, length</code></td>
6462 </tr>
6464 <tr>
6465 <td align="left"><code id="SC_MOD_CHANGEMARGIN">SC_MOD_CHANGEMARGIN</code></td>
6467 <td align="center">0x10000</td>
6469 <td>A text margin has changed.</td>
6471 <td><code>line</code></td>
6472 </tr>
6474 <tr>
6475 <td align="left"><code id="SC_MOD_CHANGEANNOTATION">SC_MOD_CHANGEANNOTATION</code></td>
6477 <td align="center">0x20000</td>
6479 <td>An annotation has changed.</td>
6481 <td><code>line</code></td>
6482 </tr>
6484 <tr>
6485 <td align="left"><code>SC_MULTILINEUNDOREDO</code></td>
6487 <td align="center">0x1000</td>
6489 <td>This is part of an Undo or Redo with multi-line changes.</td>
6491 <td>None</td>
6492 </tr>
6494 <tr>
6495 <td align="left"><code>SC_STARTACTION</code></td>
6497 <td align="center">0x2000</td>
6499 <td>This is set on a SC_PERFORMED_USER action when it is the
6500 first or only step in an undo transaction. This can be used to integrate the Scintilla
6501 undo stack with an undo stack in the container application by adding a Scintilla
6502 action to the container's stack for the currently opened container transaction or
6503 to open a new container transaction if there is no open container transaction.
6504 </td>
6506 <td>None</td>
6507 </tr>
6509 <tr>
6510 <td align="left"><code id="SC_MOD_CONTAINER">SC_MOD_CONTAINER</code></td>
6512 <td align="center">0x40000</td>
6514 <td>This is set on for actions that the container stored into the undo stack with
6515 <a class="message" href="#SCI_ADDUNDOACTION"><code>SCI_ADDUNDOACTION</code></a>.
6516 </td>
6518 <td>token</td>
6519 </tr>
6521 <tr>
6522 <td align="left"><code>SC_MODEVENTMASKALL</code></td>
6524 <td align="center">0x7FFFF</td>
6526 <td>This is a mask for all valid flags. This is the default mask state set by <a
6527 class="message" href="#SCI_SETMODEVENTMASK"><code>SCI_SETMODEVENTMASK</code></a>.</td>
6529 <td>None</td>
6530 </tr>
6531 </tbody>
6532 </table>
6534 <p><b id="SCEN_CHANGE">SCEN_CHANGE</b><br />
6535 <code>SCEN_CHANGE</code> (768) is fired when the text (not the style) of the document changes.
6536 This notification is sent using the <code>WM_COMMAND</code> message on Windows and the
6537 "Command" signal on GTK+ as this is the behavior of the standard Edit control
6538 (<code>SCEN_CHANGE</code> has the same value as the Windows Edit control
6539 <code>EN_CHANGE</code>). No other information is sent. If you need more detailed information
6540 use <a class="message" href="#SCN_MODIFIED"><code>SCN_MODIFIED</code></a>. You can filter the
6541 types of changes you are notified about with <a class="message"
6542 href="#SCI_SETMODEVENTMASK"><code>SCI_SETMODEVENTMASK</code></a>.</p>
6544 <p><b id="SCI_SETMODEVENTMASK">SCI_SETMODEVENTMASK(int eventMask)</b><br />
6545 <b id="SCI_GETMODEVENTMASK">SCI_GETMODEVENTMASK</b><br />
6546 These messages set and get an event mask that determines which document change events are
6547 notified to the container with <a class="message"
6548 href="#SCN_MODIFIED"><code>SCN_MODIFIED</code></a> and <a class="message"
6549 href="#SCEN_CHANGE"><code>SCEN_CHANGE</code></a>. For example, a container may decide to see
6550 only notifications about changes to text and not styling changes by calling
6551 <code>SCI_SETMODEVENTMASK(SC_MOD_INSERTTEXT|SC_MOD_DELETETEXT)</code>.</p>
6553 <p>The possible notification types are the same as the <code>modificationType</code> bit flags
6554 used by <code>SCN_MODIFIED</code>: <code>SC_MOD_INSERTTEXT</code>,
6555 <code>SC_MOD_DELETETEXT</code>, <code>SC_MOD_CHANGESTYLE</code>,
6556 <code>SC_MOD_CHANGEFOLD</code>, <code>SC_PERFORMED_USER</code>, <code>SC_PERFORMED_UNDO</code>,
6557 <code>SC_PERFORMED_REDO</code>, <code>SC_MULTISTEPUNDOREDO</code>,
6558 <code>SC_LASTSTEPINUNDOREDO</code>, <code>SC_MOD_CHANGEMARKER</code>,
6559 <code>SC_MOD_BEFOREINSERT</code>, <code>SC_MOD_BEFOREDELETE</code>,
6560 <code>SC_MULTILINEUNDOREDO</code>, and <code>SC_MODEVENTMASKALL</code>.</p>
6562 <p><b id="SCEN_SETFOCUS">SCEN_SETFOCUS</b><br />
6563 <b id="SCEN_KILLFOCUS">SCEN_KILLFOCUS</b><br />
6564 <code>SCEN_SETFOCUS</code> (512) is fired when Scintilla receives focus and
6565 <code>SCEN_KILLFOCUS</code> (256) when it loses focus. These notifications are sent using the
6566 <code>WM_COMMAND</code> message on Windows and the "Command" signal on GTK+ as this is the
6567 behavior of the standard Edit control. Unfortunately, these codes do not match the Windows Edit
6568 notification codes <code>EN_SETFOCUS</code> (256) and <code>EN_KILLFOCUS</code> (512). It is
6569 now too late to change the Scintilla codes as clients depend on the current values.</p>
6571 <p><b id="SCN_MACRORECORD">SCN_MACRORECORD</b><br />
6572 The <code><a class="message" href="#SCI_STARTRECORD">SCI_STARTRECORD</a></code> and <a
6573 class="message" href="#SCI_STOPRECORD"><code>SCI_STOPRECORD</code></a> messages enable and
6574 disable macro recording. When enabled, each time a recordable change occurs, the
6575 <code>SCN_MACRORECORD</code> notification is sent to the container. It is up to the container
6576 to record the action. To see the complete list of <code>SCI_*</code> messages that are
6577 recordable, search the Scintilla source <code>Editor.cxx</code> for
6578 <code>Editor::NotifyMacroRecord</code>. The fields of <code>SCNotification</code> set in this
6579 notification are:</p>
6581 <table cellpadding="1" cellspacing="2" border="0" summary="Macro record notification data">
6582 <tbody>
6583 <tr>
6584 <th align="left">Field</th>
6586 <th align="left">Usage</th>
6587 </tr>
6588 </tbody>
6590 <tbody valign="top">
6591 <tr>
6592 <td align="left"><code>message</code></td>
6594 <td align="left">The <code>SCI_*</code> message that caused the notification.</td>
6595 </tr>
6597 <tr>
6598 <td align="left"><code>wParam</code></td>
6600 <td align="left">The value of <code>wParam</code> in the <code>SCI_*</code> message.</td>
6601 </tr>
6603 <tr>
6604 <td align="left"><code>lParam</code></td>
6606 <td align="left">The value of <code>lParam</code> in the <code>SCI_*</code> message.</td>
6607 </tr>
6608 </tbody>
6609 </table>
6611 <p><b id="SCN_MARGINCLICK">SCN_MARGINCLICK</b><br />
6612 This notification tells the container that the mouse was clicked inside a <a class="jump"
6613 href="#Margins">margin</a> that was marked as sensitive (see <a class="message"
6614 href="#SCI_SETMARGINSENSITIVEN"><code>SCI_SETMARGINSENSITIVEN</code></a>). This can be used to
6615 perform folding or to place breakpoints. The following <code>SCNotification</code> fields are
6616 used:</p>
6618 <table cellpadding="1" cellspacing="2" border="0" summary="Margin click notification">
6619 <tbody>
6620 <tr>
6621 <th align="left">Field</th>
6623 <th align="left">Usage</th>
6624 </tr>
6625 </tbody>
6627 <tbody valign="top">
6628 <tr>
6629 <td align="left"><code>modifiers</code></td>
6631 <td align="left">The appropriate combination of <code>SCI_SHIFT</code>,
6632 <code>SCI_CTRL</code> and <code>SCI_ALT</code> to indicate the keys that were held down
6633 at the time of the margin click.</td>
6634 </tr>
6636 <tr>
6637 <td align="left"><code>position</code></td>
6639 <td align="left">The position of the start of the line in the document that corresponds
6640 to the margin click.</td>
6641 </tr>
6643 <tr>
6644 <td align="left"><code>margin</code></td>
6646 <td align="left">The margin number that was clicked.</td>
6647 </tr>
6648 </tbody>
6649 </table>
6651 <p><b id="SCN_NEEDSHOWN">SCN_NEEDSHOWN</b><br />
6652 Scintilla has determined that a range of lines that is currently invisible should be made
6653 visible. An example of where this may be needed is if the end of line of a contracted fold
6654 point is deleted. This message is sent to the container in case it wants to make the line
6655 visible in some unusual way such as making the whole document visible. Most containers will
6656 just ensure each line in the range is visible by calling <a class="message"
6657 href="#SCI_ENSUREVISIBLE"><code>SCI_ENSUREVISIBLE</code></a>. The <code>position</code> and
6658 <code>length</code> fields of <code>SCNotification</code> indicate the range of the document
6659 that should be made visible. The container code will be similar to the following code
6660 skeleton:</p>
6661 <pre>
6662 firstLine = SCI_LINEFROMPOSITION(scn.position)
6663 lastLine = SCI_LINEFROMPOSITION(scn.position+scn.length-1)
6664 for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next
6665 </pre>
6667 <p><b id="SCN_PAINTED">SCN_PAINTED</b><br />
6668 Painting has just been done. Useful when you want to update some other widgets based on a
6669 change in Scintilla, but want to have the paint occur first to appear more responsive. There is
6670 no other information in <code>SCNotification</code>.</p>
6672 <p><b id="SCN_USERLISTSELECTION">SCN_USERLISTSELECTION</b><br />
6673 The user has selected an item in a <a class="jump" href="#UserLists">user list</a>. The
6674 <code>SCNotification</code> fields used are:</p>
6676 <table cellpadding="1" cellspacing="2" border="0" summary="User list notification">
6677 <tbody>
6678 <tr>
6679 <th align="left">Field</th>
6681 <th align="left">Usage</th>
6682 </tr>
6683 </tbody>
6685 <tbody valign="top">
6686 <tr>
6687 <td align="left"><code>listType</code></td>
6689 <td align="left">This is set to the <code>listType</code> parameter from the <a
6690 class="message" href="#SCI_USERLISTSHOW"><code>SCI_USERLISTSHOW</code></a> message that
6691 initiated the list.</td>
6692 </tr>
6694 <tr>
6695 <td align="left"><code>text</code></td>
6697 <td align="left">The text of the selection.</td>
6698 </tr>
6700 <tr>
6701 <td align="left"><code>position</code></td>
6703 <td align="left">The position the list was displayed at.</td>
6704 </tr>
6705 </tbody>
6706 </table>
6707 <br />
6710 <p><b id="SCN_URIDROPPED">SCN_URIDROPPED</b><br />
6711 Only on the GTK+ version. Indicates that the user has dragged a URI such as a file name or Web
6712 address onto Scintilla. The container could interpret this as a request to open the file. The
6713 <code>text</code> field of <code>SCNotification</code> points at the URI text.</p>
6715 <p><b id="SCN_DWELLSTART">SCN_DWELLSTART</b><br />
6716 <b id="SCN_DWELLEND">SCN_DWELLEND</b><br />
6717 <code>SCN_DWELLSTART</code> is generated when the user keeps the mouse in one position for the
6718 dwell period (see <code><a class="message"
6719 href="#SCI_SETMOUSEDWELLTIME">SCI_SETMOUSEDWELLTIME</a></code>). <code>SCN_DWELLEND</code> is
6720 generated after a <code>SCN_DWELLSTART</code> and the mouse is moved or other activity such as
6721 key press indicates the dwell is over. Both notifications set the same fields in
6722 <code>SCNotification</code>:</p>
6724 <table cellpadding="1" cellspacing="2" border="0" summary="Mouse dwell notification">
6725 <tbody>
6726 <tr>
6727 <th align="left">Field</th>
6729 <th align="left">Usage</th>
6730 </tr>
6731 </tbody>
6733 <tbody valign="top">
6734 <tr>
6735 <td align="left"><code>position</code></td>
6737 <td align="left">This is the nearest position in the document to the position where the
6738 mouse pointer was lingering.</td>
6739 </tr>
6741 <tr>
6742 <td align="left"><code>x, y</code></td>
6744 <td align="left">Where the pointer lingered. The <code>position</code> field is set to
6745 <code><a class="message"
6746 href="#SCI_POSITIONFROMPOINTCLOSE">SCI_POSITIONFROMPOINTCLOSE</a>(x, y)</code>.</td>
6747 </tr>
6748 </tbody>
6749 </table>
6750 <br />
6752 <p><b id="SCI_SETMOUSEDWELLTIME">SCI_SETMOUSEDWELLTIME(int milliseconds)</b><br />
6753 <b id="SCI_GETMOUSEDWELLTIME">SCI_GETMOUSEDWELLTIME</b><br />
6754 These two messages set and get the time the mouse must sit still, in milliseconds, to generate
6755 a <code><a class="message" href="#SCN_DWELLSTART">SCN_DWELLSTART</a></code> notification. If
6756 set to <code>SC_TIME_FOREVER</code>, the default, no dwell events are generated.</p>
6758 <p><b id="SCN_ZOOM">SCN_ZOOM</b><br />
6759 This notification is generated when the user zooms the display using the keyboard or the
6760 <code><a class="message" href="#SCI_SETZOOM">SCI_SETZOOM</a></code> method is called. This
6761 notification can be used to recalculate positions, such as the width of the line number margin
6762 to maintain sizes in terms of characters rather than pixels. <code>SCNotification</code> has no
6763 additional information.</p>
6766 <b id="SCN_HOTSPOTCLICK">SCN_HOTSPOTCLICK</b><br />
6767 <b id="SCN_HOTSPOTDOUBLECLICK">SCN_HOTSPOTDOUBLECLICK</b><br />
6768 <b id="SCN_HOTSPOTRELEASECLICK">SCN_HOTSPOTRELEASECLICK</b><br />
6769 These notifications are generated when the user clicks or double clicks on
6770 text that is in a style with the hotspot attribute set.
6771 This notification can be used to link to variable definitions or web pages.
6772 The <code>position</code> field is set the text position of the click or
6773 double click and the <code>modifiers</code> field set to the key modifiers
6774 held down in a similar manner to <a class="message" href="#SCN_KEY">SCN_KEY</a>.
6775 Only the state of the Ctrl key is reported for <code>SCN_HOTSPOTRELEASECLICK</code>.</p>
6778 <b id="SCN_INDICATORCLICK">SCN_INDICATORCLICK</b><br />
6779 <b id="SCN_INDICATORRELEASE">SCN_INDICATORRELEASE</b><br />
6780 These notifications are generated when the user clicks or releases the mouse on
6781 text that has an indicator.
6782 The <code>position</code> field is set the text position of the click or
6783 double click and the <code>modifiers</code> field set to the key modifiers
6784 held down in a similar manner to <a class="message" href="#SCN_KEY">SCN_KEY</a>.</p>
6786 <p><b id="SCN_CALLTIPCLICK">SCN_CALLTIPCLICK</b><br />
6787 This notification is generated when the user clicks on a calltip.
6788 This notification can be used to display the next function prototype when a
6789 function name is overloaded with different arguments.
6790 The <code>position</code> field is set to 1 if the click is in an up arrow,
6791 2 if in a down arrow, and 0 if elsewhere.</p>
6793 <p><b id="SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</b><br />
6794 The user has selected an item in an <a class="jump" href="#Autocompletion">autocompletion list</a>. The
6795 notification is sent before the selection is inserted. Automatic insertion can be cancelled by sending a
6796 <code><a class="message" href="#SCI_AUTOCCANCEL">SCI_AUTOCCANCEL</a></code> message
6797 before returning from the notification. The <code>SCNotification</code> fields used are:</p>
6799 <table cellpadding="1" cellspacing="2" border="0" summary="Autocompletion list notification">
6800 <tbody>
6801 <tr>
6802 <th align="left">Field</th>
6804 <th align="left">Usage</th>
6805 </tr>
6806 </tbody>
6808 <tbody valign="top">
6809 <tr>
6810 <td align="left"><code>position</code></td>
6812 <td align="left">The start position of the word being completed.</td>
6813 </tr>
6814 <tr>
6815 <td align="left"><code>text</code></td>
6817 <td align="left">The text of the selection.</td>
6818 </tr>
6819 </tbody>
6820 </table>
6822 <p><b id="SCN_AUTOCCANCELLED">SCN_AUTOCCANCELLED</b><br />
6823 The user has cancelled an <a class="jump" href="#Autocompletion">autocompletion list</a>.
6824 There is no other information in SCNotification.</p>
6826 <p><b id="SCN_AUTOCCHARDELETED">SCN_AUTOCCHARDELETED</b><br />
6827 The user deleted a character while autocompletion list was active.
6828 There is no other information in SCNotification.</p>
6830 <h2 id="Images">Images</h2>
6832 <p>Two formats are supported for images used in margin markers and autocompletion lists, RGBA and XPM.</p>
6834 <h3 id="RGBA">RGBA</h3>
6836 <p>The RGBA format allows translucency with an <a class="jump" href="#alpha">alpha</a>
6837 value for each pixel. It is simpler than
6838 <code>XPM</code> and more capable.</p>
6840 <p>The data is a sequence of 4 byte pixel values starting with the pixels for the top line, with the
6841 leftmost pixel first, then continuing with the pixels for subsequent lines. There is no gap between
6842 lines for alignment reasons.</p>
6844 <p>Each pixel consists of, in order, a red byte, a green byte, a blue byte and an alpha byte.
6845 The colour bytes are not premultiplied by the alpha value. That is, a fully red pixel that is
6846 25% opaque will be [FF, 00, 00, 3F]</p>
6848 <p>Since the RGBA pixel data does not include any size information the
6849 width and height must previously been set with the
6850 <a class="message" href="#SCI_RGBAIMAGESETWIDTH"><code>SCI_RGBAIMAGESETWIDTH</code></a> and
6851 <a class="message" href="#SCI_RGBAIMAGESETHEIGHT"><code>SCI_RGBAIMAGESETHEIGHT</code></a> messages.</p>
6853 <p>GUI platforms often include functions for reading image file formats like PNG into memory
6854 in the RGBA form or a similar form.
6855 If there is no suitable platform support, the <a href="http://lodev.org/lodepng/">LodePNG and picoPNG</a> libraries are small libraries
6856 for loading and decoding PNG files available under a BSD-style license.</p>
6858 <p>RGBA format is supported on Windows, GTK+ and OS X Cocoa.
6859 It is not supported on OS X Carbon.</p>
6861 <h3 id="XPM">XPM</h3>
6863 <p>The XPM format is
6864 <a class="jump" href="http://en.wikipedia.org/wiki/X_PixMap">described here</a>.
6865 Scintilla is only able to handle XPM pixmaps that use one character per pixel with no named colours.
6866 There may be a completely transparent colour named "None".</p>
6867 <p>There are two forms of data structure used for XPM images, the first "lines form" format is well suited
6868 to embedding an image inside C source code and the "text form" is suited to reading from a file.
6869 In the lines form, an array of strings is used with the first string indicating the dimensions and number of colours
6870 used. This is followed by a string for each colour and that section is followed by the image with one string per line.
6871 The text form contains the same data as one null terminated block formatted as C source code starting
6872 with a "/* XPM */" comment to mark the format.</p>
6873 <p>Either format may be used with Scintilla APIs with the bytes at the location pointed to examined
6874 to determine which format: if the bytes start with "/* XPM */" then it is treated as text form,
6875 otherwise it is treated as lines form.</p>
6877 <p>XPM format is supported on on all platforms.</p>
6879 <h2 id="GTK">GTK+</h2>
6880 <p>On GTK+, the following functions create a Scintilla widget, communicate with it and allow
6881 resources to be released after all Scintilla widgets have been destroyed.</p>
6882 <code><a class="message" href="#scintilla_new">GtkWidget *scintilla_new()</a><br />
6883 <a class="message" href="#scintilla_set_id">void scintilla_set_id(ScintillaObject *sci, uptr_t id)</a><br />
6884 <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 />
6885 <a class="message" href="#scintilla_release_resources">void scintilla_release_resources()</a><br />
6886 </code>
6888 <p><b id="scintilla_new">GtkWidget *scintilla_new()</b><br />
6889 Create a new Scintilla widget. The returned pointer can be added to a container and displayed in the same way as other
6890 widgets.</p>
6892 <p><b id="scintilla_set_id">void scintilla_set_id(ScintillaObject *sci, uptr_t id)</b><br />
6893 Set the control ID which will be used in the idFrom field of the NotifyHeader structure of all
6894 notifications for this instance.
6895 This is equivalent to <a class="message" href="#SCI_SETIDENTIFIER">SCI_SETIDENTIFIER</a>.</p>
6897 <p><b id="scintilla_send_message">sptr_t scintilla_send_message(ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam)</b><br />
6898 The main entry point allows sending any of the messages described in this document.</p>
6900 <p><b id="scintilla_release_resources">void scintilla_release_resources()</b><br />
6901 Call this to free any remaining resources after all the Scintilla widgets have been destroyed.</p>
6903 <h2 id="DeprecatedMessages">Deprecated messages and notifications</h2>
6905 <p>The following messages are currently supported to emulate existing Windows controls, but
6906 they will be removed in future versions of Scintilla. If you use these messages you should
6907 replace them with the Scintilla equivalent.</p>
6908 <pre>
6909 WM_GETTEXT(int length, char *text)
6910 WM_SETTEXT(&lt;unused&gt;, const char *text)
6911 EM_GETLINE(int line, char *text)
6912 EM_REPLACESEL(&lt;unused&gt;, const char *text)
6913 EM_SETREADONLY
6914 EM_GETTEXTRANGE(&lt;unused&gt;, TEXTRANGE *tr)
6915 WM_CUT
6916 WM_COPY
6917 WM_PASTE
6918 WM_CLEAR
6919 WM_UNDO
6920 EM_CANUNDO
6921 EM_EMPTYUNDOBUFFER
6922 WM_GETTEXTLENGTH
6923 EM_GETFIRSTVISIBLELINE
6924 EM_GETLINECOUNT
6925 EM_GETMODIFY
6926 EM_SETMODIFY(bool isModified)
6927 EM_GETRECT(RECT *rect)
6928 EM_GETSEL(int *start, int *end)
6929 EM_EXGETSEL(&lt;unused&gt;, CHARRANGE *cr)
6930 EM_SETSEL(int start, int end)
6931 EM_EXSETSEL(&lt;unused&gt;, CHARRANGE *cr)
6932 EM_GETSELTEXT(&lt;unused&gt;, char *text)
6933 EM_LINEFROMCHAR(int position)
6934 EM_EXLINEFROMCHAR(int position)
6935 EM_LINEINDEX(int line)
6936 EM_LINELENGTH(int position)
6937 EM_SCROLL(int line)
6938 EM_LINESCROLL(int column, int line)
6939 EM_SCROLLCARET()
6940 EM_CANPASTE
6941 EM_CHARFROMPOS(&lt;unused&gt;, POINT *location)
6942 EM_POSFROMCHAR(int position, POINT *location)
6943 EM_SELECTIONTYPE
6944 EM_HIDESELECTION(bool hide)
6945 EM_FINDTEXT(int flags, FINDTEXTEX *ft)
6946 EM_FINDTEXTEX(int flags, FINDTEXTEX *ft)
6947 EM_GETMARGINS
6948 EM_SETMARGINS(EC_LEFTMARGIN or EC_RIGHTMARGIN or EC_USEFONTINFO, int val)
6949 EM_FORMATRANGE
6950 </pre>
6952 <p>The following are features that are only included if you define
6953 <code>INCLUDE_DEPRECATED_FEATURES</code> in <code>Scintilla.h</code>. To ensure future
6954 compatibility you should change them as indicated.</p>
6956 <p><b id="SC_CP_DBCS">SC_CP_DBCS</b> Deprecated<br />
6957 This was used to set a DBCS (Double Byte Character Set) mode on GTK+.
6958 An explicit DBCS code page should be used when calling <a class="message" href="#SCI_SETCODEPAGE">SCI_SETCODEPAGE</a></p>
6960 <p><b id="SCI_SETUSEPALETTE">SCI_SETUSEPALETTE(bool allowPaletteUse)</b> Deprecated<br />
6961 <b id="SCI_GETUSEPALETTE">SCI_GETUSEPALETTE</b> Deprecated<br />
6962 Scintilla no longer supports palette mode. The last version to support palettes was 2.29.
6963 Any calls to these methods should be removed.</p>
6965 <h2 id="EditMessagesNeverSupportedByScintilla">Edit messages never supported by Scintilla</h2>
6966 <pre>
6967 EM_GETWORDBREAKPROC EM_GETWORDBREAKPROCEX
6968 EM_SETWORDBREAKPROC EM_SETWORDBREAKPROCEX
6969 EM_GETWORDWRAPMODE EM_SETWORDWRAPMODE
6970 EM_LIMITTEXT EM_EXLIMITTEXT
6971 EM_SETRECT EM_SETRECTNP
6972 EM_FMTLINES
6973 EM_GETHANDLE EM_SETHANDLE
6974 EM_GETPASSWORDCHAR EM_SETPASSWORDCHAR
6975 EM_SETTABSTOPS
6976 EM_FINDWORDBREAK
6977 EM_GETCHARFORMAT EM_SETCHARFORMAT
6978 EM_GETOLEINTERFACE EM_SETOLEINTERFACE
6979 EM_SETOLECALLBACK
6980 EM_GETPARAFORMAT EM_SETPARAFORMAT
6981 EM_PASTESPECIAL
6982 EM_REQUESTRESIZE
6983 EM_GETBKGNDCOLOR EM_SETBKGNDCOLOR
6984 EM_STREAMIN EM_STREAMOUT
6985 EM_GETIMECOLOR EM_SETIMECOLOR
6986 EM_GETIMEOPTIONS EM_SETIMEOPTIONS
6987 EM_GETOPTIONS EM_SETOPTIONS
6988 EM_GETPUNCTUATION EM_SETPUNCTUATION
6989 EM_GETTHUMB
6990 EM_GETEVENTMASK
6991 EM_SETEVENTMASK
6992 EM_DISPLAYBAND
6993 EM_SETTARGETDEVICE
6994 </pre>
6996 <p>Scintilla tries to be a superset of the standard windows Edit and RichEdit controls wherever
6997 that makes sense. As it is not intended for use in a word processor, some edit messages can not
6998 be sensibly handled. Unsupported messages have no effect.</p>
7000 <h2 id="BuildingScintilla">Building Scintilla</h2>
7002 <p>To build Scintilla or SciTE, see the README file present in both the Scintilla and SciTE
7003 directories. For Windows, GCC 3.2, Borland C++ or Microsoft Visual Studio .NET can be used
7004 for building. There is a make file for building Scintilla but not SciTE with Visual C++ 6 at
7005 scintilla/win32/scintilla_vc6.mak. For GTK+, GCC 3.1 should be used. GTK+ 1.2x and 2.0x are
7006 supported. The version of GTK+ installed should be detected automatically.
7007 When both GTK+ 1 and GTK+ 2 are present, building for GTK+ 1.x requires defining GTK1
7008 on the command line.</p>
7010 <h3>Static linking</h3>
7012 <p>On Windows, Scintilla is normally used as a dynamic library as a .DLL file. If you want to
7013 link Scintilla directly into your application .EXE or .DLL file, then the
7014 <code>STATIC_BUILD</code> preprocessor symbol should be defined and
7015 <code>Scintilla_RegisterClasses</code> called. <code>STATIC_BUILD</code> prevents compiling the
7016 <code>DllMain</code> function which will conflict with any <code>DllMain</code> defined in your
7017 code. <code>Scintilla_RegisterClasses</code> takes the <code>HINSTANCE</code> of your
7018 application and ensures that the "Scintilla" window class is registered.</p>
7020 <h3>Ensuring lexers are linked into Scintilla</h3>
7022 <p>Depending on the compiler and linker used, the lexers may be stripped out. This is most
7023 often caused when building a static library. To ensure the lexers are linked in, the
7024 <code>Scintilla_LinkLexers()</code> function may be called.</p>
7026 <h3>Changing set of lexers</h3>
7028 <p>To change the set of lexers in Scintilla, add and remove lexer source files
7029 (<code>Lex*.cxx</code>) from the <code>scintilla/src directory</code> and run the
7030 <code>src/LexGen.py</code> script from the <code>src</code> directory to update the make files
7031 and <code>KeyWords.cxx</code>. <code>LexGen.py</code> requires Python 2.1 or later. If you do
7032 not have access to Python, you can hand edit <code>KeyWords.cxx</code> in a simple-minded way,
7033 following the patterns of other lexers. The important thing is to include
7034 <code>LINK_LEXER(lmMyLexer);</code> to correspond with the <code>LexerModule
7035 lmMyLexer(...);</code> in your lexer source code.</p>
7037 <h3>Building with an alternative Regular Expression implementation</h3>
7039 <p id="AlternativeRegEx">A simple interface provides support for switching the Regular Expressions engine at
7040 compile time. You must implement <code>RegexSearchBase</code> for your chosen engine,
7041 look at the built-in implementation <code>BuiltinRegex</code> to see how this is done.
7042 You then need to implement the factory method <code>CreateRegexSearch</code>
7043 to create an instance of your class. You must disable the built-in implementation by defining
7044 <code>SCI_OWNREGEX</code>.</p>
7046 </body>
7047 </html>