Update Scintilla to version 3.5.1
[TortoiseGit.git] / ext / scintilla / doc / ScintillaDoc.html
bloba808c9b5f00c4f9d0666dc0e78541082c3b1cec9
1 <?xml version="1.0"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5 <html xmlns="http://www.w3.org/1999/xhtml">
6 <head>
7 <meta name="generator"
8 content="HTML Tidy for Windows (vers 1st August 2002), see www.w3.org" />
9 <meta name="generator" content="SciTE" />
10 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
12 <title>Scintilla Documentation</title>
14 <style type="text/css">
15 <!--
16 /*<![CDATA[*/
17 CODE { font-weight: bold; font-family: Consolas,Bitstream Vera Sans Mono,Courier New,monospace; }
18 A:visited { color: blue; }
19 A:hover { text-decoration: underline ! important; }
20 A.message { text-decoration: none; font-weight: bold; font-family: Consolas,Bitstream Vera Sans Mono,Courier New,monospace; }
21 A.toc { text-decoration: none; }
22 A.jump { text-decoration: none; }
23 .S0 {
24 color: #808080;
26 .S2 {
27 font-family: 'Comic Sans MS';
28 color: #007F00;
29 font-size: 9pt;
31 .S3 {
32 font-family: 'Comic Sans MS';
33 color: #3F703F;
34 font-size: 9pt;
36 .S4 {
37 color: #007F7F;
39 .S5 {
40 font-weight: bold;
41 color: #00007F;
43 .S9 {
44 color: #7F7F00;
46 .S10 {
47 font-weight: bold;
48 color: #000000;
50 .S17 {
51 font-family: 'Comic Sans MS';
52 color: #3060A0;
53 font-size: 9pt;
55 DIV.highlighted {
56 background: #F7FCF7;
57 border: 1px solid #C0D7C0;
58 margin: 0.3em 3em;
59 padding: 0.3em 0.6em;
60 font-family: 'Verdana';
61 color: #000000;
62 font-size: 10pt;
64 .provisional {
65 background: #FFB000;
67 /*]]>*/
68 -->
69 </style>
70 </head>
72 <body bgcolor="#FFFFFF" text="#000000">
73 <table bgcolor="#000000" width="100%" cellspacing="0" cellpadding="0" border="0"
74 summary="Banner">
75 <tr>
76 <td><img src="SciTEIco.png" border="3" height="64" width="64" alt="Scintilla icon" /></td>
78 <td><a href="index.html"
79 style="color:white;text-decoration:none;font-size:200%">Scintilla</a></td>
80 </tr>
81 </table>
83 <h1>Scintilla Documentation</h1>
85 <p>Last edited 25 September 2014 NH</p>
87 <p>There is <a class="jump" href="Design.html">an overview of the internal design of
88 Scintilla</a>.<br />
89 <a class="jump" href="ScintillaUsage.html">Some notes on using Scintilla</a>.<br />
90 <a class="jump" href="Steps.html">How to use the Scintilla Edit Control on Windows</a>.<br />
91 <a class="jump" href="http://www.scintilla.org/dmapp.zip">A simple sample using Scintilla from
92 C++ on Windows</a>.<br />
93 <a class="jump" href="http://www.scintilla.org/SciTry.vb">A simple sample using Scintilla from
94 Visual Basic</a>.<br />
95 <a class="jump" href="http://www.scintilla.org/bait.zip">Bait is a tiny sample using Scintilla
96 on GTK+</a>.<br />
97 <a class="jump" href="Lexer.txt">A detailed description of how to write a lexer, including a
98 discussion of folding</a>.<br />
99 <a class="jump" href="http://sphere.sourceforge.net/flik/docs/scintilla-container_lexer.html">
100 How to implement a lexer in the container</a>.<br />
101 <a class="jump" href="http://sphere.sourceforge.net/flik/docs/scintilla-folding.html">
102 How to implement folding</a>.<br />
103 <a class="jump" href="https://bitbucket.org/StarFire/scintilla-doc/downloads/Scintilla-var'aq-Tutorial.pdf">
104 Beginner's Guide to lexing and folding</a>.<br />
105 The <a class="jump" href="SciCoding.html">coding style</a> used in Scintilla and SciTE is
106 worth following if you want to contribute code to Scintilla but is not compulsory.</p>
108 <h2>Introduction</h2>
110 <p>The Windows version of Scintilla is a Windows Control. As such, its primary programming
111 interface is through Windows messages. Early versions of Scintilla emulated much of the API
112 defined by the standard Windows Edit and RichEdit controls but those APIs are now deprecated in
113 favour of Scintilla's own, more consistent API. In addition to messages performing the actions
114 of a normal Edit control, Scintilla allows control of syntax styling, folding, markers, autocompletion
115 and call tips.</p>
117 <p>The GTK+ version also uses messages in a similar way to the Windows version. This is
118 different to normal GTK+ practice but made it easier to implement rapidly.</p>
120 <p>Scintilla also builds with Cocoa on OS X and with Qt, and follows the conventions of
121 those platforms.</p>
123 <p>Scintilla does not properly support right-to-left languages like Arabic and Hebrew.
124 While text in these languages may appear correct, it is not possible to interact with this text
125 as is normal with other editing components.</p>
127 <p>This documentation describes the individual messages and notifications used by Scintilla. It
128 does not describe how to link them together to form a useful editor. For now, the best way to
129 work out how to develop using Scintilla is to see how SciTE uses it. SciTE exercises most of
130 Scintilla's facilities.</p>
132 <p>In the descriptions that follow, the messages are described as function calls with zero, one
133 or two arguments. These two arguments are the standard <code>wParam</code> and
134 <code>lParam</code> familiar to Windows programmers. These parameters are integers that
135 are large enough to hold pointers, and the return value is also an integer large enough to contain a
136 pointer.
137 Although the commands only use the
138 arguments described, because all messages have two arguments whether Scintilla uses them or
139 not, it is strongly recommended that any unused arguments are set to 0. This allows future
140 enhancement of messages without the risk of breaking existing code. Common argument types
141 are:</p>
143 <table cellpadding="1" cellspacing="2" border="0" summary="Common argument types">
144 <tbody valign="top">
145 <tr>
146 <th align="left">bool</th>
148 <td>Arguments expect the values 0 for <code>false</code> and 1 for
149 <code>true</code>.</td>
150 </tr>
152 <tr>
153 <th align="left">int</th>
155 <td>Arguments are 32-bit signed integers.</td>
156 </tr>
158 <tr>
159 <th align="left">const&nbsp;char&nbsp;*</th>
161 <td>Arguments point at text that is being passed to Scintilla but not modified. The text
162 may be zero terminated or another argument may specify the character count, the
163 description will make this clear.</td>
164 </tr>
166 <tr>
167 <th align="left">char *</th>
169 <td>Arguments point at text buffers that Scintilla will fill with text. In some cases,
170 another argument will tell Scintilla the buffer size. In others, you must make sure that
171 the buffer is big enough to hold the requested text. If a NULL pointer (0) is passed
172 then, for SCI_* calls, the length that should be allocated is returned.</td>
173 </tr>
175 <tr>
176 <th align="left" id="colour">colour</th>
178 <td>Colours are set using the RGB format (Red, Green, Blue). The intensity of each colour
179 is set in the range 0 to 255. If you have three such intensities, they are combined as:
180 red | (green &lt;&lt; 8) | (blue &lt;&lt; 16). If you set all intensities to 255, the
181 colour is white. If you set all intensities to 0, the colour is black. When you set a
182 colour, you are making a request. What you will get depends on the capabilities of the
183 system and the current screen mode.</td>
184 </tr>
186 <tr>
187 <th align="left" id="alpha">alpha</th>
189 <td>Translucency is set using an alpha value.
190 Alpha ranges from 0 (SC_ALPHA_TRANSPARENT) which is completely transparent to
191 255 (SC_ALPHA_OPAQUE) which is opaque. The value 256 (SC_ALPHA_NOALPHA)
192 is opaque and uses code that is not alpha-aware and may be faster. Not all platforms support
193 translucency and only some Scintilla features implement translucency.
194 The default alpha value for most features is SC_ALPHA_NOALPHA.</td>
195 </tr>
197 <tr>
198 <th align="left">&lt;unused&gt;</th>
200 <td>This is an unused argument. Setting it to 0 will ensure compatibility with future
201 enhancements.</td>
202 </tr>
203 </tbody>
204 </table>
206 <h2 id="MessageCategories">Contents</h2>
208 <table cellpadding="4" cellspacing="2" border="0" summary="Message categories">
209 <tbody>
210 <tr>
211 <td>o <a class="toc" href="#TextRetrievalAndModification">Text retrieval and
212 modification</a></td>
214 <td>o <a class="toc" href="#Searching">Searching and replacing</a></td>
216 <td>o <a class="toc" href="#Overtype">Overtype</a></td>
218 </tr>
220 <tr>
221 <td>o <a class="toc" href="#CutCopyAndPaste">Cut, copy and paste</a></td>
223 <td>o <a class="toc" href="#ErrorHandling">Error handling</a></td>
225 <td>o <a class="toc" href="#UndoAndRedo">Undo and Redo</a></td>
227 </tr>
229 <tr>
230 <td>o <a class="toc" href="#SelectionAndInformation">Selection and information</a></td>
232 <td>o <a class="toc" href="#MultipleSelectionAndVirtualSpace">Multiple Selection and Virtual Space</a></td>
234 <td>o <a class="toc" href="#ScrollingAndAutomaticScrolling">Scrolling and automatic
235 scrolling</a></td>
237 </tr>
239 <tr>
240 <td>o <a class="toc" href="#WhiteSpace">White space</a></td>
242 <td>o <a class="toc" href="#Cursor">Cursor</a></td>
244 <td>o <a class="toc" href="#MouseCapture">Mouse capture</a></td>
246 </tr>
248 <tr>
249 <td>o <a class="toc" href="#LineEndings">Line endings</a></td>
251 <td>o <a class="toc" href="#Styling">Styling</a></td>
253 <td>o <a class="toc" href="#StyleDefinition">Style definition</a></td>
255 </tr>
257 <tr>
258 <td>o <a class="toc" href="#CaretAndSelectionStyles">Caret, selection, and hotspot styles</a></td>
260 <td>o <a class="toc" href="#CharacterRepresentations">Character representations</a></td>
262 <td>o <a class="toc" href="#Margins">Margins</a></td>
264 </tr>
266 <tr>
267 <td>o <a class="toc" href="#Annotations">Annotations</a></td>
269 <td>o <a class="toc" href="#OtherSettings">Other settings</a></td>
271 <td>o <a class="toc" href="#BraceHighlighting">Brace highlighting</a></td>
273 </tr>
275 <tr>
276 <td>o <a class="toc" href="#TabsAndIndentationGuides">Tabs and Indentation
277 Guides</a></td>
279 <td>o <a class="toc" href="#Markers">Markers</a></td>
281 <td>o <a class="toc" href="#Indicators">Indicators</a></td>
283 </tr>
285 <tr>
286 <td>o <a class="toc" href="#Autocompletion">Autocompletion</a></td>
288 <td>o <a class="toc" href="#UserLists">User lists</a></td>
290 <td>o <a class="toc" href="#CallTips">Call tips</a></td>
292 </tr>
294 <tr>
295 <td>o <a class="toc" href="#KeyboardCommands">Keyboard commands</a></td>
297 <td>o <a class="toc" href="#KeyBindings">Key bindings</a></td>
299 <td>o <a class="toc" href="#PopupEditMenu">Popup edit menu</a></td>
301 </tr>
303 <tr>
304 <td>o <a class="toc" href="#MacroRecording">Macro recording</a></td>
306 <td>o <a class="toc" href="#Printing">Printing</a></td>
308 <td>o <a class="toc" href="#DirectAccess">Direct access</a></td>
310 </tr>
312 <tr>
313 <td>o <a class="toc" href="#MultipleViews">Multiple views</a></td>
315 <td>o <a class="toc" href="#BackgroundLoadSave">Background loading and saving</a></td>
317 <td>o <a class="toc" href="#Folding">Folding</a></td>
319 </tr>
321 <tr>
322 <td>o <a class="toc" href="#LineWrapping">Line wrapping</a></td>
324 <td>o <a class="toc" href="#Zooming">Zooming</a></td>
326 <td>o <a class="toc" href="#LongLines">Long lines</a></td>
328 </tr>
330 <tr>
331 <td>o <a class="toc" href="#Lexer">Lexer</a></td>
333 <td>o <a class="toc" href="#LexerObjects">Lexer objects</a></td>
335 <td>o <a class="toc" href="#Notifications">Notifications</a></td>
337 </tr>
339 <tr>
340 <td>o <a class="toc" href="#Images">Images</a></td>
342 <td>o <a class="toc" href="#GTK">GTK+</a></td>
344 <td>o <a class="toc" href="#ProvisionalMessages"><span class="provisional">Provisional messages</span></a></td>
346 </tr>
348 <tr>
349 <td>o <a class="toc" href="#DeprecatedMessages">Deprecated messages</a></td>
351 <td>o <a class="toc" href="#EditMessagesNeverSupportedByScintilla">Edit messages never
352 supported by Scintilla</a></td>
354 <td>o <a class="toc" href="#BuildingScintilla">Building Scintilla</a></td>
356 </tr>
357 </tbody>
358 </table>
360 <p>Messages with names of the form <code>SCI_SETxxxxx</code> often have a companion
361 <code>SCI_GETxxxxx</code>. To save tedious repetition, if the <code>SCI_GETxxxxx</code> message
362 returns the value set by the <code>SCI_SETxxxxx</code> message, the <code>SET</code> routine is
363 described and the <code>GET</code> routine is left to your imagination.</p>
365 <h2 id="TextRetrievalAndModification">Text retrieval and modification</h2>
367 <p>Each byte in a Scintilla document is associated with a byte of styling
368 information. The combination of a character byte and a style byte is called a cell. Style bytes
369 are interpreted an index into an array of styles.</p>
371 <p>In this document, 'character' normally refers to a byte even when multi-byte characters are used.
372 Lengths measure the numbers of bytes, not the amount of characters in those bytes.</p>
374 <p>Positions within the Scintilla document refer to a character or the gap before that
375 character. The first character in a document is 0, the second 1 and so on. If a document
376 contains <code>nLen</code> characters, the last character is numbered <code>nLen</code>-1.
377 The caret exists between character positions and can be located from before the first character (0)
378 to after the last character (<code>nLen</code>).</p>
380 <p>There are places where the caret can not go where two character bytes make up one character.
381 This occurs when a DBCS character from a language like Japanese is included in the document or
382 when line ends are marked with the CP/M standard of a carriage return followed by a line feed.
383 The <code>INVALID_POSITION</code> constant (-1) represents an invalid position within the
384 document.</p>
386 <p>All lines of text in Scintilla are the same height, and this height is calculated from the
387 largest font in any current style. This restriction is for performance; if lines differed in
388 height then calculations involving positioning of text would require the text to be styled
389 first.</p>
390 <code><a class="message" href="#SCI_GETTEXT">SCI_GETTEXT(int length, char *text)</a><br />
391 <a class="message" href="#SCI_SETTEXT">SCI_SETTEXT(&lt;unused&gt;, const char *text)</a><br />
392 <a class="message" href="#SCI_SETSAVEPOINT">SCI_SETSAVEPOINT</a><br />
393 <a class="message" href="#SCI_GETLINE">SCI_GETLINE(int line, char *text)</a><br />
394 <a class="message" href="#SCI_REPLACESEL">SCI_REPLACESEL(&lt;unused&gt;, const char
395 *text)</a><br />
396 <a class="message" href="#SCI_SETREADONLY">SCI_SETREADONLY(bool readOnly)</a><br />
397 <a class="message" href="#SCI_GETREADONLY">SCI_GETREADONLY</a><br />
398 <a class="message" href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE(&lt;unused&gt;, Sci_TextRange
399 *tr)</a><br />
400 <a class="message" href="#SCI_ALLOCATE">SCI_ALLOCATE(int bytes, &lt;unused&gt;)</a><br />
401 <a class="message" href="#SCI_ADDTEXT">SCI_ADDTEXT(int length, const char *s)</a><br />
402 <a class="message" href="#SCI_ADDSTYLEDTEXT">SCI_ADDSTYLEDTEXT(int length, cell *s)</a><br />
403 <a class="message" href="#SCI_APPENDTEXT">SCI_APPENDTEXT(int length, const char *s)</a><br />
404 <a class="message" href="#SCI_INSERTTEXT">SCI_INSERTTEXT(int pos, const char *text)</a><br />
405 <a class="message" href="#SCI_CHANGEINSERTION">SCI_CHANGEINSERTION(int length, const char *text)</a><br />
406 <a class="message" href="#SCI_CLEARALL">SCI_CLEARALL</a><br />
407 <a class="message" href="#SCI_DELETERANGE">SCI_DELETERANGE(int pos, int deleteLength)</a><br />
408 <a class="message" href="#SCI_CLEARDOCUMENTSTYLE">SCI_CLEARDOCUMENTSTYLE</a><br />
409 <a class="message" href="#SCI_GETCHARAT">SCI_GETCHARAT(int position)</a><br />
410 <a class="message" href="#SCI_GETSTYLEAT">SCI_GETSTYLEAT(int position)</a><br />
411 <a class="message" href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT(&lt;unused&gt;, Sci_TextRange
412 *tr)</a><br />
413 <a class="message" href="#SCI_RELEASEALLEXTENDEDSTYLES">SCI_RELEASEALLEXTENDEDSTYLES</a><br />
414 <a class="message" href="#SCI_ALLOCATEEXTENDEDSTYLES">SCI_ALLOCATEEXTENDEDSTYLES(int numberStyles)</a><br />
415 <a class="message" href="#SCI_TARGETASUTF8">SCI_TARGETASUTF8(&lt;unused&gt;, char *s)</a><br />
416 <a class="message" href="#SCI_ENCODEDFROMUTF8">SCI_ENCODEDFROMUTF8(const char *utf8, char *encoded)</a><br />
417 <a class="message" href="#SCI_SETLENGTHFORENCODE">SCI_SETLENGTHFORENCODE(int bytes)</a><br />
418 </code>
420 <p><b id="SCI_GETTEXT">SCI_GETTEXT(int length, char *text)</b><br />
421 This returns <code>length</code>-1 characters of text from the start of the document plus one
422 terminating 0 character. To collect all the text in a document, use <code>SCI_GETLENGTH</code>
423 to get the number of characters in the document (<code>nLen</code>), allocate a character
424 buffer of length <code>nLen+1</code> bytes, then call <code>SCI_GETTEXT(nLen+1, char
425 *text)</code>. If the text argument is 0 then the length that should be allocated to store the
426 entire document is returned.
427 If you then save the text, you should use <code>SCI_SETSAVEPOINT</code> to mark
428 the text as unmodified.</p>
430 <p>See also: <code><a class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>, <a
431 class="message" href="#SCI_GETCURLINE">SCI_GETCURLINE</a>, <a class="message"
432 href="#SCI_GETLINE">SCI_GETLINE</a>, <a class="message"
433 href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>, <a class="message"
434 href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a></code></p>
436 <p><b id="SCI_SETTEXT">SCI_SETTEXT(&lt;unused&gt;, const char *text)</b><br />
437 This replaces all the text in the document with the zero terminated text string you pass
438 in.</p>
440 <p><b id="SCI_SETSAVEPOINT">SCI_SETSAVEPOINT</b><br />
441 This message tells Scintilla that the current state of the document is unmodified. This is
442 usually done when the file is saved or loaded, hence the name "save point". As Scintilla
443 performs undo and redo operations, it notifies the container that it has entered or left the
444 save point with <code><a class="message"
445 href="#SCN_SAVEPOINTREACHED">SCN_SAVEPOINTREACHED</a></code> and <code><a class="message"
446 href="#SCN_SAVEPOINTLEFT">SCN_SAVEPOINTLEFT</a></code> <a class="jump"
447 href="#Notifications">notification messages</a>, allowing the container to know if the file
448 should be considered dirty or not.</p>
450 <p>See also: <code><a class="message" href="#SCI_EMPTYUNDOBUFFER">SCI_EMPTYUNDOBUFFER</a>, <a
451 class="message" href="#SCI_GETMODIFY">SCI_GETMODIFY</a></code></p>
453 <p><b id="SCI_GETLINE">SCI_GETLINE(int line, char *text)</b><br />
454 This fills the buffer defined by text with the contents of the nominated line (lines start at
455 0). The buffer is not terminated by a 0 character. It is up to you to make sure that the buffer
456 is long enough for the text, use <a class="message"
457 href="#SCI_LINELENGTH"><code>SCI_LINELENGTH(int line)</code></a>. The returned value is the
458 number of characters copied to the buffer. The returned text includes any end of line
459 characters. If you ask for a line number outside the range of lines in the document, 0
460 characters are copied. If the text argument is 0 then the length that should be allocated
461 to store the entire line is returned.</p>
463 <p>See also: <code><a class="message" href="#SCI_GETCURLINE">SCI_GETCURLINE</a>, <a
464 class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>, <a class="message"
465 href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a>, <a class="message"
466 href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>, <a class="message"
467 href="#SCI_GETTEXT">SCI_GETTEXT</a></code></p>
469 <p><b id="SCI_REPLACESEL">SCI_REPLACESEL(&lt;unused&gt;, const char *text)</b><br />
470 The currently selected text between the <a class="jump" href="#SelectionAndInformation">anchor
471 and the current position</a> is replaced by the 0 terminated text string. If the anchor and
472 current position are the same, the text is inserted at the caret position. The caret is
473 positioned after the inserted text and the caret is scrolled into view.</p>
475 <p><b id="SCI_SETREADONLY">SCI_SETREADONLY(bool readOnly)</b><br />
476 <b id="SCI_GETREADONLY">SCI_GETREADONLY</b><br />
477 These messages set and get the read-only flag for the document. If you mark a document as read
478 only, attempts to modify the text cause the <a class="message"
479 href="#SCN_MODIFYATTEMPTRO"><code>SCN_MODIFYATTEMPTRO</code></a> notification.</p>
481 <p><b id="SCI_GETTEXTRANGE">SCI_GETTEXTRANGE(&lt;unused&gt;, <a class="jump"
482 href="#Sci_TextRange">Sci_TextRange</a> *tr)</b><br />
483 This collects the text between the positions <code>cpMin</code> and <code>cpMax</code> and
484 copies it to <code>lpstrText</code> (see <code>struct Sci_TextRange</code> in
485 <code>Scintilla.h</code>). If <code>cpMax</code> is -1, text is returned to the end of the
486 document. The text is 0 terminated, so you must supply a buffer that is at least 1 character
487 longer than the number of characters you wish to read. The return value is the length of the
488 returned text not including the terminating 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_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>, <a class="message"
494 href="#SCI_GETTEXT">SCI_GETTEXT</a></code></p>
496 <p><b id="SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT(&lt;unused&gt;, <a class="jump"
497 href="#Sci_TextRange">Sci_TextRange</a> *tr)</b><br />
498 This collects styled text into a buffer using two bytes for each cell, with the character at
499 the lower address of each pair and the style byte at the upper address. Characters between the
500 positions <code>cpMin</code> and <code>cpMax</code> are copied to <code>lpstrText</code> (see
501 <code>struct Sci_TextRange</code> in <code>Scintilla.h</code>). Two 0 bytes are added to the end of
502 the text, so the buffer that <code>lpstrText</code> points at must be at least
503 <code>2*(cpMax-cpMin)+2</code> bytes long. No check is made for sensible values of
504 <code>cpMin</code> or <code>cpMax</code>. Positions outside the document return character codes
505 and style bytes of 0.</p>
507 <p>See also: <code><a class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>, <a
508 class="message" href="#SCI_GETLINE">SCI_GETLINE</a>, <a class="message"
509 href="#SCI_GETCURLINE">SCI_GETCURLINE</a>, <a class="message"
510 href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a>, <a class="message"
511 href="#SCI_GETTEXT">SCI_GETTEXT</a></code></p>
513 <p><b id="SCI_ALLOCATE">SCI_ALLOCATE(int bytes, &lt;unused&gt;)</b><br />
514 Allocate a document buffer large enough to store a given number of bytes.
515 The document will not be made smaller than its current contents.</p>
517 <p><b id="SCI_ADDTEXT">SCI_ADDTEXT(int length, const char *s)</b><br />
518 This inserts the first <code>length</code> characters from the string <code>s</code>
519 at the current position. This will include any 0's in the string that you might have expected
520 to stop the insert operation. The current position is set at the end of the inserted text,
521 but it is not scrolled into view.</p>
523 <p><b id="SCI_ADDSTYLEDTEXT">SCI_ADDSTYLEDTEXT(int length, cell *s)</b><br />
524 This behaves just like <code>SCI_ADDTEXT</code>, but inserts styled text.</p>
526 <p><b id="SCI_APPENDTEXT">SCI_APPENDTEXT(int length, const char *s)</b><br />
527 This adds the first <code>length</code> characters from the string <code>s</code> to the end
528 of the document. This will include any 0's in the string that you might have expected to stop
529 the operation. The current selection is not changed and the new text is not scrolled into
530 view.</p>
532 <p><b id="SCI_INSERTTEXT">SCI_INSERTTEXT(int pos, const char *text)</b><br />
533 This inserts the zero terminated <code>text</code> string at position <code>pos</code> or at
534 the current position if <code>pos</code> is -1. If the current position is after the insertion point
535 then it is moved along with its surrounding text but no scrolling is performed.</p>
537 <p><b id="SCI_CHANGEINSERTION">SCI_CHANGEINSERTION(int length, const char *text)</b><br />
538 This may only be called from a <a class="message" href="#SC_MOD_INSERTCHECK">SC_MOD_INSERTCHECK</a>
539 notification handler and will change the text being inserted to that provided.</p>
541 <p><b id="SCI_CLEARALL">SCI_CLEARALL</b><br />
542 Unless the document is read-only, this deletes all the text.</p>
544 <p><b id="SCI_DELETERANGE">SCI_DELETERANGE(int pos, int deleteLength)</b><br />
545 Deletes a range of text in the document.</p>
547 <p><b id="SCI_CLEARDOCUMENTSTYLE">SCI_CLEARDOCUMENTSTYLE</b><br />
548 When wanting to completely restyle the document, for example after choosing a lexer, the
549 <code>SCI_CLEARDOCUMENTSTYLE</code> can be used to clear all styling information and reset the
550 folding state.</p>
552 <p><b id="SCI_GETCHARAT">SCI_GETCHARAT(int pos)</b><br />
553 This returns the character at <code>pos</code> in the document or 0 if <code>pos</code> is
554 negative or past the end of the document.</p>
556 <p><b id="SCI_GETSTYLEAT">SCI_GETSTYLEAT(int pos)</b><br />
557 This returns the style at <code>pos</code> in the document, or 0 if <code>pos</code> is
558 negative or past the end of the document.</p>
560 <p><b id="SCI_RELEASEALLEXTENDEDSTYLES">SCI_RELEASEALLEXTENDEDSTYLES</b><br />
561 <b id="SCI_ALLOCATEEXTENDEDSTYLES">SCI_ALLOCATEEXTENDEDSTYLES(int numberStyles)</b><br />
562 Extended styles are used for features like textual margins and annotations as well as internally by Scintilla.
563 They are outside the range 0..255 used for the styles bytes associated with document bytes.
564 These functions manage the use of extended styles to ensures that components cooperate in defining styles.
565 <code>SCI_RELEASEALLEXTENDEDSTYLES</code> releases any extended styles allocated by the container.
566 <code>SCI_ALLOCATEEXTENDEDSTYLES</code> allocates a range of style numbers after the byte style values and returns
567 the number of the first allocated style.
568 Ranges for margin and annotation styles should be allocated before calling
569 <a class="message" href="#SCI_MARGINSETSTYLEOFFSET">SCI_MARGINSETSTYLEOFFSET</a> or
570 <a class="message" href="#SCI_ANNOTATIONSETSTYLEOFFSET">SCI_ANNOTATIONSETSTYLEOFFSET</a>.</p>
572 <p><b id="Sci_TextRange">Sci_TextRange</b> and <b id="Sci_CharacterRange">Sci_CharacterRange</b><br />
573 These structures are defined to be exactly the same shape as the Win32 <code>TEXTRANGE</code>
574 and <code>CHARRANGE</code>, so that older code that treats Scintilla as a RichEdit will
575 work.</p>
576 <pre>
577 struct Sci_CharacterRange {
578 long cpMin;
579 long cpMax;
582 struct Sci_TextRange {
583 struct Sci_CharacterRange chrg;
584 char *lpstrText;
586 </pre>
588 <h3 id="EncodedAccess">GTK+-specific: Access to encoded text</h3>
590 <p><b id="SCI_TARGETASUTF8">SCI_TARGETASUTF8(&lt;unused&gt;, char *s)</b><br />
591 This method retrieves the value of the target encoded as UTF-8 which is the default
592 encoding of GTK+ so is useful for retrieving text for use in other parts of the user interface,
593 such as find and replace dialogs. The length of the encoded text in bytes is returned.
594 </p>
596 <p><b id="SCI_ENCODEDFROMUTF8">SCI_ENCODEDFROMUTF8(const char *utf8, char *encoded)</b><br />
597 <b id="SCI_SETLENGTHFORENCODE">SCI_SETLENGTHFORENCODE(int bytes)</b><br />
598 <code>SCI_ENCODEDFROMUTF8</code> converts a UTF-8 string into the document's
599 encoding which is useful for taking the results of a find dialog, for example, and receiving
600 a string of bytes that can be searched for in the document. Since the text can contain nul bytes,
601 the <code>SCI_SETLENGTHFORENCODE</code> method can be used to set the
602 length that will be converted. If set to -1, the length is determined by finding a nul byte.
603 The length of the converted string is returned.
604 </p>
607 <h2 id="Searching">Searching</h2>
609 There are methods to search for text and for regular expressions. The regular expression support
610 is limited and should only be used for simple cases and initial development. A different regular expression
611 library can be <a class="jump" href="#AlternativeRegEx">integrated into Scintilla</a>
612 or can be called from the container using direct access to the buffer contents through
613 <a class="message" href="#SCI_GETCHARACTERPOINTER">SCI_GETCHARACTERPOINTER</a>.
614 </p>
615 <code><a class="message" href="#SCI_FINDTEXT">SCI_FINDTEXT(int flags, Sci_TextToFind
616 *ttf)</a><br />
617 <a class="message" href="#SCI_SEARCHANCHOR">SCI_SEARCHANCHOR</a><br />
618 <a class="message" href="#SCI_SEARCHNEXT">SCI_SEARCHNEXT(int searchFlags, const char
619 *text)</a><br />
620 <a class="message" href="#SCI_SEARCHPREV">SCI_SEARCHPREV(int searchFlags, const char
621 *text)</a><br />
622 <a class="jump" href="#SearchAndReplaceUsingTheTarget">Search and replace using the
623 target</a><br />
624 </code>
626 <p><b id="searchFlags"><code>searchFlags</code></b><br />
627 Several of the search routines use flag options, which include a simple regular expression
628 search. Combine the flag options by adding them:</p>
630 <table border="0" summary="Search flags">
631 <tbody>
632 <tr>
633 <td><code>SCFIND_MATCHCASE</code></td>
635 <td>A match only occurs with text that matches the case of the search string.</td>
636 </tr>
638 <tr>
639 <td><code>SCFIND_WHOLEWORD</code></td>
641 <td>A match only occurs if the characters before and after are not word characters.</td>
642 </tr>
644 <tr>
645 <td><code>SCFIND_WORDSTART</code></td>
647 <td>A match only occurs if the character before is not a word character.</td>
648 </tr>
650 <tr>
651 <td><code>SCFIND_REGEXP</code></td>
653 <td>The search string should be interpreted as a regular expression.</td>
654 </tr>
655 <tr>
656 <td><code>SCFIND_POSIX</code></td>
658 <td>Treat regular expression in a more POSIX compatible manner
659 by interpreting bare ( and ) for tagged sections rather than \( and \).</td>
660 </tr>
661 </tbody>
662 </table>
664 <p>You can
665 search backwards to find the previous occurrence of a search string by setting the end of the
666 search range before the start.</p>
668 <p>In a regular expression, special characters interpreted are:</p>
670 <table border="0" summary="Regular expression synopsis">
671 <tbody>
672 <tr>
673 <td><code>.</code></td>
675 <td>Matches any character</td>
676 </tr>
678 <tr>
679 <td><code>\(</code></td>
681 <td>This marks the start of a region for tagging a match.</td>
682 </tr>
684 <tr>
685 <td><code>\)</code></td>
687 <td>This marks the end of a tagged region.</td>
688 </tr>
690 <tr>
691 <td><code>\n</code></td>
693 <td>Where <code>n</code> is 1 through 9 refers to the first through ninth tagged region
694 when replacing. For example, if the search string was <code>Fred\([1-9]\)XXX</code> and
695 the replace string was <code>Sam\1YYY</code>, when applied to <code>Fred2XXX</code> this
696 would generate <code>Sam2YYY</code>.
697 <code>\0</code> refers to all of the matching text.</td>
698 </tr>
700 <tr>
701 <td><code>\&lt;</code></td>
703 <td>This matches the start of a word using Scintilla's definitions of words.</td>
704 </tr>
706 <tr>
707 <td><code>\&gt;</code></td>
709 <td>This matches the end of a word using Scintilla's definition of words.</td>
710 </tr>
712 <tr>
713 <td><code>\x</code></td>
715 <td>This allows you to use a character x that would otherwise have a special meaning. For
716 example, \[ would be interpreted as [ and not as the start of a character set.</td>
717 </tr>
719 <tr>
720 <td><code>[...]</code></td>
722 <td>This indicates a set of characters, for example, [abc] means any of the characters a,
723 b or c. You can also use ranges, for example [a-z] for any lower case character.</td>
724 </tr>
726 <tr>
727 <td><code>[^...]</code></td>
729 <td>The complement of the characters in the set. For example, [^A-Za-z] means any
730 character except an alphabetic character.</td>
731 </tr>
733 <tr>
734 <td><code>^</code></td>
736 <td>This matches the start of a line (unless used inside a set, see above).</td>
737 </tr>
739 <tr>
740 <td><code>$</code></td>
742 <td>This matches the end of a line.</td>
743 </tr>
745 <tr>
746 <td><code>*</code></td>
748 <td>This matches 0 or more times. For example, <code>Sa*m</code> matches <code>Sm</code>,
749 <code>Sam</code>, <code>Saam</code>, <code>Saaam</code> and so on.</td>
750 </tr>
752 <tr>
753 <td><code>+</code></td>
755 <td>This matches 1 or more times. For example, <code>Sa+m</code> matches
756 <code>Sam</code>, <code>Saam</code>, <code>Saaam</code> and so on.</td>
757 </tr>
758 </tbody>
759 </table>
761 <p>Regular expressions will only match ranges within a single line, never matching over multiple lines.</p>
763 <p><b id="SCI_FINDTEXT">SCI_FINDTEXT(int searchFlags, <a class="jump"
764 href="#Sci_TextToFind">Sci_TextToFind</a> *ttf)</b><br />
765 This message searches for text in the document. It does not use or move the current selection.
766 The <a class="jump" href="#searchFlags"><code>searchFlags</code></a> argument controls the
767 search type, which includes regular expression searches.</p>
769 <p>The <code>Sci_TextToFind</code> structure is defined in <code>Scintilla.h</code>; set
770 <code>chrg.cpMin</code> and <code>chrg.cpMax</code> with the range of positions in the document
771 to search. You can search backwards by
772 setting <code>chrg.cpMax</code> less than <code>chrg.cpMin</code>.
773 Set the <code>lpstrText</code> member of <code>Sci_TextToFind</code> to point at a zero terminated
774 text string holding the search pattern. If your language makes the use of <code>Sci_TextToFind</code>
775 difficult, you should consider using <code>SCI_SEARCHINTARGET</code> instead.</p>
777 <p>The return value is -1 if the search fails or the position of the start of the found text if
778 it succeeds. The <code>chrgText.cpMin</code> and <code>chrgText.cpMax</code> members of
779 <code>Sci_TextToFind</code> are filled in with the start and end positions of the found text.</p>
781 <p>See also: <code><a class="message"
782 href="#SCI_SEARCHINTARGET">SCI_SEARCHINTARGET</a></code></p>
784 <p><b id="Sci_TextToFind">Sci_TextToFind</b><br />
785 This structure is defined to have exactly the same shape as the Win32 structure
786 <code>FINDTEXTEX</code> for old code that treated Scintilla as a RichEdit control.</p>
787 <pre>
788 struct Sci_TextToFind {
789 struct <a class="jump" href="#Sci_CharacterRange">Sci_CharacterRange</a> chrg; // range to search
790 const char *lpstrText; // the search pattern (zero terminated)
791 struct Sci_CharacterRange chrgText; // returned as position of matching text
793 </pre>
795 <p><b id="SCI_SEARCHANCHOR">SCI_SEARCHANCHOR</b><br />
796 <b id="SCI_SEARCHNEXT">SCI_SEARCHNEXT(int searchFlags, const char *text)</b><br />
797 <b id="SCI_SEARCHPREV">SCI_SEARCHPREV(int searchFlags, const char *text)</b><br />
798 These messages provide relocatable search support. This allows multiple incremental
799 interactive searches to be macro recorded while still setting the selection to found text so
800 the find/select operation is self-contained. These three messages send <a class="message"
801 href="#SCN_MACRORECORD"><code>SCN_MACRORECORD</code></a> <a class="jump"
802 href="#Notifications">notifications</a> if macro recording is enabled.</p>
804 <p><code>SCI_SEARCHANCHOR</code> sets the search start point used by
805 <code>SCI_SEARCHNEXT</code> and <code>SCI_SEARCHPREV</code> to the start of the current
806 selection, that is, the end of the selection that is nearer to the start of the document. You
807 should always call this before calling either of <code>SCI_SEARCHNEXT</code> or
808 <code>SCI_SEARCHPREV</code>.</p>
810 <p><code>SCI_SEARCHNEXT</code> and <code>SCI_SEARCHPREV</code> search for the next and previous
811 occurrence of the zero terminated search string pointed at by text. The search is modified by
812 the <a class="jump" href="#searchFlags"><code>searchFlags</code></a>. </p>
814 <p>The return value is -1 if nothing is found, otherwise the return value is the start position
815 of the matching text. The selection is updated to show the matched text, but is not scrolled
816 into view.</p>
818 <p>See also: <a class="message" href="#SCI_SEARCHINTARGET"><code>SCI_SEARCHINTARGET</code></a>,
819 <a class="message" href="#SCI_FINDTEXT"><code>SCI_FINDTEXT</code></a></p>
821 <h3 id="SearchAndReplaceUsingTheTarget">Search and replace using the target</h3>
823 <p>Using <a class="message" href="#SCI_REPLACESEL"><code>SCI_REPLACESEL</code></a>,
824 modifications cause scrolling and other visible changes, which may take some time and cause
825 unwanted display updates. If performing many changes, such as a replace all command, the target
826 can be used instead. First, set the target, ie. the range to be replaced. Then call
827 <code>SCI_REPLACETARGET</code> or <code>SCI_REPLACETARGETRE</code>.</p>
829 <p>Searching can be performed within the target range with <code>SCI_SEARCHINTARGET</code>,
830 which uses a counted string to allow searching for null characters. It returns the
831 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
832 <code>SCI_SEARCHINTARGET</code> such as <code>SCFIND_MATCHCASE</code>,
833 <code>SCFIND_WHOLEWORD</code>, <code>SCFIND_WORDSTART</code>, and <code>SCFIND_REGEXP</code>
834 can be set with <code>SCI_SETSEARCHFLAGS</code>. <code>SCI_SEARCHINTARGET</code> may be simpler
835 for some clients to use than <a class="message"
836 href="#SCI_FINDTEXT"><code>SCI_FINDTEXT</code></a>, as that requires using a pointer to a
837 structure.</p>
838 <code><a class="message" href="#SCI_SETTARGETSTART">SCI_SETTARGETSTART(int pos)</a><br />
839 <a class="message" href="#SCI_GETTARGETSTART">SCI_GETTARGETSTART</a><br />
840 <a class="message" href="#SCI_SETTARGETEND">SCI_SETTARGETEND(int pos)</a><br />
841 <a class="message" href="#SCI_GETTARGETEND">SCI_GETTARGETEND</a><br />
842 <a class="message" href="#SCI_TARGETFROMSELECTION">SCI_TARGETFROMSELECTION</a><br />
843 <a class="message" href="#SCI_SETSEARCHFLAGS">SCI_SETSEARCHFLAGS(int searchFlags)</a><br />
844 <a class="message" href="#SCI_GETSEARCHFLAGS">SCI_GETSEARCHFLAGS</a><br />
845 <a class="message" href="#SCI_SEARCHINTARGET">SCI_SEARCHINTARGET(int length, const char
846 *text)</a><br />
847 <a class="message" href="#SCI_REPLACETARGET">SCI_REPLACETARGET(int length, const char
848 *text)</a><br />
849 <a class="message" href="#SCI_REPLACETARGETRE">SCI_REPLACETARGETRE(int length, const char
850 *text)</a><br />
851 <a class="message" href="#SCI_GETTAG">SCI_GETTAG(int tagNumber, char *tagValue)</a><br />
852 </code>
854 <p><b id="SCI_SETTARGETSTART">SCI_SETTARGETSTART(int pos)</b><br />
855 <b id="SCI_GETTARGETSTART">SCI_GETTARGETSTART</b><br />
856 <b id="SCI_SETTARGETEND">SCI_SETTARGETEND(int pos)</b><br />
857 <b id="SCI_GETTARGETEND">SCI_GETTARGETEND</b><br />
858 These functions set and return the start and end of the target. When searching in non-regular
859 expression mode, you can set start greater than end to find the last matching text in the
860 target rather than the first matching text. The target is also set by a successful
861 <code>SCI_SEARCHINTARGET</code>.</p>
863 <p><b id="SCI_TARGETFROMSELECTION">SCI_TARGETFROMSELECTION</b><br />
864 Set the target start and end to the start and end positions of the selection.</p>
866 <p><b id="SCI_SETSEARCHFLAGS">SCI_SETSEARCHFLAGS(int searchFlags)</b><br />
867 <b id="SCI_GETSEARCHFLAGS">SCI_GETSEARCHFLAGS</b><br />
868 These get and set the <a class="jump" href="#searchFlags"><code>searchFlags</code></a> used by
869 <code>SCI_SEARCHINTARGET</code>. There are several option flags including a simple regular
870 expression search.</p>
872 <p><b id="SCI_SEARCHINTARGET">SCI_SEARCHINTARGET(int length, const char *text)</b><br />
873 This searches for the first occurrence of a text string in the target defined by
874 <code>SCI_SETTARGETSTART</code> and <code>SCI_SETTARGETEND</code>. The text string is not zero
875 terminated; the size is set by <code>length</code>. The search is modified by the search flags
876 set by <code>SCI_SETSEARCHFLAGS</code>. If the search succeeds, the target is set to the found
877 text and the return value is the position of the start of the matching text. If the search
878 fails, the result is -1.</p>
880 <p><b id="SCI_REPLACETARGET">SCI_REPLACETARGET(int length, const char *text)</b><br />
881 If <code>length</code> is -1, <code>text</code> is a zero terminated string, otherwise
882 <code>length</code> sets the number of character to replace the target with.
883 After replacement, the target range refers to the replacement text.
884 The return value
885 is the length of the replacement string.<br />
886 Note that the recommended way to delete text in the document is to set the target to the text to be removed,
887 and to perform a replace target with an empty string.</p>
889 <p><b id="SCI_REPLACETARGETRE">SCI_REPLACETARGETRE(int length, const char *text)</b><br />
890 This replaces the target using regular expressions. If <code>length</code> is -1,
891 <code>text</code> is a zero terminated string, otherwise <code>length</code> is the number of
892 characters to use. The replacement string is formed from the text string with any sequences of
893 <code>\1</code> through <code>\9</code> replaced by tagged matches from the most recent regular
894 expression search. <code>\0</code> is replaced with all the matched text from the most recent search.
895 After replacement, the target range refers to the replacement text.
896 The return value is the length of the replacement string.</p>
898 <p><b id="SCI_GETTAG">SCI_GETTAG(int tagNumber, char *tagValue)</b><br />
899 Discover what text was matched by tagged expressions in a regular expression search.
900 This is useful if the application wants to interpret the replacement string itself.</p>
902 <p>See also: <a class="message" href="#SCI_FINDTEXT"><code>SCI_FINDTEXT</code></a></p>
904 <h2 id="Overtype">Overtype</h2>
906 <p><b id="SCI_SETOVERTYPE">SCI_SETOVERTYPE(bool overType)</b><br />
907 <b id="SCI_GETOVERTYPE">SCI_GETOVERTYPE</b><br />
908 When overtype is enabled, each typed character replaces the character to the right of the text
909 caret. When overtype is disabled, characters are inserted at the caret.
910 <code>SCI_GETOVERTYPE</code> returns <code>TRUE</code> (1) if overtyping is active, otherwise
911 <code>FALSE</code> (0) will be returned. Use <code>SCI_SETOVERTYPE</code> to set the overtype
912 mode.</p>
914 <h2 id="CutCopyAndPaste">Cut, copy and paste</h2>
916 <code><a class="message" href="#SCI_CUT">SCI_CUT</a><br />
917 <a class="message" href="#SCI_COPY">SCI_COPY</a><br />
918 <a class="message" href="#SCI_PASTE">SCI_PASTE</a><br />
919 <a class="message" href="#SCI_CLEAR">SCI_CLEAR</a><br />
920 <a class="message" href="#SCI_CANPASTE">SCI_CANPASTE</a><br />
921 <a class="message" href="#SCI_COPYRANGE">SCI_COPYRANGE(int start, int end)</a><br />
922 <a class="message" href="#SCI_COPYTEXT">SCI_COPYTEXT(int length,
923 const char *text)</a><br />
924 <a class="message" href="#SCI_COPYALLOWLINE">SCI_COPYALLOWLINE</a><br />
925 <a class="message" href="#SCI_SETPASTECONVERTENDINGS">SCI_SETPASTECONVERTENDINGS(bool convert)</a><br />
926 <a class="message" href="#SCI_GETPASTECONVERTENDINGS">SCI_GETPASTECONVERTENDINGS</a><br />
927 </code>
929 <p><b id="SCI_CUT">SCI_CUT</b><br />
930 <b id="SCI_COPY">SCI_COPY</b><br />
931 <b id="SCI_PASTE">SCI_PASTE</b><br />
932 <b id="SCI_CLEAR">SCI_CLEAR</b><br />
933 <b id="SCI_CANPASTE">SCI_CANPASTE</b><br />
934 <b id="SCI_COPYALLOWLINE">SCI_COPYALLOWLINE</b><br />
935 These commands perform the standard tasks of cutting and copying data to the clipboard,
936 pasting from the clipboard into the document, and clearing the document.
937 <code>SCI_CANPASTE</code> returns non-zero if the document isn't read-only and if the selection
938 doesn't contain protected text. If you need a "can copy" or "can cut", use
939 <code>SCI_GETSELECTIONEMPTY()</code>, which will be zero if there are any non-empty
940 selection ranges implying that a copy or cut to the clipboard should work.</p>
942 <p>GTK+ does not really support <code>SCI_CANPASTE</code> and always returns <code>TRUE</code>
943 unless the document is read-only.</p>
945 <p>On X, the clipboard is asynchronous and may require several messages between
946 the destination and source applications. Data from SCI_PASTE will not arrive in the
947 document immediately.</p>
949 <p><code>SCI_COPYALLOWLINE</code> works the same as SCI_COPY except that if the
950 selection is empty then the current line is copied. On Windows, an extra "MSDEVLineSelect" marker
951 is added to the clipboard which is then used in <code>SCI_PASTE</code> to paste
952 the whole line before the current line.</p>
954 <b id="SCI_COPYRANGE">SCI_COPYRANGE(int start, int end)</b><br />
955 <b id="SCI_COPYTEXT">SCI_COPYTEXT(int length, const char *text)</b><br />
956 <p><code>SCI_COPYRANGE</code> copies a range of text from the document to
957 the system clipboard and <code>SCI_COPYTEXT</code> copies a supplied piece of
958 text to the system clipboard.</p>
960 <p><b id="SCI_SETPASTECONVERTENDINGS">SCI_SETPASTECONVERTENDINGS(bool convert)</b><br />
961 <b id="SCI_GETPASTECONVERTENDINGS">SCI_GETPASTECONVERTENDINGS</b><br />
962 If this property is set then when text is pasted any line ends are converted to match the document's
963 end of line mode as set with
964 <a class="message" href="#SCI_SETEOLMODE">SCI_SETEOLMODE</a>.
965 Defaults to true.</p>
967 <h2 id="ErrorHandling">Error handling</h2>
969 <p><b id="SCI_SETSTATUS">SCI_SETSTATUS(int status)</b><br />
970 <b id="SCI_GETSTATUS">SCI_GETSTATUS</b><br />
971 If an error occurs, Scintilla may set an internal error number that can be retrieved with
972 <code>SCI_GETSTATUS</code>.
973 To clear the error status call <code>SCI_SETSTATUS(0)</code>.
974 The currently defined statuses are:
975 </p>
977 <table cellpadding="1" cellspacing="2" border="0" summary="Status values">
978 <tbody valign="top">
979 <tr>
980 <th align="left">SC_STATUS_OK</th>
981 <td>0</td>
982 <td>No failures</td>
983 </tr>
985 <tr>
986 <th align="left">SC_STATUS_FAILURE</th>
987 <td>1</td>
988 <td>Generic failure</td>
989 </tr>
991 <tr>
992 <th align="left">SC_STATUS_BADALLOC</th>
993 <td>2</td>
994 <td>Memory is exhausted</td>
995 </tr>
997 </tbody>
998 </table>
1000 <h2 id="UndoAndRedo">Undo and Redo</h2>
1002 <p>Scintilla has multiple level undo and redo. It will continue to collect undoable actions
1003 until memory runs out. Scintilla saves actions that change the document. Scintilla does not
1004 save caret and selection movements, view scrolling and the like. Sequences of typing or
1005 deleting are compressed into single transactions to make it easier to undo and redo at a sensible
1006 level of detail. Sequences of actions can be combined into transactions that are undone as a unit.
1007 These sequences occur between <code>SCI_BEGINUNDOACTION</code> and
1008 <code>SCI_ENDUNDOACTION</code> messages. These transactions can be nested and only the top-level
1009 sequences are undone as units.</p>
1010 <code><a class="message" href="#SCI_UNDO">SCI_UNDO</a><br />
1011 <a class="message" href="#SCI_CANUNDO">SCI_CANUNDO</a><br />
1012 <a class="message" href="#SCI_EMPTYUNDOBUFFER">SCI_EMPTYUNDOBUFFER</a><br />
1013 <a class="message" href="#SCI_REDO">SCI_REDO</a><br />
1014 <a class="message" href="#SCI_CANREDO">SCI_CANREDO</a><br />
1015 <a class="message" href="#SCI_SETUNDOCOLLECTION">SCI_SETUNDOCOLLECTION(bool
1016 collectUndo)</a><br />
1017 <a class="message" href="#SCI_GETUNDOCOLLECTION">SCI_GETUNDOCOLLECTION</a><br />
1018 <a class="message" href="#SCI_BEGINUNDOACTION">SCI_BEGINUNDOACTION</a><br />
1019 <a class="message" href="#SCI_ENDUNDOACTION">SCI_ENDUNDOACTION</a><br />
1020 <a class="message" href="#SCI_ADDUNDOACTION">SCI_ADDUNDOACTION(int token, int flags)</a><br />
1021 </code>
1023 <p><b id="SCI_UNDO">SCI_UNDO</b><br />
1024 <b id="SCI_CANUNDO">SCI_CANUNDO</b><br />
1025 <code>SCI_UNDO</code> undoes one action, or if the undo buffer has reached a
1026 <code>SCI_ENDUNDOACTION</code> point, all the actions back to the corresponding
1027 <code>SCI_BEGINUNDOACTION</code>.</p>
1029 <p><code>SCI_CANUNDO</code> returns 0 if there is nothing to undo, and 1 if there is. You would
1030 typically use the result of this message to enable/disable the Edit menu Undo command.</p>
1032 <p><b id="SCI_REDO">SCI_REDO</b><br />
1033 <b id="SCI_CANREDO">SCI_CANREDO</b><br />
1034 <code>SCI_REDO</code> undoes the effect of the last <code>SCI_UNDO</code> operation.</p>
1036 <p><code>SCI_CANREDO</code> returns 0 if there is no action to redo and 1 if there are undo
1037 actions to redo. You could typically use the result of this message to enable/disable the Edit
1038 menu Redo command.</p>
1040 <p><b id="SCI_EMPTYUNDOBUFFER">SCI_EMPTYUNDOBUFFER</b><br />
1041 This command tells Scintilla to forget any saved undo or redo history. It also sets the save
1042 point to the start of the undo buffer, so the document will appear to be unmodified. This does
1043 not cause the <code><a class="message"
1044 href="#SCN_SAVEPOINTREACHED">SCN_SAVEPOINTREACHED</a></code> notification to be sent to the
1045 container.</p>
1047 <p>See also: <a class="message" href="#SCI_SETSAVEPOINT"><code>SCI_SETSAVEPOINT</code></a></p>
1049 <p><b id="SCI_SETUNDOCOLLECTION">SCI_SETUNDOCOLLECTION(bool collectUndo)</b><br />
1050 <b id="SCI_GETUNDOCOLLECTION">SCI_GETUNDOCOLLECTION</b><br />
1051 You can control whether Scintilla collects undo information with
1052 <code>SCI_SETUNDOCOLLECTION</code>. Pass in <code>true</code> (1) to collect information and
1053 <code>false</code> (0) to stop collecting. If you stop collection, you should also use
1054 <code>SCI_EMPTYUNDOBUFFER</code> to avoid the undo buffer being unsynchronized with the data in
1055 the buffer.</p>
1057 <p>You might wish to turn off saving undo information if you use the Scintilla to store text
1058 generated by a program (a Log view) or in a display window where text is often deleted and
1059 regenerated.</p>
1061 <p><b id="SCI_BEGINUNDOACTION">SCI_BEGINUNDOACTION</b><br />
1062 <b id="SCI_ENDUNDOACTION">SCI_ENDUNDOACTION</b><br />
1063 Send these two messages to Scintilla to mark the beginning and end of a set of operations that
1064 you want to undo all as one operation but that you have to generate as several operations.
1065 Alternatively, you can use these to mark a set of operations that you do not want to have
1066 combined with the preceding or following operations if they are undone.</p>
1068 <p><b id="SCI_ADDUNDOACTION">SCI_ADDUNDOACTION(int token, int flags)</b><br />
1069 The container can add its own actions into the undo stack by calling
1070 <code>SCI_ADDUNDOACTION</code> and an <code>SCN_MODIFIED</code>
1071 notification will be sent to the container with the
1072 <a class="message" href="#SC_MOD_CONTAINER"><code>SC_MOD_CONTAINER</code></a>
1073 flag when it is time to undo (<code>SC_PERFORMED_UNDO</code>) or
1074 redo (<code>SC_PERFORMED_REDO</code>) the action. The token argument supplied is
1075 returned in the <code>token</code> field of the notification.</p>
1076 <p>For example, if the container wanted to allow undo and redo of a 'toggle bookmark' command then
1077 it could call <code>SCI_ADDUNDOACTION(line, 0)</code> each time the command is performed.
1078 Then when it receives a notification to undo or redo it toggles a bookmark on the line given by
1079 the token field. If there are different types of commands or parameters that need to be stored into the undo
1080 stack then the container should maintain a stack of its own for the document and use the current
1081 position in that stack as the argument to <code>SCI_ADDUNDOACTION(line)</code>.
1082 <code>SCI_ADDUNDOACTION</code> commands are not combined together
1083 into a single undo transaction unless grouped with <code>SCI_BEGINUNDOACTION</code>
1084 and <code>SCI_ENDUNDOACTION</code>.</p>
1086 <p>The flags argument can be <code>UNDO_MAY_COALESCE</code> (1) if the container action may be
1087 coalesced along with any insertion and deletion actions into a single compound action, otherwise 0.
1088 Coalescing treats coalescible container actions as transparent so will still only group together insertions that
1089 look like typing or deletions that look like multiple uses of the Backspace or Delete keys.
1090 </p>
1091 <h2 id="SelectionAndInformation">Selection and information</h2>
1093 <p>Scintilla maintains a selection that stretches between two points, the anchor and the
1094 current position. If the anchor and the current position are the same, there is no selected
1095 text. Positions in the document range from 0 (before the first character), to the document size
1096 (after the last character). If you use messages, there is nothing to stop you setting a
1097 position that is in the middle of a CRLF pair, or in the middle of a 2 byte character. However,
1098 keyboard commands will not move the caret into such positions.</p>
1099 <code><a class="message" href="#SCI_GETTEXTLENGTH">SCI_GETTEXTLENGTH</a><br />
1100 <a class="message" href="#SCI_GETLENGTH">SCI_GETLENGTH</a><br />
1101 <a class="message" href="#SCI_GETLINECOUNT">SCI_GETLINECOUNT</a><br />
1102 <a class="message" href="#SCI_SETFIRSTVISIBLELINE">SCI_SETFIRSTVISIBLELINE(int lineDisplay)</a><br />
1103 <a class="message" href="#SCI_GETFIRSTVISIBLELINE">SCI_GETFIRSTVISIBLELINE</a><br />
1104 <a class="message" href="#SCI_LINESONSCREEN">SCI_LINESONSCREEN</a><br />
1105 <a class="message" href="#SCI_GETMODIFY">SCI_GETMODIFY</a><br />
1106 <a class="message" href="#SCI_SETSEL">SCI_SETSEL(int anchorPos, int currentPos)</a><br />
1107 <a class="message" href="#SCI_GOTOPOS">SCI_GOTOPOS(int position)</a><br />
1108 <a class="message" href="#SCI_GOTOLINE">SCI_GOTOLINE(int line)</a><br />
1109 <a class="message" href="#SCI_SETCURRENTPOS">SCI_SETCURRENTPOS(int position)</a><br />
1110 <a class="message" href="#SCI_GETCURRENTPOS">SCI_GETCURRENTPOS</a><br />
1111 <a class="message" href="#SCI_SETANCHOR">SCI_SETANCHOR(int position)</a><br />
1112 <a class="message" href="#SCI_GETANCHOR">SCI_GETANCHOR</a><br />
1113 <a class="message" href="#SCI_SETSELECTIONSTART">SCI_SETSELECTIONSTART(int position)</a><br />
1114 <a class="message" href="#SCI_GETSELECTIONSTART">SCI_GETSELECTIONSTART</a><br />
1115 <a class="message" href="#SCI_SETSELECTIONEND">SCI_SETSELECTIONEND(int position)</a><br />
1116 <a class="message" href="#SCI_GETSELECTIONEND">SCI_GETSELECTIONEND</a><br />
1117 <a class="message" href="#SCI_SETEMPTYSELECTION">SCI_SETEMPTYSELECTION(int pos)</a><br />
1118 <a class="message" href="#SCI_SELECTALL">SCI_SELECTALL</a><br />
1119 <a class="message" href="#SCI_LINEFROMPOSITION">SCI_LINEFROMPOSITION(int position)</a><br />
1120 <a class="message" href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(int line)</a><br />
1121 <a class="message" href="#SCI_GETLINEENDPOSITION">SCI_GETLINEENDPOSITION(int line)</a><br />
1122 <a class="message" href="#SCI_LINELENGTH">SCI_LINELENGTH(int line)</a><br />
1123 <a class="message" href="#SCI_GETCOLUMN">SCI_GETCOLUMN(int position)</a><br />
1124 <a class="message" href="#SCI_FINDCOLUMN">SCI_FINDCOLUMN(int line, int column)</a><br />
1125 <a class="message" href="#SCI_POSITIONFROMPOINT">SCI_POSITIONFROMPOINT(int x, int y)</a><br />
1126 <a class="message" href="#SCI_POSITIONFROMPOINTCLOSE">SCI_POSITIONFROMPOINTCLOSE(int x, int
1127 y)</a><br />
1128 <a class="message" href="#SCI_CHARPOSITIONFROMPOINT">SCI_CHARPOSITIONFROMPOINT(int x, int y)</a><br />
1129 <a class="message" href="#SCI_CHARPOSITIONFROMPOINTCLOSE">SCI_CHARPOSITIONFROMPOINTCLOSE(int x, int
1130 y)</a><br />
1131 <a class="message" href="#SCI_POINTXFROMPOSITION">SCI_POINTXFROMPOSITION(&lt;unused&gt;, int
1132 position)</a><br />
1133 <a class="message" href="#SCI_POINTYFROMPOSITION">SCI_POINTYFROMPOSITION(&lt;unused&gt;, int
1134 position)</a><br />
1135 <a class="message" href="#SCI_HIDESELECTION">SCI_HIDESELECTION(bool hide)</a><br />
1136 <a class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT(&lt;unused&gt;, char *text)</a><br />
1137 <a class="message" href="#SCI_GETCURLINE">SCI_GETCURLINE(int textLen, char *text)</a><br />
1138 <a class="message" href="#SCI_SELECTIONISRECTANGLE">SCI_SELECTIONISRECTANGLE</a><br />
1139 <a class="message" href="#SCI_SETSELECTIONMODE">SCI_SETSELECTIONMODE(int mode)</a><br />
1140 <a class="message" href="#SCI_GETSELECTIONMODE">SCI_GETSELECTIONMODE</a><br />
1141 <a class="message" href="#SCI_GETLINESELSTARTPOSITION">SCI_GETLINESELSTARTPOSITION(int line)</a><br />
1142 <a class="message" href="#SCI_GETLINESELENDPOSITION">SCI_GETLINESELENDPOSITION(int line)</a><br />
1143 <a class="message" href="#SCI_MOVECARETINSIDEVIEW">SCI_MOVECARETINSIDEVIEW</a><br />
1144 <a class="message" href="#SCI_WORDENDPOSITION">SCI_WORDENDPOSITION(int position, bool
1145 onlyWordCharacters)</a><br />
1146 <a class="message" href="#SCI_WORDSTARTPOSITION">SCI_WORDSTARTPOSITION(int position, bool
1147 onlyWordCharacters)</a><br />
1148 <a class="message" href="#SCI_POSITIONBEFORE">SCI_POSITIONBEFORE(int position)</a><br />
1149 <a class="message" href="#SCI_POSITIONAFTER">SCI_POSITIONAFTER(int position)</a><br />
1150 <a class="message" href="#SCI_POSITIONRELATIVE">SCI_POSITIONRELATIVE(int position, int relative)</a><br />
1151 <a class="message" href="#SCI_COUNTCHARACTERS">SCI_COUNTCHARACTERS(int startPos, int endPos)</a><br />
1152 <a class="message" href="#SCI_TEXTWIDTH">SCI_TEXTWIDTH(int styleNumber, const char *text)</a><br />
1153 <a class="message" href="#SCI_TEXTHEIGHT">SCI_TEXTHEIGHT(int line)</a><br />
1154 <a class="message" href="#SCI_CHOOSECARETX">SCI_CHOOSECARETX</a><br />
1155 <a class="message" href="#SCI_MOVESELECTEDLINESUP">SCI_MOVESELECTEDLINESUP</a><br />
1156 <a class="message" href="#SCI_MOVESELECTEDLINESDOWN">SCI_MOVESELECTEDLINESDOWN</a><br />
1157 <a class="message" href="#SCI_SETMOUSESELECTIONRECTANGULARSWITCH">SCI_SETMOUSESELECTIONRECTANGULARSWITCH(bool
1158 mouseSelectionRectangularSwitch)</a><br />
1159 <a class="message" href="#SCI_GETMOUSESELECTIONRECTANGULARSWITCH">SCI_GETMOUSESELECTIONRECTANGULARSWITCH</a><br />
1160 </code>
1162 <p><b id="SCI_GETTEXTLENGTH">SCI_GETTEXTLENGTH</b><br />
1163 <b id="SCI_GETLENGTH">SCI_GETLENGTH</b><br />
1164 Both these messages return the length of the document in bytes.</p>
1166 <p><b id="SCI_GETLINECOUNT">SCI_GETLINECOUNT</b><br />
1167 This returns the number of lines in the document. An empty document contains 1 line. A
1168 document holding only an end of line sequence has 2 lines.</p>
1170 <p><b id="SCI_SETFIRSTVISIBLELINE">SCI_SETFIRSTVISIBLELINE(int lineDisplay)</b><br />
1171 <b id="SCI_GETFIRSTVISIBLELINE">SCI_GETFIRSTVISIBLELINE</b><br />
1172 These messages retrieve and set the line number of the first visible line in the Scintilla view. The first line
1173 in the document is numbered 0. The value is a visible line rather than a document line.</p>
1175 <p><b id="SCI_LINESONSCREEN">SCI_LINESONSCREEN</b><br />
1176 This returns the number of complete lines visible on the screen. With a constant line height,
1177 this is the vertical space available divided by the line separation. Unless you arrange to size
1178 your window to an integral number of lines, there may be a partial line visible at the bottom
1179 of the view.</p>
1181 <p><b id="SCI_GETMODIFY">SCI_GETMODIFY</b><br />
1182 This returns non-zero if the document is modified and 0 if it is unmodified. The modified
1183 status of a document is determined by the undo position relative to the save point. The save
1184 point is set by <a class="message" href="#SCI_SETSAVEPOINT"><code>SCI_SETSAVEPOINT</code></a>,
1185 usually when you have saved data to a file.</p>
1187 <p>If you need to be notified when the document becomes modified, Scintilla notifies the
1188 container that it has entered or left the save point with the <a class="message"
1189 href="#SCN_SAVEPOINTREACHED"><code>SCN_SAVEPOINTREACHED</code></a> and <a class="message"
1190 href="#SCN_SAVEPOINTLEFT"><code>SCN_SAVEPOINTLEFT</code></a> <a class="jump"
1191 href="#Notifications">notification messages</a>.</p>
1193 <p><b id="SCI_SETSEL">SCI_SETSEL(int anchorPos, int currentPos)</b><br />
1194 This message sets both the anchor and the current position. If <code>currentPos</code> is
1195 negative, it means the end of the document. If <code>anchorPos</code> is negative, it means
1196 remove any selection (i.e. set the anchor to the same position as <code>currentPos</code>). The
1197 caret is scrolled into view after this operation.</p>
1199 <p><b id="SCI_GOTOPOS">SCI_GOTOPOS(int pos)</b><br />
1200 This removes any selection, sets the caret at <code>pos</code> and scrolls the view to make
1201 the caret visible, if necessary. It is equivalent to
1202 <code>SCI_SETSEL(pos, pos)</code>. The anchor position is set the same as the current
1203 position.</p>
1205 <p><b id="SCI_GOTOLINE">SCI_GOTOLINE(int line)</b><br />
1206 This removes any selection and sets the caret at the start of line number <code>line</code>
1207 and scrolls the view (if needed) to make it visible. The anchor position is set the same as the
1208 current position. If <code>line</code> is outside the lines in the document (first line is 0),
1209 the line set is the first or last.</p>
1211 <p><b id="SCI_SETCURRENTPOS">SCI_SETCURRENTPOS(int pos)</b><br />
1212 This sets the current position and creates a selection between the anchor and the current
1213 position. The caret is not scrolled into view.</p>
1215 <p>See also: <a class="message" href="#SCI_SCROLLCARET"><code>SCI_SCROLLCARET</code></a></p>
1217 <p><b id="SCI_GETCURRENTPOS">SCI_GETCURRENTPOS</b><br />
1218 This returns the current position.</p>
1220 <p><b id="SCI_SETANCHOR">SCI_SETANCHOR(int pos)</b><br />
1221 This sets the anchor position and creates a selection between the anchor position and the
1222 current position. The caret is not scrolled into view.</p>
1224 <p>See also: <a class="message" href="#SCI_SCROLLCARET"><code>SCI_SCROLLCARET</code></a></p>
1226 <p><b id="SCI_GETANCHOR">SCI_GETANCHOR</b><br />
1227 This returns the current anchor position.</p>
1229 <p><b id="SCI_SETSELECTIONSTART">SCI_SETSELECTIONSTART(int pos)</b><br />
1230 <b id="SCI_SETSELECTIONEND">SCI_SETSELECTIONEND(int pos)</b><br />
1231 These set the selection based on the assumption that the anchor position is less than the
1232 current position. They do not make the caret visible. The table shows the positions of the
1233 anchor and the current position after using these messages.</p>
1235 <table cellpadding="3" cellspacing="0" border="1" summary="SetSelection caret positioning">
1236 <thead align="center">
1237 <tr>
1238 <th>
1239 </th>
1241 <th>anchor</th>
1243 <th>current</th>
1244 </tr>
1245 </thead>
1247 <tbody align="center">
1248 <tr>
1249 <th><code>SCI_SETSELECTIONSTART</code></th>
1251 <td><code>pos</code></td>
1253 <td><code>Max(pos, current)</code></td>
1254 </tr>
1256 <tr>
1257 <th><code>SCI_SETSELECTIONEND</code></th>
1259 <td><code>Min(anchor, pos)</code></td>
1261 <td><code>pos</code></td>
1262 </tr>
1263 </tbody>
1264 </table>
1266 <p>See also: <a class="message" href="#SCI_SCROLLCARET"><code>SCI_SCROLLCARET</code></a></p>
1268 <p><b id="SCI_GETSELECTIONSTART">SCI_GETSELECTIONSTART</b><br />
1269 <b id="SCI_GETSELECTIONEND">SCI_GETSELECTIONEND</b><br />
1270 These return the start and end of the selection without regard to which end is the current
1271 position and which is the anchor. <code>SCI_GETSELECTIONSTART</code> returns the smaller of the
1272 current position or the anchor position. <code>SCI_GETSELECTIONEND</code> returns the larger of
1273 the two values.</p>
1275 <p><b id="SCI_SETEMPTYSELECTION">SCI_SETEMPTYSELECTION(int pos)</b><br />
1276 This removes any selection and sets the caret at <code>pos</code>. The caret is not scrolled into view.</p>
1278 <p><b id="SCI_SELECTALL">SCI_SELECTALL</b><br />
1279 This selects all the text in the document. The current position is not scrolled into view.</p>
1281 <p><b id="SCI_LINEFROMPOSITION">SCI_LINEFROMPOSITION(int pos)</b><br />
1282 This message returns the line that contains the position <code>pos</code> in the document. The
1283 return value is 0 if <code>pos</code> &lt;= 0. The return value is the last line if
1284 <code>pos</code> is beyond the end of the document.</p>
1286 <p><b id="SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(int line)</b><br />
1287 This returns the document position that corresponds with the start of the line. If
1288 <code>line</code> is negative, the position of the line holding the start of the selection is
1289 returned. If <code>line</code> is greater than the lines in the document, the return value is
1290 -1. If <code>line</code> is equal to the number of lines in the document (i.e. 1 line past the
1291 last line), the return value is the end of the document.</p>
1293 <p><b id="SCI_GETLINEENDPOSITION">SCI_GETLINEENDPOSITION(int line)</b><br />
1294 This returns the position at the end of the line, before any line end characters. If <code>line</code>
1295 is the last line in the document (which does not have any end of line characters) or greater,
1296 the result is the size of the document.
1297 If <code>line</code> is negative the result is undefined.</p>
1299 <p><b id="SCI_LINELENGTH">SCI_LINELENGTH(int line)</b><br />
1300 This returns the length of the line, including any line end characters. If <code>line</code>
1301 is negative or beyond the last line in the document, the result is 0. If you want the length of
1302 the line not including any end of line characters, use <a class="message"
1303 href="#SCI_GETLINEENDPOSITION"><code>SCI_GETLINEENDPOSITION(line)</code></a> - <a class="message"
1304 href="#SCI_POSITIONFROMLINE"><code>SCI_POSITIONFROMLINE(line)</code></a>.</p>
1306 <p><b id="SCI_GETSELTEXT">SCI_GETSELTEXT(&lt;unused&gt;, char *text)</b><br />
1307 This copies the currently selected text and a terminating 0 byte to the <code>text</code>
1308 buffer. The buffer size should be determined by calling with a NULL pointer for the <code>text</code> argument
1309 <code>SCI_GETSELTEXT(0,0)</code>.
1310 This allows for rectangular and discontiguous selections as well as simple selections.
1311 See <a class="toc" href="#MultipleSelectionAndVirtualSpace">Multiple Selection</a> for information on
1312 how multiple and rectangular selections and virtual space are copied.</p>
1314 <p>See also: <code><a class="message" href="#SCI_GETCURLINE">SCI_GETCURLINE</a>,
1315 <a class="message" href="#SCI_GETLINE">SCI_GETLINE</a>,
1316 <a class="message" href="#SCI_GETTEXT">SCI_GETTEXT</a>,
1317 <a class="message" href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>,
1318 <a class="message" href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a>
1319 </code></p>
1321 <p><b id="SCI_GETCURLINE">SCI_GETCURLINE(int textLen, char *text)</b><br />
1322 This retrieves the text of the line containing the caret and returns the position within the
1323 line of the caret. Pass in <code>char* text</code> pointing at a buffer large enough to hold
1324 the text you wish to retrieve and a terminating 0 character.
1325 Set <code>textLen</code> to the
1326 length of the buffer which must be at least 1 to hold the terminating 0 character.
1327 If the text argument is 0 then the length that should be allocated
1328 to store the entire current line is returned.</p>
1330 <p>See also: <code><a class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>, <a
1331 class="message" href="#SCI_GETLINE">SCI_GETLINE</a>, <a class="message"
1332 href="#SCI_GETTEXT">SCI_GETTEXT</a>, <a class="message"
1333 href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>, <a class="message"
1334 href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a></code></p>
1336 <p><b id="SCI_SELECTIONISRECTANGLE">SCI_SELECTIONISRECTANGLE</b><br />
1337 This returns 1 if the current selection is in rectangle mode, 0 if not.</p>
1339 <p><b id="SCI_SETSELECTIONMODE">SCI_SETSELECTIONMODE(int mode)</b><br />
1340 <b id="SCI_GETSELECTIONMODE">SCI_GETSELECTIONMODE</b><br />
1341 The two functions set and get the selection mode, which can be
1342 stream (<code>SC_SEL_STREAM</code>=0) or
1343 rectangular (<code>SC_SEL_RECTANGLE</code>=1) or
1344 by lines (<code>SC_SEL_LINES</code>=2)
1345 or thin rectangular (<code>SC_SEL_THIN</code>=3).
1346 When set in these modes, regular caret moves will extend or reduce the selection,
1347 until the mode is cancelled by a call with same value or with <code>SCI_CANCEL</code>.
1348 The get function returns the current mode even if the selection was made by mouse
1349 or with regular extended moves.
1350 <code>SC_SEL_THIN</code> is the mode after a rectangular selection has been typed into and ensures
1351 that no characters are selected.</p>
1353 <p><b id="SCI_GETLINESELSTARTPOSITION">SCI_GETLINESELSTARTPOSITION(int line)</b><br />
1354 <b id="SCI_GETLINESELENDPOSITION">SCI_GETLINESELENDPOSITION(int line)</b><br />
1355 Retrieve the position of the start and end of the selection at the given line with
1356 <code>INVALID_POSITION</code> returned if no selection on this line.</p>
1358 <p><b id="SCI_MOVECARETINSIDEVIEW">SCI_MOVECARETINSIDEVIEW</b><br />
1359 If the caret is off the top or bottom of the view, it is moved to the nearest line that is
1360 visible to its current position. Any selection is lost.</p>
1362 <p><b id="SCI_WORDENDPOSITION">SCI_WORDENDPOSITION(int position, bool
1363 onlyWordCharacters)</b><br />
1364 <b id="SCI_WORDSTARTPOSITION">SCI_WORDSTARTPOSITION(int position, bool
1365 onlyWordCharacters)</b><br />
1366 These messages return the start and end of words using the same definition of words as used
1367 internally within Scintilla. You can set your own list of characters that count as words with
1368 <a class="message" href="#SCI_SETWORDCHARS"><code>SCI_SETWORDCHARS</code></a>. The position
1369 sets the start or the search, which is forwards when searching for the end and backwards when
1370 searching for the start.</p>
1372 <p>Set <code>onlyWordCharacters</code> to <code>true</code> (1) to stop searching at the first
1373 non-word character in the search direction. If <code>onlyWordCharacters</code> is
1374 <code>false</code> (0), the first character in the search direction sets the type of the search
1375 as word or non-word and the search stops at the first non-matching character. Searches are also
1376 terminated by the start or end of the document.</p>
1378 <p>If "w" represents word characters and "." represents non-word characters and "|" represents
1379 the position and <code>true</code> or <code>false</code> is the state of
1380 <code>onlyWordCharacters</code>:</p>
1382 <table cellpadding="3" cellspacing="0" border="1" summary="Word start and end positions">
1383 <thead align="center">
1384 <tr>
1385 <th>Initial state</th>
1387 <th>end, true</th>
1389 <th>end, false</th>
1391 <th>start, true</th>
1393 <th>start, false</th>
1394 </tr>
1395 </thead>
1397 <tbody align="center">
1398 <tr>
1399 <td>..ww..|..ww..</td>
1401 <td>..ww..|..ww..</td>
1403 <td>..ww....|ww..</td>
1405 <td>..ww..|..ww..</td>
1407 <td>..ww|....ww..</td>
1408 </tr>
1410 <tr>
1411 <td>....ww|ww....</td>
1413 <td>....wwww|....</td>
1415 <td>....wwww|....</td>
1417 <td>....|wwww....</td>
1419 <td>....|wwww....</td>
1420 </tr>
1422 <tr>
1423 <td>..ww|....ww..</td>
1425 <td>..ww|....ww..</td>
1427 <td>..ww....|ww..</td>
1429 <td>..|ww....ww..</td>
1431 <td>..|ww....ww..</td>
1432 </tr>
1434 <tr>
1435 <td>..ww....|ww..</td>
1437 <td>..ww....ww|..</td>
1439 <td>..ww....ww|..</td>
1441 <td>..ww....|ww..</td>
1443 <td>..ww|....ww..</td>
1444 </tr>
1445 </tbody>
1446 </table>
1448 <p><b id="SCI_POSITIONBEFORE">SCI_POSITIONBEFORE(int position)</b><br />
1449 <b id="SCI_POSITIONAFTER">SCI_POSITIONAFTER(int position)</b><br />
1450 These messages return the position before and after another position
1451 in the document taking into account the current code page. The minimum
1452 position returned is 0 and the maximum is the last position in the document.
1453 If called with a position within a multi byte character will return the position
1454 of the start/end of that character.</p>
1456 <p><b id="SCI_POSITIONRELATIVE">SCI_POSITIONRELATIVE(int position, int relative)</b><br />
1457 Count a number of whole characters before or after the argument position and return that position.
1458 The minimum position returned is 0 and the maximum is the last position in the document.
1459 </p>
1461 <p><b id="SCI_COUNTCHARACTERS">SCI_COUNTCHARACTERS(int startPos, int endPos)</b><br />
1462 Returns the number of whole characters between two positions..</p>
1464 <p><b id="SCI_TEXTWIDTH">SCI_TEXTWIDTH(int styleNumber, const char *text)</b><br />
1465 This returns the pixel width of a string drawn in the given <code>styleNumber</code> which can
1466 be used, for example, to decide how wide to make the line number margin in order to display a
1467 given number of numerals.</p>
1469 <p><b id="SCI_TEXTHEIGHT">SCI_TEXTHEIGHT(int line)</b><br />
1470 This returns the height in pixels of a particular line. Currently all lines are the same
1471 height.</p>
1473 <p><b id="SCI_GETCOLUMN">SCI_GETCOLUMN(int pos)</b><br />
1474 This message returns the column number of a position <code>pos</code> within the document
1475 taking the width of tabs into account. This returns the column number of the last tab on the
1476 line before <code>pos</code>, plus the number of characters between the last tab and
1477 <code>pos</code>. If there are no tab characters on the line, the return value is the number of
1478 characters up to the position on the line. In both cases, double byte characters count as a
1479 single character. This is probably only useful with monospaced fonts.</p>
1481 <p><b id="SCI_FINDCOLUMN">SCI_FINDCOLUMN(int line, int column)</b><br />
1482 This message returns the position of a <code>column</code> on a <code>line</code>
1483 taking the width of tabs into account. It treats a multi-byte character as a single column.
1484 Column numbers, like lines start at 0.</p>
1486 <p><b id="SCI_POSITIONFROMPOINT">SCI_POSITIONFROMPOINT(int x, int y)</b><br />
1487 <b id="SCI_POSITIONFROMPOINTCLOSE">SCI_POSITIONFROMPOINTCLOSE(int x, int y)</b><br />
1488 <code>SCI_POSITIONFROMPOINT</code> finds the closest character position to a point and
1489 <code>SCI_POSITIONFROMPOINTCLOSE</code> is similar but returns -1 if the point is outside the
1490 window or not close to any characters.</p>
1492 <p><b id="SCI_CHARPOSITIONFROMPOINT">SCI_CHARPOSITIONFROMPOINT(int x, int y)</b><br />
1493 <b id="SCI_CHARPOSITIONFROMPOINTCLOSE">SCI_CHARPOSITIONFROMPOINTCLOSE(int x, int y)</b><br />
1494 <code>SCI_CHARPOSITIONFROMPOINT</code> finds the closest character to a point and
1495 <code>SCI_CHARPOSITIONFROMPOINTCLOSE</code> is similar but returns -1 if the point is outside the
1496 window or not close to any characters. This is similar to the previous methods but finds characters rather than
1497 inter-character positions.</p>
1499 <p><b id="SCI_POINTXFROMPOSITION">SCI_POINTXFROMPOSITION(&lt;unused&gt;, int pos)</b><br />
1500 <b id="SCI_POINTYFROMPOSITION">SCI_POINTYFROMPOSITION(&lt;unused&gt;, int pos)</b><br />
1501 These messages return the x and y display pixel location of text at position <code>pos</code>
1502 in the document.</p>
1504 <p><b id="SCI_HIDESELECTION">SCI_HIDESELECTION(bool hide)</b><br />
1505 The normal state is to make the selection visible by drawing it as set by <a class="message"
1506 href="#SCI_SETSELFORE"><code>SCI_SETSELFORE</code></a> and <a class="message"
1507 href="#SCI_SETSELBACK"><code>SCI_SETSELBACK</code></a>. However, if you hide the selection, it
1508 is drawn as normal text.</p>
1510 <p><b id="SCI_CHOOSECARETX">SCI_CHOOSECARETX</b><br />
1511 Scintilla remembers the x value of the last position horizontally moved to explicitly by the
1512 user and this value is then used when moving vertically such as by using the up and down keys.
1513 This message sets the current x position of the caret as the remembered value.</p>
1515 <p><b id="SCI_MOVESELECTEDLINESUP">SCI_MOVESELECTEDLINESUP</b><br />
1516 Move the selected lines up one line, shifting the line above after the selection.
1517 The selection will be automatically extended to the beginning of the selection's first line and the end of the seletion's last line.
1518 If nothing was selected, the line the cursor is currently at will be selected.</p>
1520 <p><b id="SCI_MOVESELECTEDLINESDOWN">SCI_MOVESELECTEDLINESDOWN</b><br />
1521 Move the selected lines down one line, shifting the line below before the selection.
1522 The selection will be automatically extended to the beginning of the selection's first line and the end of the seletion's last line.
1523 If nothing was selected, the line the cursor is currently at will be selected.</p>
1525 <p><b id="SCI_SETMOUSESELECTIONRECTANGULARSWITCH">SCI_SETMOUSESELECTIONRECTANGULARSWITCH(bool
1526 mouseSelectionRectangularSwitch)</b><br />
1527 <b id="SCI_GETMOUSESELECTIONRECTANGULARSWITCH">SCI_GETMOUSESELECTIONRECTANGULARSWITCH</b><br />
1528 Enable or disable the ability to switch to rectangular selection mode while making a selection with the mouse.
1529 When this option is turned on, mouse selections in stream mode can be switched to rectangular mode by pressing
1530 the corresponding modifier key. They then stick to rectangular mode even when the modifier key is released again.
1531 When this option is turned off, mouse selections will always stick to the mode the selection was started in. It
1532 is off by default.</p>
1534 <h2 id="MultipleSelectionAndVirtualSpace">Multiple Selection and Virtual Space</h2>
1536 <code>
1537 <a class="message" href="#SCI_SETMULTIPLESELECTION">SCI_SETMULTIPLESELECTION(bool multipleSelection)</a><br />
1538 <a class="message" href="#SCI_GETMULTIPLESELECTION">SCI_GETMULTIPLESELECTION</a><br />
1539 <a class="message" href="#SCI_SETADDITIONALSELECTIONTYPING">SCI_SETADDITIONALSELECTIONTYPING(bool additionalSelectionTyping)</a><br />
1540 <a class="message" href="#SCI_GETADDITIONALSELECTIONTYPING">SCI_GETADDITIONALSELECTIONTYPING</a><br />
1541 <a class="message" href="#SCI_SETMULTIPASTE">SCI_SETMULTIPASTE(int multiPaste)</a><br />
1542 <a class="message" href="#SCI_GETMULTIPASTE">SCI_GETMULTIPASTE</a><br />
1543 <a class="message" href="#SCI_SETVIRTUALSPACEOPTIONS">SCI_SETVIRTUALSPACEOPTIONS(int virtualSpaceOptions)</a><br />
1544 <a class="message" href="#SCI_GETVIRTUALSPACEOPTIONS">SCI_GETVIRTUALSPACEOPTIONS</a><br />
1545 <a class="message" href="#SCI_SETRECTANGULARSELECTIONMODIFIER">SCI_SETRECTANGULARSELECTIONMODIFIER(int modifier)</a><br />
1546 <a class="message" href="#SCI_GETRECTANGULARSELECTIONMODIFIER">SCI_GETRECTANGULARSELECTIONMODIFIER</a><br />
1547 <br />
1549 <a class="message" href="#SCI_GETSELECTIONS">SCI_GETSELECTIONS</a><br />
1550 <a class="message" href="#SCI_GETSELECTIONEMPTY">SCI_GETSELECTIONEMPTY</a><br />
1551 <a class="message" href="#SCI_CLEARSELECTIONS">SCI_CLEARSELECTIONS</a><br />
1552 <a class="message" href="#SCI_SETSELECTION">SCI_SETSELECTION(int caret, int anchor)</a><br />
1553 <a class="message" href="#SCI_ADDSELECTION">SCI_ADDSELECTION(int caret, int anchor)</a><br />
1554 <a class="message" href="#SCI_DROPSELECTIONN">SCI_DROPSELECTIONN(int selection)</a><br />
1555 <a class="message" href="#SCI_SETMAINSELECTION">SCI_SETMAINSELECTION(int selection)</a><br />
1556 <a class="message" href="#SCI_GETMAINSELECTION">SCI_GETMAINSELECTION</a><br />
1557 <br />
1559 <a class="message" href="#SCI_SETSELECTIONNCARET">SCI_SETSELECTIONNCARET(int selection, int pos)</a><br />
1560 <a class="message" href="#SCI_GETSELECTIONNCARET">SCI_GETSELECTIONNCARET(int selection)</a><br />
1561 <a class="message" href="#SCI_SETSELECTIONNCARETVIRTUALSPACE">SCI_SETSELECTIONNCARETVIRTUALSPACE(int selection, int space)</a><br />
1562 <a class="message" href="#SCI_GETSELECTIONNCARETVIRTUALSPACE">SCI_GETSELECTIONNCARETVIRTUALSPACE(int selection)</a><br />
1563 <a class="message" href="#SCI_SETSELECTIONNANCHOR">SCI_SETSELECTIONNANCHOR(int selection, int posAnchor)</a><br />
1564 <a class="message" href="#SCI_GETSELECTIONNANCHOR">SCI_GETSELECTIONNANCHOR(int selection)</a><br />
1565 <a class="message" href="#SCI_SETSELECTIONNANCHORVIRTUALSPACE">SCI_SETSELECTIONNANCHORVIRTUALSPACE(int selection, int space)</a><br />
1566 <a class="message" href="#SCI_GETSELECTIONNANCHORVIRTUALSPACE">SCI_GETSELECTIONNANCHORVIRTUALSPACE(int selection)</a><br />
1567 <a class="message" href="#SCI_SETSELECTIONNSTART">SCI_SETSELECTIONNSTART(int selection, int pos)</a><br />
1568 <a class="message" href="#SCI_GETSELECTIONNSTART">SCI_GETSELECTIONNSTART(int selection)</a><br />
1569 <a class="message" href="#SCI_SETSELECTIONNEND">SCI_SETSELECTIONNEND(int selection, int pos)</a><br />
1570 <a class="message" href="#SCI_GETSELECTIONNEND">SCI_GETSELECTIONNEND(int selection)</a><br />
1571 <br />
1573 <a class="message" href="#SCI_SETRECTANGULARSELECTIONCARET">SCI_SETRECTANGULARSELECTIONCARET(int pos)</a><br />
1574 <a class="message" href="#SCI_GETRECTANGULARSELECTIONCARET">SCI_GETRECTANGULARSELECTIONCARET</a><br />
1575 <a class="message" href="#SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE">SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE(int space)</a><br />
1576 <a class="message" href="#SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE">SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE</a><br />
1577 <a class="message" href="#SCI_SETRECTANGULARSELECTIONANCHOR">SCI_SETRECTANGULARSELECTIONANCHOR(int posAnchor)</a><br />
1578 <a class="message" href="#SCI_GETRECTANGULARSELECTIONANCHOR">SCI_GETRECTANGULARSELECTIONANCHOR</a><br />
1579 <a class="message" href="#SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE">SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE(int space)</a><br />
1580 <a class="message" href="#SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE">SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE</a><br />
1581 <br />
1583 <a class="message" href="#SCI_SETADDITIONALSELALPHA">SCI_SETADDITIONALSELALPHA(int alpha)</a><br />
1584 <a class="message" href="#SCI_GETADDITIONALSELALPHA">SCI_GETADDITIONALSELALPHA</a><br />
1585 <a class="message" href="#SCI_SETADDITIONALSELFORE">SCI_SETADDITIONALSELFORE(int colour)</a><br />
1586 <a class="message" href="#SCI_SETADDITIONALSELBACK">SCI_SETADDITIONALSELBACK(int colour)</a><br />
1587 <a class="message" href="#SCI_SETADDITIONALCARETFORE">SCI_SETADDITIONALCARETFORE(int colour)</a><br />
1588 <a class="message" href="#SCI_GETADDITIONALCARETFORE">SCI_GETADDITIONALCARETFORE</a><br />
1589 <a class="message" href="#SCI_SETADDITIONALCARETSBLINK">SCI_SETADDITIONALCARETSBLINK(bool additionalCaretsBlink)</a><br />
1590 <a class="message" href="#SCI_GETADDITIONALCARETSBLINK">SCI_GETADDITIONALCARETSBLINK</a><br />
1591 <a class="message" href="#SCI_SETADDITIONALCARETSVISIBLE">SCI_SETADDITIONALCARETSVISIBLE(bool additionalCaretsVisible)</a><br />
1592 <a class="message" href="#SCI_GETADDITIONALCARETSVISIBLE">SCI_GETADDITIONALCARETSVISIBLE</a><br />
1593 <br />
1595 <a class="message" href="#SCI_SWAPMAINANCHORCARET">SCI_SWAPMAINANCHORCARET</a><br />
1596 <a class="message" href="#SCI_ROTATESELECTION">SCI_ROTATESELECTION</a><br />
1597 </code>
1600 There may be multiple selections active at one time.
1601 More selections are made by holding down the Ctrl key while dragging with the mouse.
1602 The most recent selection is the main selection and determines which part of the document is shown automatically.
1603 Any selection apart from the main selection is called an additional selection.
1604 The calls in the previous section operate on the main selection.
1605 There is always at least one selection.
1606 </p>
1609 Rectangular selections are handled as multiple selections although the original rectangular range is remembered so that
1610 subsequent operations may be handled differently for rectangular selections. For example, pasting a rectangular selection
1611 places each piece in a vertical column.
1612 </p>
1615 Virtual space is space beyond the end of each line. The caret may be moved into virtual space but no real space will be
1616 added to the document until there is some text typed or some other text insertion command is used.
1617 </p>
1619 <p>When discontiguous selections are copied to the clipboard, each selection is added to the clipboard text
1620 in order with no delimiting characters.
1621 For rectangular selections the document's line end is added after each line's text. Rectangular selections
1622 are always copied from top line to bottom, not in the in order of selection.Virtual space is not copied.</p>
1625 <b id="SCI_SETMULTIPLESELECTION">SCI_SETMULTIPLESELECTION(bool multipleSelection)</b><br />
1626 <b id="SCI_GETMULTIPLESELECTION">SCI_GETMULTIPLESELECTION</b><br />
1627 Enable or disable multiple selection. When multiple selection is disabled, it is not possible to select
1628 multiple ranges by holding down the Ctrl key while dragging with the mouse.</p>
1631 <b id="SCI_SETADDITIONALSELECTIONTYPING">SCI_SETADDITIONALSELECTIONTYPING(bool additionalSelectionTyping)</b><br />
1632 <b id="SCI_GETADDITIONALSELECTIONTYPING">SCI_GETADDITIONALSELECTIONTYPING</b><br />
1633 Whether typing, backspace, or delete works with multiple selections simultaneously.</p>
1636 <b id="SCI_SETMULTIPASTE">SCI_SETMULTIPASTE(int multiPaste)</b><br />
1637 <b id="SCI_GETMULTIPASTE">SCI_GETMULTIPASTE</b><br />
1638 When pasting into multiple selections, the pasted text can go into just the main selection with <code>SC_MULTIPASTE_ONCE</code>=0
1639 or into each selection with <code>SC_MULTIPASTE_EACH</code>=1. <code>SC_MULTIPASTE_ONCE</code> is the default.</p>
1642 <b id="SCI_SETVIRTUALSPACEOPTIONS">SCI_SETVIRTUALSPACEOPTIONS(int virtualSpace)</b><br />
1643 <b id="SCI_GETVIRTUALSPACEOPTIONS">SCI_GETVIRTUALSPACEOPTIONS</b><br />
1644 Virtual space can be enabled or disabled for rectangular selections or in other circumstances or in both.
1645 There are two bit flags <code>SCVS_RECTANGULARSELECTION</code>=1 and
1646 <code>SCVS_USERACCESSIBLE</code>=2 which can be set independently.
1647 <code>SCVS_NONE</code>=0, the default, disables all use of virtual space.</p>
1650 <b id="SCI_SETRECTANGULARSELECTIONMODIFIER">SCI_SETRECTANGULARSELECTIONMODIFIER(int modifier)</b><br />
1651 <b id="SCI_GETRECTANGULARSELECTIONMODIFIER">SCI_GETRECTANGULARSELECTIONMODIFIER</b><br />
1652 On GTK+, the key used to indicate that a rectangular selection should be created when combined with a mouse drag can be set.
1653 The three possible values are <code>SCMOD_CTRL</code>=2 (default), <code>SCMOD_ALT</code>=4 or <code>SCMOD_SUPER</code>=8.
1654 Since <code>SCMOD_ALT</code> is often already used by a window manager, the window manager may need configuring to allow this choice.
1655 <code>SCMOD_SUPER</code> is often a system dependent modifier key such as the Left Windows key on a Windows keyboard or the
1656 Command key on a Mac.</p>
1659 <b id="SCI_GETSELECTIONS">SCI_GETSELECTIONS</b><br />
1660 Return the number of selections currently active.</p>
1663 <b id="SCI_GETSELECTIONEMPTY">SCI_GETSELECTIONEMPTY</b><br />
1664 Return 1 if every selected range is empty else 0.</p>
1667 <b id="SCI_CLEARSELECTIONS">SCI_CLEARSELECTIONS</b><br />
1668 Set a single empty selection at 0 as the only selection.</p>
1671 <b id="SCI_SETSELECTION">SCI_SETSELECTION(int caret, int anchor)</b><br />
1672 Set a single selection from <code>anchor</code> to <code>caret</code> as the only selection.</p>
1675 <b id="SCI_ADDSELECTION">SCI_ADDSELECTION(int caret, int anchor)</b><br />
1676 Add a new selection from <code>anchor</code> to <code>caret</code> as the main selection retaining all other
1677 selections as additional selections.
1678 Since there is always at least one selection, to set a list of selections, the first selection should be
1679 added with <code>SCI_SETSELECTION</code> and later selections added with <code>SCI_ADDSELECTION</code></p>
1682 <b id="SCI_DROPSELECTIONN">SCI_DROPSELECTIONN(int selection)</b><br />
1683 If there are multiple selections, remove the indicated selection.
1684 If this was the main selection then make the previous selection the main and if it was the first then the last selection becomes main.
1685 If there is only one selection, or there is no selection <code>selection</code>, then there is no effect.</p>
1688 <b id="SCI_SETMAINSELECTION">SCI_SETMAINSELECTION(int selection)</b><br />
1689 <b id="SCI_GETMAINSELECTION">SCI_GETMAINSELECTION</b><br />
1690 One of the selections is the main selection which is used to determine what range of text is automatically visible.
1691 The main selection may be displayed in different colours or with a differently styled caret.
1692 Only an already existing selection can be made main.</p>
1695 <b id="SCI_SETSELECTIONNCARET">SCI_SETSELECTIONNCARET(int selection, int pos)</b><br />
1696 <b id="SCI_GETSELECTIONNCARET">SCI_GETSELECTIONNCARET(int selection)</b><br />
1697 <b id="SCI_SETSELECTIONNCARETVIRTUALSPACE">SCI_SETSELECTIONNCARETVIRTUALSPACE(int selection, int space)</b><br />
1698 <b id="SCI_GETSELECTIONNCARETVIRTUALSPACE">SCI_GETSELECTIONNCARETVIRTUALSPACE(int selection)</b><br />
1699 <b id="SCI_SETSELECTIONNANCHOR">SCI_SETSELECTIONNANCHOR(int selection, int posAnchor)</b><br />
1700 <b id="SCI_GETSELECTIONNANCHOR">SCI_GETSELECTIONNANCHOR(int selection)</b><br />
1701 <b id="SCI_SETSELECTIONNANCHORVIRTUALSPACE">SCI_SETSELECTIONNANCHORVIRTUALSPACE(int selection, int space)</b><br />
1702 <b id="SCI_GETSELECTIONNANCHORVIRTUALSPACE">SCI_GETSELECTIONNANCHORVIRTUALSPACE(int selection)</b><br />
1703 Set or query the position and amount of virtual space for the caret and anchor of each already existing selection.</p>
1706 <b id="SCI_SETSELECTIONNSTART">SCI_SETSELECTIONNSTART(int selection, int pos)</b><br />
1707 <b id="SCI_GETSELECTIONNSTART">SCI_GETSELECTIONNSTART(int selection)</b><br />
1708 <b id="SCI_SETSELECTIONNEND">SCI_SETSELECTIONNEND(int selection, int pos)</b><br />
1709 <b id="SCI_GETSELECTIONNEND">SCI_GETSELECTIONNEND(int selection)</b><br />
1710 Set or query the start and end position of each already existing selection.
1711 Mostly of use to query each range for its text.</p>
1714 <b id="SCI_SETRECTANGULARSELECTIONCARET">SCI_SETRECTANGULARSELECTIONCARET(int pos)</b><br />
1715 <b id="SCI_GETRECTANGULARSELECTIONCARET">SCI_GETRECTANGULARSELECTIONCARET</b><br />
1716 <b id="SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE">SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE(int space)</b><br />
1717 <b id="SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE">SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE</b><br />
1718 <b id="SCI_SETRECTANGULARSELECTIONANCHOR">SCI_SETRECTANGULARSELECTIONANCHOR(int posAnchor)</b><br />
1719 <b id="SCI_GETRECTANGULARSELECTIONANCHOR">SCI_GETRECTANGULARSELECTIONANCHOR</b><br />
1720 <b id="SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE">SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE(int space)</b><br />
1721 <b id="SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE">SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE</b><br />
1722 Set or query the position and amount of virtual space for the caret and anchor of the rectangular selection.
1723 After setting the rectangular selection, this is broken down into multiple selections, one for each line.</p>
1726 <b id="SCI_SETADDITIONALSELALPHA">SCI_SETADDITIONALSELALPHA(int alpha)</b><br />
1727 <b id="SCI_GETADDITIONALSELALPHA">SCI_GETADDITIONALSELALPHA</b><br />
1728 <b id="SCI_SETADDITIONALSELFORE">SCI_SETADDITIONALSELFORE(int <a class="jump" href="#colour">colour</a>)</b><br />
1729 <b id="SCI_SETADDITIONALSELBACK">SCI_SETADDITIONALSELBACK(int <a class="jump" href="#colour">colour</a>)</b><br />
1730 Modify the appearance of additional selections so that they can be differentiated from the main selection which has its appearance set with
1731 <a class="message" href="#SCI_SETSELALPHA"><code>SCI_SETSELALPHA</code></a>,
1732 <a class="message" href="#SCI_GETSELALPHA"><code>SCI_GETSELALPHA</code></a>,
1733 <a class="message" href="#SCI_SETSELFORE"><code>SCI_SETSELFORE</code></a>, and
1734 <a class="message" href="#SCI_SETSELBACK"><code>SCI_SETSELBACK</code></a>.
1735 <code>SCI_SETADDITIONALSELFORE</code> and
1736 <code>SCI_SETADDITIONALSELBACK</code> calls have no
1737 effect until <a class="message" href="#SCI_SETSELFORE"><code>SCI_SETSELFORE</code></a>
1738 and <a class="message" href="#SCI_SETSELBACK"><code>SCI_SETSELBACK</code></a> are
1739 called with useSelection*Colour value set to true. Subsequent calls to
1740 <a class="message" href="#SCI_SETSELFORE"><code>SCI_SETSELFORE</code></a>,
1741 and <a class="message" href="#SCI_SETSELBACK"><code>SCI_SETSELBACK</code></a> will
1742 overwrite the values set by <code>SCI_SETADDITIONALSEL*</code> functions.</p>
1744 <b id="SCI_SETADDITIONALCARETFORE">SCI_SETADDITIONALCARETFORE(int <a class="jump" href="#colour">colour</a>)</b><br />
1745 <b id="SCI_GETADDITIONALCARETFORE">SCI_GETADDITIONALCARETFORE</b><br />
1746 <b id="SCI_SETADDITIONALCARETSBLINK">SCI_SETADDITIONALCARETSBLINK(bool additionalCaretsBlink)</b><br />
1747 <b id="SCI_GETADDITIONALCARETSBLINK">SCI_GETADDITIONALCARETSBLINK</b><br />
1748 Modify the appearance of additional carets so that they can be differentiated from the main caret which has its appearance set with
1749 <a class="message" href="#SCI_SETCARETFORE"><code>SCI_SETCARETFORE</code></a>,
1750 <a class="message" href="#SCI_GETCARETFORE"><code>SCI_GETCARETFORE</code></a>,
1751 <a class="message" href="#SCI_SETCARETPERIOD"><code>SCI_SETCARETPERIOD</code></a>, and
1752 <a class="message" href="#SCI_GETCARETPERIOD"><code>SCI_GETCARETPERIOD</code></a>.</p>
1755 <b id="SCI_SETADDITIONALCARETSVISIBLE">SCI_SETADDITIONALCARETSVISIBLE(bool additionalCaretsVisible)</b><br />
1756 <b id="SCI_GETADDITIONALCARETSVISIBLE">SCI_GETADDITIONALCARETSVISIBLE</b><br />
1757 Determine whether to show additional carets (defaults to <code>true</code>).</p>
1760 <b id="SCI_SWAPMAINANCHORCARET">SCI_SWAPMAINANCHORCARET</b><br />
1761 <b id="SCI_ROTATESELECTION">SCI_ROTATESELECTION</b><br />
1762 These commands may be assigned to keys to make it possible to manipulate multiple selections.
1763 <code>SCI_SWAPMAINANCHORCARET</code> moves the caret to the opposite end of the main selection.
1764 <code>SCI_ROTATESELECTION</code> makes the next selection be the main selection.
1765 </p>
1767 <h2 id="ScrollingAndAutomaticScrolling">Scrolling and automatic scrolling</h2>
1768 <code><a class="message" href="#SCI_LINESCROLL">SCI_LINESCROLL(int column, int line)</a><br />
1769 <a class="message" href="#SCI_SCROLLCARET">SCI_SCROLLCARET</a><br />
1770 <a class="message" href="#SCI_SCROLLRANGE">SCI_SCROLLRANGE(int secondary, int primary)</a><br />
1771 <a class="message" href="#SCI_SETXCARETPOLICY">SCI_SETXCARETPOLICY(int caretPolicy, int
1772 caretSlop)</a><br />
1773 <a class="message" href="#SCI_SETYCARETPOLICY">SCI_SETYCARETPOLICY(int caretPolicy, int
1774 caretSlop)</a><br />
1775 <a class="message" href="#SCI_SETVISIBLEPOLICY">SCI_SETVISIBLEPOLICY(int caretPolicy, int
1776 caretSlop)</a><br />
1777 <a class="message" href="#SCI_SETHSCROLLBAR">SCI_SETHSCROLLBAR(bool visible)</a><br />
1778 <a class="message" href="#SCI_GETHSCROLLBAR">SCI_GETHSCROLLBAR</a><br />
1779 <a class="message" href="#SCI_SETVSCROLLBAR">SCI_SETVSCROLLBAR(bool visible)</a><br />
1780 <a class="message" href="#SCI_GETVSCROLLBAR">SCI_GETVSCROLLBAR</a><br />
1781 <a class="message" href="#SCI_GETXOFFSET">SCI_GETXOFFSET</a><br />
1782 <a class="message" href="#SCI_SETXOFFSET">SCI_SETXOFFSET(int xOffset)</a><br />
1783 <a class="message" href="#SCI_SETSCROLLWIDTH">SCI_SETSCROLLWIDTH(int pixelWidth)</a><br />
1784 <a class="message" href="#SCI_GETSCROLLWIDTH">SCI_GETSCROLLWIDTH</a><br />
1785 <a class="message" href="#SCI_SETSCROLLWIDTHTRACKING">SCI_SETSCROLLWIDTHTRACKING(bool tracking)</a><br />
1786 <a class="message" href="#SCI_GETSCROLLWIDTHTRACKING">SCI_GETSCROLLWIDTHTRACKING</a><br />
1787 <a class="message" href="#SCI_SETENDATLASTLINE">SCI_SETENDATLASTLINE(bool
1788 endAtLastLine)</a><br />
1789 <a class="message" href="#SCI_GETENDATLASTLINE">SCI_GETENDATLASTLINE</a><br />
1790 </code>
1792 <p><b id="SCI_LINESCROLL">SCI_LINESCROLL(int column, int line)</b><br />
1793 This will attempt to scroll the display by the number of columns and lines that you specify.
1794 Positive line values increase the line number at the top of the screen (i.e. they move the text
1795 upwards as far as the user is concerned), Negative line values do the reverse.</p>
1797 <p>The column measure is the width of a space in the default style. Positive values increase
1798 the column at the left edge of the view (i.e. they move the text leftwards as far as the user
1799 is concerned). Negative values do the reverse.</p>
1801 <p>See also: <a class="message" href="#SCI_SETXOFFSET"><code>SCI_SETXOFFSET</code></a></p>
1803 <p><b id="SCI_SCROLLCARET">SCI_SCROLLCARET</b><br />
1804 If the current position (this is the caret if there is no selection) is not visible, the view
1805 is scrolled to make it visible according to the current caret policy.</p>
1807 <p><b id="SCI_SCROLLRANGE">SCI_SCROLLRANGE(int secondary, int primary)</b><br />
1808 Scroll the argument positions and the range between them into view giving
1809 priority to the primary position then the secondary position.
1810 The behaviour is similar to <a class="message" href="#SCI_SCROLLCARET"><code>SCI_SCROLLCARET</code></a>
1811 with the primary position used instead of the caret. An effort is then made to ensure that the secondary
1812 position and range between are also visible.
1813 This may be used to make a search match visible.</p>
1815 <p><b id="SCI_SETXCARETPOLICY">SCI_SETXCARETPOLICY(int caretPolicy, int caretSlop)</b><br />
1816 <b id="SCI_SETYCARETPOLICY">SCI_SETYCARETPOLICY(int caretPolicy, int caretSlop)</b><br />
1817 These set the caret policy. The value of <code>caretPolicy</code> is a combination of
1818 <code>CARET_SLOP</code>, <code>CARET_STRICT</code>, <code>CARET_JUMPS</code> and
1819 <code>CARET_EVEN</code>.</p>
1821 <table cellpadding="1" cellspacing="2" border="0" summary="Caret policy">
1822 <tbody valign="top">
1823 <tr>
1824 <th align="left"><code>CARET_SLOP</code></th>
1826 <td>If set, we can define a slop value: <code>caretSlop</code>. This value defines an
1827 unwanted zone (UZ) where the caret is... unwanted. This zone is defined as a number of
1828 pixels near the vertical margins, and as a number of lines near the horizontal margins.
1829 By keeping the caret away from the edges, it is seen within its context. This makes it
1830 likely that the identifier that the caret is on can be completely seen, and that the
1831 current line is seen with some of the lines following it, which are often dependent on
1832 that line.</td>
1833 </tr>
1835 <tr>
1836 <th align="left"><code>CARET_STRICT</code></th>
1838 <td>If set, the policy set by <code>CARET_SLOP</code> is enforced... strictly. The caret
1839 is centred on the display if <code>caretSlop</code> is not set, and cannot go in the UZ
1840 if <code>caretSlop</code> is set.</td>
1841 </tr>
1843 <tr>
1844 <th align="left"><code>CARET_JUMPS</code></th>
1846 <td>If set, the display is moved more energetically so the caret can move in the same
1847 direction longer before the policy is applied again. '3UZ' notation is used to indicate
1848 three time the size of the UZ as a distance to the margin.</td>
1849 </tr>
1851 <tr>
1852 <th align="left"><code>CARET_EVEN</code></th>
1854 <td>If not set, instead of having symmetrical UZs, the left and bottom UZs are extended
1855 up to right and top UZs respectively. This way, we favour the displaying of useful
1856 information: the beginning of lines, where most code reside, and the lines after the
1857 caret, for example, the body of a function.</td>
1858 </tr>
1859 </tbody>
1860 </table>
1862 <table cellpadding="3" cellspacing="0" border="1" summary="Caret positioning">
1863 <thead align="center">
1864 <tr>
1865 <th>slop</th>
1867 <th>strict</th>
1869 <th>jumps</th>
1871 <th>even</th>
1873 <th>Caret can go to the margin</th>
1875 <th>On reaching limit (going out of visibility<br />
1876 or going into the UZ) display is...</th>
1877 </tr>
1878 </thead>
1880 <tbody align="center">
1881 <tr>
1882 <td>0</td>
1884 <td>0</td>
1886 <td>0</td>
1888 <td>0</td>
1890 <td>Yes</td>
1892 <td>moved to put caret on top/on right</td>
1893 </tr>
1895 <tr>
1896 <td>0</td>
1898 <td>0</td>
1900 <td>0</td>
1902 <td>1</td>
1904 <td>Yes</td>
1906 <td>moved by one position</td>
1907 </tr>
1909 <tr>
1910 <td>0</td>
1912 <td>0</td>
1914 <td>1</td>
1916 <td>0</td>
1918 <td>Yes</td>
1920 <td>moved to put caret on top/on right</td>
1921 </tr>
1923 <tr>
1924 <td>0</td>
1926 <td>0</td>
1928 <td>1</td>
1930 <td>1</td>
1932 <td>Yes</td>
1934 <td>centred on the caret</td>
1935 </tr>
1937 <tr>
1938 <td>0</td>
1940 <td>1</td>
1942 <td>-</td>
1944 <td>0</td>
1946 <td>Caret is always on top/on right of display</td>
1948 <td>-</td>
1949 </tr>
1951 <tr>
1952 <td>0</td>
1954 <td>1</td>
1956 <td>-</td>
1958 <td>1</td>
1960 <td>No, caret is always centred</td>
1962 <td>-</td>
1963 </tr>
1965 <tr>
1966 <td>1</td>
1968 <td>0</td>
1970 <td>0</td>
1972 <td>0</td>
1974 <td>Yes</td>
1976 <td>moved to put caret out of the asymmetrical UZ</td>
1977 </tr>
1979 <tr>
1980 <td>1</td>
1982 <td>0</td>
1984 <td>0</td>
1986 <td>1</td>
1988 <td>Yes</td>
1990 <td>moved to put caret out of the UZ</td>
1991 </tr>
1993 <tr>
1994 <td>1</td>
1996 <td>0</td>
1998 <td>1</td>
2000 <td>0</td>
2002 <td>Yes</td>
2004 <td>moved to put caret at 3UZ of the top or right margin</td>
2005 </tr>
2007 <tr>
2008 <td>1</td>
2010 <td>0</td>
2012 <td>1</td>
2014 <td>1</td>
2016 <td>Yes</td>
2018 <td>moved to put caret at 3UZ of the margin</td>
2019 </tr>
2021 <tr>
2022 <td>1</td>
2024 <td>1</td>
2026 <td>-</td>
2028 <td>0</td>
2030 <td>Caret is always at UZ of top/right margin</td>
2032 <td>-</td>
2033 </tr>
2035 <tr>
2036 <td>1</td>
2038 <td>1</td>
2040 <td>0</td>
2042 <td>1</td>
2044 <td>No, kept out of UZ</td>
2046 <td>moved by one position</td>
2047 </tr>
2049 <tr>
2050 <td>1</td>
2052 <td>1</td>
2054 <td>1</td>
2056 <td>0</td>
2058 <td>No, kept out of UZ</td>
2060 <td>moved to put caret at 3UZ of the margin</td>
2061 </tr>
2062 </tbody>
2063 </table>
2065 <p><b id="SCI_SETVISIBLEPOLICY">SCI_SETVISIBLEPOLICY(int caretPolicy, int caretSlop)</b><br />
2066 This determines how the vertical positioning is determined when <a class="message"
2067 href="#SCI_ENSUREVISIBLEENFORCEPOLICY"><code>SCI_ENSUREVISIBLEENFORCEPOLICY</code></a> is
2068 called. It takes <code>VISIBLE_SLOP</code> and <code>VISIBLE_STRICT</code> flags for the policy
2069 parameter. It is similar in operation to <a class="message"
2070 href="#SCI_SETYCARETPOLICY"><code>SCI_SETYCARETPOLICY(int caretPolicy, int
2071 caretSlop)</code></a>.</p>
2073 <p><b id="SCI_SETHSCROLLBAR">SCI_SETHSCROLLBAR(bool visible)</b><br />
2074 <b id="SCI_GETHSCROLLBAR">SCI_GETHSCROLLBAR</b><br />
2075 The horizontal scroll bar is only displayed if it is needed for the assumed width.
2076 If you never wish to see it, call
2077 <code>SCI_SETHSCROLLBAR(0)</code>. Use <code>SCI_SETHSCROLLBAR(1)</code> to enable it again.
2078 <code>SCI_GETHSCROLLBAR</code> returns the current state. The default state is to display it
2079 when needed.</p>
2080 <p>See also: <a class="message" href="#SCI_SETSCROLLWIDTH">SCI_SETSCROLLWIDTH</a>.</p>
2082 <p><b id="SCI_SETVSCROLLBAR">SCI_SETVSCROLLBAR(bool visible)</b><br />
2083 <b id="SCI_GETVSCROLLBAR">SCI_GETVSCROLLBAR</b><br />
2084 By default, the vertical scroll bar is always displayed when required. You can choose to hide
2085 or show it with <code>SCI_SETVSCROLLBAR</code> and get the current state with
2086 <code>SCI_GETVSCROLLBAR</code>.</p>
2088 <p><b id="SCI_SETXOFFSET">SCI_SETXOFFSET(int xOffset)</b><br />
2089 <b id="SCI_GETXOFFSET">SCI_GETXOFFSET</b><br />
2090 The <code>xOffset</code> is the horizontal scroll position in pixels of the start of the text
2091 view. A value of 0 is the normal position with the first text column visible at the left of the
2092 view.</p>
2094 <p>See also: <a class="message" href="#SCI_LINESCROLL"><code>SCI_LINESCROLL</code></a></p>
2096 <p><b id="SCI_SETSCROLLWIDTH">SCI_SETSCROLLWIDTH(int pixelWidth)</b><br />
2097 <b id="SCI_GETSCROLLWIDTH">SCI_GETSCROLLWIDTH</b><br />
2098 For performance, Scintilla does not measure the display width of the document to determine
2099 the properties of the horizontal scroll bar. Instead, an assumed width is used.
2100 These messages set and get the document width in pixels assumed by Scintilla.
2101 The default value is 2000.
2102 To ensure the width of the currently visible lines can be scrolled use
2103 <a class="message" href="#SCI_SETSCROLLWIDTHTRACKING"><code>SCI_SETSCROLLWIDTHTRACKING</code></a></p>
2105 <p><b id="SCI_SETSCROLLWIDTHTRACKING">SCI_SETSCROLLWIDTHTRACKING(bool tracking)</b><br />
2106 <b id="SCI_GETSCROLLWIDTHTRACKING">SCI_GETSCROLLWIDTHTRACKING</b><br />
2107 If scroll width tracking is enabled then the scroll width is adjusted to ensure that all of the lines currently
2108 displayed can be completely scrolled. This mode never adjusts the scroll width to be narrower.</p>
2110 <p><b id="SCI_SETENDATLASTLINE">SCI_SETENDATLASTLINE(bool endAtLastLine)</b><br />
2111 <b id="SCI_GETENDATLASTLINE">SCI_GETENDATLASTLINE</b><br />
2112 <code>SCI_SETENDATLASTLINE</code> sets the scroll range so that maximum scroll position has
2113 the last line at the bottom of the view (default). Setting this to <code>false</code> allows
2114 scrolling one page below the last line.</p>
2116 <h2 id="WhiteSpace">White space</h2>
2117 <code><a class="message" href="#SCI_SETVIEWWS">SCI_SETVIEWWS(int wsMode)</a><br />
2118 <a class="message" href="#SCI_GETVIEWWS">SCI_GETVIEWWS</a><br />
2119 <a class="message" href="#SCI_SETWHITESPACEFORE">SCI_SETWHITESPACEFORE(bool
2120 useWhitespaceForeColour, int colour)</a><br />
2121 <a class="message" href="#SCI_SETWHITESPACEBACK">SCI_SETWHITESPACEBACK(bool
2122 useWhitespaceBackColour, int colour)</a><br />
2123 <a class="message" href="#SCI_SETWHITESPACESIZE">SCI_SETWHITESPACESIZE(int
2124 size)</a><br />
2125 <a class="message" href="#SCI_GETWHITESPACESIZE">SCI_GETWHITESPACESIZE</a><br />
2126 <a class="message" href="#SCI_SETEXTRAASCENT">SCI_SETEXTRAASCENT(int extraAscent)</a><br />
2127 <a class="message" href="#SCI_GETEXTRAASCENT">SCI_GETEXTRAASCENT</a><br />
2128 <a class="message" href="#SCI_SETEXTRADESCENT">SCI_SETEXTRADESCENT(int extraDescent)</a><br />
2129 <a class="message" href="#SCI_GETEXTRADESCENT">SCI_GETEXTRADESCENT</a><br />
2130 </code>
2132 <p><b id="SCI_SETVIEWWS">SCI_SETVIEWWS(int wsMode)</b><br />
2133 <b id="SCI_GETVIEWWS">SCI_GETVIEWWS</b><br />
2134 White space can be made visible which may be useful for languages in which white space is
2135 significant, such as Python. Space characters appear as small centred dots and tab characters
2136 as light arrows pointing to the right. There are also ways to control the display of <a
2137 class="jump" href="#LineEndings">end of line characters</a>. The two messages set and get the
2138 white space display mode. The <code>wsMode</code> argument can be one of:</p>
2140 <table cellpadding="1" cellspacing="2" border="0" summary="White space policy">
2141 <tbody valign="top">
2142 <tr>
2143 <th align="left"><code>SCWS_INVISIBLE</code></th>
2145 <td>0</td>
2147 <td>The normal display mode with white space displayed as an empty background
2148 colour.</td>
2149 </tr>
2151 <tr>
2152 <th align="left"><code>SCWS_VISIBLEALWAYS</code></th>
2154 <td>1</td>
2156 <td>White space characters are drawn as dots and arrows,</td>
2157 </tr>
2159 <tr>
2160 <th align="left"><code>SCWS_VISIBLEAFTERINDENT</code></th>
2162 <td>2</td>
2164 <td>White space used for indentation is displayed normally but after the first visible
2165 character, it is shown as dots and arrows.</td>
2166 </tr>
2167 </tbody>
2168 </table>
2170 <p>The effect of using any other <code>wsMode</code> value is undefined.</p>
2172 <p><b id="SCI_SETWHITESPACEFORE">SCI_SETWHITESPACEFORE(bool useWhitespaceForeColour, int <a
2173 class="jump" href="#colour">colour</a>)</b><br />
2174 <b id="SCI_SETWHITESPACEBACK">SCI_SETWHITESPACEBACK(bool useWhitespaceBackColour, int <a
2175 class="jump" href="#colour">colour</a>)</b><br />
2176 By default, the colour of visible white space is determined by the lexer in use. The
2177 foreground and/or background colour of all visible white space can be set globally, overriding
2178 the lexer's colours with <code>SCI_SETWHITESPACEFORE</code> and
2179 <code>SCI_SETWHITESPACEBACK</code>.</p>
2181 <p><b id="SCI_SETWHITESPACESIZE">SCI_SETWHITESPACESIZE(int size)</b><br />
2182 <b id="SCI_GETWHITESPACESIZE">SCI_GETWHITESPACESIZE</b><br />
2183 <code>SCI_SETWHITESPACESIZE</code> sets the size of the dots used for mark space characters.
2184 The <code>SCI_GETWHITESPACESIZE</code> message retrieves the current size.
2185 </p>
2188 <b id="SCI_SETEXTRAASCENT">SCI_SETEXTRAASCENT(int extraAscent)</b><br />
2189 <b id="SCI_GETEXTRAASCENT">SCI_GETEXTRAASCENT</b><br />
2190 <b id="SCI_SETEXTRADESCENT">SCI_SETEXTRADESCENT(int extraDescent)</b><br />
2191 <b id="SCI_GETEXTRADESCENT">SCI_GETEXTRADESCENT</b><br />
2192 Text is drawn with the base of each character on a 'baseline'. The height of a line is found from the maximum
2193 that any style extends above the baseline (its 'ascent'), added to the maximum that any style extends below the
2194 baseline (its 'descent').
2195 Space may be added to the maximum ascent (<code>SCI_SETEXTRAASCENT</code>) and the
2196 maximum descent (<code>SCI_SETEXTRADESCENT</code>) to allow for more space between lines.
2197 This may done to make the text easier to read or to accommodate underlines or highlights.
2198 </p>
2200 <h2 id="Cursor">Cursor</h2>
2202 <p><b id="SCI_SETCURSOR">SCI_SETCURSOR(int curType)</b><br />
2203 <b id="SCI_GETCURSOR">SCI_GETCURSOR</b><br />
2204 The cursor is normally chosen in a context sensitive way, so it will be different over the
2205 margin than when over the text. When performing a slow action, you may wish to change to a wait
2206 cursor. You set the cursor type with <code>SCI_SETCURSOR</code>. The <code>curType</code>
2207 argument can be:</p>
2209 <table cellpadding="1" cellspacing="2" border="0" summary="Mouse cursors">
2210 <tbody valign="top">
2211 <tr>
2212 <th align="left"><code>SC_CURSORNORMAL</code></th>
2214 <td>-1</td>
2216 <td>The normal cursor is displayed.</td>
2217 </tr>
2219 <tr>
2220 <th align="left"><code>SC_CURSORWAIT</code></th>
2222 <td>&nbsp;4</td>
2224 <td>The wait cursor is displayed when the mouse is over or owned by the Scintilla
2225 window.</td>
2226 </tr>
2227 </tbody>
2228 </table>
2230 <p>Cursor values 1 through 7 have defined cursors, but only <code>SC_CURSORWAIT</code> is
2231 usefully controllable. Other values of <code>curType</code> cause a pointer to be displayed.
2232 The <code>SCI_GETCURSOR</code> message returns the last cursor type you set, or
2233 <code>SC_CURSORNORMAL</code> (-1) if you have not set a cursor type.</p>
2235 <h2 id="MouseCapture">Mouse capture</h2>
2237 <p><b id="SCI_SETMOUSEDOWNCAPTURES">SCI_SETMOUSEDOWNCAPTURES(bool captures)</b><br />
2238 <b id="SCI_GETMOUSEDOWNCAPTURES">SCI_GETMOUSEDOWNCAPTURES</b><br />
2239 When the mouse is pressed inside Scintilla, it is captured so future mouse movement events are
2240 sent to Scintilla. This behaviour may be turned off with
2241 <code>SCI_SETMOUSEDOWNCAPTURES(0)</code>.</p>
2243 <h2 id="LineEndings">Line endings</h2>
2245 <p>Scintilla can handle the major line end conventions and, depending on settings and
2246 the current lexer also support additional Unicode line ends.</p>
2248 <p>Scintilla can interpret any of the Macintosh (\r), Unix (\n) and Windows (\r\n)
2249 line ends.
2250 When the user presses the Enter key, one of these line
2251 end strings is inserted into the buffer. The default is \r\n in Windows and \n in Unix, but
2252 this can be changed with the <code>SCI_SETEOLMODE</code> message. You can also convert the
2253 entire document to one of these line endings with <code>SCI_CONVERTEOLS</code>. Finally, you
2254 can choose to display the line endings with <code>SCI_SETVIEWEOL</code>.</p>
2256 <p>For the UTF-8 encoding, three additional Unicode line ends,
2257 Next Line (<code>NEL=U+0085</code>), Line Separator (<code>LS=U+2028</code>), and Paragraph Separator (<code>PS=U+2029</code>)
2258 may optionally be interpreted when Unicode line ends is turned on and the current lexer also supports
2259 Unicode line ends.</p>
2261 <a class="message" href="#SCI_SETEOLMODE">SCI_SETEOLMODE(int eolMode)</a><br />
2262 <a class="message" href="#SCI_GETEOLMODE">SCI_GETEOLMODE</a><br />
2263 <a class="message" href="#SCI_CONVERTEOLS">SCI_CONVERTEOLS(int eolMode)</a><br />
2264 <a class="message" href="#SCI_SETVIEWEOL">SCI_SETVIEWEOL(bool visible)</a><br />
2265 <a class="message" href="#SCI_GETVIEWEOL">SCI_GETVIEWEOL</a><br />
2267 <a class="message" href="#SCI_GETLINEENDTYPESSUPPORTED">SCI_GETLINEENDTYPESSUPPORTED</a><br />
2268 <a class="message" href="#SCI_SETLINEENDTYPESALLOWED">SCI_SETLINEENDTYPESALLOWED(int lineEndBitSet)</a><br />
2269 <a class="message" href="#SCI_GETLINEENDTYPESALLOWED">SCI_GETLINEENDTYPESALLOWED</a><br />
2270 <a class="message" href="#SCI_GETLINEENDTYPESACTIVE">SCI_GETLINEENDTYPESACTIVE</a><br />
2272 <p><b id="SCI_SETEOLMODE">SCI_SETEOLMODE(int eolMode)</b><br />
2273 <b id="SCI_GETEOLMODE">SCI_GETEOLMODE</b><br />
2274 <code>SCI_SETEOLMODE</code> sets the characters that are added into the document when the user
2275 presses the Enter key. You can set <code>eolMode</code> to one of <code>SC_EOL_CRLF</code> (0),
2276 <code>SC_EOL_CR</code> (1), or <code>SC_EOL_LF</code> (2). The <code>SCI_GETEOLMODE</code>
2277 message retrieves the current state.</p>
2279 <p><b id="SCI_CONVERTEOLS">SCI_CONVERTEOLS(int eolMode)</b><br />
2280 This message changes all the end of line characters in the document to match
2281 <code>eolMode</code>. Valid values are: <code>SC_EOL_CRLF</code> (0), <code>SC_EOL_CR</code>
2282 (1), or <code>SC_EOL_LF</code> (2).</p>
2284 <p><b id="SCI_SETVIEWEOL">SCI_SETVIEWEOL(bool visible)</b><br />
2285 <b id="SCI_GETVIEWEOL">SCI_GETVIEWEOL</b><br />
2286 Normally, the end of line characters are hidden, but <code>SCI_SETVIEWEOL</code> allows you to
2287 display (or hide) them by setting <code>visible</code> <code>true</code> (or
2288 <code>false</code>). The visible rendering of the end of line characters is similar to
2289 <code>(CR)</code>, <code>(LF)</code>, or <code>(CR)(LF)</code>. <code>SCI_GETVIEWEOL</code>
2290 returns the current state.</p>
2292 <p><b id="SCI_GETLINEENDTYPESSUPPORTED">SCI_GETLINEENDTYPESSUPPORTED</b><br />
2293 <code>SCI_GETLINEENDTYPESSUPPORTED</code> reports the different types of line ends supported
2294 by the current lexer. This is a bit set although there is currently only a single choice
2295 with either <code>SC_LINE_END_TYPE_DEFAULT</code> (0) or <code>SC_LINE_END_TYPE_UNICODE</code> (1).
2296 These values are also used by the other messages concerned with Unicode line ends.</p>
2298 <p><b id="SCI_SETLINEENDTYPESALLOWED">SCI_SETLINEENDTYPESALLOWED(int lineEndBitSet)</b><br />
2299 <b id="SCI_GETLINEENDTYPESALLOWED">SCI_GETLINEENDTYPESALLOWED</b><br />
2300 By default, only the ASCII line ends are interpreted. Unicode line ends may be requested with
2301 <code>SCI_SETLINEENDTYPESALLOWED(SC_LINE_END_TYPE_UNICODE)</code>
2302 but this will be ineffective unless the lexer also allows you Unicode line ends.
2303 <code>SCI_GETLINEENDTYPESALLOWED</code> returns the current state.</p>
2305 <p><b id="SCI_GETLINEENDTYPESACTIVE">SCI_GETLINEENDTYPESACTIVE</b><br />
2306 <code>SCI_GETLINEENDTYPESACTIVE</code> reports the set of line ends currently interpreted
2307 by Scintilla. It is <code>SCI_GETLINEENDTYPESSUPPORTED &amp; SCI_GETLINEENDTYPESALLOWED</code>.</p>
2309 <h2 id="Styling">Styling</h2>
2311 <p>The styling messages allow you to assign styles to text. If your styling needs can be met by
2312 one of the standard lexers, or if you can write your own, then a lexer is probably the easiest
2313 way to style your document. If you choose to use the container to do the styling you can use
2314 the <a class="message" href="#SCI_SETLEXER"><code>SCI_SETLEXER</code></a> command to select
2315 <code>SCLEX_CONTAINER</code>, in which case the container is sent a <a class="message"
2316 href="#SCN_STYLENEEDED"><code>SCN_STYLENEEDED</code></a> <a class="jump"
2317 href="#Notifications">notification</a> each time text needs styling for display. As another
2318 alternative, you might use idle time to style the document. Even if you use a lexer, you might
2319 use the styling commands to mark errors detected by a compiler. The following commands can be
2320 used.</p>
2321 <code><a class="message" href="#SCI_GETENDSTYLED">SCI_GETENDSTYLED</a><br />
2322 <a class="message" href="#SCI_STARTSTYLING">SCI_STARTSTYLING(int position, int unused)</a><br />
2323 <a class="message" href="#SCI_SETSTYLING">SCI_SETSTYLING(int length, int style)</a><br />
2324 <a class="message" href="#SCI_SETSTYLINGEX">SCI_SETSTYLINGEX(int length, const char
2325 *styles)</a><br />
2326 <a class="message" href="#SCI_SETLINESTATE">SCI_SETLINESTATE(int line, int value)</a><br />
2327 <a class="message" href="#SCI_GETLINESTATE">SCI_GETLINESTATE(int line)</a><br />
2328 <a class="message" href="#SCI_GETMAXLINESTATE">SCI_GETMAXLINESTATE</a><br />
2329 </code>
2331 <p><b id="SCI_GETENDSTYLED">SCI_GETENDSTYLED</b><br />
2332 Scintilla keeps a record of the last character that is likely to be styled correctly. This is
2333 moved forwards when characters after it are styled and moved backwards if changes are made to
2334 the text of the document before it. Before drawing text, this position is checked to see if any
2335 styling is needed and, if so, a <code><a class="message"
2336 href="#SCN_STYLENEEDED">SCN_STYLENEEDED</a></code> notification message is sent to the
2337 container. The container can send <code>SCI_GETENDSTYLED</code> to work out where it needs to
2338 start styling. Scintilla will always ask to style whole lines.</p>
2340 <p><b id="SCI_STARTSTYLING">SCI_STARTSTYLING(int pos, int unused)</b><br />
2341 This prepares for styling by setting the styling position <code>pos</code> to start at.
2342 The unused argument was used in earlier versions but is now ignored.
2343 After
2344 <code>SCI_STARTSTYLING</code>, send multiple <code>SCI_SETSTYLING</code> messages for each
2345 lexical entity to style.</p>
2347 <p><b id="SCI_SETSTYLING">SCI_SETSTYLING(int length, int style)</b><br />
2348 This message sets the style of <code>length</code> characters starting at the styling position
2349 and then increases the styling position by <code>length</code>, ready for the next call.<br />
2350 </p>
2352 <p><b id="SCI_SETSTYLINGEX">SCI_SETSTYLINGEX(int length, const char *styles)</b><br />
2353 As an alternative to <code>SCI_SETSTYLING</code>, which applies the same style to each byte,
2354 you can use this message which specifies the styles for each of <code>length</code> bytes from
2355 the styling position and then increases the styling position by <code>length</code>, ready for
2356 the next call.</p>
2358 <p><b id="SCI_SETLINESTATE">SCI_SETLINESTATE(int line, int value)</b><br />
2359 <b id="SCI_GETLINESTATE">SCI_GETLINESTATE(int line)</b><br />
2360 As well as the 8 bits of lexical state stored for each character there is also an integer
2361 stored for each line. This can be used for longer lived parse states such as what the current
2362 scripting language is in an ASP page. Use <code>SCI_SETLINESTATE</code> to set the integer
2363 value and <code>SCI_GETLINESTATE</code> to get the value.
2364 Changing the value produces a <a class="message" href="#SC_MOD_CHANGELINESTATE">SC_MOD_CHANGELINESTATE</a> notification.
2365 </p>
2367 <p><b id="SCI_GETMAXLINESTATE">SCI_GETMAXLINESTATE</b><br />
2368 This returns the last line that has any line state.</p>
2370 <h2 id="StyleDefinition">Style definition</h2>
2372 <p>While the style setting messages mentioned above change the style numbers associated with
2373 text, these messages define how those style numbers are interpreted visually. There are 256
2374 lexer styles that can be set, numbered 0 to <code>STYLE_MAX</code> (255).
2375 There are also some
2376 predefined numbered styles starting at 32, The following <code>STYLE_</code>* constants are
2377 defined.</p>
2379 <table cellpadding="1" cellspacing="2" border="0" summary="Preset styles">
2380 <tbody valign="top">
2381 <tr>
2382 <th align="left"><code>STYLE_DEFAULT</code></th>
2384 <td>32</td>
2386 <td>This style defines the attributes that all styles receive when the
2387 <code>SCI_STYLECLEARALL</code> message is used.</td>
2388 </tr>
2390 <tr>
2391 <th align="left"><code>STYLE_LINENUMBER</code></th>
2393 <td>33</td>
2395 <td>This style sets the attributes of the text used to display line numbers in a line
2396 number margin. The background colour set for this style also sets the background colour
2397 for all margins that do not have any folding mask bits set. That is, any margin for which
2398 <code>mask &amp; SC_MASK_FOLDERS</code> is 0. See <a class="message"
2399 href="#SCI_SETMARGINMASKN"><code>SCI_SETMARGINMASKN</code></a> for more about masks.</td>
2400 </tr>
2402 <tr>
2403 <th align="left"><code>STYLE_BRACELIGHT</code></th>
2405 <td>34</td>
2407 <td>This style sets the attributes used when highlighting braces with the <a
2408 class="message" href="#BraceHighlighting"><code>SCI_BRACEHIGHLIGHT</code></a> message and
2409 when highlighting the corresponding indentation with <a class="message"
2410 href="#SCI_SETHIGHLIGHTGUIDE"><code>SCI_SETHIGHLIGHTGUIDE</code></a>.</td>
2411 </tr>
2413 <tr>
2414 <th align="left"><code>STYLE_BRACEBAD</code></th>
2416 <td>35</td>
2418 <td>This style sets the display attributes used when marking an unmatched brace with the
2419 <a class="message" href="#BraceHighlighting"><code>SCI_BRACEBADLIGHT</code></a>
2420 message.</td>
2421 </tr>
2423 <tr>
2424 <th align="left"><code>STYLE_CONTROLCHAR</code></th>
2426 <td>36</td>
2428 <td>This style sets the font used when drawing control characters.
2429 Only the font, size, bold, italics, and character set attributes are used and not
2430 the colour attributes. See
2431 also: <a class="message"
2432 href="#SCI_SETCONTROLCHARSYMBOL"><code>SCI_SETCONTROLCHARSYMBOL</code></a>.</td>
2433 </tr>
2435 <tr>
2436 <th align="left"><code>STYLE_INDENTGUIDE</code></th>
2438 <td>37</td>
2440 <td>This style sets the foreground and background colours used when drawing the
2441 indentation guides.</td>
2442 </tr>
2444 <tr>
2445 <th align="left"><code>STYLE_CALLTIP</code></th>
2447 <td>38</td>
2449 <td> Call tips normally use the font attributes defined by <code>STYLE_DEFAULT</code>.
2450 Use of <a class="message" href="#SCI_CALLTIPUSESTYLE"><code>SCI_CALLTIPUSESTYLE</code></a>
2451 causes call tips to use this style instead. Only the font face name, font size,
2452 foreground and background colours and character set attributes are used.</td>
2453 </tr>
2455 <tr>
2456 <th align="left"><code>STYLE_LASTPREDEFINED</code></th>
2458 <td>39</td>
2460 <td>To make it easier for client code to discover the range of styles that are
2461 predefined, this is set to the style number of the last predefined style. This is
2462 currently set to 39 and the last style with an identifier is 38, which reserves space
2463 for one future predefined style.</td>
2464 </tr>
2466 <tr>
2467 <th align="left"><code>STYLE_MAX</code></th>
2469 <td>255</td>
2471 <td>This is not a style but is the number of the maximum style that can be set. Styles
2472 between <code>STYLE_LASTPREDEFINED</code> and <code>STYLE_MAX</code> may be used.</td>
2473 </tr>
2474 </tbody>
2475 </table>
2477 <p>For each style you can set the font name, size and use of bold, italic and underline,
2478 foreground and background colour and the character set. You can also choose to hide text with a
2479 given style, display all characters as upper or lower case and fill from the last character on
2480 a line to the end of the line (for embedded languages). There is also an experimental attribute
2481 to make text read-only.</p>
2483 <p>It is entirely up to you how you use styles. If you want to use syntax colouring you might
2484 use style 0 for white space, style 1 for numbers, style 2 for keywords, style 3 for strings,
2485 style 4 for preprocessor, style 5 for operators, and so on.</p>
2486 <code><a class="message" href="#SCI_STYLERESETDEFAULT">SCI_STYLERESETDEFAULT</a><br />
2487 <a class="message" href="#SCI_STYLECLEARALL">SCI_STYLECLEARALL</a><br />
2488 <a class="message" href="#SCI_STYLESETFONT">SCI_STYLESETFONT(int styleNumber, char
2489 *fontName)</a><br />
2490 <a class="message" href="#SCI_STYLEGETFONT">SCI_STYLEGETFONT(int styleNumber, char *fontName)</a><br />
2491 <a class="message" href="#SCI_STYLESETSIZE">SCI_STYLESETSIZE(int styleNumber, int
2492 sizeInPoints)</a><br />
2493 <a class="message" href="#SCI_STYLEGETSIZE">SCI_STYLEGETSIZE(int styleNumber)</a><br />
2494 <a class="message" href="#SCI_STYLESETSIZEFRACTIONAL">SCI_STYLESETSIZEFRACTIONAL(int styleNumber, int
2495 sizeInHundredthPoints)</a><br />
2496 <a class="message" href="#SCI_STYLEGETSIZEFRACTIONAL">SCI_STYLEGETSIZEFRACTIONAL(int styleNumber)</a><br />
2497 <a class="message" href="#SCI_STYLESETBOLD">SCI_STYLESETBOLD(int styleNumber, bool
2498 bold)</a><br />
2499 <a class="message" href="#SCI_STYLEGETBOLD">SCI_STYLEGETBOLD(int styleNumber)</a><br />
2500 <a class="message" href="#SCI_STYLESETWEIGHT">SCI_STYLESETWEIGHT(int styleNumber, int
2501 weight)</a><br />
2502 <a class="message" href="#SCI_STYLEGETWEIGHT">SCI_STYLEGETWEIGHT(int styleNumber)</a><br />
2503 <a class="message" href="#SCI_STYLESETITALIC">SCI_STYLESETITALIC(int styleNumber, bool
2504 italic)</a><br />
2505 <a class="message" href="#SCI_STYLEGETITALIC">SCI_STYLEGETITALIC(int styleNumber)</a><br />
2506 <a class="message" href="#SCI_STYLESETUNDERLINE">SCI_STYLESETUNDERLINE(int styleNumber, bool
2507 underline)</a><br />
2508 <a class="message" href="#SCI_STYLEGETUNDERLINE">SCI_STYLEGETUNDERLINE(int styleNumber)</a><br />
2509 <a class="message" href="#SCI_STYLESETFORE">SCI_STYLESETFORE(int styleNumber, int
2510 colour)</a><br />
2511 <a class="message" href="#SCI_STYLEGETFORE">SCI_STYLEGETFORE(int styleNumber)</a><br />
2512 <a class="message" href="#SCI_STYLESETBACK">SCI_STYLESETBACK(int styleNumber, int
2513 colour)</a><br />
2514 <a class="message" href="#SCI_STYLEGETBACK">SCI_STYLEGETBACK(int styleNumber)</a><br />
2515 <a class="message" href="#SCI_STYLESETEOLFILLED">SCI_STYLESETEOLFILLED(int styleNumber, bool
2516 eolFilled)</a><br />
2517 <a class="message" href="#SCI_STYLEGETEOLFILLED">SCI_STYLEGETEOLFILLED(int styleNumber)</a><br />
2518 <a class="message" href="#SCI_STYLESETCHARACTERSET">SCI_STYLESETCHARACTERSET(int styleNumber,
2519 int charSet)</a><br />
2520 <a class="message" href="#SCI_STYLEGETCHARACTERSET">SCI_STYLEGETCHARACTERSET(int styleNumber)</a><br />
2521 <a class="message" href="#SCI_STYLESETCASE">SCI_STYLESETCASE(int styleNumber, int
2522 caseMode)</a><br />
2523 <a class="message" href="#SCI_STYLEGETCASE">SCI_STYLEGETCASE(int styleNumber)</a><br />
2524 <a class="message" href="#SCI_STYLESETVISIBLE">SCI_STYLESETVISIBLE(int styleNumber, bool
2525 visible)</a><br />
2526 <a class="message" href="#SCI_STYLEGETVISIBLE">SCI_STYLEGETVISIBLE(int styleNumber)</a><br />
2527 <a class="message" href="#SCI_STYLESETCHANGEABLE">SCI_STYLESETCHANGEABLE(int styleNumber, bool
2528 changeable)</a><br />
2529 <a class="message" href="#SCI_STYLEGETCHANGEABLE">SCI_STYLEGETCHANGEABLE(int styleNumber)</a><br />
2530 <a class="message" href="#SCI_STYLESETHOTSPOT">SCI_STYLESETHOTSPOT(int styleNumber, bool
2531 hotspot)</a><br />
2532 <a class="message" href="#SCI_STYLEGETHOTSPOT">SCI_STYLEGETHOTSPOT(int styleNumber)</a><br />
2533 </code>
2535 <p><b id="SCI_STYLERESETDEFAULT">SCI_STYLERESETDEFAULT</b><br />
2536 This message resets <code>STYLE_DEFAULT</code> to its state when Scintilla was
2537 initialised.</p>
2539 <p><b id="SCI_STYLECLEARALL">SCI_STYLECLEARALL</b><br />
2540 This message sets all styles to have the same attributes as <code>STYLE_DEFAULT</code>. If you
2541 are setting up Scintilla for syntax colouring, it is likely that the lexical styles you set
2542 will be very similar. One way to set the styles is to:<br />
2543 1. Set <code>STYLE_DEFAULT</code> to the common features of all styles.<br />
2544 2. Use <code>SCI_STYLECLEARALL</code> to copy this to all styles.<br />
2545 3. Set the style attributes that make your lexical styles different.</p>
2547 <p><b id="SCI_STYLESETFONT">SCI_STYLESETFONT(int styleNumber, const char *fontName)</b><br />
2548 <b id="SCI_STYLEGETFONT">SCI_STYLEGETFONT(int styleNumber, char *fontName)</b><br />
2549 <b id="SCI_STYLESETSIZE">SCI_STYLESETSIZE(int styleNumber, int sizeInPoints)</b><br />
2550 <b id="SCI_STYLEGETSIZE">SCI_STYLEGETSIZE(int styleNumber)</b><br />
2551 <b id="SCI_STYLESETSIZEFRACTIONAL">SCI_STYLESETSIZEFRACTIONAL(int styleNumber, int sizeInHundredthPoints)</b><br />
2552 <b id="SCI_STYLEGETSIZEFRACTIONAL">SCI_STYLEGETSIZEFRACTIONAL(int styleNumber)</b><br />
2553 <b id="SCI_STYLESETBOLD">SCI_STYLESETBOLD(int styleNumber, bool bold)</b><br />
2554 <b id="SCI_STYLEGETBOLD">SCI_STYLEGETBOLD(int styleNumber)</b><br />
2555 <b id="SCI_STYLESETWEIGHT">SCI_STYLESETWEIGHT(int styleNumber, int weight)</b><br />
2556 <b id="SCI_STYLEGETWEIGHT">SCI_STYLEGETWEIGHT(int styleNumber)</b><br />
2557 <b id="SCI_STYLESETITALIC">SCI_STYLESETITALIC(int styleNumber, bool italic)</b><br />
2558 <b id="SCI_STYLEGETITALIC">SCI_STYLEGETITALIC(int styleNumber)</b><br />
2559 These messages (plus <a class="message"
2560 href="#SCI_STYLESETCHARACTERSET"><code>SCI_STYLESETCHARACTERSET</code></a>) set the font
2561 attributes that are used to match the fonts you request to those available. The
2562 <code>fontName</code> is a zero terminated string holding the name of a font. Under Windows,
2563 only the first 32 characters of the name are used and the name is not case sensitive. For
2564 internal caching, Scintilla tracks fonts by name and does care about the casing of font names,
2565 so please be consistent. On GTK+, Pango is used to display text.</p>
2566 <p>Sizes can be set to a whole number of points with <code>SCI_STYLESETSIZE</code>
2567 or to a fractional point size in hundredths of a point with <code>SCI_STYLESETSIZEFRACTIONAL</code>
2568 by multiplying the size by 100 (<code>SC_FONT_SIZE_MULTIPLIER</code>).
2569 For example, a text size of 9.4 points is set with <code>SCI_STYLESETSIZEFRACTIONAL(&lt;style&gt;, 940)</code>.
2570 </p>
2571 <p>The weight or boldness of a font can be set with <code>SCI_STYLESETBOLD</code>
2572 or <code>SCI_STYLESETWEIGHT</code>. The weight is a number between 1 and 999 with 1 being very light
2573 and 999 very heavy. While any value can be used, fonts often only support between 2 and 4 weights with three weights
2574 being common enough to have symbolic names:
2575 <code>SC_WEIGHT_NORMAL</code> (400),
2576 <code>SC_WEIGHT_SEMIBOLD</code> (600), and
2577 <code>SC_WEIGHT_BOLD</code> (700).
2578 The <code>SCI_STYLESETBOLD</code> message takes a boolean argument with 0 choosing <code>SC_WEIGHT_NORMAL</code>
2579 and 1 <code>SC_WEIGHT_BOLD</code>.
2580 </p>
2582 <p><b id="SCI_STYLESETUNDERLINE">SCI_STYLESETUNDERLINE(int styleNumber, bool
2583 underline)</b><br />
2584 <b id="SCI_STYLEGETUNDERLINE">SCI_STYLEGETUNDERLINE(int styleNumber)</b><br />
2585 You can set a style to be underlined. The underline is drawn in the foreground colour. All
2586 characters with a style that includes the underline attribute are underlined, even if they are
2587 white space.</p>
2589 <p><b id="SCI_STYLESETFORE">SCI_STYLESETFORE(int styleNumber, int <a class="jump"
2590 href="#colour">colour</a>)</b><br />
2591 <b id="SCI_STYLEGETFORE">SCI_STYLEGETFORE(int styleNumber)</b><br />
2592 <b id="SCI_STYLESETBACK">SCI_STYLESETBACK(int styleNumber, int <a class="jump"
2593 href="#colour">colour</a>)</b><br />
2594 <b id="SCI_STYLEGETBACK">SCI_STYLEGETBACK(int styleNumber)</b><br />
2595 Text is drawn in the foreground colour. The space in each character cell that is not occupied
2596 by the character is drawn in the background colour.</p>
2598 <p><b id="SCI_STYLESETEOLFILLED">SCI_STYLESETEOLFILLED(int styleNumber, bool
2599 eolFilled)</b><br />
2600 <b id="SCI_STYLEGETEOLFILLED">SCI_STYLEGETEOLFILLED(int styleNumber)</b><br />
2601 If the last character in the line has a style with this attribute set, the remainder of the
2602 line up to the right edge of the window is filled with the background colour set for the last
2603 character. This is useful when a document contains embedded sections in another language such
2604 as HTML pages with embedded JavaScript. By setting <code>eolFilled</code> to <code>true</code>
2605 and a consistent background colour (different from the background colour set for the HTML
2606 styles) to all JavaScript styles then JavaScript sections will be easily distinguished from
2607 HTML.</p>
2609 <p><b id="SCI_STYLESETCHARACTERSET">SCI_STYLESETCHARACTERSET(int styleNumber, int
2610 charSet)</b><br />
2611 <b id="SCI_STYLEGETCHARACTERSET">SCI_STYLEGETCHARACTERSET(int styleNumber)</b><br />
2612 You can set a style to use a different character set than the default. The places where such
2613 characters sets are likely to be useful are comments and literal strings. For example,
2614 <code>SCI_STYLESETCHARACTERSET(SCE_C_STRING, SC_CHARSET_RUSSIAN)</code> would ensure that
2615 strings in Russian would display correctly in C and C++ (<code>SCE_C_STRING</code> is the style
2616 number used by the C and C++ lexer to display literal strings; it has the value 6). This
2617 feature works differently on Windows and GTK+.</p>
2619 <p>The character sets supported on Windows are:<br />
2620 <code>SC_CHARSET_ANSI</code>, <code>SC_CHARSET_ARABIC</code>, <code>SC_CHARSET_BALTIC</code>,
2621 <code>SC_CHARSET_CHINESEBIG5</code>, <code>SC_CHARSET_DEFAULT</code>,
2622 <code>SC_CHARSET_EASTEUROPE</code>, <code>SC_CHARSET_GB2312</code>,
2623 <code>SC_CHARSET_GREEK</code>, <code>SC_CHARSET_HANGUL</code>, <code>SC_CHARSET_HEBREW</code>,
2624 <code>SC_CHARSET_JOHAB</code>, <code>SC_CHARSET_MAC</code>, <code>SC_CHARSET_OEM</code>,
2625 <code>SC_CHARSET_RUSSIAN</code> (code page 1251),
2626 <code>SC_CHARSET_SHIFTJIS</code>, <code>SC_CHARSET_SYMBOL</code>, <code>SC_CHARSET_THAI</code>,
2627 <code>SC_CHARSET_TURKISH</code>, and <code>SC_CHARSET_VIETNAMESE</code>.</p>
2629 <p>The character sets supported on GTK+ are:<br />
2630 <code>SC_CHARSET_ANSI</code>, <code>SC_CHARSET_CYRILLIC</code> (code page 1251),
2631 <code>SC_CHARSET_EASTEUROPE</code>,
2632 <code>SC_CHARSET_GB2312</code>, <code>SC_CHARSET_HANGUL</code>,
2633 <code>SC_CHARSET_RUSSIAN</code> (KOI8-R), <code>SC_CHARSET_SHIFTJIS</code>, and
2634 <code>SC_CHARSET_8859_15</code>.</p>
2636 <p><b id="SCI_STYLESETCASE">SCI_STYLESETCASE(int styleNumber, int caseMode)</b><br />
2637 <b id="SCI_STYLEGETCASE">SCI_STYLEGETCASE(int styleNumber)</b><br />
2638 The value of caseMode determines how text is displayed. You can set upper case
2639 (<code>SC_CASE_UPPER</code>, 1) or lower case (<code>SC_CASE_LOWER</code>, 2) or display
2640 normally (<code>SC_CASE_MIXED</code>, 0). This does not change the stored text, only how it is
2641 displayed.</p>
2643 <p><b id="SCI_STYLESETVISIBLE">SCI_STYLESETVISIBLE(int styleNumber, bool visible)</b><br />
2644 <b id="SCI_STYLEGETVISIBLE">SCI_STYLEGETVISIBLE(int styleNumber)</b><br />
2645 Text is normally visible. However, you can completely hide it by giving it a style with the
2646 <code>visible</code> set to 0. This could be used to hide embedded formatting instructions or
2647 hypertext keywords in HTML or XML.</p>
2649 <p><b id="SCI_STYLESETCHANGEABLE">SCI_STYLESETCHANGEABLE(int styleNumber, bool
2650 changeable)</b><br />
2651 <b id="SCI_STYLEGETCHANGEABLE">SCI_STYLEGETCHANGEABLE(int styleNumber)</b><br />
2652 This is an experimental and incompletely implemented style attribute. The default setting is
2653 <code>changeable</code> set <code>true</code> but when set <code>false</code> it makes text
2654 read-only. Currently it only stops the caret from being within not-changeable text and does not
2655 yet stop deleting a range that contains not-changeable text.</p>
2657 <p><b id="SCI_STYLESETHOTSPOT">SCI_STYLESETHOTSPOT(int styleNumber, bool
2658 hotspot)</b><br />
2659 <b id="SCI_STYLEGETHOTSPOT">SCI_STYLEGETHOTSPOT(int styleNumber)</b><br />
2660 This style is used to mark ranges of text that can detect mouse clicks.
2661 The cursor changes to a hand over hotspots, and the foreground, and background colours
2662 may change and an underline appear to indicate that these areas are sensitive to clicking.
2663 This may be used to allow hyperlinks to other documents.</p>
2665 <h2 id="CaretAndSelectionStyles">Caret, selection, and hotspot styles</h2>
2667 <p>The selection is shown by changing the foreground and/or background colours. If one of these
2668 is not set then that attribute is not changed for the selection. The default is to show the
2669 selection by changing the background to light grey and leaving the foreground the same as when
2670 it was not selected. When there is no selection, the current insertion point is marked by the
2671 text caret. This is a vertical line that is normally blinking on and off to attract the users
2672 attention.</p>
2673 <code><a class="message" href="#SCI_SETSELFORE">SCI_SETSELFORE(bool useSelectionForeColour, int colour)</a><br />
2674 <a class="message" href="#SCI_SETSELBACK">SCI_SETSELBACK(bool useSelectionBackColour, int colour)</a><br />
2675 <a class="message" href="#SCI_SETSELALPHA">SCI_SETSELALPHA(int alpha)</a><br />
2676 <a class="message" href="#SCI_GETSELALPHA">SCI_GETSELALPHA</a><br />
2677 <a class="message" href="#SCI_SETSELEOLFILLED">SCI_SETSELEOLFILLED(bool filled)</a><br />
2678 <a class="message" href="#SCI_GETSELEOLFILLED">SCI_GETSELEOLFILLED</a><br />
2679 <a class="message" href="#SCI_SETCARETFORE">SCI_SETCARETFORE(int colour)</a><br />
2680 <a class="message" href="#SCI_GETCARETFORE">SCI_GETCARETFORE</a><br />
2681 <a class="message" href="#SCI_SETCARETLINEVISIBLE">SCI_SETCARETLINEVISIBLE(bool show)</a><br />
2682 <a class="message" href="#SCI_GETCARETLINEVISIBLE">SCI_GETCARETLINEVISIBLE</a><br />
2683 <a class="message" href="#SCI_SETCARETLINEBACK">SCI_SETCARETLINEBACK(int colour)</a><br />
2684 <a class="message" href="#SCI_GETCARETLINEBACK">SCI_GETCARETLINEBACK</a><br />
2685 <a class="message" href="#SCI_SETCARETLINEBACKALPHA">SCI_SETCARETLINEBACKALPHA(int alpha)</a><br />
2686 <a class="message" href="#SCI_GETCARETLINEBACKALPHA">SCI_GETCARETLINEBACKALPHA</a><br />
2687 <a class="message" href="#SCI_SETCARETLINEVISIBLEALWAYS">SCI_SETCARETLINEVISIBLEALWAYS(bool alwaysVisible)</a><br />
2688 <a class="message" href="#SCI_GETCARETLINEVISIBLEALWAYS">SCI_GETCARETLINEVISIBLEALWAYS</a><br />
2689 <a class="message" href="#SCI_SETCARETPERIOD">SCI_SETCARETPERIOD(int milliseconds)</a><br />
2690 <a class="message" href="#SCI_GETCARETPERIOD">SCI_GETCARETPERIOD</a><br />
2691 <a class="message" href="#SCI_SETCARETSTYLE">SCI_SETCARETSTYLE(int style)</a><br />
2692 <a class="message" href="#SCI_GETCARETSTYLE">SCI_GETCARETSTYLE</a><br />
2693 <a class="message" href="#SCI_SETCARETWIDTH">SCI_SETCARETWIDTH(int pixels)</a><br />
2694 <a class="message" href="#SCI_GETCARETWIDTH">SCI_GETCARETWIDTH</a><br />
2695 <a class="message" href="#SCI_SETHOTSPOTACTIVEFORE">SCI_SETHOTSPOTACTIVEFORE(bool useSetting, int colour)</a><br />
2696 <a class="message" href="#SCI_GETHOTSPOTACTIVEFORE">SCI_GETHOTSPOTACTIVEFORE</a><br />
2697 <a class="message" href="#SCI_SETHOTSPOTACTIVEBACK">SCI_SETHOTSPOTACTIVEBACK(bool useSetting, int colour)</a><br />
2698 <a class="message" href="#SCI_GETHOTSPOTACTIVEBACK">SCI_GETHOTSPOTACTIVEBACK</a><br />
2699 <a class="message" href="#SCI_SETHOTSPOTACTIVEUNDERLINE">SCI_SETHOTSPOTACTIVEUNDERLINE(bool underline)</a><br />
2700 <a class="message" href="#SCI_GETHOTSPOTACTIVEUNDERLINE">SCI_GETHOTSPOTACTIVEUNDERLINE</a><br />
2701 <a class="message" href="#SCI_SETHOTSPOTSINGLELINE">SCI_SETHOTSPOTSINGLELINE(bool singleLine)</a><br />
2702 <a class="message" href="#SCI_GETHOTSPOTSINGLELINE">SCI_GETHOTSPOTSINGLELINE</a><br />
2703 <a class="message" href="#SCI_SETCARETSTICKY">SCI_SETCARETSTICKY(int useCaretStickyBehaviour)</a><br />
2704 <a class="message" href="#SCI_GETCARETSTICKY">SCI_GETCARETSTICKY</a><br />
2705 <a class="message" href="#SCI_TOGGLECARETSTICKY">SCI_TOGGLECARETSTICKY</a><br />
2706 </code>
2708 <p><b id="SCI_SETSELFORE">SCI_SETSELFORE(bool useSelectionForeColour, int <a class="jump"
2709 href="#colour">colour</a>)</b><br />
2710 <b id="SCI_SETSELBACK">SCI_SETSELBACK(bool useSelectionBackColour, int <a class="jump"
2711 href="#colour">colour</a>)</b><br />
2712 You can choose to override the default selection colouring with these two messages. The colour
2713 you provide is used if you set <code>useSelection*Colour</code> to <code>true</code>. If it is
2714 set to <code>false</code>, the default styled colouring is used and the <code>colour</code>
2715 argument has no effect.</p>
2716 <p><b id="SCI_SETSELALPHA">SCI_SETSELALPHA(int <a class="jump" href="#alpha">alpha</a>)</b><br />
2717 <b id="SCI_GETSELALPHA">SCI_GETSELALPHA</b><br />
2718 The selection can be drawn translucently in the selection background colour by
2719 setting an alpha value.</p>
2721 <p><b id="SCI_SETSELEOLFILLED">SCI_SETSELEOLFILLED(bool filled)</b><br />
2722 <b id="SCI_GETSELEOLFILLED">SCI_GETSELEOLFILLED</b><br />
2723 The selection can be drawn up to the right hand border by setting this property.</p>
2725 <p><b id="SCI_SETCARETFORE">SCI_SETCARETFORE(int <a class="jump"
2726 href="#colour">colour</a>)</b><br />
2727 <b id="SCI_GETCARETFORE">SCI_GETCARETFORE</b><br />
2728 The colour of the caret can be set with <code>SCI_SETCARETFORE</code> and retrieved with
2729 <code>SCI_GETCARETFORE</code>.</p>
2731 <p><b id="SCI_SETCARETLINEVISIBLE">SCI_SETCARETLINEVISIBLE(bool show)</b><br />
2732 <b id="SCI_GETCARETLINEVISIBLE">SCI_GETCARETLINEVISIBLE</b><br />
2733 <b id="SCI_SETCARETLINEBACK">SCI_SETCARETLINEBACK(int <a class="jump"
2734 href="#colour">colour</a>)</b><br />
2735 <b id="SCI_GETCARETLINEBACK">SCI_GETCARETLINEBACK</b><br />
2736 <b id="SCI_SETCARETLINEBACKALPHA">SCI_SETCARETLINEBACKALPHA(int <a class="jump" href="#alpha">alpha</a>)</b><br />
2737 <b id="SCI_GETCARETLINEBACKALPHA">SCI_GETCARETLINEBACKALPHA</b><br />
2738 You can choose to make the background colour of the line containing the caret different with
2739 these messages. To do this, set the desired background colour with
2740 <code>SCI_SETCARETLINEBACK</code>, then use <code>SCI_SETCARETLINEVISIBLE(true)</code> to
2741 enable the effect. You can cancel the effect with <code>SCI_SETCARETLINEVISIBLE(false)</code>.
2742 The two <code>SCI_GETCARET*</code> functions return the state and the colour. This form of
2743 background colouring has highest priority when a line has markers that would otherwise change
2744 the background colour.
2745 The caret line may also be drawn translucently which allows other background colours to show
2746 through. This is done by setting the alpha (translucency) value by calling
2747 SCI_SETCARETLINEBACKALPHA. When the alpha is not SC_ALPHA_NOALPHA,
2748 the caret line is drawn after all other features so will affect the colour of all other features.
2749 </p>
2751 <p><b id="SCI_SETCARETLINEVISIBLEALWAYS">SCI_SETCARETLINEVISIBLEALWAYS(bool alwaysVisible)</b><br />
2752 <b id="SCI_GETCARETLINEVISIBLEALWAYS">SCI_GETCARETLINEVISIBLEALWAYS</b><br />
2753 Choose to make the caret line always visible even when the window is not in focus.
2754 Default behaviour <code>SCI_SETCARETLINEVISIBLEALWAYS(false)</code> the caret line is only visible when the window is in focus.
2755 </p>
2757 <p><b id="SCI_SETCARETPERIOD">SCI_SETCARETPERIOD(int milliseconds)</b><br />
2758 <b id="SCI_GETCARETPERIOD">SCI_GETCARETPERIOD</b><br />
2759 The rate at which the caret blinks can be set with <code>SCI_SETCARETPERIOD</code> which
2760 determines the time in milliseconds that the caret is visible or invisible before changing
2761 state. Setting the period to 0 stops the caret blinking. The default value is 500 milliseconds.
2762 <code>SCI_GETCARETPERIOD</code> returns the current setting.</p>
2764 <p><b id="SCI_SETCARETSTYLE">SCI_SETCARETSTYLE(int style)</b><br />
2765 <b id="SCI_GETCARETSTYLE">SCI_GETCARETSTYLE</b><br />
2766 The style of the caret can be set with <code>SCI_SETCARETSTYLE</code> to be a line caret
2767 (CARETSTYLE_LINE=1), a block caret (CARETSTYLE_BLOCK=2) or to not draw at all
2768 (CARETSTYLE_INVISIBLE=0). The default value is the line caret (CARETSTYLE_LINE=1).
2769 You can determine the current caret style setting using <code>SCI_GETCARETSTYLE</code>.</p>
2771 <p>The block character draws most combining and multibyte character sequences successfully,
2772 though some fonts like Thai Fonts (and possibly others) can sometimes appear strange when
2773 the cursor is positioned at these characters, which may result in only drawing a part of the
2774 cursor character sequence. This is most notable on Windows platforms.</p>
2776 <p><b id="SCI_SETCARETWIDTH">SCI_SETCARETWIDTH(int pixels)</b><br />
2777 <b id="SCI_GETCARETWIDTH">SCI_GETCARETWIDTH</b><br />
2778 The width of the line caret can be set with <code>SCI_SETCARETWIDTH</code> to a value of
2779 0, 1, 2 or 3 pixels. The default width is 1 pixel. You can read back the current width with
2780 <code>SCI_GETCARETWIDTH</code>. A width of 0 makes the caret invisible (added at version
2781 1.50), similar to setting the caret style to CARETSTYLE_INVISIBLE (though not interchangeable).
2782 This setting only affects the width of the cursor when the cursor style is set to line caret
2783 mode, it does not affect the width for a block caret.</p>
2785 <p><b id="SCI_SETHOTSPOTACTIVEFORE">SCI_SETHOTSPOTACTIVEFORE(bool useHotSpotForeColour, int <a class="jump"
2786 href="#colour">colour</a>)</b><br />
2787 <b id="SCI_GETHOTSPOTACTIVEFORE">SCI_GETHOTSPOTACTIVEFORE</b><br />
2788 <b id="SCI_SETHOTSPOTACTIVEBACK">SCI_SETHOTSPOTACTIVEBACK(bool useHotSpotBackColour, int <a class="jump"
2789 href="#colour">colour</a>)</b><br />
2790 <b id="SCI_GETHOTSPOTACTIVEBACK">SCI_GETHOTSPOTACTIVEBACK</b><br />
2791 <b id="SCI_SETHOTSPOTACTIVEUNDERLINE">SCI_SETHOTSPOTACTIVEUNDERLINE(bool underline)</b><br />
2792 <b id="SCI_GETHOTSPOTACTIVEUNDERLINE">SCI_GETHOTSPOTACTIVEUNDERLINE</b><br />
2793 <b id="SCI_SETHOTSPOTSINGLELINE">SCI_SETHOTSPOTSINGLELINE(bool singleLine)</b><br />
2794 <b id="SCI_GETHOTSPOTSINGLELINE">SCI_GETHOTSPOTSINGLELINE</b><br />
2795 While the cursor hovers over text in a style with the hotspot attribute set,
2796 the default colouring can be modified and an underline drawn with these settings.
2797 Single line mode stops a hotspot from wrapping onto next line.</p>
2799 <p><b id="SCI_SETCARETSTICKY">SCI_SETCARETSTICKY(int useCaretStickyBehaviour)</b><br />
2800 <b id="SCI_GETCARETSTICKY">SCI_GETCARETSTICKY</b><br />
2801 <b id="SCI_TOGGLECARETSTICKY">SCI_TOGGLECARETSTICKY</b><br />
2802 These messages set, get or toggle the caretSticky setting which controls when the last position
2803 of the caret on the line is saved.</p>
2805 <p>When set to <code>SC_CARETSTICKY_OFF</code> (0), the sticky flag is off; all text changes
2806 (and all caret position changes) will remember the
2807 caret's new horizontal position when moving to different lines. This is the default.</p>
2809 <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
2810 horizontal caret position is moving the caret with mouse or keyboard (left/right arrow keys, home/end keys, etc). </p>
2812 <p>When set to <code>SC_CARETSTICKY_WHITESPACE</code> (2), the caret acts like mode 0 (sticky off) except under one
2813 special case; when space or tab characters are inserted. (Including pasting <b>only space/tabs</b> -- undo, redo,
2814 etc. do not exhibit this behaviour..).</p>
2816 <p><code>SCI_TOGGLECARETSTICKY</code> switches from <code>SC_CARETSTICKY_ON</code> and <code>SC_CARETSTICKY_WHITESPACE</code>
2817 to <code>SC_CARETSTICKY_OFF</code> and from <code>SC_CARETSTICKY_OFF</code> to <code>SC_CARETSTICKY_ON</code>.</p>
2819 <h2 id="CharacterRepresentations">Character representations</h2>
2821 <p>Some characters, such as control characters and invalid bytes, do not have a visual glyph or use a glyph that is hard to distinguish.</p>
2823 <p>Control characters (characters with codes less than 32, or between 128 and 159 in some encodings)
2824 are displayed by Scintilla using their mnemonics inverted in a rounded rectangle. These mnemonics come from the
2825 early days of signalling, though some are still used (LF = Line Feed, BS = Back Space, CR =
2826 Carriage Return, for example).</p>
2828 <p>For the low 'C0' values: "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
2829 "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", "DLE", "DC1", "DC2", "DC3", "DC4", "NAK",
2830 "SYN", "ETB", "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US".</p>
2832 <p>For the high 'C1' values:
2833 "PAD", "HOP", "BPH", "NBH", "IND", "NEL", "SSA", "ESA",
2834 "HTS", "HTJ", "VTS", "PLD", "PLU", "RI", "SS2", "SS3",
2835 "DCS", "PU1", "PU2", "STS", "CCH", "MW", "SPA", "EPA",
2836 "SOS", "SGCI", "SCI", "CSI", "ST", "OSC", "PM", "APC".</p>
2838 <p>Invalid bytes are shown in a similar way with an 'x' followed by their value in hexadecimal, like "xFE".</p>
2840 <code>
2841 <a class="message" href="#SCI_SETREPRESENTATION">SCI_SETREPRESENTATION(const char *encodedCharacter, const char *representation)</a><br />
2842 <a class="message" href="#SCI_GETREPRESENTATION">SCI_GETREPRESENTATION(const char *encodedCharacter, char *representation)</a><br />
2843 <a class="message" href="#SCI_CLEARREPRESENTATION">SCI_CLEARREPRESENTATION(const char *encodedCharacter)</a><br />
2844 <a class="message" href="#SCI_SETCONTROLCHARSYMBOL">SCI_SETCONTROLCHARSYMBOL(int symbol)</a><br />
2845 <a class="message" href="#SCI_GETCONTROLCHARSYMBOL">SCI_GETCONTROLCHARSYMBOL</a><br />
2846 </code>
2848 <p><b id="SCI_SETREPRESENTATION">SCI_SETREPRESENTATION(const char *encodedCharacter, const char *representation)</b><br />
2849 <b id="SCI_GETREPRESENTATION">SCI_GETREPRESENTATION(const char *encodedCharacter, char *representation)</b><br />
2850 <b id="SCI_CLEARREPRESENTATION">SCI_CLEARREPRESENTATION(const char *encodedCharacter)</b><br />
2851 Any character, including those normally displayed as mnemonics may be represented by a
2852 string inverted in a rounded rectangle.</p>
2854 <p>For example, the Ohm sign &#x2126; U+2126 looks very similar to the Greek Omega character &#x3a9; U+03C9 so,
2855 for the UTF-8 encoding, to distinguish the Ohm sign as "U+2126 &#x2126;" this call could be made:
2856 <code>SCI_SETREPRESENTATION("\xe2\x84\xa6", "U+2126 \xe2\x84\xa6")</code></p>
2858 <p>The encodedCharacter parameter is a NUL-terminated string of the bytes for one character in the
2859 current encoding. This can not be used to set a representation for multiple-character strings. </p>
2861 <p>The NUL (0) character is a special case since the encodedCharacter parameter is NUL terminated, the NUL
2862 character is specified as an empty string.</p>
2864 <p><b id="SCI_SETCONTROLCHARSYMBOL">SCI_SETCONTROLCHARSYMBOL(int symbol)</b><br />
2865 <b id="SCI_GETCONTROLCHARSYMBOL">SCI_GETCONTROLCHARSYMBOL</b><br />
2866 The mnemonics may be replaced by a nominated symbol with an ASCII code in the
2867 range 32 to 255. If you set a symbol value less than 32, all control characters are displayed
2868 as mnemonics. The symbol you set is rendered in the font of the style set for the character.
2869 You can read back the current symbol with the <code>SCI_GETCONTROLCHARSYMBOL</code> message.
2870 The default symbol value is 0.</p>
2872 <h2 id="Margins">Margins</h2>
2874 <p>There may be up to five margins, numbered 0 to <code>SC_MAX_MARGIN</code> (4)
2875 to the left of the text display, plus a gap either side of
2876 the text. Each margin can be set to display only symbols, line numbers, or text with <a
2877 class="message" href="#SCI_SETMARGINTYPEN"><code>SCI_SETMARGINTYPEN</code></a>.
2878 Textual margins may also display symbols.
2879 The markers
2880 that can be displayed in each margin are set with <a class="message"
2881 href="#SCI_SETMARGINMASKN"><code>SCI_SETMARGINMASKN</code></a>. Any markers not associated with
2882 a visible margin will be displayed as changes in background colour in the text. A width in
2883 pixels can be set for each margin. Margins with a zero width are ignored completely. You can
2884 choose if a mouse click in a margin sends a <a class="message"
2885 href="#SCN_MARGINCLICK"><code>SCN_MARGINCLICK</code></a> notification to the container or
2886 selects a line of text.</p>
2888 <p>The margins are numbered 0 to 4. Using a margin number outside the valid range has no
2889 effect. By default, margin 0 is set to display line numbers, but is given a width of 0, so it
2890 is hidden. Margin 1 is set to display non-folding symbols and is given a width of 16 pixels, so
2891 it is visible. Margin 2 is set to display the folding symbols, but is given a width of 0, so it
2892 is hidden. Of course, you can set the margins to be whatever you wish.</p>
2894 <p>Styled text margins used to show revision and blame information:</p>
2895 <p><img src="styledmargin.png" alt="Styled text margins used to show revision and blame information" /></p>
2897 <code><a class="message" href="#SCI_SETMARGINTYPEN">SCI_SETMARGINTYPEN(int margin, int
2898 type)</a><br />
2899 <a class="message" href="#SCI_GETMARGINTYPEN">SCI_GETMARGINTYPEN(int margin)</a><br />
2900 <a class="message" href="#SCI_SETMARGINWIDTHN">SCI_SETMARGINWIDTHN(int margin, int
2901 pixelWidth)</a><br />
2902 <a class="message" href="#SCI_GETMARGINWIDTHN">SCI_GETMARGINWIDTHN(int margin)</a><br />
2903 <a class="message" href="#SCI_SETMARGINMASKN">SCI_SETMARGINMASKN(int margin, int
2904 mask)</a><br />
2905 <a class="message" href="#SCI_GETMARGINMASKN">SCI_GETMARGINMASKN(int margin)</a><br />
2906 <a class="message" href="#SCI_SETMARGINSENSITIVEN">SCI_SETMARGINSENSITIVEN(int margin, bool
2907 sensitive)</a><br />
2908 <a class="message" href="#SCI_GETMARGINSENSITIVEN">SCI_GETMARGINSENSITIVEN(int
2909 margin)</a><br />
2910 <a class="message" href="#SCI_SETMARGINCURSORN">SCI_SETMARGINCURSORN(int margin, int
2911 cursor)</a><br />
2912 <a class="message" href="#SCI_GETMARGINCURSORN">SCI_GETMARGINCURSORN(int
2913 margin)</a><br />
2914 <a class="message" href="#SCI_SETMARGINLEFT">SCI_SETMARGINLEFT(&lt;unused&gt;, int
2915 pixels)</a><br />
2916 <a class="message" href="#SCI_GETMARGINLEFT">SCI_GETMARGINLEFT</a><br />
2917 <a class="message" href="#SCI_SETMARGINRIGHT">SCI_SETMARGINRIGHT(&lt;unused&gt;, int
2918 pixels)</a><br />
2919 <a class="message" href="#SCI_GETMARGINRIGHT">SCI_GETMARGINRIGHT</a><br />
2920 <a class="message" href="#SCI_SETFOLDMARGINCOLOUR">SCI_SETFOLDMARGINCOLOUR(bool useSetting, int colour)</a><br />
2921 <a class="message" href="#SCI_SETFOLDMARGINHICOLOUR">SCI_SETFOLDMARGINHICOLOUR(bool useSetting, int colour)</a><br />
2922 <a class="message" href="#SCI_MARGINSETTEXT">SCI_MARGINSETTEXT(int line, char *text)</a><br />
2923 <a class="message" href="#SCI_MARGINGETTEXT">SCI_MARGINGETTEXT(int line, char *text)</a><br />
2924 <a class="message" href="#SCI_MARGINSETSTYLE">SCI_MARGINSETSTYLE(int line, int style)</a><br />
2925 <a class="message" href="#SCI_MARGINGETSTYLE">SCI_MARGINGETSTYLE(int line)</a><br />
2926 <a class="message" href="#SCI_MARGINSETSTYLES">SCI_MARGINSETSTYLES(int line, char *styles)</a><br />
2927 <a class="message" href="#SCI_MARGINGETSTYLES">SCI_MARGINGETSTYLES(int line, char *styles)</a><br />
2928 <a class="message" href="#SCI_MARGINTEXTCLEARALL">SCI_MARGINTEXTCLEARALL</a><br />
2929 <a class="message" href="#SCI_MARGINSETSTYLEOFFSET">SCI_MARGINSETSTYLEOFFSET(int style)</a><br />
2930 <a class="message" href="#SCI_MARGINGETSTYLEOFFSET">SCI_MARGINGETSTYLEOFFSET</a><br />
2931 <a class="message" href="#SCI_SETMARGINOPTIONS">SCI_SETMARGINOPTIONS(int marginOptions)</a><br />
2932 <a class="message" href="#SCI_GETMARGINOPTIONS">SCI_GETMARGINOPTIONS</a><br />
2933 </code>
2935 <p><b id="SCI_SETMARGINTYPEN">SCI_SETMARGINTYPEN(int margin, int iType)</b><br />
2936 <b id="SCI_GETMARGINTYPEN">SCI_GETMARGINTYPEN(int margin)</b><br />
2937 These two routines set and get the type of a margin. The margin argument should be 0, 1, 2, 3 or 4.
2938 You can use the predefined constants <code>SC_MARGIN_SYMBOL</code> (0) and
2939 <code>SC_MARGIN_NUMBER</code> (1) to set a margin as either a line number or a symbol margin.
2940 A margin with application defined text may use <code>SC_MARGIN_TEXT</code> (4) or
2941 <code>SC_MARGIN_RTEXT</code> (5) to right justify the text.
2942 By convention, margin 0 is used for line numbers and the next two are used for symbols. You can
2943 also use the constants <code>SC_MARGIN_BACK</code> (2) and <code>SC_MARGIN_FORE</code> (3) for
2944 symbol margins that set their background colour to match the STYLE_DEFAULT background and
2945 foreground colours.</p>
2947 <p><b id="SCI_SETMARGINWIDTHN">SCI_SETMARGINWIDTHN(int margin, int pixelWidth)</b><br />
2948 <b id="SCI_GETMARGINWIDTHN">SCI_GETMARGINWIDTHN(int margin)</b><br />
2949 These routines set and get the width of a margin in pixels. A margin with zero width is
2950 invisible. By default, Scintilla sets margin 1 for symbols with a width of 16 pixels, so this
2951 is a reasonable guess if you are not sure what would be appropriate. Line number margins widths
2952 should take into account the number of lines in the document and the line number style. You
2953 could use something like <a class="message"
2954 href="#SCI_TEXTWIDTH"><code>SCI_TEXTWIDTH(STYLE_LINENUMBER, "_99999")</code></a> to get a
2955 suitable width.</p>
2957 <p><b id="SCI_SETMARGINMASKN">SCI_SETMARGINMASKN(int margin, int mask)</b><br />
2958 <b id="SCI_GETMARGINMASKN">SCI_GETMARGINMASKN(int margin)</b><br />
2959 The mask is a 32-bit value. Each bit corresponds to one of 32 logical symbols that can be
2960 displayed in a margin that is enabled for symbols. There is a useful constant,
2961 <code>SC_MASK_FOLDERS</code> (0xFE000000 or -33554432), that is a mask for the 7 logical
2962 symbols used to denote folding. You can assign a wide range of symbols and colours to each of
2963 the 32 logical symbols, see <a href="#Markers">Markers</a> for more information. If <code>(mask
2964 &amp; SC_MASK_FOLDERS)==0</code>, the margin background colour is controlled by style 33 (<a
2965 class="message" href="#StyleDefinition"><code>STYLE_LINENUMBER</code></a>).</p>
2967 <p>You add logical markers to a line with <a class="message"
2968 href="#SCI_MARKERADD"><code>SCI_MARKERADD</code></a>. If a line has an associated marker that
2969 does not appear in the mask of any margin with a non-zero width, the marker changes the
2970 background colour of the line. For example, suppose you decide to use logical marker 10 to mark
2971 lines with a syntax error and you want to show such lines by changing the background colour.
2972 The mask for this marker is 1 shifted left 10 times (1&lt;&lt;10) which is 0x400. If you make
2973 sure that no symbol margin includes 0x400 in its mask, any line with the marker gets the
2974 background colour changed.</p>
2976 <p>To set a non-folding margin 1 use <code>SCI_SETMARGINMASKN(1, ~SC_MASK_FOLDERS)</code>
2977 which is the default set by Scintilla.
2978 To set a folding margin 2 use <code>SCI_SETMARGINMASKN(2, SC_MASK_FOLDERS)</code>.
2979 <code>~SC_MASK_FOLDERS</code> is 0x1FFFFFF in hexadecimal or 33554431
2980 decimal. Of course, you may need to display all 32 symbols in a margin, in which case use
2981 <code>SCI_SETMARGINMASKN(margin, -1)</code>.</p>
2983 <p><b id="SCI_SETMARGINSENSITIVEN">SCI_SETMARGINSENSITIVEN(int margin, bool
2984 sensitive)</b><br />
2985 <b id="SCI_GETMARGINSENSITIVEN">SCI_GETMARGINSENSITIVEN(int margin)</b><br />
2986 Each of the five margins can be set sensitive or insensitive to mouse clicks. A click in a
2987 sensitive margin sends a <a class="message"
2988 href="#SCN_MARGINCLICK"><code>SCN_MARGINCLICK</code></a> <a class="jump"
2989 href="#Notifications">notification</a> to the container. Margins that are not sensitive act as
2990 selection margins which make it easy to select ranges of lines. By default, all margins are
2991 insensitive.</p>
2993 <p><b id="SCI_SETMARGINCURSORN">SCI_SETMARGINCURSORN(int margin, int
2994 cursor)</b><br />
2995 <b id="SCI_GETMARGINCURSORN">SCI_GETMARGINCURSORN(int margin)</b><br />
2996 A reversed arrow cursor is normally shown over all margins. This may be changed to a normal arrow with
2997 <code>SCI_SETMARGINCURSORN(margin, SC_CURSORARROW)</code> or restored to a
2998 reversed arrow with
2999 <code>SCI_SETMARGINCURSORN(margin, SC_CURSORREVERSEARROW)</code>.</p>
3001 <p><b id="SCI_SETMARGINLEFT">SCI_SETMARGINLEFT(&lt;unused&gt;, int pixels)</b><br />
3002 <b id="SCI_GETMARGINLEFT">SCI_GETMARGINLEFT</b><br />
3003 <b id="SCI_SETMARGINRIGHT">SCI_SETMARGINRIGHT(&lt;unused&gt;, int pixels)</b><br />
3004 <b id="SCI_GETMARGINRIGHT">SCI_GETMARGINRIGHT</b><br />
3005 These messages set and get the width of the blank margin on both sides of the text in pixels.
3006 The default is to one pixel on each side.</p>
3008 <p><b id="SCI_SETFOLDMARGINCOLOUR">SCI_SETFOLDMARGINCOLOUR(bool useSetting, int colour)</b><br />
3009 <b id="SCI_SETFOLDMARGINHICOLOUR">SCI_SETFOLDMARGINHICOLOUR(bool useSetting, int colour)</b><br />
3010 These messages allow changing the colour of the fold margin and fold margin highlight.
3011 On Windows the fold margin colour defaults to ::GetSysColor(COLOR_3DFACE) and the fold margin highlight
3012 colour to ::GetSysColor(COLOR_3DHIGHLIGHT).</p>
3015 <b id="SCI_MARGINSETTEXT">SCI_MARGINSETTEXT(int line, char *text)</b><br />
3016 <b id="SCI_MARGINGETTEXT">SCI_MARGINGETTEXT(int line, char *text)</b><br />
3017 <b id="SCI_MARGINSETSTYLE">SCI_MARGINSETSTYLE(int line, int style)</b><br />
3018 <b id="SCI_MARGINGETSTYLE">SCI_MARGINGETSTYLE(int line)</b><br />
3019 <b id="SCI_MARGINSETSTYLES">SCI_MARGINSETSTYLES(int line, char *styles)</b><br />
3020 <b id="SCI_MARGINGETSTYLES">SCI_MARGINGETSTYLES(int line, char *styles)</b><br />
3021 <b id="SCI_MARGINTEXTCLEARALL">SCI_MARGINTEXTCLEARALL</b><br />
3022 Text margins are created with the type SC_MARGIN_TEXT or SC_MARGIN_RTEXT.
3023 A different string may be set for each line with <code>SCI_MARGINSETTEXT</code>.
3024 The whole of the text margin on a line may be displayed in a particular style with
3025 <code>SCI_MARGINSETSTYLE</code> or each character may be individually styled with
3026 <code>SCI_MARGINSETSTYLES</code> which uses an array of bytes with each byte setting the style
3027 of the corresponding text byte similar to <code>SCI_SETSTYLINGEX</code>.
3028 Setting a text margin will cause a
3029 <a class="message" href="#SC_MOD_CHANGEMARGIN"><code>SC_MOD_CHANGEMARGIN</code></a>
3030 notification to be sent.
3031 </p>
3033 Only some style attributes are active in text margins: font, size/sizeFractional, bold/weight, italics, fore, back, and characterSet.
3034 </p>
3036 <b id="SCI_MARGINSETSTYLEOFFSET">SCI_MARGINSETSTYLEOFFSET(int style)</b><br />
3037 <b id="SCI_MARGINGETSTYLEOFFSET">SCI_MARGINGETSTYLEOFFSET</b><br />
3038 Margin styles may be completely separated from standard text styles by setting a style offset. For example,
3039 <code>SCI_MARGINSETSTYLEOFFSET(256)</code> would allow the margin styles to be numbered from
3040 256 up to 511 so they do not overlap styles set by lexers. Each style number set with <code>SCI_MARGINSETSTYLE</code>
3041 or <code>SCI_MARGINSETSTYLES</code> has the offset added before looking up the style.
3042 </p>
3044 Always call <a class="message" href="#SCI_ALLOCATEEXTENDEDSTYLES">SCI_ALLOCATEEXTENDEDSTYLES</a>
3045 before <code>SCI_MARGINSETSTYLEOFFSET</code> and use the result as the argument to <code>SCI_MARGINSETSTYLEOFFSET</code>.
3046 </p>
3048 <b id="SCI_SETMARGINOPTIONS">SCI_SETMARGINOPTIONS(int marginOptions)</b><br />
3049 <b id="SCI_GETMARGINOPTIONS">SCI_GETMARGINOPTIONS</b><br />
3050 Define margin options by enabling appropriate bit flags. At the moment, only one flag is available
3051 <code>SC_MARGINOPTION_SUBLINESELECT</code>=1, which controls how wrapped lines are selected when clicking
3052 on margin in front of them. If <code>SC_MARGINOPTION_SUBLINESELECT</code> is set only sub line of wrapped
3053 line is selected, otherwise whole wrapped line is selected. Margin options are set to
3054 <code>SC_MARGINOPTION_NONE</code>=0 by default.
3055 </p>
3057 <h2 id="Annotations">Annotations</h2>
3059 <p>Annotations are read-only lines of text underneath each line of editable text.
3060 An annotation may consist of multiple lines separated by '\n'.
3061 Annotations can be used to display an assembler version of code for debugging or to show diagnostic messages inline or to
3062 line up different versions of text in a merge tool.</p>
3063 <p>Annotations count as display lines for the methods
3064 <a class="message" href="#SCI_VISIBLEFROMDOCLINE"><code>SCI_VISIBLEFROMDOCLINE</code></a> and
3065 <a class="message" href="#SCI_DOCLINEFROMVISIBLE"><code>SCI_DOCLINEFROMVISIBLE</code></a></p>
3066 <p>Annotations used for inline diagnostics:</p>
3067 <p><img src="annotations.png" alt="Annotations used for inline diagnostics" /></p>
3069 <code>
3070 <a class="message" href="#SCI_ANNOTATIONSETTEXT">SCI_ANNOTATIONSETTEXT(int line, char *text)</a><br />
3071 <a class="message" href="#SCI_ANNOTATIONGETTEXT">SCI_ANNOTATIONGETTEXT(int line, char *text)</a><br />
3072 <a class="message" href="#SCI_ANNOTATIONSETSTYLE">SCI_ANNOTATIONSETSTYLE(int line, int style)</a><br />
3073 <a class="message" href="#SCI_ANNOTATIONGETSTYLE">SCI_ANNOTATIONGETSTYLE(int line)</a><br />
3074 <a class="message" href="#SCI_ANNOTATIONSETSTYLES">SCI_ANNOTATIONSETSTYLES(int line, char *styles)</a><br />
3075 <a class="message" href="#SCI_ANNOTATIONGETSTYLES">SCI_ANNOTATIONGETSTYLES(int line, char *styles)</a><br />
3076 <a class="message" href="#SCI_ANNOTATIONGETLINES">SCI_ANNOTATIONGETLINES(int line)</a><br />
3077 <a class="message" href="#SCI_ANNOTATIONCLEARALL">SCI_ANNOTATIONCLEARALL</a><br />
3078 <a class="message" href="#SCI_ANNOTATIONSETVISIBLE">SCI_ANNOTATIONSETVISIBLE(int visible)</a><br />
3079 <a class="message" href="#SCI_ANNOTATIONGETVISIBLE">SCI_ANNOTATIONGETVISIBLE</a><br />
3080 <a class="message" href="#SCI_ANNOTATIONSETSTYLEOFFSET">SCI_ANNOTATIONSETSTYLEOFFSET(int style)</a><br />
3081 <a class="message" href="#SCI_ANNOTATIONGETSTYLEOFFSET">SCI_ANNOTATIONGETSTYLEOFFSET</a><br />
3082 </code>
3085 <b id="SCI_ANNOTATIONSETTEXT">SCI_ANNOTATIONSETTEXT(int line, char *text)</b><br />
3086 <b id="SCI_ANNOTATIONGETTEXT">SCI_ANNOTATIONGETTEXT(int line, char *text)</b><br />
3087 <b id="SCI_ANNOTATIONSETSTYLE">SCI_ANNOTATIONSETSTYLE(int line, int style)</b><br />
3088 <b id="SCI_ANNOTATIONGETSTYLE">SCI_ANNOTATIONGETSTYLE(int line)</b><br />
3089 <b id="SCI_ANNOTATIONSETSTYLES">SCI_ANNOTATIONSETSTYLES(int line, char *styles)</b><br />
3090 <b id="SCI_ANNOTATIONGETSTYLES">SCI_ANNOTATIONGETSTYLES(int line, char *styles)</b><br />
3091 <b id="SCI_ANNOTATIONGETLINES">SCI_ANNOTATIONGETLINES(int line)</b><br />
3092 <b id="SCI_ANNOTATIONCLEARALL">SCI_ANNOTATIONCLEARALL</b><br />
3093 A different string may be set for each line with <code>SCI_ANNOTATIONSETTEXT</code>.
3094 To clear annotations call <code>SCI_ANNOTATIONSETTEXT</code> with a NULL pointer.
3095 The whole of the text ANNOTATION on a line may be displayed in a particular style with
3096 <code>SCI_ANNOTATIONSETSTYLE</code> or each character may be individually styled with
3097 <code>SCI_ANNOTATIONSETSTYLES</code> which uses an array of bytes with each byte setting the style
3098 of the corresponding text byte similar to <code>SCI_SETSTYLINGEX</code>. The text must be set first as it
3099 specifies how long the annotation is so how many bytes of styling to read.
3100 Setting an annotation will cause a
3101 <a class="message" href="#SC_MOD_CHANGEANNOTATION"><code>SC_MOD_CHANGEANNOTATION</code></a>
3102 notification to be sent.
3103 </p>
3105 The number of lines annotating a line can be retrieved with <code>SCI_ANNOTATIONGETLINES</code>.
3106 All the lines can be cleared of annotations with <code>SCI_ANNOTATIONCLEARALL</code>
3107 which is equivalent to clearing each line (setting to 0) and then deleting other memory used for this feature.
3108 </p>
3110 Only some style attributes are active in annotations: font, size/sizeFractional, bold/weight, italics, fore, back, and characterSet.
3111 </p>
3113 <b id="SCI_ANNOTATIONSETVISIBLE">SCI_ANNOTATIONSETVISIBLE(int visible)</b><br />
3114 <b id="SCI_ANNOTATIONGETVISIBLE">SCI_ANNOTATIONGETVISIBLE</b><br />
3115 Annotations can be made visible in a view and there is a choice of display style when visible.
3116 The two messages set and get the annotation display mode. The <code>visible</code>
3117 argument can be one of:</p>
3119 <table cellpadding="1" cellspacing="2" border="0" summary="Annotation visibility">
3120 <tbody valign="top">
3121 <tr>
3122 <th align="left"><code>ANNOTATION_HIDDEN</code></th>
3124 <td>0</td>
3126 <td>Annotations are not displayed.</td>
3127 </tr>
3129 <tr>
3130 <th align="left"><code>ANNOTATION_STANDARD</code></th>
3132 <td>1</td>
3134 <td>Annotations are drawn left justified with no adornment.</td>
3135 </tr>
3137 <tr>
3138 <th align="left"><code>ANNOTATION_BOXED</code></th>
3140 <td>2</td>
3142 <td>Annotations are indented to match the text and are surrounded by a box.</td>
3143 </tr>
3144 </tbody>
3145 </table>
3148 <b id="SCI_ANNOTATIONSETSTYLEOFFSET">SCI_ANNOTATIONSETSTYLEOFFSET(int style)</b><br />
3149 <b id="SCI_ANNOTATIONGETSTYLEOFFSET">SCI_ANNOTATIONGETSTYLEOFFSET</b><br />
3150 Annotation styles may be completely separated from standard text styles by setting a style offset. For example,
3151 <code>SCI_ANNOTATIONSETSTYLEOFFSET(512)</code> would allow the annotation styles to be numbered from
3152 512 up to 767 so they do not overlap styles set by lexers (or margins if margins offset is 256).
3153 Each style number set with <code>SCI_ANNOTATIONSETSTYLE</code>
3154 or <code>SCI_ANNOTATIONSETSTYLES</code> has the offset added before looking up the style.
3155 </p>
3157 Always call <a class="message" href="#SCI_ALLOCATEEXTENDEDSTYLES">SCI_ALLOCATEEXTENDEDSTYLES</a>
3158 before <code>SCI_ANNOTATIONSETSTYLEOFFSET</code> and use the result as the argument to <code>SCI_ANNOTATIONSETSTYLEOFFSET</code>.
3159 </p>
3161 <h2 id="OtherSettings">Other settings</h2>
3162 <a class="message" href="#SCI_SETBUFFEREDDRAW">SCI_SETBUFFEREDDRAW(bool isBuffered)</a><br />
3163 <a class="message" href="#SCI_GETBUFFEREDDRAW">SCI_GETBUFFEREDDRAW</a><br />
3164 <a class="message" href="#SCI_SETPHASESDRAW">SCI_SETPHASESDRAW(int phases)</a><br />
3165 <a class="message" href="#SCI_GETPHASESDRAW">SCI_GETPHASESDRAW</a><br />
3166 <a class="message" href="#SCI_SETTWOPHASEDRAW">SCI_SETTWOPHASEDRAW(bool twoPhase)</a><br />
3167 <a class="message" href="#SCI_GETTWOPHASEDRAW">SCI_GETTWOPHASEDRAW</a><br />
3168 <a class="message" href="#SCI_SETTECHNOLOGY">SCI_SETTECHNOLOGY(int technology)</a><br />
3169 <a class="message" href="#SCI_GETTECHNOLOGY">SCI_GETTECHNOLOGY</a><br />
3170 <a class="message" href="#SCI_SETFONTQUALITY">SCI_SETFONTQUALITY(int fontQuality)</a><br />
3171 <a class="message" href="#SCI_GETFONTQUALITY">SCI_GETFONTQUALITY</a><br />
3172 <a class="message" href="#SCI_SETCODEPAGE">SCI_SETCODEPAGE(int codePage)</a><br />
3173 <a class="message" href="#SCI_GETCODEPAGE">SCI_GETCODEPAGE</a><br />
3174 <a class="message" href="#SCI_SETIMEINTERACTION">SCI_SETIMEINTERACTION(int imeInteraction)</a><br />
3175 <a class="message" href="#SCI_GETIMEINTERACTION">SCI_GETIMEINTERACTION</a><br />
3176 <a class="message" href="#SCI_SETKEYSUNICODE">SCI_SETKEYSUNICODE(bool keysUnicode)</a><br />
3177 <a class="message" href="#SCI_GETKEYSUNICODE">SCI_GETKEYSUNICODE</a><br />
3178 <a class="message" href="#SCI_SETWORDCHARS">SCI_SETWORDCHARS(&lt;unused&gt;, const char *characters)</a><br />
3179 <a class="message" href="#SCI_GETWORDCHARS">SCI_GETWORDCHARS(&lt;unused&gt;, char *characters)</a><br />
3180 <a class="message" href="#SCI_SETWHITESPACECHARS">SCI_SETWHITESPACECHARS(&lt;unused&gt;, const char *characters)</a><br />
3181 <a class="message" href="#SCI_GETWHITESPACECHARS">SCI_GETWHITESPACECHARS(&lt;unused&gt;, char *characters)</a><br />
3182 <a class="message" href="#SCI_SETPUNCTUATIONCHARS">SCI_SETPUNCTUATIONCHARS(&lt;unused&gt;, const char *characters)</a><br />
3183 <a class="message" href="#SCI_GETPUNCTUATIONCHARS">SCI_GETPUNCTUATIONCHARS(&lt;unused&gt;, char *characters)</a><br />
3184 <a class="message" href="#SCI_SETCHARSDEFAULT">SCI_SETCHARSDEFAULT</a><br />
3185 <a class="message" href="#SCI_GRABFOCUS">SCI_GRABFOCUS</a><br />
3186 <a class="message" href="#SCI_SETFOCUS">SCI_SETFOCUS(bool focus)</a><br />
3187 <a class="message" href="#SCI_GETFOCUS">SCI_GETFOCUS</a><br />
3188 </code>
3190 <p>To forward a message <code>(WM_XXXX, WPARAM, LPARAM)</code> to Scintilla, you can use
3191 <code>SendMessage(hScintilla, WM_XXXX, WPARAM, LPARAM)</code> where <code>hScintilla</code> is
3192 the handle to the Scintilla window you created as your editor.</p>
3194 <p>While we are on the subject of forwarding messages in Windows, the top level window should
3195 forward any <code>WM_SETTINGCHANGE</code> messages to Scintilla (this is currently used to
3196 collect changes to mouse settings, but could be used for other user interface items in the
3197 future).</p>
3199 <p><b id="SCI_SETBUFFEREDDRAW">SCI_SETBUFFEREDDRAW(bool isBuffered)</b><br />
3200 <b id="SCI_GETBUFFEREDDRAW">SCI_GETBUFFEREDDRAW</b><br />
3201 These messages turn buffered drawing on or off and report the buffered drawing state. Buffered
3202 drawing draws each line into a bitmap rather than directly to the screen and then copies the
3203 bitmap to the screen. This avoids flickering although it does take longer. The default is for
3204 drawing to be buffered.</p>
3206 <p><b id="SCI_SETPHASESDRAW">SCI_SETPHASESDRAW(int phases)</b><br />
3207 <b id="SCI_GETPHASESDRAW">SCI_GETPHASESDRAW</b><br />
3208 There are several orders in which the text area may be drawn offering a trade-off between speed
3209 and allowing all pixels of text to be seen even when they overlap other elements.</p>
3210 <p>In single phase drawing (<code>SC_PHASES_ONE</code>) each
3211 run of characters in one style is drawn along with its background.
3212 If a character overhangs the end of a run, such as in "<i>V</i>_" where the
3213 "<i>V</i>" is in a different style from the "_", then this can cause the right hand
3214 side of the "<i>V</i>" to be overdrawn by the background of the "_" which
3215 cuts it off.</p>
3216 <p>Two phase drawing (<code>SC_PHASES_TWO</code>)
3217 fixes this by drawing all the backgrounds of a line first and then drawing the text
3218 in transparent mode. Lines are drawn separately and no line will overlap another
3219 so any pixels that overlap into another line such as extreme ascenders and
3220 descenders on characters will be cut off.
3221 Two phase drawing may flicker more than single phase
3222 unless buffered drawing is on or the platform is naturally buffered.
3223 The default is for drawing to be two phase.</p>
3224 <p>Multiple phase drawing (<code>SC_PHASES_MULTIPLE</code>)
3225 draws the whole area multiple times, once for each feature, building up the
3226 the appearance in layers or phases. The coloured backgrounds for all lines are
3227 drawn before any text and then all the text is drawn in transparent mode over this
3228 combined background without clipping text to the line boundaries. This allows
3229 extreme ascenders and decenders to overflow into the adjacent lines.
3230 This mode is incompatible with buffered drawing and will act as <code>SC_PHASES_TWO</code>
3231 if buffered drawing is turned on.
3232 Multiple phase drawing is slower than two phase drawing.
3233 Setting the layout cache to <a class="message" href="#SCI_SETLAYOUTCACHE">SC_CACHE_PAGE</a>
3234 or higher can ensure that multiple phase drawing is not significantly slower.</p>
3236 <p><b id="SCI_SETTWOPHASEDRAW">SCI_SETTWOPHASEDRAW(bool twoPhase)</b><br />
3237 <b id="SCI_GETTWOPHASEDRAW">SCI_GETTWOPHASEDRAW</b><br />
3238 This property has been replaced with the preceding PHASESDRAW property which is more general,
3239 allowing multiple phase drawing as well as one and two phase drawing.</p>
3241 <p><b id="SCI_SETTECHNOLOGY">SCI_SETTECHNOLOGY(int technology)</b><br />
3242 <b id="SCI_GETTECHNOLOGY">SCI_GETTECHNOLOGY</b><br />
3243 The technology property allows choosing between different drawing APIs and options.
3244 On most platforms, the only choice is <code>SC_TECHNOLOGY_DEFAULT</code> (0).
3245 On Windows Vista or later, <code>SC_TECHNOLOGY_DIRECTWRITE</code> (1) or
3246 <code class="provisional">SC_TECHNOLOGY_DIRECTWRITERETAIN</code> (2)
3247 can be chosen to use the Direct2D and DirectWrite APIs for higher quality antialiased drawing.
3248 <code class="provisional">SC_TECHNOLOGY_DIRECTWRITERETAIN</code> differs from
3249 <code>SC_TECHNOLOGY_DIRECTWRITE</code> by requesting that the frame
3250 is retained after being presented which may prevent drawing failures on some cards and drivers.
3251 Since Direct2D buffers drawing, Scintilla's buffering can be turned off with
3252 <code>SCI_SETBUFFEREDDRAW(0)</code>.
3253 <span class="provisional">Since <code>SC_TECHNOLOGY_DIRECTWRITERETAIN</code>
3254 is provisional, it may be changed or removed in a future release if a better solution is found.</span></p>
3256 <p><b id="SCI_SETFONTQUALITY">SCI_SETFONTQUALITY(int fontQuality)</b><br />
3257 <b id="SCI_GETFONTQUALITY">SCI_GETFONTQUALITY</b><br />
3258 Manage font quality (antialiasing method). Currently, the following values are available on Windows:
3259 <code>SC_EFF_QUALITY_DEFAULT</code> (backward compatible),
3260 <code>SC_EFF_QUALITY_NON_ANTIALIASED</code>,
3261 <code>SC_EFF_QUALITY_ANTIALIASED</code>,
3262 <code>SC_EFF_QUALITY_LCD_OPTIMIZED</code>.</p>
3263 <p>In case it is necessary to squeeze more options into this property, only a limited number of bits defined
3264 by SC_EFF_QUALITY_MASK (0xf) will be used for quality.</p>
3266 <p><b id="SCI_SETCODEPAGE">SCI_SETCODEPAGE(int codePage)</b><br />
3267 <b id="SCI_GETCODEPAGE">SCI_GETCODEPAGE</b><br />
3268 Scintilla has some support for Japanese, Chinese and Korean DBCS. Use this message with
3269 <code>codePage</code> set to the code page number to set Scintilla to use code page information
3270 to ensure double byte characters are treated as one character rather than two. This also stops
3271 the caret from moving between the two bytes in a double byte character.
3272 Do not use this message to choose between different single byte character sets: it doesn't do that.
3273 Call with
3274 <code>codePage</code> set to zero to disable DBCS support. The default is
3275 <code>SCI_SETCODEPAGE(0)</code>.</p>
3277 <p>Code page <code>SC_CP_UTF8</code> (65001) sets Scintilla into Unicode mode with the document
3278 treated as a sequence of characters expressed in UTF-8. The text is converted to the platform's
3279 normal Unicode encoding before being drawn by the OS and thus can display Hebrew, Arabic,
3280 Cyrillic, and Han characters. Languages which can use two characters stacked vertically in one
3281 horizontal space, such as Thai, will mostly work but there are some issues where the characters
3282 are drawn separately leading to visual glitches. Bi-directional text is not supported. </p>
3284 <p>Code page can be set to 932 (Japanese Shift-JIS), 936 (Simplified Chinese GBK),
3285 949 (Korean Unified Hangul Code), 950 (Traditional Chinese Big5), or 1361 (Korean Johab)
3286 although these may require installation of language specific support.</p>
3288 <p><b id="SCI_SETIMEINTERACTION">SCI_SETIMEINTERACTION(int imeInteraction)</b><br />
3289 <b id="SCI_GETIMEINTERACTION">SCI_GETIMEINTERACTION</b><br />
3290 When entering text in Chinese, Japanese, or Korean an Input Method Editor (IME) may be displayed.
3291 The IME may be an extra window appearing above Scintilla or may be displayed by Scintilla itself
3292 as text. On some platforms there is a choice between the two techniques.
3293 A windowed IME <code>SC_IME_WINDOWED</code> (0) may be more similar in appearance and
3294 behaviour to the IME in other applications.
3295 An inline IME <code>SC_IME_INLINE</code> (1) may work better with some Scintilla features such as
3296 rectangular and multiple selection.</p>
3297 <p>The windowed behaviour can be chosen with <code>SCI_SETIMEINTERACTION(SC_IME_WINDOWED)</code>
3298 and the inline behaviour with <code>SCI_SETIMEINTERACTION(SC_IME_INLINE)</code>.
3299 Scintilla may ignore this call in some cases. For example, the inline behaviour might only be supported for some languages.</p>
3301 <p><b id="SCI_SETKEYSUNICODE">SCI_SETKEYSUNICODE(bool keysUnicode)</b><br />
3302 <b id="SCI_GETKEYSUNICODE">SCI_GETKEYSUNICODE</b><br />
3303 On Windows, character keys are normally handled differently depending on whether Scintilla is a wide
3304 or narrow character window with character messages treated as Unicode when wide and as 8 bit otherwise.
3305 Set this property to always treat as Unicode. This option is needed for Delphi.</p>
3307 <p><b id="SCI_SETWORDCHARS">SCI_SETWORDCHARS(&lt;unused&gt;, const char *characters)</b><br />
3308 Scintilla has several functions that operate on words, which are defined to be contiguous
3309 sequences of characters from a particular set of characters. This message defines which
3310 characters are members of that set. The character sets are set to default values before processing this
3311 function.
3312 For example, if you don't allow '_' in your set of characters
3313 use:<br />
3314 <code>SCI_SETWORDCHARS(0, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")</code>;</p>
3316 <p><b id="SCI_GETWORDCHARS">SCI_GETWORDCHARS(&lt;unused&gt;, char *characters)</b><br />
3317 This fills the characters parameter with all the characters included in words.
3318 The characters parameter must be large enough to hold all of the characters.
3319 If the characters parameter is 0 then the length that should be allocated
3320 to store the entire set is returned.</p>
3322 <p><b id="SCI_SETWHITESPACECHARS">SCI_SETWHITESPACECHARS(&lt;unused&gt;, const char *characters)</b><br />
3323 <b id="SCI_GETWHITESPACECHARS">SCI_GETWHITESPACECHARS(&lt;unused&gt;, char *characters)</b><br />
3324 Similar to <code>SCI_SETWORDCHARS</code>, this message allows the user to define which chars Scintilla considers
3325 as whitespace. Setting the whitespace chars allows the user to fine-tune Scintilla's behaviour doing
3326 such things as moving the cursor to the start or end of a word; for example, by defining punctuation chars
3327 as whitespace, they will be skipped over when the user presses ctrl+left or ctrl+right.
3328 This function should be called after <code>SCI_SETWORDCHARS</code> as it will
3329 reset the whitespace characters to the default set.
3330 <code>SCI_GETWHITESPACECHARS</code> behaves similarly to <code>SCI_GETWORDCHARS</code>.</p>
3332 <p><b id="SCI_SETPUNCTUATIONCHARS">SCI_SETPUNCTUATIONCHARS(&lt;unused&gt;, const char *characters)</b><br />
3333 <b id="SCI_GETPUNCTUATIONCHARS">SCI_GETPUNCTUATIONCHARS(&lt;unused&gt;, char *characters)</b><br />
3334 Similar to <code>SCI_SETWORDCHARS</code> and <code>SCI_SETWHITESPACECHARS</code>, this message
3335 allows the user to define which chars Scintilla considers as punctuation.
3336 <code>SCI_GETPUNCTUATIONCHARS</code> behaves similarly to <code>SCI_GETWORDCHARS</code>.</p>
3338 <p><b id="SCI_SETCHARSDEFAULT">SCI_SETCHARSDEFAULT</b><br />
3339 Use the default sets of word and whitespace characters. This sets whitespace to space, tab and other
3340 characters with codes less than 0x20, with word characters set to alphanumeric and '_'.
3341 </p>
3344 <p><b id="SCI_GRABFOCUS">SCI_GRABFOCUS</b><br />
3345 <b id="SCI_SETFOCUS">SCI_SETFOCUS(bool focus)</b><br />
3346 <b id="SCI_GETFOCUS">SCI_GETFOCUS</b><br />
3347 Scintilla can be told to grab the focus with this message. This is needed more on GTK+ where
3348 focus handling is more complicated than on Windows.</p>
3350 <p>The internal focus flag can be set with <code>SCI_SETFOCUS</code>. This is used by clients
3351 that have complex focus requirements such as having their own window that gets the real focus
3352 but with the need to indicate that Scintilla has the logical focus.</p>
3354 <h2 id="BraceHighlighting">Brace highlighting</h2>
3355 <code><a class="message" href="#SCI_BRACEHIGHLIGHT">SCI_BRACEHIGHLIGHT(int pos1, int
3356 pos2)</a><br />
3357 <a class="message" href="#SCI_BRACEBADLIGHT">SCI_BRACEBADLIGHT(int pos1)</a><br />
3358 <a class="message" href="#SCI_BRACEHIGHLIGHTINDICATOR">SCI_BRACEHIGHLIGHTINDICATOR(bool useBraceHighlightIndicator, int indicatorNumber)</a><br />
3359 <a class="message" href="#SCI_BRACEBADLIGHTINDICATOR">SCI_BRACEBADLIGHTINDICATOR(bool useBraceBadLightIndicator, int indicatorNumber)</a><br />
3360 <a class="message" href="#SCI_BRACEMATCH">SCI_BRACEMATCH(int position, int
3361 maxReStyle)</a><br />
3362 </code>
3364 <p><b id="SCI_BRACEHIGHLIGHT">SCI_BRACEHIGHLIGHT(int pos1, int pos2)</b><br />
3365 Up to two characters can be highlighted in a 'brace highlighting style', which is defined as
3366 style number <a class="message" href="#StyleDefinition"><code>STYLE_BRACELIGHT</code></a> (34).
3367 If you have enabled indent guides, you may also wish to highlight the indent that corresponds
3368 with the brace. You can locate the column with <a class="message"
3369 href="#SCI_GETCOLUMN"><code>SCI_GETCOLUMN</code></a> and highlight the indent with <a
3370 class="message" href="#SCI_SETHIGHLIGHTGUIDE"><code>SCI_SETHIGHLIGHTGUIDE</code></a>.</p>
3372 <p><b id="SCI_BRACEBADLIGHT">SCI_BRACEBADLIGHT(int pos1)</b><br />
3373 If there is no matching brace then the <a class="jump" href="#StyleDefinition">brace
3374 badlighting style</a>, style <code>STYLE_BRACEBAD</code> (35), can be used to show the brace
3375 that is unmatched. Using a position of <code>INVALID_POSITION</code> (-1) removes the
3376 highlight.</p>
3378 <p><b id="SCI_BRACEHIGHLIGHTINDICATOR">SCI_BRACEHIGHLIGHTINDICATOR(bool useBraceHighlightIndicator, int indicatorNumber)</b><br />
3379 Use specified indicator to highlight matching braces instead of changing their style.</p>
3381 <p><b id="SCI_BRACEBADLIGHTINDICATOR">SCI_BRACEBADLIGHTINDICATOR(bool useBraceBadLightIndicator, int indicatorNumber)</b><br />
3382 Use specified indicator to highlight non matching brace instead of changing its style.</p>
3384 <p><b id="SCI_BRACEMATCH">SCI_BRACEMATCH(int pos, int maxReStyle)</b><br />
3385 The <code>SCI_BRACEMATCH</code> message finds a corresponding matching brace given
3386 <code>pos</code>, the position of one brace. The brace characters handled are '(', ')', '[',
3387 ']', '{', '}', '&lt;', and '&gt;'. The search is forwards from an opening brace and backwards
3388 from a closing brace. If the character at position is not a brace character, or a matching
3389 brace cannot be found, the return value is -1. Otherwise, the return value is the position of
3390 the matching brace.</p>
3392 <p>A match only occurs if the style of the matching brace is the same as the starting brace or
3393 the matching brace is beyond the end of styling. Nested braces are handled correctly. The
3394 <code>maxReStyle</code> parameter must currently be 0 - it may be used in the future to limit
3395 the length of brace searches.</p>
3397 <h2 id="TabsAndIndentationGuides">Tabs and Indentation Guides</h2>
3399 <p>Indentation (the white space at the start of a line) is often used by programmers to clarify
3400 program structure and in some languages, for example Python, it may be part of the language
3401 syntax. Tabs are normally used in editors to insert a tab character or to pad text with spaces
3402 up to the next tab.</p>
3404 <p>When Scintilla is laying out a section of text, text after a tab character will usually be
3405 displayed at the next multiple of TABWIDTH columns from the left. However, it is also possible
3406 to explicitly set tabstops in pixels for each line.</p>
3408 <p>Scintilla can be set to treat tab and backspace in the white space at the start of a line in
3409 a special way: inserting a tab indents the line to the next indent position rather than just
3410 inserting a tab at the current character position and backspace unindents the line rather than
3411 deleting a character. Scintilla can also display indentation guides (vertical lines) to help
3412 you to generate code.</p>
3413 <code><a class="message" href="#SCI_SETTABWIDTH">SCI_SETTABWIDTH(int widthInChars)</a><br />
3414 <a class="message" href="#SCI_GETTABWIDTH">SCI_GETTABWIDTH</a><br />
3415 <a class="message" href="#SCI_CLEARTABSTOPS">SCI_CLEARTABSTOPS(int line)</a><br />
3416 <a class="message" href="#SCI_ADDTABSTOP">SCI_ADDTABSTOP(int line, int x)</a><br />
3417 <a class="message" href="#SCI_GETNEXTTABSTOP">SCI_GETNEXTTABSTOP(int line, int x)</a><br />
3418 <a class="message" href="#SCI_SETUSETABS">SCI_SETUSETABS(bool useTabs)</a><br />
3419 <a class="message" href="#SCI_GETUSETABS">SCI_GETUSETABS</a><br />
3420 <a class="message" href="#SCI_SETINDENT">SCI_SETINDENT(int widthInChars)</a><br />
3421 <a class="message" href="#SCI_GETINDENT">SCI_GETINDENT</a><br />
3422 <a class="message" href="#SCI_SETTABINDENTS">SCI_SETTABINDENTS(bool tabIndents)</a><br />
3423 <a class="message" href="#SCI_GETTABINDENTS">SCI_GETTABINDENTS</a><br />
3424 <a class="message" href="#SCI_SETBACKSPACEUNINDENTS">SCI_SETBACKSPACEUNINDENTS(bool
3425 bsUnIndents)</a><br />
3426 <a class="message" href="#SCI_GETBACKSPACEUNINDENTS">SCI_GETBACKSPACEUNINDENTS</a><br />
3427 <a class="message" href="#SCI_SETLINEINDENTATION">SCI_SETLINEINDENTATION(int line, int
3428 indentation)</a><br />
3429 <a class="message" href="#SCI_GETLINEINDENTATION">SCI_GETLINEINDENTATION(int line)</a><br />
3430 <a class="message" href="#SCI_GETLINEINDENTPOSITION">SCI_GETLINEINDENTPOSITION(int
3431 line)</a><br />
3432 <a class="message" href="#SCI_SETINDENTATIONGUIDES">SCI_SETINDENTATIONGUIDES(int indentView)</a><br />
3433 <a class="message" href="#SCI_GETINDENTATIONGUIDES">SCI_GETINDENTATIONGUIDES</a><br />
3434 <a class="message" href="#SCI_SETHIGHLIGHTGUIDE">SCI_SETHIGHLIGHTGUIDE(int column)</a><br />
3435 <a class="message" href="#SCI_GETHIGHLIGHTGUIDE">SCI_GETHIGHLIGHTGUIDE</a><br />
3436 </code>
3438 <p><b id="SCI_SETTABWIDTH">SCI_SETTABWIDTH(int widthInChars)</b><br />
3439 <b id="SCI_GETTABWIDTH">SCI_GETTABWIDTH</b><br />
3440 <code>SCI_SETTABWIDTH</code> sets the size of a tab as a multiple of the size of a space
3441 character in <code>STYLE_DEFAULT</code>. The default tab width is 8 characters. There are no
3442 limits on tab sizes, but values less than 1 or large values may have undesirable effects.</p>
3444 <p><b id="SCI_CLEARTABSTOPS">SCI_CLEARTABSTOPS(int line)</b><br />
3445 <b id="SCI_ADDTABSTOP">SCI_ADDTABSTOP(int line, int x)</b><br />
3446 <b id="SCI_GETNEXTTABSTOP">SCI_GETNEXTTABSTOP(int line, int x)</b><br />
3447 <code>SCI_CLEARTABSTOPS</code> clears explicit tabstops on a line. <code>SCI_ADDTABSTOP</code>
3448 adds an explicit tabstop at the specified distance from the left (in pixels), and
3449 <code>SCI_GETNEXTTABSTOP</code> gets the next explicit tabstop position set after the given x position,
3450 or zero if there aren't any.
3451 Changing tab stops produces a <a class="message" href="#SC_MOD_CHANGETABSTOPS">SC_MOD_CHANGETABSTOPS</a> notification.
3452 </p>
3454 <p><b id="SCI_SETUSETABS">SCI_SETUSETABS(bool useTabs)</b><br />
3455 <b id="SCI_GETUSETABS">SCI_GETUSETABS</b><br />
3456 <code>SCI_SETUSETABS</code> determines whether indentation should be created out of a mixture
3457 of tabs and spaces or be based purely on spaces. Set <code>useTabs</code> to <code>false</code>
3458 (0) to create all tabs and indents out of spaces. The default is <code>true</code>. You can use
3459 <a class="message" href="#SCI_GETCOLUMN"><code>SCI_GETCOLUMN</code></a> to get the column of a
3460 position taking the width of a tab into account.</p>
3461 <p><b id="SCI_SETINDENT">SCI_SETINDENT(int widthInChars)</b><br />
3462 <b id="SCI_GETINDENT">SCI_GETINDENT</b><br />
3463 <code>SCI_SETINDENT</code> sets the size of indentation in terms of the width of a space in <a
3464 class="message" href="#StyleDefinition"><code>STYLE_DEFAULT</code></a>. If you set a width of
3465 0, the indent size is the same as the tab size. There are no limits on indent sizes, but values
3466 less than 0 or large values may have undesirable effects.
3467 </p>
3469 <p><b id="SCI_SETTABINDENTS">SCI_SETTABINDENTS(bool tabIndents)</b><br />
3470 <b id="SCI_GETTABINDENTS">SCI_GETTABINDENTS</b><br />
3471 <b id="SCI_SETBACKSPACEUNINDENTS">SCI_SETBACKSPACEUNINDENTS(bool bsUnIndents)</b><br />
3472 <b id="SCI_GETBACKSPACEUNINDENTS">SCI_GETBACKSPACEUNINDENTS</b><br />
3473 </p>
3475 <p>Inside indentation white space, the tab and backspace keys can be made to indent and
3476 unindent rather than insert a tab character or delete a character with the
3477 <code>SCI_SETTABINDENTS</code> and <code>SCI_SETBACKSPACEUNINDENTS</code> functions.</p>
3479 <p><b id="SCI_SETLINEINDENTATION">SCI_SETLINEINDENTATION(int line, int indentation)</b><br />
3480 <b id="SCI_GETLINEINDENTATION">SCI_GETLINEINDENTATION(int line)</b><br />
3481 The amount of indentation on a line can be discovered and set with
3482 <code>SCI_GETLINEINDENTATION</code> and <code>SCI_SETLINEINDENTATION</code>. The indentation is
3483 measured in character columns, which correspond to the width of space characters.</p>
3485 <p><b id="SCI_GETLINEINDENTPOSITION">SCI_GETLINEINDENTPOSITION(int line)</b><br />
3486 This returns the position at the end of indentation of a line.</p>
3488 <p><b id="SCI_SETINDENTATIONGUIDES">SCI_SETINDENTATIONGUIDES(int indentView)</b><br />
3489 <b id="SCI_GETINDENTATIONGUIDES">SCI_GETINDENTATIONGUIDES</b><br />
3490 Indentation guides are dotted vertical lines that appear within indentation white space every
3491 indent size columns. They make it easy to see which constructs line up especially when they
3492 extend over multiple pages. Style <a class="message"
3493 href="#StyleDefinition"><code>STYLE_INDENTGUIDE</code></a> (37) is used to specify the
3494 foreground and background colour of the indentation guides.</p>
3496 <p>There are 4 indentation guide views.
3497 SC_IV_NONE turns the feature off but the other 3 states determine how far the guides appear on
3498 empty lines. </p>
3499 <table border="0" summary="Search flags">
3500 <tbody>
3501 <tr>
3502 <td><code>SC_IV_NONE</code></td>
3503 <td>No indentation guides are shown.</td>
3504 </tr>
3506 <tr>
3507 <td><code>SC_IV_REAL</code></td>
3508 <td>Indentation guides are shown inside real indentation white space.</td>
3509 </tr>
3511 <tr>
3512 <td><code>SC_IV_LOOKFORWARD</code></td>
3513 <td>Indentation guides are shown beyond the actual indentation up to the level of the
3514 next non-empty line.
3515 If the previous non-empty line was a fold header then indentation guides are shown for
3516 one more level of indent than that line. This setting is good for Python.</td>
3517 </tr>
3519 <tr>
3520 <td><code>SC_IV_LOOKBOTH</code></td>
3521 <td>Indentation guides are shown beyond the actual indentation up to the level of the
3522 next non-empty line or previous non-empty line whichever is the greater.
3523 This setting is good for most languages.</td>
3524 </tr>
3526 </tbody>
3527 </table>
3529 <p><b id="SCI_SETHIGHLIGHTGUIDE">SCI_SETHIGHLIGHTGUIDE(int column)</b><br />
3530 <b id="SCI_GETHIGHLIGHTGUIDE">SCI_GETHIGHLIGHTGUIDE</b><br />
3531 When brace highlighting occurs, the indentation guide corresponding to the braces may be
3532 highlighted with the brace highlighting style, <a class="message"
3533 href="#StyleDefinition"><code>STYLE_BRACELIGHT</code></a> (34). Set <code>column</code> to 0 to
3534 cancel this highlight.</p>
3536 <h2 id="Markers">Markers</h2>
3538 <p>There are 32 markers, numbered 0 to <code>MARKER_MAX</code> (31), and you can assign any combination of them to each
3539 line in the document. Markers appear in the <a class="jump" href="#Margins">selection
3540 margin</a> to the left of the text. If the selection margin is set to zero width, the
3541 background colour of the whole line is changed instead. Marker numbers 25 to 31 are used by
3542 Scintilla in folding margins, and have symbolic names of the form <code>SC_MARKNUM_</code>*,
3543 for example <code>SC_MARKNUM_FOLDEROPEN</code>.</p>
3545 <p>Marker numbers 0 to 24 have no pre-defined function; you can use them to mark syntax errors
3546 or the current point of execution, break points, or whatever you need marking. If you do not
3547 need folding, you can use all 32 for any purpose you wish.</p>
3549 <p>Each marker number has a symbol associated with it. You can also set the foreground and
3550 background colour for each marker number, so you can use the same symbol more than once with
3551 different colouring for different uses. Scintilla has a set of symbols you can assign
3552 (<code>SC_MARK_</code>*) or you can use characters. By default, all 32 markers are set to
3553 <code>SC_MARK_CIRCLE</code> with a black foreground and a white background.</p>
3555 <p>The markers are drawn in the order of their numbers, so higher numbered markers appear on
3556 top of lower numbered ones. Markers try to move with their text by tracking where the start of
3557 their line moves. When a line is deleted, its markers are combined, by an <code>OR</code>
3558 operation, with the markers of the next line.</p>
3559 <code><a class="message" href="#SCI_MARKERDEFINE">SCI_MARKERDEFINE(int markerNumber, int
3560 markerSymbols)</a><br />
3561 <a class="message" href="#SCI_MARKERDEFINEPIXMAP">SCI_MARKERDEFINEPIXMAP(int markerNumber,
3562 const char *xpm)</a><br />
3563 <a class="message" href="#SCI_RGBAIMAGESETWIDTH">SCI_RGBAIMAGESETWIDTH(int width)</a><br />
3564 <a class="message" href="#SCI_RGBAIMAGESETHEIGHT">SCI_RGBAIMAGESETHEIGHT(int height)</a><br />
3565 <a class="message" href="#SCI_RGBAIMAGESETSCALE">SCI_RGBAIMAGESETSCALE(int scalePercent)</a><br />
3566 <a class="message" href="#SCI_MARKERDEFINERGBAIMAGE">SCI_MARKERDEFINERGBAIMAGE(int markerNumber,
3567 const char *pixels)</a><br />
3568 <a class="message" href="#SCI_MARKERSYMBOLDEFINED">SCI_MARKERSYMBOLDEFINED(int markerNumber)
3569 </a><br />
3570 <a class="message" href="#SCI_MARKERSETFORE">SCI_MARKERSETFORE(int markerNumber, int
3571 colour)</a><br />
3572 <a class="message" href="#SCI_MARKERSETBACK">SCI_MARKERSETBACK(int markerNumber, int
3573 colour)</a><br />
3574 <a class="message" href="#SCI_MARKERSETBACKSELECTED">SCI_MARKERSETBACKSELECTED(int markerNumber, int
3575 colour)</a><br />
3576 <a class="message" href="#SCI_MARKERENABLEHIGHLIGHT">SCI_MARKERENABLEHIGHLIGHT(int enabled)</a><br />
3577 <a class="message" href="#SCI_MARKERSETALPHA">SCI_MARKERSETALPHA(int markerNumber, int
3578 alpha)</a><br />
3579 <a class="message" href="#SCI_MARKERADD">SCI_MARKERADD(int line, int markerNumber)</a><br />
3580 <a class="message" href="#SCI_MARKERADDSET">SCI_MARKERADDSET(int line, int markerMask)</a><br />
3581 <a class="message" href="#SCI_MARKERDELETE">SCI_MARKERDELETE(int line, int
3582 markerNumber)</a><br />
3583 <a class="message" href="#SCI_MARKERDELETEALL">SCI_MARKERDELETEALL(int markerNumber)</a><br />
3584 <a class="message" href="#SCI_MARKERGET">SCI_MARKERGET(int line)</a><br />
3585 <a class="message" href="#SCI_MARKERNEXT">SCI_MARKERNEXT(int lineStart, int
3586 markerMask)</a><br />
3587 <a class="message" href="#SCI_MARKERPREVIOUS">SCI_MARKERPREVIOUS(int lineStart, int
3588 markerMask)</a><br />
3589 <a class="message" href="#SCI_MARKERLINEFROMHANDLE">SCI_MARKERLINEFROMHANDLE(int
3590 handle)</a><br />
3591 <a class="message" href="#SCI_MARKERDELETEHANDLE">SCI_MARKERDELETEHANDLE(int handle)</a><br />
3592 </code>
3594 <p><b id="SCI_MARKERDEFINE">SCI_MARKERDEFINE(int markerNumber, int markerSymbols)</b><br />
3595 This message associates a marker number in the range 0 to 31 with one of the marker symbols or
3596 an ASCII character. The general-purpose marker symbols currently available are:<br />
3597 <code>SC_MARK_CIRCLE</code>,
3598 <code>SC_MARK_ROUNDRECT</code>,
3599 <code>SC_MARK_ARROW</code>,
3600 <code>SC_MARK_SMALLRECT</code>,
3601 <code>SC_MARK_SHORTARROW</code>,
3602 <code>SC_MARK_EMPTY</code>,
3603 <code>SC_MARK_ARROWDOWN</code>,
3604 <code>SC_MARK_MINUS</code>,
3605 <code>SC_MARK_PLUS</code>,
3606 <code>SC_MARK_ARROWS</code>,
3607 <code>SC_MARK_DOTDOTDOT</code>,
3608 <code>SC_MARK_BACKGROUND</code>,
3609 <code>SC_MARK_LEFTRECT</code>,
3610 <code>SC_MARK_FULLRECT</code>,
3611 <code>SC_MARK_BOOKMARK</code>, and
3612 <code>SC_MARK_UNDERLINE</code>.
3613 </p>
3615 <p>The <code>SC_MARK_BACKGROUND</code> marker changes the background colour of the line only.
3616 The <code>SC_MARK_FULLRECT</code> symbol mirrors this, changing only the margin background colour.
3617 <code>SC_MARK_UNDERLINE</code> draws an underline across the text.
3618 The <code>SC_MARK_EMPTY</code> symbol is invisible, allowing client code to track the movement
3619 of lines. You would also use it if you changed the folding style and wanted one or more of the
3620 <code>SC_FOLDERNUM_</code>* markers to have no associated symbol.</p>
3622 <p>Applications may use the marker symbol <code>SC_MARK_AVAILABLE</code> to indicate that
3623 plugins may allocate that marker number.
3624 </p>
3626 <p>There are also marker symbols designed for use in the folding margin in a flattened tree
3627 style.<br />
3628 <code>SC_MARK_BOXMINUS</code>,
3629 <code>SC_MARK_BOXMINUSCONNECTED</code>,
3630 <code>SC_MARK_BOXPLUS</code>,
3631 <code>SC_MARK_BOXPLUSCONNECTED</code>,
3632 <code>SC_MARK_CIRCLEMINUS</code>,
3633 <code>SC_MARK_CIRCLEMINUSCONNECTED</code>,
3634 <code>SC_MARK_CIRCLEPLUS</code>,
3635 <code>SC_MARK_CIRCLEPLUSCONNECTED</code>,
3636 <code>SC_MARK_LCORNER</code>,
3637 <code>SC_MARK_LCORNERCURVE</code>,
3638 <code>SC_MARK_TCORNER</code>,
3639 <code>SC_MARK_TCORNERCURVE</code>, and
3640 <code>SC_MARK_VLINE</code>.</p>
3641 Characters can be used as markers by adding the ASCII value of the character to
3642 <code>SC_MARK_CHARACTER</code> (10000). For example, to use 'A' (ASCII code 65) as marker
3643 number 1 use:<br />
3644 <code>SCI_MARKERDEFINE(1, SC_MARK_CHARACTER+65)</code>. <br />
3646 <p>The marker numbers <code>SC_MARKNUM_FOLDER</code> and <code>SC_MARKNUM_FOLDEROPEN</code> are
3647 used for showing that a fold is present and open or closed. Any symbols may be assigned for
3648 this purpose although the (<code>SC_MARK_PLUS</code>, <code>SC_MARK_MINUS</code>) pair or the
3649 (<code>SC_MARK_ARROW</code>, <code>SC_MARK_ARROWDOWN</code>) pair are good choices. As well as
3650 these two, more assignments are needed for the flattened tree style:
3651 <code>SC_MARKNUM_FOLDEREND</code>, <code>SC_MARKNUM_FOLDERMIDTAIL</code>,
3652 <code>SC_MARKNUM_FOLDEROPENMID</code>, <code>SC_MARKNUM_FOLDERSUB</code>, and
3653 <code>SC_MARKNUM_FOLDERTAIL</code>. The bits used for folding are specified by
3654 <code>SC_MASK_FOLDERS</code>, which is commonly used as an argument to
3655 <code>SCI_SETMARGINMASKN</code> when defining a margin to be used for folding.</p>
3657 <p>This table shows which <code>SC_MARK_</code>* symbols should be assigned to which
3658 <code>SC_MARKNUM_</code>* marker numbers to obtain four folding styles: Arrow (mimics
3659 Macintosh), plus/minus shows folded lines as '+' and opened folds as '-', Circle tree, Box
3660 tree.</p>
3662 <table cellpadding="1" cellspacing="2" border="0" summary="Markers used for folding">
3663 <thead align="left">
3664 <tr>
3665 <th><code>SC_MARKNUM_</code>*</th>
3667 <th>Arrow</th>
3669 <th>Plus/minus</th>
3671 <th>Circle tree</th>
3673 <th>Box tree</th>
3674 </tr>
3675 </thead>
3677 <tbody valign="top">
3678 <tr>
3679 <th align="left"><code>FOLDEROPEN</code></th>
3681 <td><code>ARROWDOWN</code></td>
3683 <td><code>MINUS</code></td>
3685 <td><code>CIRCLEMINUS</code></td>
3687 <td><code>BOXMINUS</code></td>
3688 </tr>
3690 <tr>
3691 <th align="left"><code>FOLDER</code></th>
3693 <td><code>ARROW</code></td>
3695 <td><code>PLUS</code></td>
3697 <td><code>CIRCLEPLUS</code></td>
3699 <td><code>BOXPLUS</code></td>
3700 </tr>
3702 <tr>
3703 <th align="left"><code>FOLDERSUB</code></th>
3705 <td><code>EMPTY</code></td>
3707 <td><code>EMPTY</code></td>
3709 <td><code>VLINE</code></td>
3711 <td><code>VLINE</code></td>
3712 </tr>
3714 <tr>
3715 <th align="left"><code>FOLDERTAIL</code></th>
3717 <td><code>EMPTY</code></td>
3719 <td><code>EMPTY</code></td>
3721 <td><code>LCORNERCURVE</code></td>
3723 <td><code>LCORNER</code></td>
3724 </tr>
3726 <tr>
3727 <th align="left"><code>FOLDEREND</code></th>
3729 <td><code>EMPTY</code></td>
3731 <td><code>EMPTY</code></td>
3733 <td><code>CIRCLEPLUSCONNECTED</code></td>
3735 <td><code>BOXPLUSCONNECTED</code></td>
3736 </tr>
3738 <tr>
3739 <th align="left"><code>FOLDEROPENMID</code></th>
3741 <td><code>EMPTY</code></td>
3743 <td><code>EMPTY</code></td>
3745 <td><code>CIRCLEMINUSCONNECTED</code></td>
3747 <td><code>BOXMINUSCONNECTED</code></td>
3748 </tr>
3750 <tr>
3751 <th align="left"><code>FOLDERMIDTAIL</code></th>
3753 <td><code>EMPTY</code></td>
3755 <td><code>EMPTY</code></td>
3757 <td><code>TCORNERCURVE</code></td>
3759 <td><code>TCORNER</code></td>
3760 </tr>
3761 </tbody>
3762 </table>
3763 <p><img src="Markers.png" alt="Marker samples" /></p>
3765 <p><b id="SCI_MARKERDEFINEPIXMAP">SCI_MARKERDEFINEPIXMAP(int markerNumber, const char
3766 *xpm)</b><br />
3767 Markers can be set to pixmaps with this message. The
3768 <a class="jump" href="#XPM">XPM format</a> is used for the pixmap.
3769 Pixmaps use the <code>SC_MARK_PIXMAP</code> marker symbol. </p>
3772 <b id="SCI_RGBAIMAGESETWIDTH">SCI_RGBAIMAGESETWIDTH(int width)</b><br />
3773 <b id="SCI_RGBAIMAGESETHEIGHT">SCI_RGBAIMAGESETHEIGHT(int height)</b><br />
3774 <b id="SCI_RGBAIMAGESETSCALE">SCI_RGBAIMAGESETSCALE(int scalePercent)</b><br />
3775 <b id="SCI_MARKERDEFINERGBAIMAGE">SCI_MARKERDEFINERGBAIMAGE(int markerNumber, const char *pixels)</b><br />
3776 Markers can be set to translucent pixmaps with this message. The
3777 <a class="jump" href="#RGBA">RGBA format</a> is used for the pixmap.
3778 The width and height must previously been set with the <code>SCI_RGBAIMAGESETWIDTH</code> and
3779 <code>SCI_RGBAIMAGESETHEIGHT</code> messages.</p>
3780 <p>A scale factor in percent may be set with <code>SCI_RGBAIMAGESETSCALE</code>. This is useful on OS X with
3781 a retina display where each display unit is 2 pixels: use a factor of 200 so that each image pixel is displayed using a screen pixel.
3782 The default scale, 100, will stretch each image pixel to cover 4 screen pixels on a retina display.</p>
3783 <p>Pixmaps use the <code>SC_MARK_RGBAIMAGE</code> marker symbol. </p>
3785 <p><b id="SCI_MARKERSYMBOLDEFINED">SCI_MARKERSYMBOLDEFINED(int markerNumber)</b><br />
3786 Returns the symbol defined for a markerNumber with <code>SCI_MARKERDEFINE</code>
3787 or <code>SC_MARK_PIXMAP</code> if defined with <code>SCI_MARKERDEFINEPIXMAP</code>
3788 or <code>SC_MARK_RGBAIMAGE</code> if defined with <code>SCI_MARKERDEFINERGBAIMAGE</code>.</p>
3790 <p><b id="SCI_MARKERSETFORE">SCI_MARKERSETFORE(int markerNumber, int <a class="jump"
3791 href="#colour">colour</a>)</b><br />
3792 <b id="SCI_MARKERSETBACK">SCI_MARKERSETBACK(int markerNumber, int <a class="jump"
3793 href="#colour">colour</a>)</b><br />
3794 These two messages set the foreground and background colour of a marker number.<br />
3795 <b id="SCI_MARKERSETBACKSELECTED">SCI_MARKERSETBACKSELECTED(int markerNumber, int <a class="jump"
3796 href="#colour">colour</a>)</b><br />
3797 This message sets the highlight background colour of a marker number when its folding block is selected. The default colour is #FF0000.</p>
3798 <p><b id="SCI_MARKERENABLEHIGHLIGHT">SCI_MARKERENABLEHIGHLIGHT(bool enabled)</b><br />
3799 This message allows to enable/disable the highlight folding block when it is selected. (i.e. block that contains the caret)</p>
3800 <p><b id="SCI_MARKERSETALPHA">SCI_MARKERSETALPHA(int markerNumber, int <a class="jump"
3801 href="#alpha">alpha</a>)</b><br />
3802 When markers are drawn in the content area, either because there is no margin for them or
3803 they are of <code>SC_MARK_BACKGROUND</code> or <code>SC_MARK_UNDERLINE</code> types, they may be drawn translucently by
3804 setting an alpha value.</p>
3806 <p><b id="SCI_MARKERADD">SCI_MARKERADD(int line, int markerNumber)</b><br />
3807 This message adds marker number <code>markerNumber</code> to a line. The message returns -1 if
3808 this fails (illegal line number, out of memory) or it returns a marker handle number that
3809 identifies the added marker. You can use this returned handle with <a class="message"
3810 href="#SCI_MARKERLINEFROMHANDLE"><code>SCI_MARKERLINEFROMHANDLE</code></a> to find where a
3811 marker is after moving or combining lines and with <a class="message"
3812 href="#SCI_MARKERDELETEHANDLE"><code>SCI_MARKERDELETEHANDLE</code></a> to delete the marker
3813 based on its handle. The message does not check the value of markerNumber, nor does it
3814 check if the line already contains the marker.</p>
3816 <p><b id="SCI_MARKERADDSET">SCI_MARKERADDSET(int line, int markerMask)</b><br />
3817 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
3818 <a class="message" href="#SCI_MARKERGET"><code>SCI_MARKERGET</code></a>
3819 (and used by the mask-based marker search functions
3820 <a class="message" href="#SCI_MARKERNEXT"><code>SCI_MARKERNEXT</code></a> and
3821 <a class="message" href="#SCI_MARKERPREVIOUS"><code>SCI_MARKERPREVIOUS</code></a>).
3822 As with
3823 <a class="message" href="#SCI_MARKERADD"><code>SCI_MARKERADD</code></a>, no check is made
3824 to see if any of the markers are already present on the targeted line.</p>
3826 <p><b id="SCI_MARKERDELETE">SCI_MARKERDELETE(int line, int markerNumber)</b><br />
3827 This searches the given line number for the given marker number and deletes it if it is
3828 present. If you added the same marker more than once to the line, this will delete one copy
3829 each time it is used. If you pass in a marker number of -1, all markers are deleted from the
3830 line.</p>
3832 <p><b id="SCI_MARKERDELETEALL">SCI_MARKERDELETEALL(int markerNumber)</b><br />
3833 This removes markers of the given number from all lines. If markerNumber is -1, it deletes all
3834 markers from all lines.</p>
3836 <p><b id="SCI_MARKERGET">SCI_MARKERGET(int line)</b><br />
3837 This returns a 32-bit integer that indicates which markers were present on the line. Bit 0 is
3838 set if marker 0 is present, bit 1 for marker 1 and so on.</p>
3840 <p><b id="SCI_MARKERNEXT">SCI_MARKERNEXT(int lineStart, int markerMask)</b><br />
3841 <b id="SCI_MARKERPREVIOUS">SCI_MARKERPREVIOUS(int lineStart, int markerMask)</b><br />
3842 These messages search efficiently for lines that include a given set of markers. The search
3843 starts at line number <code>lineStart</code> and continues forwards to the end of the file
3844 (<code>SCI_MARKERNEXT</code>) or backwards to the start of the file
3845 (<code>SCI_MARKERPREVIOUS</code>). The <code>markerMask</code> argument should have one bit set
3846 for each marker you wish to find. Set bit 0 to find marker 0, bit 1 for marker 1 and so on. The
3847 message returns the line number of the first line that contains one of the markers in
3848 <code>markerMask</code> or -1 if no marker is found.</p>
3850 <p><b id="SCI_MARKERLINEFROMHANDLE">SCI_MARKERLINEFROMHANDLE(int markerHandle)</b><br />
3851 The <code>markerHandle</code> argument is an identifier for a marker returned by <a
3852 class="message" href="#SCI_MARKERADD"><code>SCI_MARKERADD</code></a>. This function searches
3853 the document for the marker with this handle and returns the line number that contains it or -1
3854 if it is not found.</p>
3856 <p><b id="SCI_MARKERDELETEHANDLE">SCI_MARKERDELETEHANDLE(int markerHandle)</b><br />
3857 The <code>markerHandle</code> argument is an identifier for a marker returned by <a
3858 class="message" href="#SCI_MARKERADD"><code>SCI_MARKERADD</code></a>. This function searches
3859 the document for the marker with this handle and deletes the marker if it is found.</p>
3861 <h2 id="Indicators">Indicators</h2>
3863 <p>Indicators are used to display additional information over the top of styling.
3864 They can be used to show, for example, syntax errors, deprecated names and bad indentation
3865 by drawing underlines under text or boxes around text.</p>
3867 <p>Indicators may be displayed as simple underlines, squiggly underlines, a
3868 line of small 'T' shapes, a line of diagonal hatching, a strike-out or a rectangle around the text.</p>
3870 <p>The <code>SCI_INDIC*</code> messages allow you to get and set the visual appearance of the
3871 indicators. They all use an <code>indicatorNumber</code> argument in the range 0 to INDIC_MAX(31)
3872 to set the indicator to style. To prevent interference the set of indicators is divided up into a range for use
3873 by lexers (0..7) and a range for use by containers
3874 (8=<code>INDIC_CONTAINER</code> .. 31=<code>INDIC_MAX</code>).</p>
3876 <p>Originally, Scintilla used a different technique for indicators but this
3877 has been <a href="#RemovedFeatures">removed</a>
3878 and the APIs perform <a href="#StyleByteIndicators">no action</a>.
3879 While both techniques were supported, the term "modern indicators" was used for the
3880 newer implementation.</p>
3882 <code><a class="message" href="#SCI_INDICSETSTYLE">SCI_INDICSETSTYLE(int indicatorNumber, int
3883 indicatorStyle)</a><br />
3884 <a class="message" href="#SCI_INDICGETSTYLE">SCI_INDICGETSTYLE(int indicatorNumber)</a><br />
3885 <a class="message" href="#SCI_INDICSETFORE">SCI_INDICSETFORE(int indicatorNumber, int
3886 colour)</a><br />
3887 <a class="message" href="#SCI_INDICGETFORE">SCI_INDICGETFORE(int indicatorNumber)</a><br />
3888 <a class="message" href="#SCI_INDICSETALPHA">SCI_INDICSETALPHA(int indicatorNumber, int alpha)</a><br />
3889 <a class="message" href="#SCI_INDICGETALPHA">SCI_INDICGETALPHA(int indicatorNumber)</a><br />
3890 <a class="message" href="#SCI_INDICSETOUTLINEALPHA">SCI_INDICSETOUTLINEALPHA(int indicatorNumber, int alpha)</a><br />
3891 <a class="message" href="#SCI_INDICGETOUTLINEALPHA">SCI_INDICGETOUTLINEALPHA(int indicatorNumber)</a><br />
3892 <a class="message" href="#SCI_INDICSETUNDER">SCI_INDICSETUNDER(int indicatorNumber, bool under)</a><br />
3893 <a class="message" href="#SCI_INDICGETUNDER">SCI_INDICGETUNDER(int indicatorNumber)</a><br />
3895 <a class="message" href="#SCI_SETINDICATORCURRENT">SCI_SETINDICATORCURRENT(int indicator)</a><br />
3896 <a class="message" href="#SCI_GETINDICATORCURRENT">SCI_GETINDICATORCURRENT</a><br />
3897 <a class="message" href="#SCI_SETINDICATORVALUE">SCI_SETINDICATORVALUE(int value)</a><br />
3898 <a class="message" href="#SCI_GETINDICATORVALUE">SCI_GETINDICATORVALUE</a><br />
3899 <a class="message" href="#SCI_INDICATORFILLRANGE">SCI_INDICATORFILLRANGE(int position, int fillLength)</a><br />
3900 <a class="message" href="#SCI_INDICATORCLEARRANGE">SCI_INDICATORCLEARRANGE(int position, int clearLength)</a><br />
3901 <a class="message" href="#SCI_INDICATORALLONFOR">SCI_INDICATORALLONFOR(int position)</a><br />
3902 <a class="message" href="#SCI_INDICATORVALUEAT">SCI_INDICATORVALUEAT(int indicator, int position)</a><br />
3903 <a class="message" href="#SCI_INDICATORSTART">SCI_INDICATORSTART(int indicator, int position)</a><br />
3904 <a class="message" href="#SCI_INDICATOREND">SCI_INDICATOREND(int indicator, int position)</a><br />
3906 <a class="message" href="#SCI_FINDINDICATORSHOW">SCI_FINDINDICATORSHOW(int start, int end)</a><br />
3907 <a class="message" href="#SCI_FINDINDICATORFLASH">SCI_FINDINDICATORFLASH(int start, int end)</a><br />
3908 <a class="message" href="#SCI_FINDINDICATORHIDE">SCI_FINDINDICATORHIDE</a><br />
3909 </code>
3911 <p><b id="SCI_INDICSETSTYLE">SCI_INDICSETSTYLE(int indicatorNumber, int
3912 indicatorStyle)</b><br />
3913 <b id="SCI_INDICGETSTYLE">SCI_INDICGETSTYLE(int indicatorNumber)</b><br />
3914 These two messages set and get the style for a particular indicator. The indicator styles
3915 currently available are:<br />
3917 <img src="Indicators.png" alt="Indicator samples" /></p>
3919 <table cellpadding="1" cellspacing="2" border="0" summary="Indicators">
3920 <tbody>
3921 <tr>
3922 <th align="left">Symbol</th>
3924 <th>Value</th>
3926 <th align="left">Visual effect</th>
3927 </tr>
3928 </tbody>
3930 <tbody valign="top">
3931 <tr>
3932 <td align="left"><code>INDIC_PLAIN</code></td>
3934 <td align="center">0</td>
3936 <td>Underlined with a single, straight line.</td>
3937 </tr>
3939 <tr>
3940 <td align="left"><code>INDIC_SQUIGGLE</code></td>
3942 <td align="center">1</td>
3944 <td>A squiggly underline. Requires 3 pixels of descender space.</td>
3945 </tr>
3947 <tr>
3948 <td align="left"><code>INDIC_TT</code></td>
3950 <td align="center">2</td>
3952 <td>A line of small T shapes.</td>
3953 </tr>
3955 <tr>
3956 <td align="left"><code>INDIC_DIAGONAL</code></td>
3958 <td align="center">3</td>
3960 <td>Diagonal hatching.</td>
3961 </tr>
3963 <tr>
3964 <td align="left"><code>INDIC_STRIKE</code></td>
3966 <td align="center">4</td>
3968 <td>Strike out.</td>
3969 </tr>
3971 <tr>
3972 <td align="left"><code>INDIC_HIDDEN</code></td>
3974 <td align="center">5</td>
3976 <td>An indicator with no visual effect.</td>
3977 </tr>
3979 <tr>
3980 <td align="left"><code>INDIC_BOX</code></td>
3982 <td align="center">6</td>
3984 <td>A rectangle around the text.</td>
3985 </tr>
3987 <tr>
3988 <td align="left"><code>INDIC_ROUNDBOX</code></td>
3990 <td align="center">7</td>
3992 <td>A rectangle with rounded corners around the text using translucent drawing with the
3993 interior usually more transparent than the border. You can use
3994 <a class="message" href="#SCI_INDICSETALPHA">SCI_INDICSETALPHA</a> and
3995 <a class="message" href="#SCI_INDICSETOUTLINEALPHA">SCI_INDICSETOUTLINEALPHA</a>
3996 to control the alpha transparency values. The default alpha values are 30 for fill colour and 50 for outline colour.</td>
3997 </tr>
3999 <tr>
4000 <td align="left"><code>INDIC_STRAIGHTBOX</code></td>
4002 <td align="center">8</td>
4004 <td>A rectangle around the text using translucent drawing with the
4005 interior usually more transparent than the border. You can use
4006 <a class="message" href="#SCI_INDICSETALPHA">SCI_INDICSETALPHA</a> and
4007 <a class="message" href="#SCI_INDICSETOUTLINEALPHA">SCI_INDICSETOUTLINEALPHA</a>
4008 to control the alpha transparency values. The default alpha values are 30 for fill colour and 50 for outline colour.</td>
4009 </tr>
4011 <tr>
4012 <td align="left"><code>INDIC_DASH</code></td>
4014 <td align="center">9</td>
4016 <td>A dashed underline.</td>
4017 </tr>
4019 <tr>
4020 <td align="left"><code>INDIC_DOTS</code></td>
4022 <td align="center">10</td>
4024 <td>A dotted underline.</td>
4025 </tr>
4027 <tr>
4028 <td align="left"><code>INDIC_SQUIGGLELOW</code></td>
4030 <td align="center">11</td>
4032 <td>Similar to <code>INDIC_SQUIGGLE</code> but only using 2 vertical pixels
4033 so will fit under small fonts.</td>
4034 </tr>
4036 <tr>
4037 <td align="left"><code>INDIC_DOTBOX</code></td>
4039 <td align="center">12</td>
4041 <td>A dotted rectangle around the text using translucent drawing.
4042 Translucency alternates between the alpha and outline alpha settings with the top-left pixel using the alpha setting.
4043 <a class="message" href="#SCI_INDICSETALPHA">SCI_INDICSETALPHA</a> and
4044 <a class="message" href="#SCI_INDICSETOUTLINEALPHA">SCI_INDICSETOUTLINEALPHA</a>
4045 control the alpha transparency values. The default values are 30 for alpha and 50 for outline alpha.
4046 To avoid excessive memory allocation the maximum width of a dotted box is 4000 pixels.</td>
4047 </tr>
4049 <tr>
4050 <td align="left"><code>INDIC_SQUIGGLEPIXMAP</code></td>
4052 <td align="center">13</td>
4054 <td>A version of <code>INDIC_SQUIGGLE</code> that draws using a pixmap instead of
4055 as a series of line segments for performance.
4056 Measured to be between 3 and 6 times faster than <code>INDIC_SQUIGGLE</code> on GTK+.
4057 Appearance will not be as good as <code>INDIC_SQUIGGLE</code> on OS X in HiDPI mode.</td>
4058 </tr>
4060 <tr>
4061 <td align="left"><code>INDIC_COMPOSITIONTHICK</code></td>
4063 <td align="center">14</td>
4065 <td>A 2-pixel thick underline located at the bottom of the line to try to avoid touching the character base.
4066 Each side is inset 1 pixel so that different indicators in this style covering a range appear isolated.
4067 This is similar to an appearance used for Asian language input composition.</td>
4068 </tr>
4070 </tbody>
4071 </table>
4073 <p>The default indicator styles are equivalent to:<br />
4074 <code>SCI_INDICSETSTYLE(0, INDIC_SQUIGGLE);</code><br />
4075 <code>SCI_INDICSETSTYLE(1, INDIC_TT);</code><br />
4076 <code>SCI_INDICSETSTYLE(2, INDIC_PLAIN);</code></p>
4078 <p><b id="SCI_INDICSETFORE">SCI_INDICSETFORE(int indicatorNumber, int <a class="jump" href="#colour">colour</a>)</b><br />
4079 <b id="SCI_INDICGETFORE">SCI_INDICGETFORE(int indicatorNumber)</b><br />
4080 These two messages set and get the colour used to draw an indicator. The default indicator
4081 colours are equivalent to:<br />
4082 <code>SCI_INDICSETFORE(0, 0x007f00);</code> (dark green)<br />
4083 <code>SCI_INDICSETFORE(1, 0xff0000);</code> (light blue)<br />
4084 <code>SCI_INDICSETFORE(2, 0x0000ff);</code> (light red)</p>
4086 <p><b id="SCI_INDICSETALPHA">SCI_INDICSETALPHA(int indicatorNumber, int alpha)</b><br />
4087 <b id="SCI_INDICGETALPHA">SCI_INDICGETALPHA(int indicatorNumber)</b><br />
4088 These two messages set and get the alpha transparency used for drawing the
4089 fill colour of the INDIC_ROUNDBOX and INDIC_STRAIGHTBOX rectangle. The alpha value can range from
4090 0 (completely transparent) to 255 (no transparency).
4091 </p>
4093 <p><b id="SCI_INDICSETOUTLINEALPHA">SCI_INDICSETOUTLINEALPHA(int indicatorNumber, int alpha)</b><br />
4094 <b id="SCI_INDICGETOUTLINEALPHA">SCI_INDICGETOUTLINEALPHA(int indicatorNumber)</b><br />
4095 These two messages set and get the alpha transparency used for drawing the
4096 outline colour of the INDIC_ROUNDBOX and INDIC_STRAIGHTBOX rectangle. The alpha value can range from
4097 0 (completely transparent) to 255 (no transparency).
4098 </p>
4100 <p><b id="SCI_INDICSETUNDER">SCI_INDICSETUNDER(int indicatorNumber, bool under)</b><br />
4101 <b id="SCI_INDICGETUNDER">SCI_INDICGETUNDER(int indicatorNumber)</b><br />
4102 These two messages set and get whether an indicator is drawn under text or over(default).
4103 Drawing under text works only for indicators when <a class="message" href="#SCI_SETTWOPHASEDRAW">two phase drawing</a>
4104 is enabled.</p>
4106 <p>Indicators are stored in a format similar to run length encoding which is efficient in both
4107 speed and storage for sparse information.</p>
4108 <p>An indicator may store different values for each range but currently all values are drawn the same.
4109 In the future, it may be possible to draw different values in different styles.</p>
4111 <b id="SCI_SETINDICATORCURRENT">SCI_SETINDICATORCURRENT(int indicator)</b><br />
4112 <b id="SCI_GETINDICATORCURRENT">SCI_GETINDICATORCURRENT</b><br />
4113 These two messages set and get the indicator that will be affected by calls to
4114 <a class="message" href="#SCI_INDICATORFILLRANGE">SCI_INDICATORFILLRANGE(int position, int fillLength)</a> and
4115 <a class="message" href="#SCI_INDICATORCLEARRANGE">SCI_INDICATORCLEARRANGE(int position, int clearLength)</a>.
4116 </p>
4119 <b id="SCI_SETINDICATORVALUE">SCI_SETINDICATORVALUE(int value)</b><br />
4120 <b id="SCI_GETINDICATORVALUE">SCI_GETINDICATORVALUE</b><br />
4121 These two messages set and get the value that will be set by calls to
4122 <a class="message" href="#SCI_INDICATORFILLRANGE">SCI_INDICATORFILLRANGE</a>.
4123 </p>
4126 <b id="SCI_INDICATORFILLRANGE">SCI_INDICATORFILLRANGE(int position, int fillLength)</b><br />
4127 <b id="SCI_INDICATORCLEARRANGE">SCI_INDICATORCLEARRANGE(int position, int clearLength)</b><br />
4128 These two messages fill or clear a range for the current indicator.
4129 <code>SCI_INDICATORFILLRANGE</code> fills with the
4130 the current value.
4131 </p>
4134 <b id="SCI_INDICATORALLONFOR">SCI_INDICATORALLONFOR(int position)</b><br />
4135 Retrieve a bitmap value representing which indicators are non-zero at a position.
4136 </p>
4139 <b id="SCI_INDICATORVALUEAT">SCI_INDICATORVALUEAT(int indicator, int position)</b><br />
4140 Retrieve the value of a particular indicator at a position.
4141 </p>
4144 <b id="SCI_INDICATORSTART">SCI_INDICATORSTART(int indicator, int position)</b><br />
4145 <b id="SCI_INDICATOREND">SCI_INDICATOREND(int indicator, int position)</b><br />
4146 Find the start or end of a range with one value from a position within the range.
4147 Can be used to iterate through the document to discover all the indicator positions.
4148 </p>
4150 <h3 id="FindIndicators">OS X Find Indicator</h3>
4152 <p>On OS X search matches are highlighted with an animated gold rounded rectangle.
4153 The indicator shows, then briefly grows 25% and shrinks to the original size to draw the user's attention.
4154 While this feature is currently only implemented on OS X, it may be implemented on other platforms
4155 in the future.</p>
4157 <p><b id="SCI_FINDINDICATORSHOW">SCI_FINDINDICATORSHOW(int start, int end)</b><br />
4158 <b id="SCI_FINDINDICATORFLASH">SCI_FINDINDICATORFLASH(int start, int end)</b><br />
4159 These two messages show and animate the find indicator. The indicator remains visible with
4160 <code>SCI_FINDINDICATORSHOW</code> and fades out after showing for half a second with
4161 <code>SCI_FINDINDICATORFLASH</code>.
4162 <code>SCI_FINDINDICATORSHOW</code> behaves similarly to the OS X TextEdit and Safari applications
4163 and is best suited to editing documentation where the search target is often a word.
4164 <code>SCI_FINDINDICATORFLASH</code> is similar to Xcode and is suited to editing source code
4165 where the match will often be located next to operators which would otherwise be hidden under the indicator's
4166 padding.
4167 </p>
4169 <p><b id="SCI_FINDINDICATORHIDE">SCI_FINDINDICATORHIDE</b><br />
4170 This message hides the find indicator.
4171 </p>
4173 <p>Earlier versions of Scintilla allowed <a href="#StyleByteIndicators">partitioning style bytes</a>
4174 between style numbers and indicators and provided APIs for setting and querying this.</p>
4177 <h2 id="Autocompletion">Autocompletion</h2>
4179 <p>Autocompletion displays a list box showing likely identifiers based upon the user's typing.
4180 The user chooses the currently selected item by pressing the tab character or another character
4181 that is a member of the fillup character set defined with <code>SCI_AUTOCSETFILLUPS</code>.
4182 Autocompletion is triggered by your application. For example, in C if you detect that the user
4183 has just typed <code>fred.</code> you could look up <code>fred</code>, and if it has a known
4184 list of members, you could offer them in an autocompletion list. Alternatively, you could
4185 monitor the user's typing and offer a list of likely items once their typing has narrowed down
4186 the choice to a reasonable list. As yet another alternative, you could define a key code to
4187 activate the list.</p>
4189 <p>When the user makes a selection from the list the container is sent a <code><a class="message"
4190 href="#SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</a></code> <a class="jump"
4191 href="#Notifications">notification message</a>. On return from the notification Scintilla will insert
4192 the selected text unless the autocompletion list has been cancelled, for example by the container sending
4193 <code><a class="message" href="#SCI_AUTOCCANCEL">SCI_AUTOCCANCEL</a></code>.</p>
4195 <p>To make use of autocompletion you must monitor each character added to the document. See
4196 <code>SciTEBase::CharAdded()</code> in SciTEBase.cxx for an example of autocompletion.</p>
4197 <code><a class="message" href="#SCI_AUTOCSHOW">SCI_AUTOCSHOW(int lenEntered, const char
4198 *list)</a><br />
4199 <a class="message" href="#SCI_AUTOCCANCEL">SCI_AUTOCCANCEL</a><br />
4200 <a class="message" href="#SCI_AUTOCACTIVE">SCI_AUTOCACTIVE</a><br />
4201 <a class="message" href="#SCI_AUTOCPOSSTART">SCI_AUTOCPOSSTART</a><br />
4202 <a class="message" href="#SCI_AUTOCCOMPLETE">SCI_AUTOCCOMPLETE</a><br />
4203 <a class="message" href="#SCI_AUTOCSTOPS">SCI_AUTOCSTOPS(&lt;unused&gt;, const char
4204 *chars)</a><br />
4205 <a class="message" href="#SCI_AUTOCSETSEPARATOR">SCI_AUTOCSETSEPARATOR(char
4206 separator)</a><br />
4207 <a class="message" href="#SCI_AUTOCGETSEPARATOR">SCI_AUTOCGETSEPARATOR</a><br />
4208 <a class="message" href="#SCI_AUTOCSELECT">SCI_AUTOCSELECT(&lt;unused&gt;, const char
4209 *select)</a><br />
4210 <a class="message" href="#SCI_AUTOCGETCURRENT">SCI_AUTOCGETCURRENT</a><br />
4211 <a class="message" href="#SCI_AUTOCGETCURRENTTEXT">SCI_AUTOCGETCURRENTTEXT(&lt;unused&gt;,
4212 char *text)</a><br />
4213 <a class="message" href="#SCI_AUTOCSETCANCELATSTART">SCI_AUTOCSETCANCELATSTART(bool
4214 cancel)</a><br />
4215 <a class="message" href="#SCI_AUTOCGETCANCELATSTART">SCI_AUTOCGETCANCELATSTART</a><br />
4216 <a class="message" href="#SCI_AUTOCSETFILLUPS">SCI_AUTOCSETFILLUPS(&lt;unused&gt;, const char
4217 *chars)</a><br />
4218 <a class="message" href="#SCI_AUTOCSETCHOOSESINGLE">SCI_AUTOCSETCHOOSESINGLE(bool
4219 chooseSingle)</a><br />
4220 <a class="message" href="#SCI_AUTOCGETCHOOSESINGLE">SCI_AUTOCGETCHOOSESINGLE</a><br />
4221 <a class="message" href="#SCI_AUTOCSETIGNORECASE">SCI_AUTOCSETIGNORECASE(bool
4222 ignoreCase)</a><br />
4223 <a class="message" href="#SCI_AUTOCGETIGNORECASE">SCI_AUTOCGETIGNORECASE</a><br />
4224 <a class="message" href="#SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR">SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR(int behaviour)</a><br />
4225 <a class="message" href="#SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR">SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR</a><br />
4226 <a class="message" href="#SCI_AUTOCSETMULTI">SCI_AUTOCSETMULTI(int multi)</a><br />
4227 <a class="message" href="#SCI_AUTOCGETMULTI">SCI_AUTOCGETMULTI</a><br />
4228 <a class="message" href="#SCI_AUTOCSETORDER">SCI_AUTOCSETORDER(int order)</a><br />
4229 <a class="message" href="#SCI_AUTOCGETORDER">SCI_AUTOCGETORDER</a><br />
4230 <a class="message" href="#SCI_AUTOCSETAUTOHIDE">SCI_AUTOCSETAUTOHIDE(bool autoHide)</a><br />
4231 <a class="message" href="#SCI_AUTOCGETAUTOHIDE">SCI_AUTOCGETAUTOHIDE</a><br />
4232 <a class="message" href="#SCI_AUTOCSETDROPRESTOFWORD">SCI_AUTOCSETDROPRESTOFWORD(bool
4233 dropRestOfWord)</a><br />
4234 <a class="message" href="#SCI_AUTOCGETDROPRESTOFWORD">SCI_AUTOCGETDROPRESTOFWORD</a><br />
4235 <a class="message" href="#SCI_REGISTERIMAGE">SCI_REGISTERIMAGE(int type, const char *xpmData)</a><br />
4236 <a class="message" href="#SCI_REGISTERRGBAIMAGE">SCI_REGISTERRGBAIMAGE(int type, const char *pixels)</a><br />
4237 <a class="message" href="#SCI_CLEARREGISTEREDIMAGES">SCI_CLEARREGISTEREDIMAGES</a><br />
4238 <a class="message" href="#SCI_AUTOCSETTYPESEPARATOR">SCI_AUTOCSETTYPESEPARATOR(char separatorCharacter)</a><br />
4239 <a class="message" href="#SCI_AUTOCGETTYPESEPARATOR">SCI_AUTOCGETTYPESEPARATOR</a><br />
4240 <a class="message" href="#SCI_AUTOCSETMAXHEIGHT">SCI_AUTOCSETMAXHEIGHT(int rowCount)</a><br />
4241 <a class="message" href="#SCI_AUTOCGETMAXHEIGHT">SCI_AUTOCGETMAXHEIGHT</a><br />
4242 <a class="message" href="#SCI_AUTOCSETMAXWIDTH">SCI_AUTOCSETMAXWIDTH(int characterCount)</a><br />
4243 <a class="message" href="#SCI_AUTOCGETMAXWIDTH">SCI_AUTOCGETMAXWIDTH</a><br />
4244 </code>
4246 <p><b id="SCI_AUTOCSHOW">SCI_AUTOCSHOW(int lenEntered, const char *list)</b><br />
4247 This message causes a list to be displayed. <code>lenEntered</code> is the number of
4248 characters of the word already entered and <code>list</code> is the list of words separated by
4249 separator characters. The initial separator character is a space but this can be set or got
4250 with <a class="message" href="#SCI_AUTOCSETSEPARATOR"><code>SCI_AUTOCSETSEPARATOR</code></a>
4251 and <a class="message"
4252 href="#SCI_AUTOCGETSEPARATOR"><code>SCI_AUTOCGETSEPARATOR</code></a>.</p>
4254 <p>With default settings, the list of words should be in sorted order.
4255 If set to ignore case mode with <a class="message" href="#SCI_AUTOCSETIGNORECASE"><code>SCI_AUTOCSETIGNORECASE</code></a>, then
4256 strings are matched after being converted to upper case. One result of this is that the list
4257 should be sorted with the punctuation characters '[', '\', ']', '^', '_', and '`' sorted after
4258 letters.
4259 Alternative handling of list order may be specified with <a class="message" href="#SCI_AUTOCSETORDER">SCI_AUTOCSETORDER</a>
4260 </p>
4262 <p><b id="SCI_AUTOCCANCEL">SCI_AUTOCCANCEL</b><br />
4263 This message cancels any displayed autocompletion list. When in autocompletion mode, the list
4264 should disappear when the user types a character that can not be part of the autocompletion,
4265 such as '.', '(' or '[' when typing an identifier. A set of characters that will cancel
4266 autocompletion can be specified with <a class="message"
4267 href="#SCI_AUTOCSTOPS"><code>SCI_AUTOCSTOPS</code></a>.</p>
4269 <p><b id="SCI_AUTOCACTIVE">SCI_AUTOCACTIVE</b><br />
4270 This message returns non-zero if there is an active autocompletion list and zero if there is
4271 not.</p>
4273 <p><b id="SCI_AUTOCPOSSTART">SCI_AUTOCPOSSTART</b><br />
4274 This returns the value of the current position when <code>SCI_AUTOCSHOW</code> started display
4275 of the list.</p>
4277 <p><b id="SCI_AUTOCCOMPLETE">SCI_AUTOCCOMPLETE</b><br />
4278 This message triggers autocompletion. This has the same effect as the tab key.</p>
4280 <p><b id="SCI_AUTOCSTOPS">SCI_AUTOCSTOPS(&lt;unused&gt;, const char *chars)</b><br />
4281 The <code>chars</code> argument is a string containing a list of characters that will
4282 automatically cancel the autocompletion list. When you start the editor, this list is
4283 empty.</p>
4285 <p><b id="SCI_AUTOCSETSEPARATOR">SCI_AUTOCSETSEPARATOR(char separator)</b><br />
4286 <b id="SCI_AUTOCGETSEPARATOR">SCI_AUTOCGETSEPARATOR</b><br />
4287 These two messages set and get the separator character used to separate words in the
4288 <code>SCI_AUTOCSHOW</code> list. The default is the space character.</p>
4290 <p><b id="SCI_AUTOCSELECT">SCI_AUTOCSELECT(&lt;unused&gt;, const char *select)</b><br />
4291 <b id="SCI_AUTOCGETCURRENT">SCI_AUTOCGETCURRENT</b><br />
4292 This message selects an item in the autocompletion list. It searches the list of words for the
4293 first that matches <code>select</code>. By default, comparisons are case sensitive, but you can
4294 change this with <a class="message"
4295 href="#SCI_AUTOCSETIGNORECASE"><code>SCI_AUTOCSETIGNORECASE</code></a>. The match is character
4296 by character for the length of the <code>select</code> string. That is, if select is "Fred" it
4297 will match "Frederick" if this is the first item in the list that begins with "Fred". If an
4298 item is found, it is selected. If the item is not found, the autocompletion list closes if
4299 auto-hide is true (see <a class="message"
4300 href="#SCI_AUTOCSETAUTOHIDE"><code>SCI_AUTOCSETAUTOHIDE</code></a>).<br />
4301 The current selection index can be retrieved with <code>SCI_AUTOCGETCURRENT</code>.</p>
4303 <p><b id="SCI_AUTOCGETCURRENTTEXT">SCI_AUTOCGETCURRENTTEXT(&lt;unused&gt;, char *text)</b><br />
4304 This message retrieves the current selected text in the autocompletion list. Normally the
4305 <a class="message" href="#SCN_AUTOCSELECTION"><code>SCN_AUTOCSELECTION</code></a> notification
4306 is used instead.</p>
4308 <p>The value is copied to the <code>text</code> buffer, returning the length (not including the
4309 terminating 0). If not found, an empty string is copied to the buffer and 0 is returned.</p>
4311 <p>If the value argument is 0 then the length that should be allocated to store the value is
4312 returned; again, the terminating 0 is not included.</p>
4314 <p><b id="SCI_AUTOCSETCANCELATSTART">SCI_AUTOCSETCANCELATSTART(bool cancel)</b><br />
4315 <b id="SCI_AUTOCGETCANCELATSTART">SCI_AUTOCGETCANCELATSTART</b><br />
4316 The default behaviour is for the list to be cancelled if the caret moves to the location it
4317 was at when the list was displayed. By calling this message with a <code>false</code> argument,
4318 the list is not cancelled until the caret moves at least one character before the word being
4319 completed.</p>
4321 <p><b id="SCI_AUTOCSETFILLUPS">SCI_AUTOCSETFILLUPS(&lt;unused&gt;, const char *chars)</b><br />
4322 If a fillup character is typed with an autocompletion list active, the currently selected item
4323 in the list is added into the document, then the fillup character is added. Common fillup
4324 characters are '(', '[' and '.' but others are possible depending on the language. By default,
4325 no fillup characters are set.</p>
4327 <p><b id="SCI_AUTOCSETCHOOSESINGLE">SCI_AUTOCSETCHOOSESINGLE(bool chooseSingle)</b><br />
4328 <b id="SCI_AUTOCGETCHOOSESINGLE">SCI_AUTOCGETCHOOSESINGLE</b><br />
4329 If you use <code>SCI_AUTOCSETCHOOSESINGLE(1)</code> and a list has only one item, it is
4330 automatically added and no list is displayed. The default is to display the list even if there
4331 is only a single item.</p>
4333 <p><b id="SCI_AUTOCSETIGNORECASE">SCI_AUTOCSETIGNORECASE(bool ignoreCase)</b><br />
4334 <b id="SCI_AUTOCGETIGNORECASE">SCI_AUTOCGETIGNORECASE</b><br />
4335 By default, matching of characters to list members is case sensitive. These messages let you
4336 set and get case sensitivity.</p>
4338 <p><b id="SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR">SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR(int behaviour)</b><br />
4339 <b id="SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR">SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR</b><br />
4340 When autocompletion is set to ignore case (<code>SCI_AUTOCSETIGNORECASE</code>), by default it will
4341 nonetheless select the first list member that matches in a case sensitive way to entered characters.
4342 This corresponds to a behaviour property of <code>SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE</code> (0).
4343 If you want autocompletion to ignore case at all, choose <code>SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE</code> (1).</p>
4345 <p><b id="SCI_AUTOCSETMULTI">SCI_AUTOCSETMULTI(int multi)</b><br />
4346 <b id="SCI_AUTOCGETMULTI">SCI_AUTOCGETMULTI</b><br />
4347 When autocompleting with multiple selections present, the autocompleted text can go into just the main selection with
4348 <code>SC_MULTIAUTOC_ONCE</code> (0) or into each selection with <code>SC_MULTIAUTOC_EACH</code> (1).
4349 The default is <code>SC_MULTIAUTOC_ONCE</code>.</p>
4351 <p><b id="SCI_AUTOCSETORDER">SCI_AUTOCSETORDER(int order)</b><br />
4352 <b id="SCI_AUTOCGETORDER">SCI_AUTOCGETORDER</b><br />
4353 The default setting <code>SC_ORDER_PRESORTED</code> (0) requires that the list be provided in alphabetical sorted order.
4354 </p>
4355 <p>Sorting the list can be done by Scintilla instead of the application with <code>SC_ORDER_PERFORMSORT</code> (1).
4356 This will take additional time.
4357 </p>
4358 <p>Applications that wish to prioritize some values and show the list in order of priority instead
4359 of alphabetical order can use <code>SC_ORDER_CUSTOM</code> (2).
4360 This requires extra processing in <a class="message" href="#SCI_AUTOCSHOW">SCI_AUTOCSHOW</a> to create a sorted index.
4361 </p>
4362 <p>Setting the order should be done before calling <a class="message" href="#SCI_AUTOCSHOW">SCI_AUTOCSHOW</a>.
4363 </p>
4365 <p><b id="SCI_AUTOCSETAUTOHIDE">SCI_AUTOCSETAUTOHIDE(bool autoHide)</b><br />
4366 <b id="SCI_AUTOCGETAUTOHIDE">SCI_AUTOCGETAUTOHIDE</b><br />
4367 By default, the list is cancelled if there are no viable matches (the user has typed
4368 characters that no longer match a list entry). If you want to keep displaying the original
4369 list, set <code>autoHide</code> to <code>false</code>. This also effects <a class="message"
4370 href="#SCI_AUTOCSELECT"><code>SCI_AUTOCSELECT</code></a>.</p>
4372 <p><b id="SCI_AUTOCSETDROPRESTOFWORD">SCI_AUTOCSETDROPRESTOFWORD(bool dropRestOfWord)</b><br />
4373 <b id="SCI_AUTOCGETDROPRESTOFWORD">SCI_AUTOCGETDROPRESTOFWORD</b><br />
4374 When an item is selected, any word characters following the caret are first erased if
4375 <code>dropRestOfWord</code> is set <code>true</code>. The default is <code>false</code>.</p>
4378 <b id="SCI_REGISTERIMAGE">SCI_REGISTERIMAGE(int type, const char *xpmData)</b><br />
4379 <b id="SCI_REGISTERRGBAIMAGE">SCI_REGISTERRGBAIMAGE(int type, const char *pixels)</b><br />
4380 <b id="SCI_CLEARREGISTEREDIMAGES">SCI_CLEARREGISTEREDIMAGES</b><br />
4381 <b id="SCI_AUTOCSETTYPESEPARATOR">SCI_AUTOCSETTYPESEPARATOR(char separatorCharacter)</b><br />
4382 <b id="SCI_AUTOCGETTYPESEPARATOR">SCI_AUTOCGETTYPESEPARATOR</b><br />
4384 Autocompletion list items may display an image as well as text. Each image is first registered with an integer
4385 type. Then this integer is included in the text of the list separated by a '?' from the text. For example,
4386 "fclose?2 fopen" displays image 2 before the string "fclose" and no image before "fopen".
4387 The images are in either the <a class="jump" href="#XPM">XPM format</a> (<code>SCI_REGISTERIMAGE</code>) or
4388 <a class="jump" href="#RGBA">RGBA format</a> (<code>SCI_REGISTERRGBAIMAGE</code>).
4389 For <code>SCI_REGISTERRGBAIMAGE</code> the width and height must previously been set with
4390 the <a class="message" href="#SCI_RGBAIMAGESETWIDTH"><code>SCI_RGBAIMAGESETWIDTH</code></a> and
4391 <a class="message" href="#SCI_RGBAIMAGESETHEIGHT"><code>SCI_RGBAIMAGESETHEIGHT</code></a> messages.
4392 The set of registered images can be cleared with <code>SCI_CLEARREGISTEREDIMAGES</code> and the '?' separator changed
4393 with <code>SCI_AUTOCSETTYPESEPARATOR</code>.
4394 </p>
4397 <b id="SCI_AUTOCSETMAXHEIGHT">SCI_AUTOCSETMAXHEIGHT(int rowCount)</b><br />
4398 <b id="SCI_AUTOCGETMAXHEIGHT">SCI_AUTOCGETMAXHEIGHT</b><br />
4400 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
4401 scrollbar is shown. The default is 5.
4402 </p>
4405 <b id="SCI_AUTOCSETMAXWIDTH">SCI_AUTOCSETMAXWIDTH(int characterCount)</b><br />
4406 <b id="SCI_AUTOCGETMAXWIDTH">SCI_AUTOCGETMAXWIDTH</b><br />
4408 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.
4409 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
4410 the available width are indicated by the presence of ellipsis.
4411 </p>
4413 <h2 id="UserLists">User lists</h2>
4415 <p>User lists use the same internal mechanisms as autocompletion lists, and all the calls
4416 listed for autocompletion work on them; you cannot display a user list at the same time as an
4417 autocompletion list is active. They differ in the following respects:</p>
4419 <p>o The <code><a class="message"
4420 href="#SCI_AUTOCSETCHOOSESINGLE">SCI_AUTOCSETCHOOSESINGLE</a></code> message has no
4421 effect.<br />
4422 o When the user makes a selection you are sent a <code><a class="message"
4423 href="#SCN_USERLISTSELECTION">SCN_USERLISTSELECTION</a></code> <a class="jump"
4424 href="#Notifications">notification message</a> rather than <code><a class="message"
4425 href="#SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</a></code>.</p>
4427 <p>BEWARE: if you have set fillup characters or stop characters, these will still be active
4428 with the user list, and may result in items being selected or the user list cancelled due to
4429 the user typing into the editor.</p>
4431 <p><b id="SCI_USERLISTSHOW">SCI_USERLISTSHOW(int listType, const char *list)</b><br />
4432 The <code>listType</code> parameter is returned to the container as the <code>wParam</code>
4433 field of the <a class="message" href="#SCNotification"><code>SCNotification</code></a>
4434 structure. It must be greater than 0 as this is how Scintilla tells the difference between an
4435 autocompletion list and a user list. If you have different types of list, for example a list of
4436 buffers and a list of macros, you can use <code>listType</code> to tell which one has returned
4437 a selection. </p>
4439 <h2 id="CallTips">Call tips</h2>
4441 <p>Call tips are small windows displaying the arguments to a function and are displayed after
4442 the user has typed the name of the function. They normally display characters using the font
4443 facename, size and character set defined by
4444 <code><a class="message" href="#StyleDefinition">STYLE_DEFAULT</a></code>. You can choose to
4445 use <code><a class="message" href="#StyleDefinition">STYLE_CALLTIP</a></code> to define the
4446 facename, size, foreground and background colours and character set with
4447 <code><a class="message" href="#SCI_CALLTIPUSESTYLE">SCI_CALLTIPUSESTYLE</a></code>.
4448 This also enables support for Tab characters.
4450 There is some interaction between call tips and autocompletion lists in that showing a
4451 call tip cancels any active autocompletion list, and vice versa.</p>
4453 <p>Call tips are not implemented on Qt.</p>
4455 <p>Call tips can highlight part of the text within them. You could use this to highlight the
4456 current argument to a function by counting the number of commas (or whatever separator your
4457 language uses). See <code>SciTEBase::CharAdded()</code> in <code>SciTEBase.cxx</code> for an
4458 example of call tip use.</p>
4460 <p>The mouse may be clicked on call tips and this causes a
4461 <code><a class="message" href="#SCN_CALLTIPCLICK">SCN_CALLTIPCLICK</a></code>
4462 notification to be sent to the container. Small up and down arrows may be displayed within
4463 a call tip by, respectively, including the characters '\001', or '\002'. This is useful
4464 for showing that there are overloaded variants of one function name and that the user can
4465 click on the arrows to cycle through the overloads.</p>
4467 <p>Alternatively, call tips can be displayed when you leave the mouse pointer for a while over
4468 a word in response to the <code><a class="message"
4469 href="#SCN_DWELLSTART">SCN_DWELLSTART</a></code> <a class="jump"
4470 href="#Notifications">notification</a> and cancelled in response to <code><a class="message"
4471 href="#SCN_DWELLEND">SCN_DWELLEND</a></code>. This method could be used in a debugger to give
4472 the value of a variable, or during editing to give information about the word under the
4473 pointer.</p>
4474 <code><a class="message" href="#SCI_CALLTIPSHOW">SCI_CALLTIPSHOW(int posStart, const char
4475 *definition)</a><br />
4476 <a class="message" href="#SCI_CALLTIPCANCEL">SCI_CALLTIPCANCEL</a><br />
4477 <a class="message" href="#SCI_CALLTIPACTIVE">SCI_CALLTIPACTIVE</a><br />
4478 <a class="message" href="#SCI_CALLTIPPOSSTART">SCI_CALLTIPPOSSTART</a><br />
4479 <a class="message" href="#SCI_CALLTIPSETPOSSTART">SCI_CALLTIPSETPOSSTART(int posStart)</a><br />
4480 <a class="message" href="#SCI_CALLTIPSETHLT">SCI_CALLTIPSETHLT(int highlightStart, int
4481 highlightEnd)</a><br />
4482 <a class="message" href="#SCI_CALLTIPSETBACK">SCI_CALLTIPSETBACK(int colour)</a><br />
4483 <a class="message" href="#SCI_CALLTIPSETFORE">SCI_CALLTIPSETFORE(int colour)</a><br />
4484 <a class="message" href="#SCI_CALLTIPSETFOREHLT">SCI_CALLTIPSETFOREHLT(int colour)</a><br />
4485 <a class="message" href="#SCI_CALLTIPUSESTYLE">SCI_CALLTIPUSESTYLE(int tabsize)</a><br />
4486 <a class="message" href="#SCI_CALLTIPSETPOSITION">SCI_CALLTIPSETPOSITION(bool above)</a><br />
4487 </code>
4489 <p><b id="SCI_CALLTIPSHOW">SCI_CALLTIPSHOW(int posStart, const char *definition)</b><br />
4490 This message starts the process by displaying the call tip window. If a call tip is already
4491 active, this has no effect.<br />
4492 <code>posStart</code> is the position in the document at which to align the call tip. The call
4493 tip text is aligned to start 1 line below this character unless you have included up and/or
4494 down arrows in the call tip text in which case the tip is aligned to the right-hand edge of
4495 the rightmost arrow. The assumption is that you will start the text with something like
4496 "\001 1 of 3 \002".<br />
4497 <code>definition</code> is the call tip text. This can contain multiple lines separated by
4498 '\n' (Line Feed, ASCII code 10) characters. Do not include '\r' (Carriage Return, ASCII
4499 code 13), as this will most likely print as an empty box. '\t' (Tab, ASCII code 9) is
4500 supported if you set a tabsize with
4501 <code><a class="message" href="#SCI_CALLTIPUSESTYLE">SCI_CALLTIPUSESTYLE</a></code>.<br />
4502 The position of the caret is remembered here so that the call tip can be cancelled automatically if subsequent deletion
4503 moves the caret before this position.</p>
4505 <p><b id="SCI_CALLTIPCANCEL">SCI_CALLTIPCANCEL</b><br />
4506 This message cancels any displayed call tip. Scintilla will also cancel call tips for you if
4507 you use any keyboard commands that are not compatible with editing the argument list of a
4508 function.
4509 Call tips are cancelled if you delete back past the position where the caret was when the tip was triggered.</p>
4511 <p><b id="SCI_CALLTIPACTIVE">SCI_CALLTIPACTIVE</b><br />
4512 This returns 1 if a call tip is active and 0 if it is not active.</p>
4514 <p><b id="SCI_CALLTIPPOSSTART">SCI_CALLTIPPOSSTART</b><br />
4515 <b id="SCI_CALLTIPSETPOSSTART">SCI_CALLTIPSETPOSSTART(int posStart)</b><br />
4516 This message returns or sets the value of the current position when <code>SCI_CALLTIPSHOW</code>
4517 started to display the tip.</p>
4519 <p><b id="SCI_CALLTIPSETHLT">SCI_CALLTIPSETHLT(int hlStart, int hlEnd)</b><br />
4520 This sets the region of the call tips text to display in a highlighted style.
4521 <code>hlStart</code> is the zero-based index into the string of the first character to
4522 highlight and <code>hlEnd</code> is the index of the first character after the highlight.
4523 <code>hlEnd</code> must be greater than <code>hlStart</code>; <code>hlEnd-hlStart</code> is the
4524 number of characters to highlight. Highlights can extend over line ends if this is
4525 required.</p>
4527 <p>Unhighlighted text is drawn in a mid grey. Selected text is drawn in a dark blue. The
4528 background is white. These can be changed with
4529 <code>SCI_CALLTIPSETBACK</code>,
4530 <code>SCI_CALLTIPSETFORE</code>, and
4531 <code>SCI_CALLTIPSETFOREHLT</code>.
4532 </p>
4534 <p><b id="SCI_CALLTIPSETBACK">SCI_CALLTIPSETBACK(int colour)</b><br />
4535 The background colour of call tips can be set with this message; the default colour is white.
4536 It is not a good idea to set a dark colour as the background as the default colour for normal
4537 calltip text is mid grey and the default colour for highlighted text is dark blue. This also
4538 sets the background colour of <code>STYLE_CALLTIP</code>.</p>
4540 <p><b id="SCI_CALLTIPSETFORE">SCI_CALLTIPSETFORE(int colour)</b><br />
4541 The colour of call tip text can be set with this message; the default colour is mid grey.
4542 This also sets the foreground colour of <code>STYLE_CALLTIP</code>.</p>
4544 <p><b id="SCI_CALLTIPSETFOREHLT">SCI_CALLTIPSETFOREHLT(int colour)</b><br />
4545 The colour of highlighted call tip text can be set with this message; the default colour
4546 is dark blue.</p>
4548 <p><b id="SCI_CALLTIPUSESTYLE">SCI_CALLTIPUSESTYLE(int tabsize)</b><br />
4549 This message changes the style used for call tips from <code>STYLE_DEFAULT</code> to
4550 <code>STYLE_CALLTIP</code> and sets a tab size in screen pixels. If <code>tabsize</code> is
4551 less than 1, Tab characters are not treated specially. Once this call has been used, the
4552 call tip foreground and background colours are also taken from the style.</p>
4554 <p><b id="SCI_CALLTIPSETPOSITION">SCI_CALLTIPSETPOSITION(bool above)</b><br />
4555 By default the calltip is displayed below the text, setting above to <code>true</code>
4556 (1) will display it above the text.</p>
4559 <h2 id="KeyboardCommands">Keyboard commands</h2>
4561 <p>To allow the container application to perform any of the actions available to the user with
4562 keyboard, all the keyboard actions are messages. They do not take any parameters. These
4563 commands are also used when redefining the key bindings with the <a class="message"
4564 href="#SCI_ASSIGNCMDKEY"><code>SCI_ASSIGNCMDKEY</code></a> message.</p>
4566 <table border="0" summary="Keyboard commands">
4567 <tbody>
4568 <tr>
4569 <td><code>SCI_LINEDOWN</code></td>
4571 <td><code>SCI_LINEDOWNEXTEND</code></td>
4573 <td><code>SCI_LINEDOWNRECTEXTEND</code></td>
4575 <td><code>SCI_LINESCROLLDOWN</code></td>
4576 </tr>
4578 <tr>
4579 <td><code>SCI_LINEUP</code></td>
4581 <td><code>SCI_LINEUPEXTEND</code></td>
4583 <td><code>SCI_LINEUPRECTEXTEND</code></td>
4585 <td><code>SCI_LINESCROLLUP</code></td>
4586 </tr>
4588 <tr>
4589 <td><code>SCI_PARADOWN</code></td>
4591 <td><code>SCI_PARADOWNEXTEND</code></td>
4593 <td><code>SCI_PARAUP</code></td>
4595 <td><code>SCI_PARAUPEXTEND</code></td>
4596 </tr>
4598 <tr>
4599 <td><code>SCI_CHARLEFT</code></td>
4601 <td><code>SCI_CHARLEFTEXTEND</code></td>
4603 <td><code>SCI_CHARLEFTRECTEXTEND</code></td>
4604 </tr>
4606 <tr>
4607 <td><code>SCI_CHARRIGHT</code></td>
4609 <td><code>SCI_CHARRIGHTEXTEND</code></td>
4611 <td><code>SCI_CHARRIGHTRECTEXTEND</code></td>
4612 </tr>
4614 <tr>
4615 <td><code>SCI_WORDLEFT</code></td>
4617 <td><code>SCI_WORDLEFTEXTEND</code></td>
4619 <td><code>SCI_WORDRIGHT</code></td>
4621 <td><code>SCI_WORDRIGHTEXTEND</code></td>
4622 </tr>
4624 <tr>
4625 <td><code>SCI_WORDLEFTEND</code></td>
4627 <td><code>SCI_WORDLEFTENDEXTEND</code></td>
4629 <td><code>SCI_WORDRIGHTEND</code></td>
4631 <td><code>SCI_WORDRIGHTENDEXTEND</code></td>
4632 </tr>
4634 <tr>
4635 <td><code>SCI_WORDPARTLEFT</code></td>
4637 <td><code>SCI_WORDPARTLEFTEXTEND</code></td>
4639 <td><code>SCI_WORDPARTRIGHT</code></td>
4641 <td><code>SCI_WORDPARTRIGHTEXTEND</code></td>
4642 </tr>
4644 <tr>
4645 <td><code>SCI_HOME</code></td>
4647 <td><code>SCI_HOMEEXTEND</code></td>
4649 <td><code>SCI_HOMERECTEXTEND</code></td>
4650 </tr>
4652 <tr>
4653 <td><code>SCI_HOMEDISPLAY</code></td>
4655 <td><code>SCI_HOMEDISPLAYEXTEND</code></td>
4657 <td><code>SCI_HOMEWRAP</code></td>
4659 <td><code>SCI_HOMEWRAPEXTEND</code></td>
4660 </tr>
4662 <tr>
4663 <td><code>SCI_VCHOME</code></td>
4665 <td><code>SCI_VCHOMEEXTEND</code></td>
4667 <td><code>SCI_VCHOMERECTEXTEND</code></td>
4668 </tr>
4670 <tr>
4671 <td><code>SCI_VCHOMEWRAP</code></td>
4673 <td><code>SCI_VCHOMEWRAPEXTEND</code></td>
4675 <td><code>SCI_VCHOMEDISPLAY</code></td>
4677 <td><code>SCI_VCHOMEDISPLAYEXTEND</code></td>
4678 </tr>
4680 <tr>
4681 <td><code>SCI_LINEEND</code></td>
4683 <td><code>SCI_LINEENDEXTEND</code></td>
4685 <td><code>SCI_LINEENDRECTEXTEND</code></td>
4686 </tr>
4688 <tr>
4689 <td><code>SCI_LINEENDDISPLAY</code></td>
4691 <td><code>SCI_LINEENDDISPLAYEXTEND</code></td>
4693 <td><code>SCI_LINEENDWRAP</code></td>
4695 <td><code>SCI_LINEENDWRAPEXTEND</code></td>
4696 </tr>
4698 <tr>
4699 <td><code>SCI_DOCUMENTSTART</code></td>
4701 <td><code>SCI_DOCUMENTSTARTEXTEND</code></td>
4703 <td><code>SCI_DOCUMENTEND</code></td>
4705 <td><code>SCI_DOCUMENTENDEXTEND</code></td>
4706 </tr>
4708 <tr>
4709 <td><code>SCI_PAGEUP</code></td>
4711 <td><code>SCI_PAGEUPEXTEND</code></td>
4713 <td><code>SCI_PAGEUPRECTEXTEND</code></td>
4714 </tr>
4716 <tr>
4717 <td><code>SCI_PAGEDOWN</code></td>
4719 <td><code>SCI_PAGEDOWNEXTEND</code></td>
4721 <td><code>SCI_PAGEDOWNRECTEXTEND</code></td>
4722 </tr>
4725 <tr>
4726 <td><code>SCI_STUTTEREDPAGEUP</code></td>
4728 <td><code>SCI_STUTTEREDPAGEUPEXTEND</code></td>
4729 </tr>
4731 <tr>
4732 <td><code>SCI_STUTTEREDPAGEDOWN</code></td>
4734 <td><code>SCI_STUTTEREDPAGEDOWNEXTEND</code></td>
4735 </tr>
4737 <tr>
4738 <td><code>SCI_DELETEBACK</code></td>
4740 <td><code>SCI_DELETEBACKNOTLINE</code></td>
4741 </tr>
4743 <tr>
4744 <td><code>SCI_DELWORDLEFT</code></td>
4746 <td><code>SCI_DELWORDRIGHT</code></td>
4748 <td><code>SCI_DELWORDRIGHTEND</code></td>
4749 </tr>
4751 <tr>
4752 <td><code>SCI_DELLINELEFT</code></td>
4754 <td><code>SCI_DELLINERIGHT</code></td>
4756 <td><code>SCI_LINEDELETE</code></td>
4757 </tr>
4759 <tr>
4760 <td><code>SCI_LINECUT</code></td>
4762 <td><code>SCI_LINECOPY</code></td>
4764 <td><code>SCI_LINETRANSPOSE</code></td>
4766 <td><code>SCI_LINEDUPLICATE</code></td>
4767 </tr>
4769 <tr>
4770 <td><code>SCI_LOWERCASE</code></td>
4772 <td><code>SCI_UPPERCASE</code></td>
4774 <td><code>SCI_CANCEL</code></td>
4776 <td><code>SCI_EDITTOGGLEOVERTYPE</code></td>
4777 </tr>
4779 <tr>
4780 <td><code>SCI_NEWLINE</code></td>
4782 <td><code>SCI_FORMFEED</code></td>
4784 <td><code>SCI_TAB</code></td>
4786 <td><code>SCI_BACKTAB</code></td>
4787 </tr>
4789 <tr>
4790 <td><code>SCI_SELECTIONDUPLICATE</code></td>
4792 <td><code>SCI_VERTICALCENTRECARET</code></td>
4794 </tr>
4796 <tr>
4797 <td><code>SCI_MOVESELECTEDLINESUP</code></td>
4799 <td><code>SCI_MOVESELECTEDLINESDOWN</code></td>
4800 </tr>
4802 <tr>
4803 <td><code>SCI_SCROLLTOSTART</code></td>
4805 <td><code>SCI_SCROLLTOEND</code></td>
4806 </tr>
4807 </tbody>
4808 </table>
4810 <p>The <code>SCI_*EXTEND</code> messages extend the selection.</p>
4812 <p>The <code>SCI_*RECTEXTEND</code> messages extend the rectangular selection
4813 (and convert regular selection to rectangular one, if any).</p>
4815 <p>The <code>SCI_WORDPART*</code> commands are used to move between word segments marked by
4816 capitalisation (aCamelCaseIdentifier) or underscores (an_under_bar_ident).</p>
4818 <p>The <code>SCI_HOME*</code> commands move the caret to the start of the line, while the
4819 <code>SCI_VCHOME*</code> commands move the caret to the first non-blank character of the line
4820 (ie. just after the indentation) unless it is already there; in this case, it acts as SCI_HOME*.</p>
4822 <p>The <code>SCI_[HOME|LINEEND]DISPLAY*</code> commands are used when in line wrap mode to
4823 allow movement to the start or end of display lines as opposed to the normal
4824 <code>SCI_[HOME|LINEEND]</code> commands which move to the start or end of document lines.</p>
4826 <p>The <code>SCI_[[VC]HOME|LINEEND]WRAP*</code> commands are like their namesakes
4827 <code>SCI_[[VC]HOME|LINEEND]*</code> except they behave differently when word-wrap is enabled:
4828 They go first to the start / end of the display line, like <code>SCI_[HOME|LINEEND]DISPLAY*</code>,
4829 but if the cursor is already at the point, it goes on to the start or end of the document line,
4830 as appropriate for <code>SCI_[[VC]HOME|LINEEND]*</code>.
4831 </p>
4833 <p>The <code>SCI_SCROLLTO[START|END]</code> commands scroll the document to the start
4834 or end without changing the selection. These commands match OS X platform conventions for the behaviour of the
4835 <code>home</code> and <code>end</code> keys. Scintilla can be made to match OS X applications
4836 by binding the <code>home</code> and <code>end</code> keys to these commands.
4837 </p>
4839 <h2 id="KeyBindings">Key bindings</h2>
4841 <p>There is a default binding of keys to commands that is defined in the Scintilla source in
4842 the file <code>KeyMap.cxx</code> by the constant <code>KeyMap::MapDefault[]</code>. This table
4843 maps key definitions to <code>SCI_*</code> messages with no parameters (mostly the <a
4844 class="jump" href="#KeyboardCommands">keyboard commands</a> discussed above, but any Scintilla
4845 command that has no arguments can be mapped). You can change the mapping to suit your own
4846 requirements.</p>
4847 <code><a class="message" href="#SCI_ASSIGNCMDKEY">SCI_ASSIGNCMDKEY(int keyDefinition, int
4848 sciCommand)</a><br />
4849 <a class="message" href="#SCI_CLEARCMDKEY">SCI_CLEARCMDKEY(int keyDefinition)</a><br />
4850 <a class="message" href="#SCI_CLEARALLCMDKEYS">SCI_CLEARALLCMDKEYS</a><br />
4851 <a class="message" href="#SCI_NULL">SCI_NULL</a><br />
4852 </code>
4854 <p><b id="keyDefinition">keyDefinition</b><br />
4855 A key definition contains the key code in the low 16-bits and the key modifiers in the high
4856 16-bits. To combine <code>keyCode</code> and <code>keyMod</code> set:<br />
4857 <br />
4858 <code>keyDefinition = keyCode + (keyMod &lt;&lt; 16)</code></p>
4860 <p>The key code is a visible or control character or a key from the <code>SCK_*</code>
4861 enumeration, which contains:<br />
4862 <code>SCK_ADD</code>, <code>SCK_BACK</code>, <code>SCK_DELETE</code>, <code>SCK_DIVIDE</code>,
4863 <code>SCK_DOWN</code>, <code>SCK_END</code>, <code>SCK_ESCAPE</code>, <code>SCK_HOME</code>,
4864 <code>SCK_INSERT</code>, <code>SCK_LEFT</code>, <code>SCK_MENU</code>, <code>SCK_NEXT</code> (Page Down),
4865 <code>SCK_PRIOR</code> (Page Up), <code>SCK_RETURN</code>, <code>SCK_RIGHT</code>,
4866 <code>SCK_RWIN</code>,
4867 <code>SCK_SUBTRACT</code>, <code>SCK_TAB</code>, <code>SCK_UP</code>, and
4868 <code>SCK_WIN</code>.</p>
4870 <p>The modifiers are a combination of zero or more of <code>SCMOD_ALT</code>,
4871 <code>SCMOD_CTRL</code>, <code>SCMOD_SHIFT</code>, and <code>SCMOD_META</code>.
4872 On OS X, the Command key is mapped to <code>SCMOD_CTRL</code> and the Control key to
4873 <code>SCMOD_META</code>.
4874 If you are building a table, you might
4875 want to use <code>SCMOD_NORM</code>, which has the value 0, to mean no modifiers.</p>
4877 <p><b id="SCI_ASSIGNCMDKEY">SCI_ASSIGNCMDKEY(int <a class="jump"
4878 href="#keyDefinition">keyDefinition</a>, int sciCommand)</b><br />
4879 This assigns the given key definition to a Scintilla command identified by
4880 <code>sciCommand</code>. <code>sciCommand</code> can be any <code>SCI_*</code> command that has
4881 no arguments.</p>
4883 <p><b id="SCI_CLEARCMDKEY">SCI_CLEARCMDKEY(int <a class="jump"
4884 href="#keyDefinition">keyDefinition</a>)</b><br />
4885 This makes the given key definition do nothing by assigning the action <code>SCI_NULL</code>
4886 to it.</p>
4888 <p><b id="SCI_CLEARALLCMDKEYS">SCI_CLEARALLCMDKEYS</b><br />
4889 This command removes all keyboard command mapping by setting an empty mapping table.</p>
4891 <p><b id="SCI_NULL">SCI_NULL</b><br />
4892 The <code>SCI_NULL</code> does nothing and is the value assigned to keys that perform no
4893 action. SCI_NULL ensures that keys do not propagate to the parent window as that may
4894 cause focus to move. If you want the standard platform behaviour use the constant 0 instead.</p>
4896 <h2 id="PopupEditMenu">Popup edit menu</h2>
4898 <p><b id="SCI_USEPOPUP">SCI_USEPOPUP(bool bEnablePopup)</b><br />
4899 Clicking the wrong button on the mouse pops up a short default editing menu. This may be
4900 turned off with <code>SCI_USEPOPUP(0)</code>. If you turn it off, context menu commands (in
4901 Windows, <code>WM_CONTEXTMENU</code>) will not be handled by Scintilla, so the parent of the
4902 Scintilla window will have the opportunity to handle the message.</p>
4904 <h2 id="MacroRecording">Macro recording</h2>
4906 <p>Start and stop macro recording mode. In macro recording mode, actions are reported to the
4907 container through <code><a class="message" href="#SCN_MACRORECORD">SCN_MACRORECORD</a></code>
4908 <a class="jump" href="#Notifications">notifications</a>. It is then up to the container to
4909 record these actions for future replay.</p>
4911 <p><b id="SCI_STARTRECORD">SCI_STARTRECORD</b><br />
4912 <b id="SCI_STOPRECORD">SCI_STOPRECORD</b><br />
4913 These two messages turn macro recording on and off.</p>
4915 <h2 id="Printing">Printing</h2>
4917 <p><code>SCI_FORMATRANGE</code> can be used to draw the text onto a display surface
4918 which can include a printer display surface. Printed output shows text styling as on the
4919 screen, but it hides all margins except a line number margin. All special marker effects are
4920 removed and the selection and caret are hidden.</p>
4922 <p>Different platforms use different display surface ID types to print on. On Windows, these are
4923 <code>HDC</code>s., on GTK+ 3.x <code>cairo_t *</code>,
4924 and on Cocoa <code>CGContextRef</code> is used.</p>
4926 <code><a class="message" href="#SCI_FORMATRANGE">SCI_FORMATRANGE(bool bDraw, Sci_RangeToFormat
4927 *pfr)</a><br />
4928 <a class="message" href="#SCI_SETPRINTMAGNIFICATION">SCI_SETPRINTMAGNIFICATION(int
4929 magnification)</a><br />
4930 <a class="message" href="#SCI_GETPRINTMAGNIFICATION">SCI_GETPRINTMAGNIFICATION</a><br />
4931 <a class="message" href="#SCI_SETPRINTCOLOURMODE">SCI_SETPRINTCOLOURMODE(int mode)</a><br />
4932 <a class="message" href="#SCI_GETPRINTCOLOURMODE">SCI_GETPRINTCOLOURMODE</a><br />
4933 <a class="message" href="#SCI_SETPRINTWRAPMODE">SCI_SETPRINTWRAPMODE</a><br />
4934 <a class="message" href="#SCI_GETPRINTWRAPMODE">SCI_GETPRINTWRAPMODE</a><br />
4935 </code>
4937 <p><b id="SCI_FORMATRANGE">SCI_FORMATRANGE(bool bDraw, Sci_RangeToFormat *pfr)</b><br />
4938 This call renders a range of text into a device context. If you use
4939 this for printing, you will probably want to arrange a page header and footer; Scintilla does
4940 not do this for you. See <code>SciTEWin::Print()</code> in <code>SciTEWinDlg.cxx</code> for an
4941 example. Each use of this message renders a range of text into a rectangular area and returns
4942 the position in the document of the next character to print.</p>
4944 <p><code>bDraw</code> controls if any output is done. Set this to false if you are paginating
4945 (for example, if you use this with MFC you will need to paginate in
4946 <code>OnBeginPrinting()</code> before you output each page.</p>
4947 <pre>
4948 struct Sci_Rectangle { int left; int top; int right; int bottom; };
4950 struct Sci_RangeToFormat {
4951 Sci_SurfaceID hdc; // The Surface ID we print to
4952 Sci_SurfaceID hdcTarget; // The Surface ID we use for measuring (may be same as hdc)
4953 Sci_Rectangle rc; // Rectangle in which to print
4954 Sci_Rectangle rcPage; // Physically printable page size
4955 Sci_CharacterRange chrg; // Range of characters to print
4957 </pre>
4959 <p>On Windows, <code>hdc</code> and <code>hdcTarget</code> should both be set to the device context handle
4960 of the output device (usually a printer). If you print to a metafile these will not be the same
4961 as Windows metafiles (unlike extended metafiles) do not implement the full API for returning
4962 information. In this case, set <code>hdcTarget</code> to the screen DC.<br />
4963 <code>rcPage</code> is the rectangle <code>{0, 0, maxX, maxY}</code> where <code>maxX+1</code>
4964 and <code>maxY+1</code> are the number of physically printable pixels in x and y.<br />
4965 <code>rc</code> is the rectangle to render the text in (which will, of course, fit within the
4966 rectangle defined by rcPage).<br />
4967 <code>chrg.cpMin</code> and <code>chrg.cpMax</code> define the start position and maximum
4968 position of characters to output. All of each line within this character range is drawn.</p>
4970 <p>On Cocoa, the surface IDs for printing (<code>bDraw=1</code>) should be the graphics port of the current context
4971 (<code>(CGContextRef) [[NSGraphicsContext currentContext] graphicsPort]</code>) when the view's drawRect method is called.
4972 The Surface IDs are not really used for measurement (<code>bDraw=0</code>) but can be set
4973 to a bitmap context (created with <code>CGBitmapContextCreate</code>) to avoid runtime warnings.</p>
4975 <p>On GTK+, the surface IDs to use can be found from the printing context with
4976 <code>gtk_print_context_get_cairo_context(context)</code>.</p>
4978 <p><code>chrg.cpMin</code> and <code>chrg.cpMax</code> define the start position and maximum
4979 position of characters to output. All of each line within this character range is drawn.</p>
4981 <p>When printing, the most tedious part is always working out what the margins should be to
4982 allow for the non-printable area of the paper and printing a header and footer. If you look at
4983 the printing code in SciTE, you will find that most of it is taken up with this. The loop that
4984 causes Scintilla to render text is quite simple if you strip out all the margin, non-printable
4985 area, header and footer code.</p>
4987 <p><b id="SCI_SETPRINTMAGNIFICATION">SCI_SETPRINTMAGNIFICATION(int magnification)</b><br />
4988 <b id="SCI_GETPRINTMAGNIFICATION">SCI_GETPRINTMAGNIFICATION</b><br />
4989 <code>SCI_GETPRINTMAGNIFICATION</code> lets you to print at a different size than the screen
4990 font. <code>magnification</code> is the number of points to add to the size of each screen
4991 font. A value of -3 or -4 gives reasonably small print. You can get this value with
4992 <code>SCI_GETPRINTMAGNIFICATION</code>.</p>
4994 <p><b id="SCI_SETPRINTCOLOURMODE">SCI_SETPRINTCOLOURMODE(int mode)</b><br />
4995 <b id="SCI_GETPRINTCOLOURMODE">SCI_GETPRINTCOLOURMODE</b><br />
4996 These two messages set and get the method used to render coloured text on a printer that is
4997 probably using white paper. It is especially important to consider the treatment of colour if
4998 you use a dark or black screen background. Printing white on black uses up toner and ink very
4999 many times faster than the other way around. You can set the mode to one of:</p>
5001 <table cellpadding="1" cellspacing="2" border="0" summary="Colour printing modes">
5002 <tbody>
5003 <tr>
5004 <th align="left">Symbol</th>
5006 <th>Value</th>
5008 <th align="left">Purpose</th>
5009 </tr>
5010 </tbody>
5012 <tbody valign="top">
5013 <tr>
5014 <td align="left"><code>SC_PRINT_NORMAL</code></td>
5016 <td align="center">0</td>
5018 <td>Print using the current screen colours. This is the default.</td>
5019 </tr>
5021 <tr>
5022 <td align="left"><code>SC_PRINT_INVERTLIGHT</code></td>
5024 <td align="center">1</td>
5026 <td>If you use a dark screen background this saves ink by inverting the light value of
5027 all colours and printing on a white background.</td>
5028 </tr>
5030 <tr>
5031 <td align="left"><code>SC_PRINT_BLACKONWHITE</code></td>
5033 <td align="center">2</td>
5035 <td>Print all text as black on a white background.</td>
5036 </tr>
5038 <tr>
5039 <td align="left"><code>SC_PRINT_COLOURONWHITE</code></td>
5041 <td align="center">3</td>
5043 <td>Everything prints in its own colour on a white background.</td>
5044 </tr>
5046 <tr>
5047 <td align="left"><code>SC_PRINT_COLOURONWHITEDEFAULTBG</code></td>
5049 <td align="center">4</td>
5051 <td>Everything prints in its own colour on a white background except that line numbers
5052 use their own background colour.</td>
5053 </tr>
5054 </tbody>
5055 </table>
5057 <p><b id="SCI_SETPRINTWRAPMODE">SCI_SETPRINTWRAPMODE(int wrapMode)</b><br />
5058 <b id="SCI_GETPRINTWRAPMODE">SCI_GETPRINTWRAPMODE</b><br />
5059 These two functions get and set the printer wrap mode. <code>wrapMode</code> can be
5060 set to <code>SC_WRAP_NONE</code> (0), <code>SC_WRAP_WORD</code> (1) or
5061 <code>SC_WRAP_CHAR</code> (2). The default is
5062 <code>SC_WRAP_WORD</code>, which wraps printed output so that all characters fit
5063 into the print rectangle. If you set <code>SC_WRAP_NONE</code>, each line of text
5064 generates one line of output and the line is truncated if it is too long to fit
5065 into the print area.<br />
5066 <code>SC_WRAP_WORD</code> tries to wrap only between words as indicated by
5067 white space or style changes although if a word is longer than a line, it will be wrapped before
5068 the line end. <code>SC_WRAP_CHAR</code> is preferred to
5069 <code>SC_WRAP_WORD</code> for Asian languages where there is no white space
5070 between words.</p>
5072 <h2 id="DirectAccess">Direct access</h2>
5073 <code><a class="message" href="#SCI_GETDIRECTFUNCTION">SCI_GETDIRECTFUNCTION</a><br />
5074 <a class="message" href="#SCI_GETDIRECTPOINTER">SCI_GETDIRECTPOINTER</a><br />
5075 <a class="message" href="#SCI_GETCHARACTERPOINTER">SCI_GETCHARACTERPOINTER</a><br />
5076 <a class="message" href="#SCI_GETRANGEPOINTER">SCI_GETRANGEPOINTER(int position, int rangeLength)</a><br />
5077 <a class="message" href="#SCI_GETGAPPOSITION">SCI_GETGAPPOSITION</a><br />
5078 </code>
5080 <p>On Windows, the message-passing scheme used to communicate between the container and
5081 Scintilla is mediated by the operating system <code>SendMessage</code> function and can lead to
5082 bad performance when calling intensively. To avoid this overhead, Scintilla provides messages
5083 that allow you to call the Scintilla message function directly. The code to do this in C/C++ is
5084 of the form:</p>
5085 <pre>
5086 #include "Scintilla.h"
5087 SciFnDirect pSciMsg = (SciFnDirect)SendMessage(hSciWnd, SCI_GETDIRECTFUNCTION, 0, 0);
5088 sptr_t pSciWndData = (sptr_t)SendMessage(hSciWnd, SCI_GETDIRECTPOINTER, 0, 0);
5090 // now a wrapper to call Scintilla directly
5091 sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
5092 return pSciMsg(pSciWndData, iMessage, wParam, lParam);
5094 </pre>
5096 <p><code>SciFnDirect</code>, <code>sptr_t</code> and <code>uptr_t</code> are declared in
5097 <code>Scintilla.h</code>. <code>hSciWnd</code> is the window handle returned when you created
5098 the Scintilla window.</p>
5100 <p>While faster, this direct calling will cause problems if performed from a different thread
5101 to the native thread of the Scintilla window in which case <code>SendMessage(hSciWnd, SCI_*,
5102 wParam, lParam)</code> should be used to synchronize with the window's thread.</p>
5104 <p>This feature also works on GTK+ but has no significant impact on speed.</p>
5106 <p>From version 1.47 on Windows, Scintilla exports a function called
5107 <code>Scintilla_DirectFunction</code> that can be used the same as the function returned by
5108 <code>SCI_GETDIRECTFUNCTION</code>. This saves you the call to
5109 <code>SCI_GETDIRECTFUNCTION</code> and the need to call Scintilla indirectly via the function
5110 pointer.</p>
5112 <p><b id="SCI_GETDIRECTFUNCTION">SCI_GETDIRECTFUNCTION</b><br />
5113 This message returns the address of the function to call to handle Scintilla messages without
5114 the overhead of passing through the Windows messaging system. You need only call this once,
5115 regardless of the number of Scintilla windows you create.</p>
5117 <p><b id="SCI_GETDIRECTPOINTER">SCI_GETDIRECTPOINTER</b><br />
5118 This returns a pointer to data that identifies which Scintilla window is in use. You must call
5119 this once for each Scintilla window you create. When you call the direct function, you must
5120 pass in the direct pointer associated with the target window.</p>
5122 <p><b id="SCI_GETCHARACTERPOINTER">SCI_GETCHARACTERPOINTER</b><br />
5123 <b id="SCI_GETRANGEPOINTER">SCI_GETRANGEPOINTER(int position, int rangeLength)</b><br />
5124 <b id="SCI_GETGAPPOSITION">SCI_GETGAPPOSITION</b><br />
5125 Grant temporary direct read-only access to the memory used by Scintilla to store
5126 the document.</p>
5127 <p><code>SCI_GETCHARACTERPOINTER</code> moves the gap within Scintilla so that the
5128 text of the document is stored consecutively
5129 and ensure there is a NUL character after the text, then returns a pointer to the first character.
5130 Applications may then pass this to a function that accepts a character pointer such as a regular
5131 expression search or a parser. The pointer should <em>not</em> be written to as that may desynchronize
5132 the internal state of Scintilla.</p>
5133 <p>Since any action in Scintilla may change its internal state
5134 this pointer becomes invalid after any call or by allowing user interface activity. The application
5135 should reacquire the pointer after making any call to Scintilla or performing any user-interface calls such
5136 as modifying a progress indicator.</p>
5137 <p>This call takes similar time to inserting a character at the end of the document and this may
5138 include moving the document contents. Specifically, all the characters after the document gap
5139 are moved to before the gap. This compacted state should persist over calls and user interface
5140 actions that do not change the document contents so reacquiring the pointer afterwards is very
5141 quick. If this call is used to implement a global replace operation, then each replacement will
5142 move the gap so if <code>SCI_GETCHARACTERPOINTER</code> is called after
5143 each replacement then the operation will become O(n^2) rather than O(n). Instead, all
5144 matches should be found and remembered, then all the replacements performed.</p>
5146 <p><code>SCI_GETRANGEPOINTER</code> provides direct access to just the
5147 range requested. The gap is not moved unless it is within the requested range so this call
5148 can be faster than <code>SCI_GETCHARACTERPOINTER</code>.
5149 This can be used by application code that is able to act on blocks of text or ranges of lines.</p>
5151 <p><code>SCI_GETGAPPOSITION</code> returns the current gap position.
5152 This is a hint that applications can use to avoid calling <code>SCI_GETRANGEPOINTER</code>
5153 with a range that contains the gap and consequent costs of moving the gap.</p>
5155 <h2 id="MultipleViews">Multiple views</h2>
5157 <p>A Scintilla window and the document that it displays are separate entities. When you create
5158 a new window, you also create a new, empty document. Each document has a reference count that
5159 is initially set to 1. The document also has a list of the Scintilla windows that are linked to
5160 it so when any window changes the document, all other windows in which it appears are notified
5161 to cause them to update. The system is arranged in this way so that you can work with many
5162 documents in a single Scintilla window and so you can display a single document in multiple
5163 windows (for use with splitter windows).</p>
5165 <p>Although these messages use <code>document *pDoc</code>, to ensure compatibility with future
5166 releases of Scintilla you should treat <code>pDoc</code> as an opaque <code>void*</code>. That
5167 is, you can use and store the pointer as described in this section but you should not
5168 dereference it.</p>
5169 <code><a class="message" href="#SCI_GETDOCPOINTER">SCI_GETDOCPOINTER</a><br />
5170 <a class="message" href="#SCI_SETDOCPOINTER">SCI_SETDOCPOINTER(&lt;unused&gt;, document
5171 *pDoc)</a><br />
5172 <a class="message" href="#SCI_CREATEDOCUMENT">SCI_CREATEDOCUMENT</a><br />
5173 <a class="message" href="#SCI_ADDREFDOCUMENT">SCI_ADDREFDOCUMENT(&lt;unused&gt;, document
5174 *pDoc)</a><br />
5175 <a class="message" href="#SCI_RELEASEDOCUMENT">SCI_RELEASEDOCUMENT(&lt;unused&gt;, document
5176 *pDoc)</a><br />
5177 </code>
5179 <p><b id="SCI_GETDOCPOINTER">SCI_GETDOCPOINTER</b><br />
5180 This returns a pointer to the document currently in use by the window. It has no other
5181 effect.</p>
5183 <p><b id="SCI_SETDOCPOINTER">SCI_SETDOCPOINTER(&lt;unused&gt;, document *pDoc)</b><br />
5184 This message does the following:<br />
5185 1. It removes the current window from the list held by the current document.<br />
5186 2. It reduces the reference count of the current document by 1.<br />
5187 3. If the reference count reaches 0, the document is deleted.<br />
5188 4. <code>pDoc</code> is set as the new document for the window.<br />
5189 5. If <code>pDoc</code> was 0, a new, empty document is created and attached to the
5190 window.<br />
5191 6. If <code>pDoc</code> was not 0, its reference count is increased by 1.</p>
5193 <p><b id="SCI_CREATEDOCUMENT">SCI_CREATEDOCUMENT</b><br />
5194 This message creates a new, empty document and returns a pointer to it. This document is not
5195 selected into the editor and starts with a reference count of 1. This means that you have
5196 ownership of it and must either reduce its reference count by 1 after using
5197 <code>SCI_SETDOCPOINTER</code> so that the Scintilla window owns it or you must make sure that
5198 you reduce the reference count by 1 with <code>SCI_RELEASEDOCUMENT</code> before you close the
5199 application to avoid memory leaks.</p>
5201 <p><b id="SCI_ADDREFDOCUMENT">SCI_ADDREFDOCUMENT(&lt;unused&gt;, document *pDoc)</b><br />
5202 This increases the reference count of a document by 1. If you want to replace the current
5203 document in the Scintilla window and take ownership of the current document, for example if you
5204 are editing many documents in one window, do the following:<br />
5205 1. Use <code>SCI_GETDOCPOINTER</code> to get a pointer to the document,
5206 <code>pDoc</code>.<br />
5207 2. Use <code>SCI_ADDREFDOCUMENT(0, pDoc)</code> to increment the reference count.<br />
5208 3. Use <code>SCI_SETDOCPOINTER(0, pNewDoc)</code> to set a different document or
5209 <code>SCI_SETDOCPOINTER(0, 0)</code> to set a new, empty document.</p>
5211 <p><b id="SCI_RELEASEDOCUMENT">SCI_RELEASEDOCUMENT(&lt;unused&gt;, document *pDoc)</b><br />
5212 This message reduces the reference count of the document identified by <code>pDoc</code>. pDoc
5213 must be the result of <code>SCI_GETDOCPOINTER</code> or <code>SCI_CREATEDOCUMENT</code> and
5214 must point at a document that still exists. If you call this on a document with a reference
5215 count of 1 that is still attached to a Scintilla window, bad things will happen. To keep the
5216 world spinning in its orbit you must balance each call to <code>SCI_CREATEDOCUMENT</code> or
5217 <code>SCI_ADDREFDOCUMENT</code> with a call to <code>SCI_RELEASEDOCUMENT</code>.</p>
5219 <h2 id="BackgroundLoadSave">Background loading and saving</h2>
5221 <p>To ensure a responsive user interface, applications may decide to load and save documents using a separate thread
5222 from the user interface.</p>
5224 <h3 id="BackgroundLoad">Loading in the background</h3>
5226 <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
5227 into a Scintilla document on the user interface thread. That technique uses extra memory to store a complete copy of the
5228 file and also means that the time that Scintilla takes to perform initial line end discovery blocks the user interface.</p>
5230 <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>
5232 <p><b id="SCI_CREATELOADER">SCI_CREATELOADER(int bytes)</b><br />
5233 Create an object that supports the <code>ILoader</code> interface which can be used to load data and then
5234 be turned into a Scintilla document object for attachment to a view object.
5235 The <code>bytes</code> argument determines the initial memory allocation for the document as it is more efficient
5236 to allocate once rather than rely on the buffer growing as data is added.
5237 If <code>SCI_CREATELOADER</code> fails then 0 is returned.</p>
5239 <h4>ILoader</h4>
5241 <div class="highlighted">
5242 <span class="S5">class</span><span class="S0"> </span>ILoader<span class="S0"> </span><span class="S10">{</span><br />
5243 <span class="S5">public</span><span class="S10">:</span><br />
5244 <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 />
5245 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S2">// Returns a status code from SC_STATUS_*</span><br />
5246 <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 />
5247 <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 />
5248 <span class="S10">};</span><br />
5249 </div>
5251 <p>The application should call the <code>AddData</code> method with each block of data read from the file.
5252 <code>AddData</code> will return SC_STATUS_OK unless a failure, such as memory exhaustion occurs.
5253 If a failure occurs in <code>AddData</code> or in a file reading call then loading can be abandoned and the loader released with
5254 the <code>Release</code> call.
5255 When the whole file has been read, the <code>ConvertToDocument</code> method should be called to produce a Scintilla
5256 document pointer which can be used in the same way as a document pointer returned from
5257 <a class="message" href="#SCI_CREATEDOCUMENT">SCI_CREATEDOCUMENT</a>.
5258 There is no need to call <code>Release</code> after <code>ConvertToDocument</code>.</p>
5260 <h3 id="BackgroundSave">Saving in the background</h3>
5262 <p>An application that wants to save in the background should lock the document with <code>SCI_SETREADONLY(1)</code>
5263 to prevent modifications and retrieve a pointer to the unified document contents with
5264 <a class="message" href="#SCI_GETCHARACTERPOINTER">SCI_GETCHARACTERPOINTER</a>.
5265 The buffer of a locked document will not move so the pointer is valid until the application calls <code>SCI_SETREADONLY(0)</code>.</p>
5267 <p>If the user tries to performs a modification while the document is locked then a <code><a class="message"
5268 href="#SCN_MODIFYATTEMPTRO">SCN_MODIFYATTEMPTRO</a></code> notification is sent to the application.
5269 The application may then decide to ignore the modification or to terminate the background saving thread and reenable
5270 modification before returning from the notification.</p>
5272 <h2 id="Folding">Folding</h2>
5274 <p>The fundamental operation in folding is making lines invisible or visible. Line visibility
5275 is a property of the view rather than the document so each view may be displaying a different
5276 set of lines. From the point of view of the user, lines are hidden and displayed using fold
5277 points. Generally, the fold points of a document are based on the hierarchical structure of the
5278 document contents. In Python, the hierarchy is determined by indentation and in C++ by brace
5279 characters. This hierarchy can be represented within a Scintilla document object by attaching a
5280 numeric "fold level" to each line. The fold level is most easily set by a lexer, but you can
5281 also set it with messages.</p>
5283 <p>It is up to your code to set the connection between user actions and folding and unfolding.
5284 The best way to see how this is done is to search the SciTE source code for the messages used
5285 in this section of the documentation and see how they are used. You will also need to use
5286 markers and a folding margin to complete your folding implementation.
5287 The <code>"fold"</code> property should be set to <code>"1"</code> with
5288 <code>SCI_SETPROPERTY("fold", "1")</code> to enable folding. </p>
5289 <code><a class="message" href="#SCI_VISIBLEFROMDOCLINE">SCI_VISIBLEFROMDOCLINE(int
5290 docLine)</a><br />
5291 <a class="message" href="#SCI_DOCLINEFROMVISIBLE">SCI_DOCLINEFROMVISIBLE(int
5292 displayLine)</a><br />
5293 <a class="message" href="#SCI_SHOWLINES">SCI_SHOWLINES(int lineStart, int lineEnd)</a><br />
5294 <a class="message" href="#SCI_HIDELINES">SCI_HIDELINES(int lineStart, int lineEnd)</a><br />
5295 <a class="message" href="#SCI_GETLINEVISIBLE">SCI_GETLINEVISIBLE(int line)</a><br />
5296 <a class="message" href="#SCI_GETALLLINESVISIBLE">SCI_GETALLLINESVISIBLE</a><br />
5297 <a class="message" href="#SCI_SETFOLDLEVEL">SCI_SETFOLDLEVEL(int line, int level)</a><br />
5298 <a class="message" href="#SCI_GETFOLDLEVEL">SCI_GETFOLDLEVEL(int line)</a><br />
5299 <a class="message" href="#SCI_SETAUTOMATICFOLD">SCI_SETAUTOMATICFOLD(int automaticFold)</a><br />
5300 <a class="message" href="#SCI_GETAUTOMATICFOLD">SCI_GETAUTOMATICFOLD</a><br />
5301 <a class="message" href="#SCI_SETFOLDFLAGS">SCI_SETFOLDFLAGS(int flags)</a><br />
5302 <a class="message" href="#SCI_GETLASTCHILD">SCI_GETLASTCHILD(int line, int level)</a><br />
5303 <a class="message" href="#SCI_GETFOLDPARENT">SCI_GETFOLDPARENT(int line)</a><br />
5304 <a class="message" href="#SCI_SETFOLDEXPANDED">SCI_SETFOLDEXPANDED(int line, bool
5305 expanded)</a><br />
5306 <a class="message" href="#SCI_GETFOLDEXPANDED">SCI_GETFOLDEXPANDED(int line)</a><br />
5307 <a class="message" href="#SCI_CONTRACTEDFOLDNEXT">SCI_CONTRACTEDFOLDNEXT(int lineStart)</a><br />
5308 <a class="message" href="#SCI_TOGGLEFOLD">SCI_TOGGLEFOLD(int line)</a><br />
5309 <a class="message" href="#SCI_FOLDLINE">SCI_FOLDLINE(int line, int action)</a><br />
5310 <a class="message" href="#SCI_FOLDCHILDREN">SCI_FOLDCHILDREN(int line, int action)</a><br />
5311 <a class="message" href="#SCI_FOLDALL">SCI_FOLDALL(int action)</a><br />
5312 <a class="message" href="#SCI_EXPANDCHILDREN">SCI_EXPANDCHILDREN(int line, int level)</a><br />
5313 <a class="message" href="#SCI_ENSUREVISIBLE">SCI_ENSUREVISIBLE(int line)</a><br />
5314 <a class="message" href="#SCI_ENSUREVISIBLEENFORCEPOLICY">SCI_ENSUREVISIBLEENFORCEPOLICY(int
5315 line)</a><br />
5316 </code>
5318 <p><b id="SCI_VISIBLEFROMDOCLINE">SCI_VISIBLEFROMDOCLINE(int docLine)</b><br />
5319 When some lines are hidden and/or annotations are displayed, then a particular line in the
5320 document may be displayed at a
5321 different position to its document position. If no lines are hidden and there are no annotations,
5322 this message returns
5323 <code>docLine</code>. Otherwise, this returns the display line (counting the very first visible
5324 line as 0). The display line of an invisible line is the same as the previous visible line. The
5325 display line number of the first line in the document is 0. If lines are hidden and
5326 <code>docLine</code> is outside the range of lines in the document, the return value is -1.
5327 Lines can occupy more than one display line if they wrap.</p>
5329 <p><b id="SCI_DOCLINEFROMVISIBLE">SCI_DOCLINEFROMVISIBLE(int displayLine)</b><br />
5330 When some lines are hidden and/or annotations are displayed, then a particular line in the
5331 document may be displayed at a
5332 different position to its document position. This message returns the document line number that
5333 corresponds to a display line (counting the display line of the first line in the document as
5334 0). If <code>displayLine</code> is less than or equal to 0, the result is 0. If
5335 <code>displayLine</code> is greater than or equal to the number of displayed lines, the result
5336 is the number of lines in the document.</p>
5338 <p><b id="SCI_SHOWLINES">SCI_SHOWLINES(int lineStart, int lineEnd)</b><br />
5339 <b id="SCI_HIDELINES">SCI_HIDELINES(int lineStart, int lineEnd)</b><br />
5340 <b id="SCI_GETLINEVISIBLE">SCI_GETLINEVISIBLE(int line)</b><br />
5341 <b id="SCI_GETALLLINESVISIBLE">SCI_GETALLLINESVISIBLE</b><br />
5342 The first two messages mark a range of lines as visible or invisible and then redraw the
5343 display.
5344 <code>SCI_GETLINEVISIBLE</code> reports on the visible state of a line and returns 1 if it is
5345 visible and 0 if it is not visible.
5346 <code>SCI_GETALLLINESVISIBLE</code> returns 1 if all lines are visible and 0
5347 if some lines are hidden.
5348 These messages have no effect on fold levels or fold
5349 flags. The first line can not be hidden.</p>
5351 <p><b id="SCI_SETFOLDLEVEL">SCI_SETFOLDLEVEL(int line, int level)</b><br />
5352 <b id="SCI_GETFOLDLEVEL">SCI_GETFOLDLEVEL(int line)</b><br />
5353 These two messages set and get a 32-bit value that contains the fold level of a line and some
5354 flags associated with folding. The fold level is a number in the range 0 to
5355 <code>SC_FOLDLEVELNUMBERMASK</code> (4095). However, the initial fold level is set to
5356 <code>SC_FOLDLEVELBASE</code> (1024) to allow unsigned arithmetic on folding levels. There are
5357 two addition flag bits. <code>SC_FOLDLEVELWHITEFLAG</code> indicates that the line is blank and
5358 allows it to be treated slightly different then its level may indicate. For example, blank
5359 lines should generally not be fold points and will be considered part of the preceding section even though
5360 they may have a lesser fold level.
5361 <code>SC_FOLDLEVELHEADERFLAG</code> indicates that
5362 the line is a header (fold point).</p>
5364 <p>Use <code>SCI_GETFOLDLEVEL(line) &amp; SC_FOLDLEVELNUMBERMASK</code> to get the fold level
5365 of a line. Likewise, use <code>SCI_GETFOLDLEVEL(line) &amp; SC_FOLDLEVEL*FLAG</code> to get the
5366 state of the flags. To set the fold level you must or in the associated flags. For instance, to
5367 set the level to <code>thisLevel</code> and mark a line as being a fold point use:
5368 <code>SCI_SETFOLDLEVEL(line, thisLevel | SC_FOLDLEVELHEADERFLAG)</code>.</p>
5369 If you use a lexer, you should not need to use <code>SCI_SETFOLDLEVEL</code> as this is far
5370 better handled by the lexer. You will need to use <code>SCI_GETFOLDLEVEL</code> to decide how
5371 to handle user folding requests. If you do change the fold levels, the folding margin will
5372 update to match your changes.
5374 <p><b id="SCI_SETFOLDFLAGS">SCI_SETFOLDFLAGS(int flags)</b><br />
5375 In addition to showing markers in the folding margin, you can indicate folds to the user by
5376 drawing lines in the text area. The lines are drawn in the foreground colour set for <a
5377 class="message" href="#StyleDefinition"><code>STYLE_DEFAULT</code></a>. Bits set in
5378 <code>flags</code> determine where folding lines are drawn:<br />
5379 </p>
5381 <table cellpadding="1" cellspacing="2" border="0" summary="Fold flags">
5382 <tbody>
5383 <tr>
5384 <th align="left">Symbol</th>
5385 <th align="left">Value</th>
5386 <th align="left">Effect</th>
5387 </tr>
5388 </tbody>
5390 <tbody valign="top">
5391 <tr>
5392 <td align="left"></td>
5393 <td align="left">1</td>
5394 <td align="left">Experimental feature that has been removed.</td>
5395 </tr>
5397 <tr>
5398 <td align="left">SC_FOLDFLAG_LINEBEFORE_EXPANDED</td>
5399 <td align="left">2</td>
5401 <td align="left">Draw above if expanded</td>
5402 </tr>
5404 <tr>
5405 <td align="left">SC_FOLDFLAG_LINEBEFORE_CONTRACTED</td>
5406 <td align="left">4</td>
5408 <td align="left">Draw above if not expanded</td>
5409 </tr>
5411 <tr>
5412 <td align="left">SC_FOLDFLAG_LINEAFTER_EXPANDED</td>
5413 <td align="left">8</td>
5415 <td align="left">Draw below if expanded</td>
5416 </tr>
5418 <tr>
5419 <td align="left">SC_FOLDFLAG_LINEAFTER_CONTRACTED</td>
5420 <td align="left">16</td>
5422 <td align="left">Draw below if not expanded</td>
5423 </tr>
5425 <tr>
5426 <td align="left">SC_FOLDFLAG_LEVELNUMBERS</td>
5427 <td align="left">64</td>
5429 <td align="left">display hexadecimal fold levels in line margin to aid debugging of
5430 folding. The appearance of this feature may change in the future.</td>
5431 </tr>
5433 <tr>
5434 <td align="left">SC_FOLDFLAG_LINESTATE</td>
5435 <td align="left">128</td>
5437 <td align="left">display hexadecimal line state in line margin to aid debugging of lexing and folding.
5438 May not be used at the same time as <code>SC_FOLDFLAG_LEVELNUMBERS</code>.</td>
5439 </tr>
5440 </tbody>
5441 </table>
5443 <p>This message causes the display to redraw.</p>
5445 <p><b id="SCI_GETLASTCHILD">SCI_GETLASTCHILD(int startLine, int level)</b><br />
5446 This message searches for the next line after <code>startLine</code>, that has a folding level
5447 that is less than or equal to <code>level</code> and then returns the previous line number. If
5448 you set <code>level</code> to -1, <code>level</code> is set to the folding level of line
5449 <code>startLine</code>. If <code>from</code> is a fold point, <code>SCI_GETLASTCHILD(from,
5450 -1)</code> returns the last line that would be in made visible or hidden by toggling the fold
5451 state.</p>
5453 <p><b id="SCI_GETFOLDPARENT">SCI_GETFOLDPARENT(int startLine)</b><br />
5454 This message returns the line number of the first line before <code>startLine</code> that is
5455 marked as a fold point with <code>SC_FOLDLEVELHEADERFLAG</code> and has a fold level less than
5456 the <code>startLine</code>. If no line is found, or if the header flags and fold levels are
5457 inconsistent, the return value is -1.</p>
5459 <p><b id="SCI_TOGGLEFOLD">SCI_TOGGLEFOLD(int line)</b><br />
5460 Each fold point may be either expanded, displaying all its child lines, or contracted, hiding
5461 all the child lines. This message toggles the folding state of the given line as long as it has
5462 the <code>SC_FOLDLEVELHEADERFLAG</code> set. This message takes care of folding or expanding
5463 all the lines that depend on the line. The display updates after this message.</p>
5465 <p><b id="SCI_SETFOLDEXPANDED">SCI_SETFOLDEXPANDED(int line, bool expanded)</b><br />
5466 <b id="SCI_GETFOLDEXPANDED">SCI_GETFOLDEXPANDED(int line)</b><br />
5467 These messages set and get the expanded state of a single line. The set message has no effect
5468 on the visible state of the line or any lines that depend on it. It does change the markers in
5469 the folding margin. If you ask for the expansion state of a line that is outside the document,
5470 the result is <code>false</code> (0).</p>
5472 <p>If you just want to toggle the fold state of one line and handle all the lines that are
5473 dependent on it, it is much easier to use <code>SCI_TOGGLEFOLD</code>. You would use the
5474 <code>SCI_SETFOLDEXPANDED</code> message to process many folds without updating the display
5475 until you had finished. See <code>SciTEBase::FoldAll()</code> and
5476 <code>SciTEBase::Expand()</code> for examples of the use of these messages.</p>
5478 <p><b id="SCI_FOLDLINE">SCI_FOLDLINE(int line, int action)</b><br />
5479 <b id="SCI_FOLDCHILDREN">SCI_FOLDCHILDREN(int line, int action)</b><br />
5480 <b id="SCI_FOLDALL">SCI_FOLDALL(int action)</b><br />
5481 These messages provide a higher-level approach to folding instead of setting expanded flags and showing
5482 or hiding individual lines.</p>
5483 <p>An individual fold can be contracted/expanded/toggled with <code>SCI_FOLDLINE</code>.
5484 To affect all child folds as well call <code>SCI_FOLDCHILDREN</code>.</p>
5485 <p>To affect the entire document call <code>SCI_FOLDALL</code>. With <code>SC_FOLDACTION_TOGGLE</code>
5486 the first fold header in the document is examined to decide whether to expand or contract.
5487 </p>
5488 <table cellpadding="1" cellspacing="2" border="0" summary="Fold flags">
5489 <tbody>
5490 <tr>
5491 <th align="left">Symbol</th>
5492 <th align="left">Value</th>
5493 <th align="left">Effect</th>
5494 </tr>
5495 </tbody>
5497 <tbody valign="top">
5498 <tr>
5499 <td align="left">SC_FOLDACTION_CONTRACT</td>
5500 <td align="left">0</td>
5501 <td align="left">Contract.</td>
5502 </tr>
5504 <tr>
5505 <td align="left">SC_FOLDACTION_EXPAND</td>
5506 <td align="left">1</td>
5507 <td align="left">Expand.</td>
5508 </tr>
5510 <tr>
5511 <td align="left">SC_FOLDACTION_TOGGLE</td>
5512 <td align="left">2</td>
5513 <td align="left">Toggle between contracted and expanded.</td>
5514 </tr>
5516 </tbody>
5517 </table>
5518 <p></p>
5520 <p><b id="SCI_EXPANDCHILDREN">SCI_EXPANDCHILDREN(int line, int level)</b><br />
5521 This is used to respond to a change to a line causing its fold level or whether it is a header to change,
5522 perhaps when adding or removing a '{'.</p>
5523 <p>By the time the container has received the notification that the line has changed,
5524 the fold level has already been set, so the container has to use the previous level in this call
5525 so that any range hidden underneath this line can be shown.
5526 </p>
5528 <p><b id="SCI_SETAUTOMATICFOLD">SCI_SETAUTOMATICFOLD(int automaticFold)</b><br />
5529 <b id="SCI_GETAUTOMATICFOLD">SCI_GETAUTOMATICFOLD</b><br />
5530 Instead of implementing all the logic for handling folding in the container, Scintilla can provide behaviour
5531 that is adequate for many applications. The <code>automaticFold</code> argument is a bit set defining
5532 which of the 3 pieces of folding implementation should be enabled. Most applications should be able to use the
5533 <code>SC_AUTOMATICFOLD_SHOW</code> and <code>SC_AUTOMATICFOLD_CHANGE</code>
5534 flags unless they wish to implement quite different behaviour such as defining their own fold structure.
5535 <code>SC_AUTOMATICFOLD_CLICK</code> is more likely to be set off when an application would
5536 like to add or change click behaviour such as showing method headers only when Shift+Alt is used in
5537 conjunction with a click.
5538 </p>
5539 <table cellpadding="1" cellspacing="2" border="0" summary="Fold flags">
5540 <tbody>
5541 <tr>
5542 <th align="left">Symbol</th>
5543 <th align="left">Value</th>
5544 <th align="left">Effect</th>
5545 </tr>
5546 </tbody>
5548 <tbody valign="top">
5549 <tr>
5550 <td align="left">SC_AUTOMATICFOLD_SHOW</td>
5551 <td align="left">1</td>
5552 <td align="left">Automatically show lines as needed.
5553 This avoids sending the <code>SCN_NEEDSHOWN</code> notification.</td>
5554 </tr>
5556 <tr>
5557 <td align="left">SC_AUTOMATICFOLD_CLICK</td>
5558 <td align="left">2</td>
5559 <td align="left">Handle clicks in fold margin automatically.
5560 This avoids sending the <code>SCN_MARGINCLICK</code> notification for folding margins.</td>
5561 </tr>
5563 <tr>
5564 <td align="left">SC_AUTOMATICFOLD_CHANGE</td>
5565 <td align="left">4</td>
5566 <td align="left">Show lines as needed when fold structure is changed.
5567 The <code>SCN_MODIFIED</code> notification is still sent unless it is disabled by the
5568 container.</td>
5569 </tr>
5571 </tbody>
5572 </table>
5574 <p><b id="SCI_CONTRACTEDFOLDNEXT">SCI_CONTRACTEDFOLDNEXT(int lineStart)</b><br />
5575 Search efficiently for lines that are contracted fold headers.
5576 This is useful when saving the user's folding when switching documents or saving folding with a file.
5577 The search starts at line number <code>lineStart</code> and continues forwards to the end of the file.
5578 <code>lineStart</code> is returned if it is a contracted fold header otherwise the next contracted
5579 fold header is returned. If there are no more contracted fold headers then -1 is returned.</p>
5581 <p><b id="SCI_ENSUREVISIBLE">SCI_ENSUREVISIBLE(int line)</b><br />
5582 <b id="SCI_ENSUREVISIBLEENFORCEPOLICY">SCI_ENSUREVISIBLEENFORCEPOLICY(int line)</b><br />
5583 A line may be hidden because more than one of its parent lines is contracted. Both these
5584 message travels up the fold hierarchy, expanding any contracted folds until they reach the top
5585 level. The line will then be visible. If you use <code>SCI_ENSUREVISIBLEENFORCEPOLICY</code>,
5586 the vertical caret policy set by <a class="message"
5587 href="#SCI_SETVISIBLEPOLICY"><code>SCI_SETVISIBLEPOLICY</code></a> is then applied.</p>
5589 <h2 id="LineWrapping">Line wrapping</h2>
5591 <code><a class="message" href="#SCI_SETWRAPMODE">SCI_SETWRAPMODE(int wrapMode)</a><br />
5592 <a class="message" href="#SCI_GETWRAPMODE">SCI_GETWRAPMODE</a><br />
5593 <a class="message" href="#SCI_SETWRAPVISUALFLAGS">SCI_SETWRAPVISUALFLAGS(int wrapVisualFlags)</a><br />
5594 <a class="message" href="#SCI_GETWRAPVISUALFLAGS">SCI_GETWRAPVISUALFLAGS</a><br />
5595 <a class="message" href="#SCI_SETWRAPVISUALFLAGSLOCATION">SCI_SETWRAPVISUALFLAGSLOCATION(int wrapVisualFlagsLocation)</a><br />
5596 <a class="message" href="#SCI_GETWRAPVISUALFLAGSLOCATION">SCI_GETWRAPVISUALFLAGSLOCATION</a><br />
5597 <a class="message" href="#SCI_SETWRAPINDENTMODE">SCI_SETWRAPINDENTMODE(int indentMode)</a><br />
5598 <a class="message" href="#SCI_GETWRAPINDENTMODE">SCI_GETWRAPINDENTMODE</a><br />
5599 <a class="message" href="#SCI_SETWRAPSTARTINDENT">SCI_SETWRAPSTARTINDENT(int indent)</a><br />
5600 <a class="message" href="#SCI_GETWRAPSTARTINDENT">SCI_GETWRAPSTARTINDENT</a><br />
5601 <a class="message" href="#SCI_SETLAYOUTCACHE">SCI_SETLAYOUTCACHE(int cacheMode)</a><br />
5602 <a class="message" href="#SCI_GETLAYOUTCACHE">SCI_GETLAYOUTCACHE</a><br />
5603 <a class="message" href="#SCI_SETPOSITIONCACHE">SCI_SETPOSITIONCACHE(int size)</a><br />
5604 <a class="message" href="#SCI_GETPOSITIONCACHE">SCI_GETPOSITIONCACHE</a><br />
5605 <a class="message" href="#SCI_LINESSPLIT">SCI_LINESSPLIT(int pixelWidth)</a><br />
5606 <a class="message" href="#SCI_LINESJOIN">SCI_LINESJOIN</a><br />
5607 <a class="message" href="#SCI_WRAPCOUNT">SCI_WRAPCOUNT(int docLine)</a><br />
5608 </code>
5610 <p>By default, Scintilla does not wrap lines of text. If you enable line wrapping, lines wider
5611 than the window width are continued on the following lines. Lines are broken after space or tab
5612 characters or between runs of different styles. If this is not possible because a word in one
5613 style is wider than the window then the break occurs after the last character that completely
5614 fits on the line. The horizontal scroll bar does not appear when wrap mode is on.</p>
5616 <p>For wrapped lines Scintilla can draw visual flags (little arrows) at end of a a subline of a
5617 wrapped line and at begin of the next subline. These can be enabled individually, but if Scintilla
5618 draws the visual flag at the beginning of the next subline this subline will be indented by one char.
5619 Independent from drawing a visual flag at the begin the subline can have an indention.</p>
5621 <p>Much of the time used by Scintilla is spent on laying out and drawing text. The same text
5622 layout calculations may be performed many times even when the data used in these calculations
5623 does not change. To avoid these unnecessary calculations in some circumstances, the line layout
5624 cache can store the results of the calculations. The cache is invalidated whenever the
5625 underlying data, such as the contents or styling of the document changes. Caching the layout of
5626 the whole document has the most effect, making dynamic line wrap as much as 20 times faster but
5627 this requires 7 times the memory required by the document contents plus around 80 bytes per
5628 line.</p>
5630 <p>Wrapping is not performed immediately there is a change but is delayed until the display
5631 is redrawn. This delay improves performance by allowing a set of changes to be performed
5632 and then wrapped and displayed once. Because of this, some operations may not occur as
5633 expected. If a file is read and the scroll position moved to a particular line in the text,
5634 such as occurs when a container tries to restore a previous editing session, then
5635 the scroll position will have been determined before wrapping so an unexpected range
5636 of text will be displayed. To scroll to the position correctly, delay the scroll until the
5637 wrapping has been performed by waiting for an initial
5638 <a class="message" href="#SCN_PAINTED">SCN_PAINTED</a> notification.</p>
5640 <p><b id="SCI_SETWRAPMODE">SCI_SETWRAPMODE(int wrapMode)</b><br />
5641 <b id="SCI_GETWRAPMODE">SCI_GETWRAPMODE</b><br />
5642 Set wrapMode to <code>SC_WRAP_WORD</code> (1) to enable wrapping
5643 on word or style boundaries, <code>SC_WRAP_CHAR</code> (2) to enable wrapping
5644 between any characters, <code>SC_WRAP_WHITESPACE</code> (3) to enable
5645 wrapping on whitespace, and <code>SC_WRAP_NONE</code> (0) to disable line
5646 wrapping. <code>SC_WRAP_CHAR</code> is preferred for Asian languages where
5647 there is no white space between words.
5648 </p>
5651 <p><b id="SCI_SETWRAPVISUALFLAGS">SCI_SETWRAPVISUALFLAGS(int wrapVisualFlags)</b><br />
5652 <b id="SCI_GETWRAPVISUALFLAGS">SCI_GETWRAPVISUALFLAGS</b><br />
5653 You can enable the drawing of visual flags to indicate a line is wrapped. Bits set in
5654 wrapVisualFlags determine which visual flags are drawn.
5655 </p>
5656 <table cellpadding="1" cellspacing="2" border="0" summary="Wrap visual flags">
5657 <tbody>
5658 <tr>
5659 <th align="left">Symbol</th>
5660 <th>Value</th>
5661 <th align="left">Effect</th>
5662 </tr>
5663 </tbody>
5665 <tbody valign="top">
5666 <tr>
5667 <td align="left"><code>SC_WRAPVISUALFLAG_NONE</code></td>
5668 <td align="center">0</td>
5669 <td>No visual flags</td>
5670 </tr>
5672 <tr>
5673 <td align="left"><code>SC_WRAPVISUALFLAG_END</code></td>
5674 <td align="center">1</td>
5675 <td>Visual flag at end of subline of a wrapped line.</td>
5676 </tr>
5678 <tr>
5679 <td align="left"><code>SC_WRAPVISUALFLAG_START</code></td>
5680 <td align="center">2</td>
5681 <td>Visual flag at begin of subline of a wrapped line.<br />
5682 Subline is indented by at least 1 to make room for the flag.<br />
5683 </td>
5684 </tr>
5686 <tr>
5687 <td align="left"><code>SC_WRAPVISUALFLAG_MARGIN</code></td>
5688 <td align="center">4</td>
5689 <td>Visual flag in line number margin.</td>
5690 </tr>
5691 </tbody>
5692 </table>
5694 <p><b id="SCI_SETWRAPVISUALFLAGSLOCATION">SCI_SETWRAPVISUALFLAGSLOCATION(int wrapVisualFlagsLocation)</b><br />
5695 <b id="SCI_GETWRAPVISUALFLAGSLOCATION">SCI_GETWRAPVISUALFLAGSLOCATION</b><br />
5696 You can set whether the visual flags to indicate a line is wrapped are drawn near the border or near the text.
5697 Bits set in wrapVisualFlagsLocation set the location to near the text for the corresponding visual flag.
5698 </p>
5700 <table cellpadding="1" cellspacing="2" border="0" summary="Wrap visual flags locations">
5701 <tbody>
5702 <tr>
5703 <th align="left">Symbol</th>
5704 <th>Value</th>
5705 <th align="left">Effect</th>
5706 </tr>
5707 </tbody>
5709 <tbody valign="top">
5710 <tr>
5711 <td align="left"><code>SC_WRAPVISUALFLAGLOC_DEFAULT</code></td>
5712 <td align="center">0</td>
5713 <td>Visual flags drawn near border</td>
5714 </tr>
5716 <tr>
5717 <td align="left"><code>SC_WRAPVISUALFLAGLOC_END_BY_TEXT</code></td>
5718 <td align="center">1</td>
5719 <td>Visual flag at end of subline drawn near text</td>
5720 </tr>
5722 <tr>
5723 <td align="left"><code>SC_WRAPVISUALFLAGLOC_START_BY_TEXT</code></td>
5724 <td align="center">2</td>
5725 <td>Visual flag at beginning of subline drawn near text</td>
5726 </tr>
5727 </tbody>
5728 </table>
5730 <p><b id="SCI_SETWRAPINDENTMODE">SCI_SETWRAPINDENTMODE(int indentMode)</b><br />
5731 <b id="SCI_GETWRAPINDENTMODE">SCI_GETWRAPINDENTMODE</b><br />
5732 Wrapped sublines can be indented to the position of their first subline or one more indent level.
5733 The default is <code>SC_WRAPINDENT_FIXED</code>.
5734 The modes are:
5735 </p>
5737 <table cellpadding="1" cellspacing="2" border="0" summary="Wrap visual flags locations">
5738 <tbody>
5739 <tr>
5740 <th align="left">Symbol</th>
5741 <th>Value</th>
5742 <th align="left">Effect</th>
5743 </tr>
5744 </tbody>
5746 <tbody valign="top">
5747 <tr>
5748 <td align="left"><code>SC_WRAPINDENT_FIXED</code></td>
5749 <td align="center">0</td>
5750 <td>Wrapped sublines aligned to left of window plus amount set by
5751 <a class="message" href="#SCI_SETWRAPSTARTINDENT">SCI_SETWRAPSTARTINDENT</a></td>
5752 </tr>
5754 <tr>
5755 <td align="left"><code>SC_WRAPINDENT_SAME</code></td>
5756 <td align="center">1</td>
5757 <td>Wrapped sublines are aligned to first subline indent</td>
5758 </tr>
5760 <tr>
5761 <td align="left"><code>SC_WRAPINDENT_INDENT</code></td>
5762 <td align="center">2</td>
5763 <td>Wrapped sublines are aligned to first subline indent plus one more level of indentation</td>
5764 </tr>
5765 </tbody>
5766 </table>
5768 <p><b id="SCI_SETWRAPSTARTINDENT">SCI_SETWRAPSTARTINDENT(int indent)</b><br />
5769 <b id="SCI_GETWRAPSTARTINDENT">SCI_GETWRAPSTARTINDENT</b><br />
5770 <code>SCI_SETWRAPSTARTINDENT</code> sets the size of indentation of sublines for
5771 wrapped lines in terms of the average character width in
5772 <a class="message" href="#StyleDefinition"><code>STYLE_DEFAULT</code></a>.
5773 There are no limits on indent sizes, but values less than 0 or large values may have
5774 undesirable effects.<br />
5775 The indention of sublines is independent of visual flags, but if
5776 <code>SC_WRAPVISUALFLAG_START</code> is set an indent of at least 1 is used.
5777 </p>
5779 <p><b id="SCI_SETLAYOUTCACHE">SCI_SETLAYOUTCACHE(int cacheMode)</b><br />
5780 <b id="SCI_GETLAYOUTCACHE">SCI_GETLAYOUTCACHE</b><br />
5781 You can set <code>cacheMode</code> to one of the symbols in the table:</p>
5783 <table cellpadding="1" cellspacing="2" border="0" summary="Line caching styles">
5784 <tbody>
5785 <tr>
5786 <th align="left">Symbol</th>
5788 <th>Value</th>
5790 <th align="left">Layout cached for these lines</th>
5791 </tr>
5792 </tbody>
5794 <tbody valign="top">
5795 <tr>
5796 <td align="left"><code>SC_CACHE_NONE</code></td>
5798 <td align="center">0</td>
5800 <td>No lines are cached.</td>
5801 </tr>
5803 <tr>
5804 <td align="left"><code>SC_CACHE_CARET</code></td>
5806 <td align="center">1</td>
5808 <td>The line containing the text caret. This is the default.</td>
5809 </tr>
5811 <tr>
5812 <td align="left"><code>SC_CACHE_PAGE</code></td>
5814 <td align="center">2</td>
5816 <td>Visible lines plus the line containing the caret.</td>
5817 </tr>
5819 <tr>
5820 <td align="left"><code>SC_CACHE_DOCUMENT</code></td>
5822 <td align="center">3</td>
5824 <td>All lines in the document.</td>
5825 </tr>
5826 </tbody>
5827 </table>
5829 <p><b id="SCI_SETPOSITIONCACHE">SCI_SETPOSITIONCACHE(int size)</b><br />
5830 <b id="SCI_GETPOSITIONCACHE">SCI_GETPOSITIONCACHE</b><br />
5831 The position cache stores position information for short runs of text
5832 so that their layout can be determined more quickly if the run recurs.
5833 The size in entries of this cache can be set with <code>SCI_SETPOSITIONCACHE</code>.</p>
5835 <p><b id="SCI_LINESSPLIT">SCI_LINESSPLIT(int pixelWidth)</b><br />
5836 Split a range of lines indicated by the target into lines that are at most pixelWidth wide.
5837 Splitting occurs on word boundaries wherever possible in a similar manner to line wrapping.
5838 When <code>pixelWidth</code> is 0 then the width of the window is used.
5839 </p>
5841 <p><b id="SCI_LINESJOIN">SCI_LINESJOIN</b><br />
5842 Join a range of lines indicated by the target into one line by
5843 removing line end characters.
5844 Where this would lead to no space between words, an extra space is inserted.
5845 </p>
5847 <p><b id="SCI_WRAPCOUNT">SCI_WRAPCOUNT(int docLine)</b><br />
5848 Document lines can occupy more than one display line if they wrap and this
5849 returns the number of display lines needed to wrap a document line.</p>
5851 <h2 id="Zooming">Zooming</h2>
5853 <p>Scintilla incorporates a "zoom factor" that lets you make all the text in the document
5854 larger or smaller in steps of one point. The displayed point size never goes below 2, whatever
5855 zoom factor you set. You can set zoom factors in the range -10 to +20 points.</p>
5856 <code><a class="message" href="#SCI_ZOOMIN">SCI_ZOOMIN</a><br />
5857 <a class="message" href="#SCI_ZOOMOUT">SCI_ZOOMOUT</a><br />
5858 <a class="message" href="#SCI_SETZOOM">SCI_SETZOOM(int zoomInPoints)</a><br />
5859 <a class="message" href="#SCI_GETZOOM">SCI_GETZOOM</a><br />
5860 </code>
5862 <p><b id="SCI_ZOOMIN">SCI_ZOOMIN</b><br />
5863 <b id="SCI_ZOOMOUT">SCI_ZOOMOUT</b><br />
5864 <code>SCI_ZOOMIN</code> increases the zoom factor by one point if the current zoom factor is
5865 less than 20 points. <code>SCI_ZOOMOUT</code> decreases the zoom factor by one point if the
5866 current zoom factor is greater than -10 points.</p>
5868 <p><b id="SCI_SETZOOM">SCI_SETZOOM(int zoomInPoints)</b><br />
5869 <b id="SCI_GETZOOM">SCI_GETZOOM</b><br />
5870 These messages let you set and get the zoom factor directly. There is no limit set on the
5871 factors you can set, so limiting yourself to -10 to +20 to match the incremental zoom functions
5872 is a good idea.</p>
5874 <h2 id="LongLines">Long lines</h2>
5876 <p>You can choose to mark lines that exceed a given length by drawing a vertical line or by
5877 colouring the background of characters that exceed the set length.</p>
5878 <code><a class="message" href="#SCI_SETEDGEMODE">SCI_SETEDGEMODE(int mode)</a><br />
5879 <a class="message" href="#SCI_GETEDGEMODE">SCI_GETEDGEMODE</a><br />
5880 <a class="message" href="#SCI_SETEDGECOLUMN">SCI_SETEDGECOLUMN(int column)</a><br />
5881 <a class="message" href="#SCI_GETEDGECOLUMN">SCI_GETEDGECOLUMN</a><br />
5882 <a class="message" href="#SCI_SETEDGECOLOUR">SCI_SETEDGECOLOUR(int colour)</a><br />
5883 <a class="message" href="#SCI_GETEDGECOLOUR">SCI_GETEDGECOLOUR</a><br />
5884 </code>
5886 <p><b id="SCI_SETEDGEMODE">SCI_SETEDGEMODE(int edgeMode)</b><br />
5887 <b id="SCI_GETEDGEMODE">SCI_GETEDGEMODE</b><br />
5888 These two messages set and get the mode used to display long lines. You can set one of the
5889 values in the table:</p>
5891 <table cellpadding="1" cellspacing="2" border="0" summary="Long line styles">
5892 <tbody>
5893 <tr>
5894 <th align="left">Symbol</th>
5896 <th>Value</th>
5898 <th align="left">Long line display mode</th>
5899 </tr>
5900 </tbody>
5902 <tbody valign="top">
5903 <tr>
5904 <td align="left"><code>EDGE_NONE</code></td>
5906 <td align="center">0</td>
5908 <td>Long lines are not marked. This is the default state.</td>
5909 </tr>
5911 <tr>
5912 <td align="left"><code>EDGE_LINE</code></td>
5914 <td align="center">1</td>
5916 <td>A vertical line is drawn at the column number set by <code>SCI_SETEDGECOLUMN</code>.
5917 This works well for monospaced fonts. The line is drawn at a position based on the width
5918 of a space character in <a class="message"
5919 href="#StyleDefinition"><code>STYLE_DEFAULT</code></a>, so it may not work very well if
5920 your styles use proportional fonts or if your style have varied font sizes or you use a
5921 mixture of bold, italic and normal text.</td>
5922 </tr>
5924 <tr>
5925 <td align="left"><code>EDGE_BACKGROUND</code></td>
5927 <td align="center">2</td>
5929 <td>The background colour of characters after the column limit is changed to the colour
5930 set by <code>SCI_SETEDGECOLOUR</code>. This is recommended for proportional fonts.</td>
5931 </tr>
5932 </tbody>
5933 </table>
5935 <p><b id="SCI_SETEDGECOLUMN">SCI_SETEDGECOLUMN(int column)</b><br />
5936 <b id="SCI_GETEDGECOLUMN">SCI_GETEDGECOLUMN</b><br />
5937 These messages set and get the column number at which to display the long line marker. When
5938 drawing lines, the column sets a position in units of the width of a space character in
5939 <code>STYLE_DEFAULT</code>. When setting the background colour, the column is a character count
5940 (allowing for tabs) into the line.</p>
5942 <p><b id="SCI_SETEDGECOLOUR">SCI_SETEDGECOLOUR(int <a class="jump"
5943 href="#colour">colour</a>)</b><br />
5944 <b id="SCI_GETEDGECOLOUR">SCI_GETEDGECOLOUR</b><br />
5945 These messages set and get the colour of the marker used to show that a line has exceeded the
5946 length set by <code>SCI_SETEDGECOLUMN</code>.</p>
5948 <h2 id="Lexer">Lexer</h2>
5950 <p>If you define the symbol <code>SCI_LEXER</code> when building Scintilla, (this is sometimes
5951 called the SciLexer version of Scintilla), lexing support for a wide range of programming
5952 languages is included and the messages in this section are supported. If you want to set
5953 styling and fold points for an unsupported language you can either do this in the container or
5954 better still, write your own lexer following the pattern of one of the existing ones.</p>
5956 <p>Scintilla also supports external lexers. These are DLLs (on Windows) or .so modules (on GTK+/Linux) that export three
5957 functions: <code>GetLexerCount</code>, <code>GetLexerName</code>, and
5958 <code>GetLexerFactory</code>. See <code>externalLexer.cxx</code> for more.</p>
5959 <a class="message" href="#SCI_SETLEXER">SCI_SETLEXER(int lexer)</a><br />
5960 <a class="message" href="#SCI_GETLEXER">SCI_GETLEXER</a><br />
5961 <a class="message" href="#SCI_SETLEXERLANGUAGE">SCI_SETLEXERLANGUAGE(&lt;unused&gt;, const char
5962 *name)</a><br />
5963 <a class="message" href="#SCI_GETLEXERLANGUAGE">SCI_GETLEXERLANGUAGE(&lt;unused&gt;, char
5964 *name)</a><br />
5965 <a class="message" href="#SCI_LOADLEXERLIBRARY">SCI_LOADLEXERLIBRARY(&lt;unused&gt;, const char
5966 *path)</a><br />
5967 <a class="message" href="#SCI_COLOURISE">SCI_COLOURISE(int start, int end)</a><br />
5968 <a class="message" href="#SCI_CHANGELEXERSTATE">SCI_CHANGELEXERSTATE(int start, int end)</a><br />
5969 <a class="message" href="#SCI_PROPERTYNAMES">SCI_PROPERTYNAMES(&lt;unused&gt;, char *names)</a><br />
5970 <a class="message" href="#SCI_PROPERTYTYPE">SCI_PROPERTYTYPE(const char *name)</a><br />
5971 <a class="message" href="#SCI_DESCRIBEPROPERTY">SCI_DESCRIBEPROPERTY(const char *name, char *description)</a><br />
5972 <a class="message" href="#SCI_SETPROPERTY">SCI_SETPROPERTY(const char *key, const char *value)</a><br />
5973 <a class="message" href="#SCI_GETPROPERTY">SCI_GETPROPERTY(const char *key, char *value)</a><br />
5974 <a class="message" href="#SCI_GETPROPERTYEXPANDED">SCI_GETPROPERTYEXPANDED(const char *key, char *value)</a><br />
5975 <a class="message" href="#SCI_GETPROPERTYINT">SCI_GETPROPERTYINT(const char *key, int default)</a><br />
5976 <a class="message" href="#SCI_DESCRIBEKEYWORDSETS">SCI_DESCRIBEKEYWORDSETS(&lt;unused&gt;, char *descriptions)</a><br />
5977 <a class="message" href="#SCI_SETKEYWORDS">SCI_SETKEYWORDS(int keyWordSet, const char
5978 *keyWordList)</a><br />
5980 <a class="message" href="#SCI_GETSUBSTYLEBASES">SCI_GETSUBSTYLEBASES(&lt;unused&gt;, char *styles)</a><br />
5981 <a class="message" href="#SCI_DISTANCETOSECONDARYSTYLES">SCI_DISTANCETOSECONDARYSTYLES</a><br />
5982 <a class="message" href="#SCI_ALLOCATESUBSTYLES">SCI_ALLOCATESUBSTYLES(int styleBase, int numberStyles)</a><br />
5983 <a class="message" href="#SCI_FREESUBSTYLES">SCI_FREESUBSTYLES</a><br />
5984 <a class="message" href="#SCI_GETSUBSTYLESSTART">SCI_GETSUBSTYLESSTART(int styleBase)</a><br />
5985 <a class="message" href="#SCI_GETSUBSTYLESLENGTH">SCI_GETSUBSTYLESLENGTH(int styleBase)</a><br />
5986 <a class="message" href="#SCI_GETSTYLEFROMSUBSTYLE">SCI_GETSTYLEFROMSUBSTYLE(int subStyle)</a><br />
5987 <a class="message" href="#SCI_GETPRIMARYSTYLEFROMSTYLE">SCI_GETPRIMARYSTYLEFROMSTYLE(int style)</a><br />
5988 <a class="message" href="#SCI_SETIDENTIFIERS">SCI_SETIDENTIFIERS(int style, const char *identifiers)</a><br />
5990 <p><b id="SCI_SETLEXER">SCI_SETLEXER(int lexer)</b><br />
5991 <b id="SCI_GETLEXER">SCI_GETLEXER</b><br />
5992 You can select the lexer to use with an integer code from the <code>SCLEX_*</code> enumeration
5993 in <code>Scintilla.h</code>. There are two codes in this sequence that do not use lexers:
5994 <code>SCLEX_NULL</code> to select no lexing action and <code>SCLEX_CONTAINER</code> which sends
5995 the <code><a class="message" href="#SCN_STYLENEEDED">SCN_STYLENEEDED</a></code> notification to
5996 the container whenever a range of text needs to be styled. You cannot use the
5997 <code>SCLEX_AUTOMATIC</code> value; this identifies additional external lexers that Scintilla
5998 assigns unused lexer numbers to.</p>
6000 <p><b id="SCI_SETLEXERLANGUAGE">SCI_SETLEXERLANGUAGE(&lt;unused&gt;, const char *name)</b><br />
6001 <b id="SCI_GETLEXERLANGUAGE">SCI_GETLEXERLANGUAGE(&lt;unused&gt;, char *name)</b><br />
6002 <code>SCI_SETLEXERLANGUAGE</code> lets you select a lexer by name, and is the only method if you are using an
6003 external lexer or if you have written a lexer module for a language of your own and do not wish
6004 to assign it an explicit lexer number. To select an existing lexer, set <code>name</code> to
6005 match the (case sensitive) name given to the module, for example "ada" or "python", not "Ada"
6006 or "Python". To locate the name for the built-in lexers, open the relevant
6007 <code>Lex*.cxx</code> file and search for <code>LexerModule</code>. The third argument in the
6008 <code>LexerModule</code> constructor is the name to use.</p>
6010 <p>To test if your lexer assignment worked, use <a class="message"
6011 href="#SCI_GETLEXER"><code>SCI_GETLEXER</code></a> before and after setting the new lexer to
6012 see if the lexer number changed.</p>
6014 <p><code>SCI_GETLEXERLANGUAGE</code> retrieves the name of the lexer.</p>
6016 <p><b id="SCI_LOADLEXERLIBRARY">SCI_LOADLEXERLIBRARY(&lt;unused&gt;, const char *path)</b><br />
6017 Load a lexer implemented in a shared library. This is a .so file on GTK+/Linux or a .DLL file on Windows.
6018 </p>
6020 <p><b id="SCI_COLOURISE">SCI_COLOURISE(int startPos, int endPos)</b><br />
6021 This requests the current lexer or the container (if the lexer is set to
6022 <code>SCLEX_CONTAINER</code>) to style the document between <code>startPos</code> and
6023 <code>endPos</code>. If <code>endPos</code> is -1, the document is styled from
6024 <code>startPos</code> to the end. If the <code>"fold"</code> property is set to
6025 <code>"1"</code> and your lexer or container supports folding, fold levels are also set. This
6026 message causes a redraw.</p>
6028 <p><b id="SCI_CHANGELEXERSTATE">SCI_CHANGELEXERSTATE(int startPos, int endPos)</b><br />
6029 Indicate that the internal state of a lexer has changed over a range and therefore
6030 there may be a need to redraw.</p>
6032 <p><b id="SCI_PROPERTYNAMES">SCI_PROPERTYNAMES(&lt;unused&gt;, char *names)</b><br />
6033 <b id="SCI_PROPERTYTYPE">SCI_PROPERTYTYPE(const char *name)</b><br />
6034 <b id="SCI_DESCRIBEPROPERTY">SCI_DESCRIBEPROPERTY(const char *name, char *description)</b><br />
6035 Information may be retrieved about the properties that can be set for the current lexer.
6036 This information is only available for newer lexers.
6037 <code>SCI_PROPERTYNAMES</code> returns a string with all of the valid properties separated by "\n".
6038 If the lexer does not support this call then an empty string is returned.
6039 Properties may be boolean (<code>SC_TYPE_BOOLEAN</code>), integer (<code>SC_TYPE_INTEGER</code>),
6040 or string (<code>SC_TYPE_STRING</code>) and this is found with <code>SCI_PROPERTYTYPE</code>.
6041 A description of a property in English is returned by <code>SCI_DESCRIBEPROPERTY</code>.</p>
6043 <p><b id="SCI_SETPROPERTY">SCI_SETPROPERTY(const char *key, const char *value)</b><br />
6044 You can communicate settings to lexers with keyword:value string pairs. There is no limit to
6045 the number of keyword pairs you can set, other than available memory. <code>key</code> is a
6046 case sensitive keyword, <code>value</code> is a string that is associated with the keyword. If
6047 there is already a value string associated with the keyword, it is replaced. If you pass a zero
6048 length string, the message does nothing. Both <code>key</code> and <code>value</code> are used
6049 without modification; extra spaces at the beginning or end of <code>key</code> are
6050 significant.</p>
6052 <p>The <code>value</code> string can refer to other keywords. For example,
6053 <code>SCI_SETPROPERTY("foldTimes10", "$(fold)0")</code> stores the string
6054 <code>"$(fold)0"</code>, but when this is accessed, the <code>$(fold)</code> is replaced by the
6055 value of the <code>"fold"</code> keyword (or by nothing if this keyword does not exist).</p>
6057 <p>Currently the "fold" property is defined for most of the lexers to set the fold structure if
6058 set to "1". <code>SCLEX_PYTHON</code> understands <code>"tab.timmy.whinge.level"</code> as a
6059 setting that determines how to indicate bad indentation. Most keywords have values that are
6060 interpreted as integers. Search the lexer sources for <code>GetPropertyInt</code> to see how
6061 properties are used.</p>
6063 <p>There is a convention for naming properties used by lexers so that the set of properties can be found by scripts.
6064 Property names should start with "lexer.&lt;lexer&gt;." or "fold.&lt;lexer&gt;." when they apply to one
6065 lexer or start with "lexer." or "fold." if they apply to multiple lexers.</p>
6067 <p>Applications may discover the set of properties used by searching the source code of lexers for lines that contain
6068 <code>GetProperty</code> and a double quoted string and extract the value of the double quoted string as the property name.
6069 The <code>scintilla/scripts/LexGen.py</code> script does this and can be used as an example.
6070 Documentation for the property may be located above the call as a multi-line comment starting with
6071 <br/><code>// property &lt;property-name&gt;</code></p>
6073 <p><b id="SCI_GETPROPERTY">SCI_GETPROPERTY(const char *key, char *value)</b><br />
6074 Lookup a keyword:value pair using the specified key; if found, copy the value to the user-supplied
6075 buffer and return the length (not including the terminating 0). If not found, copy an empty string
6076 to the buffer and return 0.</p>
6078 <p>Note that "keyword replacement" as described in <a class="message" href="#SCI_SETPROPERTY">
6079 <code>SCI_SETPROPERTY</code></a> will not be performed.</p>
6081 <p>If the value argument is 0 then the length that should be allocated to store the value is returned;
6082 again, the terminating 0 is not included.</p>
6084 <p><b id="SCI_GETPROPERTYEXPANDED">SCI_GETPROPERTYEXPANDED(const char *key, char *value)</b><br />
6085 Lookup a keyword:value pair using the specified key; if found, copy the value to the user-supplied
6086 buffer and return the length (not including the terminating 0). If not found, copy an empty string
6087 to the buffer and return 0.</p>
6089 <p>Note that "keyword replacement" as described in <a class="message" href="#SCI_SETPROPERTY">
6090 <code>SCI_SETPROPERTY</code></a> will be performed.</p>
6092 <p>If the value argument is 0 then the length that should be allocated to store the value (including any indicated keyword replacement)
6093 is returned; again, the terminating 0 is not included.</p>
6095 <p><b id="SCI_GETPROPERTYINT">SCI_GETPROPERTYINT(const char *key, int default)</b><br />
6096 Lookup a keyword:value pair using the specified key; if found, interpret the value as an integer and return it.
6097 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
6098 a number, then return 0.</p>
6100 <p>Note that "keyword replacement" as described in <a class="message" href="#SCI_SETPROPERTY">
6101 <code>SCI_SETPROPERTY</code></a> will be performed before any numeric interpretation.</p>
6103 <p><b id="SCI_SETKEYWORDS">SCI_SETKEYWORDS(int keyWordSet, const char *keyWordList)</b><br />
6104 You can set up to 9 lists of keywords for use by the current lexer.
6105 <code>keyWordSet</code> can be 0 to 8 (actually 0 to <code>KEYWORDSET_MAX</code>)
6106 and selects which keyword list to replace. <code>keyWordList</code> is a list of keywords
6107 separated by spaces, tabs, <code>"\n"</code> or <code>"\r"</code> or any combination of these.
6108 It is expected that the keywords will be composed of standard ASCII printing characters,
6109 but there is nothing to stop you using any non-separator character codes from 1 to 255
6110 (except common sense).</p>
6112 <p>How these keywords are used is entirely up to the lexer. Some languages, such as HTML may
6113 contain embedded languages, VBScript and JavaScript are common for HTML. For HTML, key word set
6114 0 is for HTML, 1 is for JavaScript and 2 is for VBScript, 3 is for Python, 4 is for PHP and 5
6115 is for SGML and DTD keywords. Review the lexer code to see examples of keyword list. A fully
6116 conforming lexer sets the fourth argument of the <code>LexerModule</code> constructor to be a
6117 list of strings that describe the uses of the keyword lists.</p>
6119 <p>Alternatively, you might use set 0 for general keywords, set 1 for keywords that cause
6120 indentation and set 2 for keywords that cause unindentation. Yet again, you might have a simple
6121 lexer that colours keywords and you could change languages by changing the keywords in set 0.
6122 There is nothing to stop you building your own keyword lists into the lexer, but this means
6123 that the lexer must be rebuilt if more keywords are added.</p>
6125 <p><b id="SCI_DESCRIBEKEYWORDSETS">SCI_DESCRIBEKEYWORDSETS(&lt;unused&gt;, char *descriptions)</b><br />
6126 A description of all of the keyword sets separated by "\n" is returned by <code>SCI_DESCRIBEKEYWORDSETS</code>.</p>
6128 <h3 id="Substyles">Substyles</h3>
6129 <p>Lexers may support several different sublanguages and each sublanguage may want to style some number of
6130 sets of identifiers (or similar lexemes such as documentation keywords) uniquely. Preallocating a large number for each
6131 purpose would exhaust the number of allowed styles quickly.
6132 This is alleviated by substyles which allow the application to determine how many sets of identifiers to allocate for
6133 each purpose.
6134 Lexers have to explicitly support this feature by implementing the methods in <code>ILexerWithSubStyles</code>.</p>
6136 <p><b id="SCI_GETSUBSTYLEBASES">SCI_GETSUBSTYLEBASES(&lt;unused&gt;, char *styles)</b><br />
6137 Fill <code>styles</code> with a byte for each style that can be split into substyles.</p>
6139 <p><b id="SCI_DISTANCETOSECONDARYSTYLES">SCI_DISTANCETOSECONDARYSTYLES</b><br />
6140 Returns the distance between a primary style and its corresponding secondary style.</p>
6142 <p><b id="SCI_ALLOCATESUBSTYLES">SCI_ALLOCATESUBSTYLES(int styleBase, int numberStyles)</b><br />
6143 Allocate some number of substyles for a particular base style returning the first substyle number allocated.
6144 Substyles are allocated contiguously.</p>
6146 <p><b id="SCI_FREESUBSTYLES">SCI_FREESUBSTYLES</b><br />
6147 Free all allocated substyles.</p>
6149 <p><b id="SCI_GETSUBSTYLESSTART">SCI_GETSUBSTYLESSTART(int styleBase)</b><br />
6150 <b id="SCI_GETSUBSTYLESLENGTH">SCI_GETSUBSTYLESLENGTH(int styleBase)</b><br />
6151 Return the start and length of the substyles allocated for a base style.</p>
6153 <p><b id="SCI_GETSTYLEFROMSUBSTYLE">SCI_GETSTYLEFROMSUBSTYLE(int subStyle)</b><br />
6154 For a sub style, return the base style, else return the argument.</p>
6156 <p><b id="SCI_GETPRIMARYSTYLEFROMSTYLE">SCI_GETPRIMARYSTYLEFROMSTYLE(int style)</b><br />
6157 For a secondary style, return the primary style, else return the argument.</p>
6159 <p><b id="SCI_SETIDENTIFIERS">SCI_SETIDENTIFIERS(int style, const char *identifiers)</b><br />
6160 Similar to <code>SCI_SETKEYWORDS</code> but for substyles.
6161 The prefix feature available with <code>SCI_SETKEYWORDS</code> is not implemented for <code>SCI_SETIDENTIFIERS</code>.</p>
6163 <h2 id="LexerObjects">Lexer Objects</h2>
6165 <p>Lexers are programmed as objects that implement the ILexer interface and that interact
6166 with the document they are lexing through the IDocument interface.
6167 Previously lexers were defined by providing lexing and folding functions but creating an object
6168 to handle the interaction of a lexer with a document allows the lexer to store state information that
6169 can be used during lexing. For example a C++ lexer may store a set of preprocessor definitions
6170 or variable declarations and style these depending on their role.</p>
6172 <p>A set of helper classes allows older lexers defined by functions to be used in Scintilla.</p>
6173 <h4>ILexer</h4>
6175 <div class="highlighted">
6176 <span class="S5">class</span><span class="S0"> </span>ILexer<span class="S0"> </span><span class="S10">{</span><br />
6177 <span class="S5">public</span><span class="S10">:</span><br />
6178 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6179 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
6180 <span class="S0"> </span>Version<span class="S10">()</span><span class="S0"> </span>
6181 <span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
6182 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6183 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6184 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
6185 <span class="S0"> </span>Release<span class="S10">()</span><span class="S0"> </span>
6186 <span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6187 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span>
6188 <span class="S5">const</span><span class="S0"> </span>
6189 <span class="S5">char</span><span class="S0"> </span>
6190 <span class="S10">*</span><span class="S0"> </span>
6191 SCI_METHOD<span class="S0"> </span>PropertyNames<span class="S10">()</span>
6192 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6193 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6194 <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 />
6195 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6196 <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 />
6197 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6198 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
6199 <span class="S0"> </span>PropertySet<span class="S10">(</span><span class="S5">const</span>
6200 <span class="S0"> </span><span class="S5">char</span>
6201 <span class="S0"> </span><span class="S10">*</span>key<span class="S10">,</span>
6202 <span class="S0"> </span><span class="S5">const</span><span class="S0"> </span>
6203 <span class="S5">char</span><span class="S0"> </span><span class="S10">*</span>val<span class="S10">)</span>
6204 <span class="S0"> </span><span class="S10">=</span>
6205 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6206 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span>
6207 <span class="S5">const</span><span class="S0"> </span><span class="S5">char</span><span class="S0"> </span>
6208 <span class="S10">*</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>DescribeWordListSets<span class="S10">()</span>
6209 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
6210 <span class="S4">0</span><span class="S10">;</span><br />
6211 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6212 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
6213 <span class="S0"> </span>WordListSet<span class="S10">(</span><span class="S5">int</span>
6214 <span class="S0"> </span>n<span class="S10">,</span>
6215 <span class="S0"> </span><span class="S5">const</span><span class="S0"> </span>
6216 <span class="S5">char</span><span class="S0"> </span><span class="S10">*</span>wl<span class="S10">)</span>
6217 <span class="S0"> </span><span class="S10">=</span>
6218 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6219 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6220 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
6221 <span class="S0"> </span>Lex<span class="S10">(</span><span class="S5">unsigned</span>
6222 <span class="S0"> </span><span class="S5">int</span>
6223 <span class="S0"> </span>startPos<span class="S10">,</span>
6224 <span class="S0"> </span><span class="S5">int</span>
6225 <span class="S0"> </span>lengthDoc<span class="S10">,</span><span class="S0">
6226 </span><span class="S5">int</span><span class="S0"> </span>initStyle<span class="S10">,</span>
6227 <span class="S0"> </span>IDocument<span class="S0">
6228 </span><span class="S10">*</span>pAccess<span class="S10">)</span>
6229 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
6230 <span class="S4">0</span><span class="S10">;</span><br />
6231 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6232 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
6233 <span class="S0"> </span>Fold<span class="S10">(</span><span class="S5">unsigned</span>
6234 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>startPos<span class="S10">,</span>
6235 <span class="S0"> </span><span class="S5">int</span>
6236 <span class="S0"> </span>lengthDoc<span class="S10">,</span><span class="S0">
6237 </span><span class="S5">int</span><span class="S0"> </span>initStyle<span class="S10">,</span>
6238 <span class="S0"> </span>IDocument<span class="S0">
6239 </span><span class="S10">*</span>pAccess<span class="S10">)</span>
6240 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
6241 <span class="S4">0</span><span class="S10">;</span><br />
6242 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6243 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>
6244 <span class="S10">*</span><span class="S0"> </span>SCI_METHOD<span class="S0">
6245 </span>PrivateCall<span class="S10">(</span><span class="S5">int</span>
6246 <span class="S0"> </span>operation<span class="S10">,</span><span class="S0">
6247 </span><span class="S5">void</span><span class="S0"> </span>
6248 <span class="S10">*</span>pointer<span class="S10">)</span><span class="S0"> </span>
6249 <span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6250 <span class="S10">};</span><br />
6251 </div>
6254 The return values from PropertySet and WordListSet are used to indicate whether the change requires
6255 performing lexing or folding over any of the document. It is the position at which to restart lexing and folding or -1
6256 if the change does not require any extra work on the document.
6257 A simple approach is to return 0 if there is any possibility that a change requires lexing the document again while an
6258 optimisation could be to remember where a setting first affects the document and return that position.
6259 </p>
6261 <p><code>Version</code> returns an enumerated value specifying which version of the interface is implemented:
6262 <code>lvOriginal</code> for <code>ILexer</code> and <code>lvSubStyles</code> for <code>ILexerWithSubStyles</code>.</p>
6264 <p><code>Release</code> is called to destroy the lexer object.</p>
6266 <p><code>PrivateCall</code> allows for direct communication between the
6267 application and a lexer. An example would be where an application
6268 maintains a single large data structure containing symbolic information
6269 about system headers (like Windows.h) and provides this to the lexer
6270 where it can be applied to each document. This avoids the costs of
6271 constructing the system header information for each document. This is
6272 invoked with the <code>SCI_PRIVATELEXERCALL</code> API.</p>
6274 <p><code>Fold</code> is called with the exact range that needs folding.
6275 Previously, lexers were called with a range that started one line before the range that
6276 needs to be folded as this allowed fixing up the last line from the previous folding.
6277 The new approach allows the lexer to decide whether to backtrack or to handle this
6278 more efficiently.</p>
6280 <h4>ILexerWithSubStyles</h4>
6283 To allow lexers to report which line ends they support, and to support substyles,
6284 <code>Ilexer</code> is extended to <code>ILexerWithSubStyles</code>.
6285 </p>
6287 <div class="highlighted">
6288 <span class="S5">class</span><span class="S0"> </span>ILexerWithSubStyles<span class="S0"> </span><span class="S10">:</span><span class="S0"> </span><span class="S5">public</span><span class="S0"> </span>ILexer<span class="S0"> </span><span class="S10">{</span><br />
6289 <span class="S5">public</span><span class="S10">:</span><br />
6290 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>LineEndTypesSupported<span class="S10">()</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6291 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>AllocateSubStyles<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>styleBase<span class="S10">,</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>numberStyles<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6292 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>SubStylesStart<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>styleBase<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6293 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>SubStylesLength<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>styleBase<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6294 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>StyleFromSubStyle<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>subStyle<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6295 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>PrimaryStyleFromStyle<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>style<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6296 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>FreeSubStyles<span class="S10">()</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6297 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>SetIdentifiers<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>style<span class="S10">,</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S5">char</span><span class="S0"> </span><span class="S10">*</span>identifiers<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6298 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>DistanceToSecondaryStyles<span class="S10">()</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6299 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S5">char</span><span class="S0"> </span><span class="S10">*</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>GetSubStyleBases<span class="S10">()</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6300 <span class="S10">};</span><br />
6301 </div>
6303 <h4>IDocument</h4>
6305 <div class="highlighted">
6306 <span class="S5">class</span><span class="S0"> </span>IDocument
6307 <span class="S0"> </span><span class="S10">{</span><br />
6308 <span class="S5">public</span><span class="S10">:</span><br />
6309 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6310 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
6311 <span class="S0"> </span>Version<span class="S10">()</span><span class="S0"> </span>
6312 <span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
6313 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6314 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6315 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
6316 <span class="S0"> </span>SetErrorStatus<span class="S10">(</span><span class="S5">int</span>
6317 <span class="S0"> </span>status<span class="S10">)</span>
6318 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
6319 <span class="S4">0</span><span class="S10">;</span><br />
6320 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6321 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
6322 <span class="S0"> </span>Length<span class="S10">()</span><span class="S0"> </span>
6323 <span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
6324 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6325 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6326 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
6327 <span class="S0"> </span>GetCharRange<span class="S10">(</span><span class="S5">char</span>
6328 <span class="S0"> </span><span class="S10">*</span>buffer<span class="S10">,</span>
6329 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>
6330 position<span class="S10">,</span><span class="S0"> </span>
6331 <span class="S5">int</span><span class="S0"> </span>lengthRetrieve<span class="S10">)</span>
6332 <span class="S0"> </span><span class="S5">const</span>
6333 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
6334 <span class="S4">0</span><span class="S10">;</span><br />
6335 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6336 <span class="S0"> </span><span class="S5">char</span><span class="S0"> </span>SCI_METHOD
6337 <span class="S0"> </span>StyleAt<span class="S10">(</span><span class="S5">int</span>
6338 <span class="S0"> </span>position<span class="S10">)</span><span class="S0"> </span>
6339 <span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
6340 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6341 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6342 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
6343 <span class="S0"> </span>LineFromPosition<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>position<span class="S10">)</span>
6344 <span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
6345 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6346 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span>
6347 <span class="S5">int</span><span class="S0"> </span>SCI_METHOD
6348 <span class="S0"> </span>LineStart<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>line<span class="S10">)</span>
6349 <span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
6350 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6351 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span>
6352 <span class="S5">int</span><span class="S0"> </span>SCI_METHOD
6353 <span class="S0"> </span>GetLevel<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>line<span class="S10">)</span>
6354 <span class="S0"> </span>
6355 <span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
6356 <span class="S4">0</span><span class="S10">;</span><br />
6357 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span>
6358 <span class="S5">int</span><span class="S0"> </span>SCI_METHOD
6359 <span class="S0"> </span>SetLevel<span class="S10">(</span><span class="S5">int</span>
6360 <span class="S0"> </span>line<span class="S10">,</span><span class="S0"> </span>
6361 <span class="S5">int</span><span class="S0"> </span>level<span class="S10">)</span>
6362 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
6363 <span class="S4">0</span><span class="S10">;</span><br />
6364 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6365 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
6366 <span class="S0"> </span>GetLineState<span class="S10">(</span><span class="S5">int</span>
6367 <span class="S0"> </span>line<span class="S10">)</span>
6368 <span class="S0"> </span><span class="S5">const</span><span class="S0"> </span>
6369 <span class="S10">=</span><span class="S0"> </span><span class="S4">0</span>
6370 <span class="S10">;</span><br />
6371 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6372 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
6373 <span class="S0"> </span>SetLineState<span class="S10">(</span><span class="S5">int</span>
6374 <span class="S0"> </span>line<span class="S10">,</span>
6375 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>state<span class="S10">)</span>
6376 <span class="S0"> </span><span class="S10">=</span>
6377 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6378 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6379 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
6380 <span class="S0"> </span>StartStyling<span class="S10">(</span><span class="S5">int</span>
6381 <span class="S0"> </span>position<span class="S10">,</span>
6382 <span class="S0"> </span><span class="S5">char</span><span class="S0"> </span>mask<span class="S10">)</span>
6383 <span class="S0"> </span><span class="S10">=</span>
6384 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6385 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">bool</span>
6386 <span class="S0"> </span>SCI_METHOD
6387 <span class="S0"> </span>SetStyleFor<span class="S10">(</span><span class="S5">int</span>
6388 <span class="S0"> </span>length<span class="S10">,</span>
6389 <span class="S0"> </span><span class="S5">char</span><span class="S0"> </span>style<span class="S10">)</span>
6390 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span>
6391 <span class="S10">;</span><br />
6392 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6393 <span class="S0"> </span><span class="S5">bool</span><span class="S0"> </span>SCI_METHOD
6394 <span class="S0"> </span>SetStyles<span class="S10">(</span><span class="S5">int</span>
6395 <span class="S0"> </span>length<span class="S10">,</span><span class="S0"> </span>
6396 <span class="S5">const</span><span class="S0"> </span><span class="S5">char</span>
6397 <span class="S0"> </span><span class="S10">*</span>styles<span class="S10">)</span>
6398 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
6399 <span class="S4">0</span><span class="S10">;</span><br />
6400 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">void</span>
6401 <span class="S0"> </span>SCI_METHOD
6402 <span class="S0"> </span>DecorationSetCurrentIndicator<span class="S10">(</span><span class="S5">int</span>
6403 <span class="S0"> </span>indicator<span class="S10">)</span>
6404 <span class="S0"> </span><span class="S10">=</span>
6405 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6406 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6407 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
6408 <span class="S0"> </span>DecorationFillRange<span class="S10">(</span><span class="S5">int</span>
6409 <span class="S0"> </span>position<span class="S10">,</span>
6410 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>value<span class="S10">,</span>
6411 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>fillLength<span class="S10">)</span>
6412 <span class="S0">
6413 </span><span class="S10">=</span><span class="S0"> </span>
6414 <span class="S4">0</span><span class="S10">;</span><br />
6415 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6416 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
6417 <span class="S0"> </span>ChangeLexerState<span class="S10">(</span><span class="S5">int</span>
6418 <span class="S0"> </span>start<span class="S10">,</span>
6419 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>end<span class="S10">)</span>
6420 <span class="S0"> </span><span class="S10">=</span>
6421 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6422 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
6423 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
6424 <span class="S0"> </span>CodePage<span class="S10">()</span><span class="S0">
6425 </span><span class="S5">const</span><span class="S0"> </span>
6426 <span class="S10">=</span><span class="S0"> </span><span class="S4">0</span>
6427 <span class="S10">;</span><br />
6428 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">bool</span>
6429 <span class="S0"> </span>SCI_METHOD
6430 <span class="S0"> </span>IsDBCSLeadByte<span class="S10">(</span><span class="S5">char</span>
6431 <span class="S0"> </span>ch<span class="S10">)</span>
6432 <span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
6433 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6434 <span class="S10">};</span><br />
6435 </div>
6437 <p>Scintilla tries to minimize the consequences of modifying text to
6438 only relex and redraw the line of the change where possible. Lexer
6439 objects contain their own private extra state which can affect later
6440 lines. For example, if the C++ lexer is greying out inactive code
6441 segments then changing the statement <code>#define BEOS 0</code> to <code>#define
6442 BEOS 1</code> may require restyling and redisplaying later parts of the
6443 document. The lexer can call <code>ChangeLexerState</code> to signal to
6444 the document that it should relex and display more.</p>
6446 <p>For <code>StartStyling</code> the mask argument has no effect. It was used in version 3.4.2 and earlier.</p>
6448 <p><code>SetErrorStatus</code> is used to notify the document of
6449 exceptions. Exceptions should not be thrown over build boundaries as the
6450 two sides may be built with different compilers or incompatible
6451 exception options.</p>
6453 <h4>IDocumentWithLineEnd</h4>
6456 To allow lexers to determine the end position of a line and thus more easily support Unicode line ends
6457 <code>IDocument</code> is extended to <code>IDocumentWithLineEnd</code>.</p>
6458 <p><code>GetRelativePosition</code> navigates the document by whole characters,
6459 returning <code>INVALID_POSITION</code> for movement beyond the start and end of the document.</p>
6460 <p><code>GetCharacterAndWidth</code> provides a standard
6461 conversion from UTF-8 bytes to a UTF-32 character or from DBCS to a 16 bit value.
6462 Bytes in invalid UTF-8 are reported individually with values 0xDC80+byteValue, which are
6463 not valid Unicode code points.
6464 The <code>pWidth</code> argument can be NULL if the caller does not need to know the number of
6465 bytes in the character.
6466 </p>
6468 <div class="highlighted">
6469 <span class="S5">class</span><span class="S0"> </span>IDocumentWithLineEnd<span class="S0"> </span><span class="S10">:</span><span class="S0"> </span><span class="S5">public</span><span class="S0"> </span>IDocument<span class="S0"> </span><span class="S10">{</span><br />
6470 <span class="S5">public</span><span class="S10">:</span><br />
6471 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>LineEnd<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>line<span class="S10">)</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6472 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>GetRelativePosition<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>positionStart<span class="S10">,</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>characterOffset<span class="S10">)</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6473 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>GetCharacterAndWidth<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>position<span class="S10">,</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span><span class="S10">*</span>pWidth<span class="S10">)</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6474 <span class="S10">};</span><br />
6475 </div>
6477 <p>The <code>ILexer</code>, <code>ILexerWithSubStyles</code>, <code>IDocument</code>, and
6478 <code>IDocumentWithLineEnd</code> interfaces may be
6479 expanded in the future with extended versions (<code>ILexer2</code>...).
6480 The <code>Version</code> method indicates which interface is
6481 implemented and thus which methods may be called.</p>
6483 <h2 id="Notifications">Notifications</h2>
6485 <p>Notifications are sent (fired) from the Scintilla control to its container when an event has
6486 occurred that may interest the container.</p>
6487 <p>Notifications are sent using the
6488 <code>WM_NOTIFY</code> message on Windows.</p>
6489 <p>On GTK+, the "sci-notify" signal is sent and the signal handler should have the signature
6490 <code>handler(GtkWidget *, gint, SCNotification *notification, gpointer userData)</code>.</p>
6491 <p>On Cocoa, a delegate implementing the <code>ScintillaNotificationProtocol</code>
6492 may be set to receive notifications or the <code>ScintillaView</code> class may be subclassed and the
6493 <code>notification:</code> method overridden. Overriding <code>notification:</code> allows the
6494 subclass to control whether default handling is performed.</p>
6495 <p>The container is
6496 passed a <code>SCNotification</code> structure containing information about the event.</p>
6497 <pre id="SCNotification">
6498 struct NotifyHeader { // This matches the Win32 NMHDR structure
6499 void *hwndFrom; // environment specific window handle/pointer
6500 uptr_t idFrom; // CtrlID of the window issuing the notification
6501 unsigned int code; // The SCN_* notification code
6504 struct SCNotification {
6505 struct Sci_NotifyHeader nmhdr;
6506 int position;
6507 /* SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_MARGINCLICK, */
6508 /* SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, SCN_CALLTIPCLICK, */
6509 /* SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK, */
6510 /* SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */
6511 /* SCN_USERLISTSELECTION, SCN_AUTOCSELECTION */
6513 int ch; /* SCN_CHARADDED, SCN_KEY */
6514 int modifiers;
6515 /* SCN_KEY, SCN_DOUBLECLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, */
6516 /* SCN_HOTSPOTRELEASECLICK, SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */
6518 int modificationType; /* SCN_MODIFIED */
6519 const char *text;
6520 /* SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION, SCN_URIDROPPED */
6522 int length; /* SCN_MODIFIED */
6523 int linesAdded; /* SCN_MODIFIED */
6524 int message; /* SCN_MACRORECORD */
6525 uptr_t wParam; /* SCN_MACRORECORD */
6526 sptr_t lParam; /* SCN_MACRORECORD */
6527 int line; /* SCN_MODIFIED */
6528 int foldLevelNow; /* SCN_MODIFIED */
6529 int foldLevelPrev; /* SCN_MODIFIED */
6530 int margin; /* SCN_MARGINCLICK */
6531 int listType; /* SCN_USERLISTSELECTION */
6532 int x; /* SCN_DWELLSTART, SCN_DWELLEND */
6533 int y; /* SCN_DWELLSTART, SCN_DWELLEND */
6534 int token; /* SCN_MODIFIED with SC_MOD_CONTAINER */
6535 int annotationLinesAdded; /* SCN_MODIFIED with SC_MOD_CHANGEANNOTATION */
6536 int updated; /* SCN_UPDATEUI */
6538 </pre>
6540 <p>The notification messages that your container can choose to handle and the messages
6541 associated with them are:</p>
6542 <code><a class="message" href="#SCN_STYLENEEDED">SCN_STYLENEEDED</a><br />
6543 <a class="message" href="#SCN_CHARADDED">SCN_CHARADDED</a><br />
6544 <a class="message" href="#SCN_SAVEPOINTREACHED">SCN_SAVEPOINTREACHED</a><br />
6545 <a class="message" href="#SCN_SAVEPOINTLEFT">SCN_SAVEPOINTLEFT</a><br />
6546 <a class="message" href="#SCN_MODIFYATTEMPTRO">SCN_MODIFYATTEMPTRO</a><br />
6547 <a class="message" href="#SCN_KEY">SCN_KEY</a><br />
6548 <a class="message" href="#SCN_DOUBLECLICK">SCN_DOUBLECLICK</a><br />
6549 <a class="message" href="#SCN_UPDATEUI">SCN_UPDATEUI</a><br />
6550 <a class="message" href="#SCN_MODIFIED">SCN_MODIFIED</a><br />
6551 <a class="message" href="#SCN_MACRORECORD">SCN_MACRORECORD</a><br />
6552 <a class="message" href="#SCN_MARGINCLICK">SCN_MARGINCLICK</a><br />
6553 <a class="message" href="#SCN_NEEDSHOWN">SCN_NEEDSHOWN</a><br />
6554 <a class="message" href="#SCN_PAINTED">SCN_PAINTED</a><br />
6555 <a class="message" href="#SCN_USERLISTSELECTION">SCN_USERLISTSELECTION</a><br />
6556 <a class="message" href="#SCN_URIDROPPED">SCN_URIDROPPED</a><br />
6557 <a class="message" href="#SCN_DWELLSTART">SCN_DWELLSTART</a><br />
6558 <a class="message" href="#SCN_DWELLEND">SCN_DWELLEND</a><br />
6559 <a class="message" href="#SCN_ZOOM">SCN_ZOOM</a><br />
6560 <a class="message" href="#SCN_HOTSPOTCLICK">SCN_HOTSPOTCLICK</a><br />
6561 <a class="message" href="#SCN_HOTSPOTDOUBLECLICK">SCN_HOTSPOTDOUBLECLICK</a><br />
6562 <a class="message" href="#SCN_HOTSPOTRELEASECLICK">SCN_HOTSPOTRELEASECLICK</a><br />
6563 <a class="message" href="#SCN_INDICATORCLICK">SCN_INDICATORCLICK</a><br />
6564 <a class="message" href="#SCN_INDICATORRELEASE">SCN_INDICATORRELEASE</a><br />
6565 <a class="message" href="#SCN_CALLTIPCLICK">SCN_CALLTIPCLICK</a><br />
6566 <a class="message" href="#SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</a><br />
6567 <a class="message" href="#SCN_AUTOCCANCELLED">SCN_AUTOCCANCELLED</a><br />
6568 <a class="message" href="#SCN_AUTOCCHARDELETED">SCN_AUTOCCHARDELETED</a><br />
6569 <a class="message" href="#SCN_FOCUSIN">SCN_FOCUSIN</a><br />
6570 <a class="message" href="#SCN_FOCUSOUT">SCN_FOCUSOUT</a><br />
6571 </code>
6573 <p>The following <code>SCI_*</code> messages are associated with these notifications:</p>
6574 <code><a class="message" href="#SCI_SETMODEVENTMASK">SCI_SETMODEVENTMASK(int eventMask)</a><br />
6575 <a class="message" href="#SCI_GETMODEVENTMASK">SCI_GETMODEVENTMASK</a><br />
6576 <a class="message" href="#SCI_SETMOUSEDWELLTIME">SCI_SETMOUSEDWELLTIME(int milliseconds)</a><br />
6577 <a class="message" href="#SCI_GETMOUSEDWELLTIME">SCI_GETMOUSEDWELLTIME</a><br />
6578 <a class="message" href="#SCI_SETIDENTIFIER">SCI_SETIDENTIFIER(int identifier)</a><br />
6579 <a class="message" href="#SCI_GETIDENTIFIER">SCI_GETIDENTIFIER</a><br />
6580 </code>
6582 <p>The following additional notifications are sent using a secondary "command" method and should
6583 be avoided in new code as the primary "notification" method provides all the same events with richer
6584 information.
6585 The <code>WM_COMMAND</code> message is used on Windows.
6586 This emulates the Windows Edit control. Only the lower
6587 16 bits of the control's ID is passed in these notifications.</p>
6588 <p>On GTK+, the "command" signal is sent and the signal handler should have the signature
6589 <code>handler(GtkWidget *, gint wParam, gpointer lParam, gpointer userData)</code>.</p>
6590 <code><a class="message" href="#SCEN_CHANGE">SCEN_CHANGE</a><br />
6591 <a class="message" href="#SCEN_SETFOCUS">SCEN_SETFOCUS</a><br />
6592 <a class="message" href="#SCEN_KILLFOCUS">SCEN_KILLFOCUS</a><br />
6593 </code>
6595 <p><b id="SCI_SETIDENTIFIER">SCI_SETIDENTIFIER(int identifier)</b><br />
6596 <b id="SCI_GETIDENTIFIER">SCI_GETIDENTIFIER</b><br />
6597 These two messages set and get the identifier of the Scintilla instance which is included in notifications as the
6598 <code>idFrom</code> field.
6599 When an application creates multiple Scintilla widgets, this allows the source of each notification to be found.
6600 On Windows, this value is initialised in the <code>CreateWindow</code> call and stored as the
6601 <code>GWLP_ID</code> attribute of the window.
6602 The value should be small, preferably less than 16 bits,
6603 rather than a pointer as some of the functions will only transmit 16 or 32 bits.
6604 </p>
6606 <p><b id="SCN_STYLENEEDED">SCN_STYLENEEDED</b><br />
6607 If you used <code><a class="message"
6608 href="#SCI_SETLEXER">SCI_SETLEXER</a>(SCLEX_CONTAINER)</code> to make the container act as the
6609 lexer, you will receive this notification when Scintilla is about to display or print text that
6610 requires styling. You are required to style the text from the line that contains the position
6611 returned by <a class="message" href="#SCI_GETENDSTYLED"><code>SCI_GETENDSTYLED</code></a> up to
6612 the position passed in <code>SCNotification.position</code>. Symbolically, you need code of the
6613 form:</p>
6614 <pre>
6615 startPos = <a class="message" href="#SCI_GETENDSTYLED">SCI_GETENDSTYLED</a>()
6616 lineNumber = <a class="message"
6617 href="#SCI_LINEFROMPOSITION">SCI_LINEFROMPOSITION</a>(startPos);
6618 startPos = <a class="message"
6619 href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE</a>(lineNumber);
6620 MyStyleRoutine(startPos, SCNotification.position);
6621 </pre>
6623 <p><b id="SCN_CHARADDED">SCN_CHARADDED</b><br />
6624 This is sent when the user types an ordinary text character (as opposed to a command
6625 character) that is entered into the text. The container can use this to decide to display a <a
6626 class="jump" href="#CallTips">call tip</a> or an <a class="jump" href="#Autocompletion">auto
6627 completion list</a>. The character is in <code>SCNotification.ch</code>.
6628 This notification is sent before the character has been styled so processing that depends on
6629 styling should instead be performed in the SCN_UPDATEUI notification.</p>
6631 <p><b id="SCN_SAVEPOINTREACHED">SCN_SAVEPOINTREACHED</b><br />
6632 <b id="SCN_SAVEPOINTLEFT">SCN_SAVEPOINTLEFT</b><br />
6633 Sent to the container when the save point is entered or left, allowing the container to
6634 display a "document dirty" indicator and change its menus.<br />
6635 See also: <a class="message" href="#SCI_SETSAVEPOINT"><code>SCI_SETSAVEPOINT</code></a>, <a
6636 class="message" href="#SCI_GETMODIFY"><code>SCI_GETMODIFY</code></a></p>
6638 <p><b id="SCN_MODIFYATTEMPTRO">SCN_MODIFYATTEMPTRO</b><br />
6639 When in read-only mode, this notification is sent to the container if the user tries to change
6640 the text. This can be used to check the document out of a version control system. You can set
6641 the read-only state of a document with <code><a class="message"
6642 href="#SCI_SETREADONLY">SCI_SETREADONLY</a></code>.</p>
6644 <p><b id="SCN_KEY">SCN_KEY</b><br />
6645 Reports all keys pressed but not consumed by Scintilla. Used on GTK+ because of
6646 some problems with keyboard focus and is not sent by the Windows version. <code>SCNotification.ch</code> holds the key code and
6647 <code>SCNotification.modifiers</code> holds the modifiers. This notification is sent if the
6648 modifiers include <code>SCMOD_ALT</code> or <code>SCMOD_CTRL</code> and the key code is less
6649 than 256.</p>
6651 <p><b id="SCN_DOUBLECLICK">SCN_DOUBLECLICK</b><br />
6652 The mouse button was double clicked in editor. The <code>position</code> field is set to the text position of the
6653 double click, the <code>line</code> field is set to the line of the double click, and
6654 the <code>modifiers</code> field is set to the key modifiers
6655 held down in a similar manner to <a class="message" href="#SCN_KEY">SCN_KEY</a>.</p>
6657 <p><b id="SCN_UPDATEUI">SCN_UPDATEUI</b><br />
6658 Either the text or styling of the document has changed or the selection range or scroll position has changed.
6659 Now would be a good time to update any container UI elements that depend on document or view state.
6660 The <code>updated</code> field is set to the bit set of things changed since the previous notification.</p>
6661 <table cellpadding="1" cellspacing="2" border="0" summary="Modify notification type flags">
6662 <tbody>
6663 <tr>
6664 <th align="left">Symbol</th>
6666 <th>Value</th>
6668 <th align="left">Meaning</th>
6670 </tr>
6671 </tbody>
6673 <tbody valign="top">
6674 <tr>
6675 <td align="left"><code>SC_UPDATE_CONTENT</code></td>
6677 <td align="center">0x01</td>
6679 <td>Contents, styling or markers have been changed.</td>
6681 </tr>
6683 <tr>
6684 <td align="left"><code>SC_UPDATE_SELECTION</code></td>
6686 <td align="center">0x02</td>
6688 <td>Selection has been changed.</td>
6690 </tr>
6692 <tr>
6693 <td align="left"><code>SC_UPDATE_V_SCROLL</code></td>
6695 <td align="center">0x04</td>
6697 <td>Scrolled vertically.</td>
6699 </tr>
6701 <tr>
6702 <td align="left"><code>SC_UPDATE_H_SCROLL</code></td>
6704 <td align="center">0x08</td>
6706 <td>Scrolled horizontally.</td>
6708 </tr>
6709 </tbody>
6710 </table>
6712 <p><b id="SCN_MODIFIED">SCN_MODIFIED</b><br />
6713 This notification is sent when the text or styling of the document changes or is about to
6714 change. You can set a mask for the notifications that are sent to the container with <a
6715 class="message" href="#SCI_SETMODEVENTMASK"><code>SCI_SETMODEVENTMASK</code></a>. The
6716 notification structure contains information about what changed, how the change occurred and
6717 whether this changed the number of lines in the document. No modifications may be performed
6718 while in a <code>SCN_MODIFIED</code> event. The <code>SCNotification</code> fields used
6719 are:</p>
6721 <table cellpadding="1" cellspacing="2" border="0" summary="Modify notification types">
6722 <tbody>
6723 <tr>
6724 <th align="left">Field</th>
6726 <th align="left">Usage</th>
6727 </tr>
6728 </tbody>
6730 <tbody valign="top">
6731 <tr>
6732 <td align="left"><code>modificationType</code></td>
6734 <td align="left">A set of flags that identify the change(s) made. See the next
6735 table.</td>
6736 </tr>
6738 <tr>
6739 <td align="left"><code>position</code></td>
6741 <td align="left">Start position of a text or styling change. Set to 0 if not used.</td>
6742 </tr>
6744 <tr>
6745 <td align="left"><code>length</code></td>
6747 <td align="left">Length of the change in cells or characters when the text or styling
6748 changes. Set to 0 if not used.</td>
6749 </tr>
6751 <tr>
6752 <td align="left"><code>linesAdded</code></td>
6754 <td align="left">Number of added lines. If negative, the number of deleted lines. Set to
6755 0 if not used or no lines added or deleted.</td>
6756 </tr>
6758 <tr>
6759 <td align="left"><code>text</code></td>
6761 <td align="left">Valid for text changes, not for style changes. If we are collecting undo
6762 information this holds a pointer to the text that is handed to the Undo system, otherwise
6763 it is zero. For user performed SC_MOD_BEFOREDELETE the text field is 0.</td>
6764 </tr>
6766 <tr>
6767 <td align="left"><code>line</code></td>
6769 <td align="left">The line number at which a fold level or marker change occurred. This is
6770 0 if unused and may be -1 if more than one line changed.</td>
6771 </tr>
6773 <tr>
6774 <td align="left"><code>foldLevelNow</code></td>
6776 <td align="left">The new fold level applied to the line or 0 if this field is
6777 unused.</td>
6778 </tr>
6780 <tr>
6781 <td align="left"><code>foldLevelPrev</code></td>
6783 <td align="left">The previous folding level of the line or 0 if this field is
6784 unused.</td>
6785 </tr>
6786 </tbody>
6787 </table>
6789 <p>The <code>SCNotification.modificationType</code> field has bits set to tell you what has
6790 been done. The <code>SC_MOD_*</code> bits correspond to actions. The
6791 <code>SC_PERFORMED_*</code> bits tell you if the action was done by the user, or the result of
6792 Undo or Redo of a previous action.</p>
6794 <table cellpadding="1" cellspacing="2" border="0" summary="Modify notification type flags">
6795 <tbody>
6796 <tr>
6797 <th align="left">Symbol</th>
6799 <th>Value</th>
6801 <th align="left">Meaning</th>
6803 <th align="left">SCNotification fields</th>
6804 </tr>
6805 </tbody>
6807 <tbody valign="top">
6808 <tr>
6809 <td align="left"><code>SC_MOD_INSERTTEXT</code></td>
6811 <td align="right">0x01</td>
6813 <td>Text has been inserted into the document.</td>
6815 <td><code>position, length, text, linesAdded</code></td>
6816 </tr>
6818 <tr>
6819 <td align="left"><code>SC_MOD_DELETETEXT</code></td>
6821 <td align="right">0x02</td>
6823 <td>Text has been removed from the document.</td>
6825 <td><code>position, length, text, linesAdded</code></td>
6826 </tr>
6828 <tr>
6829 <td align="left"><code>SC_MOD_CHANGESTYLE</code></td>
6831 <td align="right">0x04</td>
6833 <td>A style change has occurred.</td>
6835 <td><code>position, length</code></td>
6836 </tr>
6838 <tr>
6839 <td align="left"><code>SC_MOD_CHANGEFOLD</code></td>
6841 <td align="right">0x08</td>
6843 <td>A folding change has occurred.</td>
6845 <td><code>line, foldLevelNow, foldLevelPrev</code></td>
6846 </tr>
6848 <tr>
6849 <td align="left"><code>SC_PERFORMED_USER</code></td>
6851 <td align="right">0x10</td>
6853 <td>Information: the operation was done by the user.</td>
6855 <td>None</td>
6856 </tr>
6858 <tr>
6859 <td align="left"><code>SC_PERFORMED_UNDO</code></td>
6861 <td align="right">0x20</td>
6863 <td>Information: this was the result of an Undo.</td>
6865 <td>None</td>
6866 </tr>
6868 <tr>
6869 <td align="left"><code>SC_PERFORMED_REDO</code></td>
6871 <td align="right">0x40</td>
6873 <td>Information: this was the result of a Redo.</td>
6875 <td>None</td>
6876 </tr>
6878 <tr>
6879 <td align="left"><code>SC_MULTISTEPUNDOREDO</code></td>
6881 <td align="right">0x80</td>
6883 <td>This is part of a multi-step Undo or Redo transaction.</td>
6885 <td>None</td>
6886 </tr>
6888 <tr>
6889 <td align="left"><code>SC_LASTSTEPINUNDOREDO</code></td>
6891 <td align="right">0x100</td>
6893 <td>This is the final step in an Undo or Redo transaction.</td>
6895 <td>None</td>
6896 </tr>
6898 <tr>
6899 <td align="left"><code>SC_MOD_CHANGEMARKER</code></td>
6901 <td align="right">0x200</td>
6903 <td>One or more markers has changed in a line.</td>
6905 <td><code>line</code></td>
6906 </tr>
6908 <tr>
6909 <td align="left"><code>SC_MOD_BEFOREINSERT</code></td>
6911 <td align="right">0x400</td>
6913 <td>Text is about to be inserted into the document.</td>
6915 <td><code>position, if performed by user then text in cells, length in cells</code></td>
6916 </tr>
6918 <tr>
6919 <td align="left"><code>SC_MOD_BEFOREDELETE</code></td>
6921 <td align="right">0x800</td>
6923 <td>Text is about to be deleted from the document.</td>
6925 <td><code>position, length</code></td>
6926 </tr>
6928 <tr>
6929 <td align="left"><code>SC_MOD_CHANGEINDICATOR</code></td>
6931 <td align="right">0x4000</td>
6933 <td>An indicator has been added or removed from a range of text.</td>
6935 <td><code>position, length</code></td>
6936 </tr>
6938 <tr>
6939 <td align="left"><code id="SC_MOD_CHANGELINESTATE">SC_MOD_CHANGELINESTATE</code></td>
6941 <td align="right">0x8000</td>
6943 <td>A line state has changed because <a class="message" href="#SCI_SETLINESTATE">SCI_SETLINESTATE</a>
6944 was called.</td>
6946 <td><code>line</code></td>
6947 </tr>
6949 <tr>
6950 <td align="left"><code id="SC_MOD_CHANGETABSTOPS">SC_MOD_CHANGETABSTOPS</code></td>
6952 <td align="right">0x200000</td>
6954 <td>The explicit tab stops on a line have changed because <a class="message" href="#SCI_CLEARTABSTOPS">SCI_CLEARTABSTOPS</a> or
6955 <a class="message" href="#SCI_ADDTABSTOP">SCI_ADDTABSTOP</a> was called.</td>
6957 <td><code>line</code></td>
6958 </tr>
6960 <tr>
6961 <td align="left"><code id="SC_MOD_LEXERSTATE">SC_MOD_LEXERSTATE</code></td>
6963 <td align="right">0x80000</td>
6965 <td>The internal state of a lexer has changed over a range.</td>
6967 <td><code>position, length</code></td>
6968 </tr>
6970 <tr>
6971 <td align="left"><code id="SC_MOD_CHANGEMARGIN">SC_MOD_CHANGEMARGIN</code></td>
6973 <td align="right">0x10000</td>
6975 <td>A text margin has changed.</td>
6977 <td><code>line</code></td>
6978 </tr>
6980 <tr>
6981 <td align="left"><code id="SC_MOD_CHANGEANNOTATION">SC_MOD_CHANGEANNOTATION</code></td>
6983 <td align="right">0x20000</td>
6985 <td>An annotation has changed.</td>
6987 <td><code>line</code></td>
6988 </tr>
6990 <tr>
6991 <td align="left"><code id="SC_MOD_INSERTCHECK">SC_MOD_INSERTCHECK</code></td>
6993 <td align="right">0x100000</td>
6995 <td>Text is about to be inserted. The handler may change the text being inserted by calling
6996 <a class="message" href="#SCI_CHANGEINSERTION">SCI_CHANGEINSERTION</a>.
6997 No other modifications may be made in this handler.</td>
6999 <td><code>position, length, text</code></td>
7000 </tr>
7002 <tr>
7003 <td align="left"><code>SC_MULTILINEUNDOREDO</code></td>
7005 <td align="right">0x1000</td>
7007 <td>This is part of an Undo or Redo with multi-line changes.</td>
7009 <td>None</td>
7010 </tr>
7012 <tr>
7013 <td align="left"><code>SC_STARTACTION</code></td>
7015 <td align="right">0x2000</td>
7017 <td>This is set on a SC_PERFORMED_USER action when it is the
7018 first or only step in an undo transaction. This can be used to integrate the Scintilla
7019 undo stack with an undo stack in the container application by adding a Scintilla
7020 action to the container's stack for the currently opened container transaction or
7021 to open a new container transaction if there is no open container transaction.
7022 </td>
7024 <td>None</td>
7025 </tr>
7027 <tr>
7028 <td align="left"><code id="SC_MOD_CONTAINER">SC_MOD_CONTAINER</code></td>
7030 <td align="right">0x40000</td>
7032 <td>This is set on for actions that the container stored into the undo stack with
7033 <a class="message" href="#SCI_ADDUNDOACTION"><code>SCI_ADDUNDOACTION</code></a>.
7034 </td>
7036 <td>token</td>
7037 </tr>
7039 <tr>
7040 <td align="left"><code>SC_MODEVENTMASKALL</code></td>
7042 <td align="right">0x1FFFFF</td>
7044 <td>This is a mask for all valid flags. This is the default mask state set by <a
7045 class="message" href="#SCI_SETMODEVENTMASK"><code>SCI_SETMODEVENTMASK</code></a>.</td>
7047 <td>None</td>
7048 </tr>
7049 </tbody>
7050 </table>
7052 <p><b id="SCEN_CHANGE">SCEN_CHANGE</b><br />
7053 <code>SCEN_CHANGE</code> (768) is fired when the text (not the style) of the document changes.
7054 This notification is sent using the <code>WM_COMMAND</code> message on Windows and the
7055 "command" signal on GTK+ as this is the behaviour of the standard Edit control
7056 (<code>SCEN_CHANGE</code> has the same value as the Windows Edit control
7057 <code>EN_CHANGE</code>). No other information is sent. If you need more detailed information
7058 use <a class="message" href="#SCN_MODIFIED"><code>SCN_MODIFIED</code></a>. You can filter the
7059 types of changes you are notified about with <a class="message"
7060 href="#SCI_SETMODEVENTMASK"><code>SCI_SETMODEVENTMASK</code></a>.</p>
7062 <p><b id="SCI_SETMODEVENTMASK">SCI_SETMODEVENTMASK(int eventMask)</b><br />
7063 <b id="SCI_GETMODEVENTMASK">SCI_GETMODEVENTMASK</b><br />
7064 These messages set and get an event mask that determines which document change events are
7065 notified to the container with <a class="message"
7066 href="#SCN_MODIFIED"><code>SCN_MODIFIED</code></a> and <a class="message"
7067 href="#SCEN_CHANGE"><code>SCEN_CHANGE</code></a>. For example, a container may decide to see
7068 only notifications about changes to text and not styling changes by calling
7069 <code>SCI_SETMODEVENTMASK(SC_MOD_INSERTTEXT|SC_MOD_DELETETEXT)</code>.</p>
7071 <p>The possible notification types are the same as the <code>modificationType</code> bit flags
7072 used by <code>SCN_MODIFIED</code>: <code>SC_MOD_INSERTTEXT</code>,
7073 <code>SC_MOD_DELETETEXT</code>, <code>SC_MOD_CHANGESTYLE</code>,
7074 <code>SC_MOD_CHANGEFOLD</code>, <code>SC_PERFORMED_USER</code>, <code>SC_PERFORMED_UNDO</code>,
7075 <code>SC_PERFORMED_REDO</code>, <code>SC_MULTISTEPUNDOREDO</code>,
7076 <code>SC_LASTSTEPINUNDOREDO</code>, <code>SC_MOD_CHANGEMARKER</code>,
7077 <code>SC_MOD_BEFOREINSERT</code>, <code>SC_MOD_BEFOREDELETE</code>,
7078 <code>SC_MULTILINEUNDOREDO</code>, and <code>SC_MODEVENTMASKALL</code>.</p>
7080 <p><b id="SCEN_SETFOCUS">SCEN_SETFOCUS</b><br />
7081 <b id="SCEN_KILLFOCUS">SCEN_KILLFOCUS</b><br />
7082 <code>SCEN_SETFOCUS</code> (512) is fired when Scintilla receives focus and
7083 <code>SCEN_KILLFOCUS</code> (256) when it loses focus. These notifications are sent using the
7084 <code>WM_COMMAND</code> message on Windows and the "command" signal on GTK+ as this is the
7085 behaviour of the standard Edit control. Unfortunately, these codes do not match the Windows Edit
7086 notification codes <code>EN_SETFOCUS</code> (256) and <code>EN_KILLFOCUS</code> (512). It is
7087 now too late to change the Scintilla codes as clients depend on the current values.</p>
7089 <p><b id="SCN_MACRORECORD">SCN_MACRORECORD</b><br />
7090 The <code><a class="message" href="#SCI_STARTRECORD">SCI_STARTRECORD</a></code> and <a
7091 class="message" href="#SCI_STOPRECORD"><code>SCI_STOPRECORD</code></a> messages enable and
7092 disable macro recording. When enabled, each time a recordable change occurs, the
7093 <code>SCN_MACRORECORD</code> notification is sent to the container. It is up to the container
7094 to record the action. To see the complete list of <code>SCI_*</code> messages that are
7095 recordable, search the Scintilla source <code>Editor.cxx</code> for
7096 <code>Editor::NotifyMacroRecord</code>. The fields of <code>SCNotification</code> set in this
7097 notification are:</p>
7099 <table cellpadding="1" cellspacing="2" border="0" summary="Macro record notification data">
7100 <tbody>
7101 <tr>
7102 <th align="left">Field</th>
7104 <th align="left">Usage</th>
7105 </tr>
7106 </tbody>
7108 <tbody valign="top">
7109 <tr>
7110 <td align="left"><code>message</code></td>
7112 <td align="left">The <code>SCI_*</code> message that caused the notification.</td>
7113 </tr>
7115 <tr>
7116 <td align="left"><code>wParam</code></td>
7118 <td align="left">The value of <code>wParam</code> in the <code>SCI_*</code> message.</td>
7119 </tr>
7121 <tr>
7122 <td align="left"><code>lParam</code></td>
7124 <td align="left">The value of <code>lParam</code> in the <code>SCI_*</code> message.</td>
7125 </tr>
7126 </tbody>
7127 </table>
7129 <p><b id="SCN_MARGINCLICK">SCN_MARGINCLICK</b><br />
7130 This notification tells the container that the mouse was clicked inside a <a class="jump"
7131 href="#Margins">margin</a> that was marked as sensitive (see <a class="message"
7132 href="#SCI_SETMARGINSENSITIVEN"><code>SCI_SETMARGINSENSITIVEN</code></a>). This can be used to
7133 perform folding or to place breakpoints. The following <code>SCNotification</code> fields are
7134 used:</p>
7136 <table cellpadding="1" cellspacing="2" border="0" summary="Margin click notification">
7137 <tbody>
7138 <tr>
7139 <th align="left">Field</th>
7141 <th align="left">Usage</th>
7142 </tr>
7143 </tbody>
7145 <tbody valign="top">
7146 <tr>
7147 <td align="left"><code>modifiers</code></td>
7149 <td align="left">The appropriate combination of <code>SCI_SHIFT</code>,
7150 <code>SCI_CTRL</code> and <code>SCI_ALT</code> to indicate the keys that were held down
7151 at the time of the margin click.</td>
7152 </tr>
7154 <tr>
7155 <td align="left"><code>position</code></td>
7157 <td align="left">The position of the start of the line in the document that corresponds
7158 to the margin click.</td>
7159 </tr>
7161 <tr>
7162 <td align="left"><code>margin</code></td>
7164 <td align="left">The margin number that was clicked.</td>
7165 </tr>
7166 </tbody>
7167 </table>
7169 <p><b id="SCN_NEEDSHOWN">SCN_NEEDSHOWN</b><br />
7170 Scintilla has determined that a range of lines that is currently invisible should be made
7171 visible. An example of where this may be needed is if the end of line of a contracted fold
7172 point is deleted. This message is sent to the container in case it wants to make the line
7173 visible in some unusual way such as making the whole document visible. Most containers will
7174 just ensure each line in the range is visible by calling <a class="message"
7175 href="#SCI_ENSUREVISIBLE"><code>SCI_ENSUREVISIBLE</code></a>. The <code>position</code> and
7176 <code>length</code> fields of <code>SCNotification</code> indicate the range of the document
7177 that should be made visible. The container code will be similar to the following code
7178 skeleton:</p>
7179 <pre>
7180 firstLine = SCI_LINEFROMPOSITION(scn.position)
7181 lastLine = SCI_LINEFROMPOSITION(scn.position+scn.length-1)
7182 for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next
7183 </pre>
7185 <p><b id="SCN_PAINTED">SCN_PAINTED</b><br />
7186 Painting has just been done. Useful when you want to update some other widgets based on a
7187 change in Scintilla, but want to have the paint occur first to appear more responsive. There is
7188 no other information in <code>SCNotification</code>.</p>
7190 <p><b id="SCN_USERLISTSELECTION">SCN_USERLISTSELECTION</b><br />
7191 The user has selected an item in a <a class="jump" href="#UserLists">user list</a>. The
7192 <code>SCNotification</code> fields used are:</p>
7194 <table cellpadding="1" cellspacing="2" border="0" summary="User list notification">
7195 <tbody>
7196 <tr>
7197 <th align="left">Field</th>
7199 <th align="left">Usage</th>
7200 </tr>
7201 </tbody>
7203 <tbody valign="top">
7204 <tr>
7205 <td align="left"><code>listType</code></td>
7207 <td align="left">This is set to the <code>listType</code> parameter from the <a
7208 class="message" href="#SCI_USERLISTSHOW"><code>SCI_USERLISTSHOW</code></a> message that
7209 initiated the list.</td>
7210 </tr>
7212 <tr>
7213 <td align="left"><code>text</code></td>
7215 <td align="left">The text of the selection.</td>
7216 </tr>
7218 <tr>
7219 <td align="left"><code>position</code></td>
7221 <td align="left">The position the list was displayed at.</td>
7222 </tr>
7223 </tbody>
7224 </table>
7225 <br />
7228 <p><b id="SCN_URIDROPPED">SCN_URIDROPPED</b><br />
7229 Only on the GTK+ version. Indicates that the user has dragged a URI such as a file name or Web
7230 address onto Scintilla. The container could interpret this as a request to open the file. The
7231 <code>text</code> field of <code>SCNotification</code> points at the URI text.</p>
7233 <p><b id="SCN_DWELLSTART">SCN_DWELLSTART</b><br />
7234 <b id="SCN_DWELLEND">SCN_DWELLEND</b><br />
7235 <code>SCN_DWELLSTART</code> is generated when the user keeps the mouse in one position for the
7236 dwell period (see <code><a class="message"
7237 href="#SCI_SETMOUSEDWELLTIME">SCI_SETMOUSEDWELLTIME</a></code>). <code>SCN_DWELLEND</code> is
7238 generated after a <code>SCN_DWELLSTART</code> and the mouse is moved or other activity such as
7239 key press indicates the dwell is over. Both notifications set the same fields in
7240 <code>SCNotification</code>:</p>
7242 <table cellpadding="1" cellspacing="2" border="0" summary="Mouse dwell notification">
7243 <tbody>
7244 <tr>
7245 <th align="left">Field</th>
7247 <th align="left">Usage</th>
7248 </tr>
7249 </tbody>
7251 <tbody valign="top">
7252 <tr>
7253 <td align="left"><code>position</code></td>
7255 <td align="left">This is the nearest position in the document to the position where the
7256 mouse pointer was lingering.</td>
7257 </tr>
7259 <tr>
7260 <td align="left"><code>x, y</code></td>
7262 <td align="left">Where the pointer lingered. The <code>position</code> field is set to
7263 <code><a class="message"
7264 href="#SCI_POSITIONFROMPOINTCLOSE">SCI_POSITIONFROMPOINTCLOSE</a>(x, y)</code>.</td>
7265 </tr>
7266 </tbody>
7267 </table>
7268 <br />
7270 <p><b id="SCI_SETMOUSEDWELLTIME">SCI_SETMOUSEDWELLTIME(int milliseconds)</b><br />
7271 <b id="SCI_GETMOUSEDWELLTIME">SCI_GETMOUSEDWELLTIME</b><br />
7272 These two messages set and get the time the mouse must sit still, in milliseconds, to generate
7273 a <code><a class="message" href="#SCN_DWELLSTART">SCN_DWELLSTART</a></code> notification. If
7274 set to <code>SC_TIME_FOREVER</code>, the default, no dwell events are generated.</p>
7276 <p><b id="SCN_ZOOM">SCN_ZOOM</b><br />
7277 This notification is generated when the user zooms the display using the keyboard or the
7278 <code><a class="message" href="#SCI_SETZOOM">SCI_SETZOOM</a></code> method is called. This
7279 notification can be used to recalculate positions, such as the width of the line number margin
7280 to maintain sizes in terms of characters rather than pixels. <code>SCNotification</code> has no
7281 additional information.</p>
7284 <b id="SCN_HOTSPOTCLICK">SCN_HOTSPOTCLICK</b><br />
7285 <b id="SCN_HOTSPOTDOUBLECLICK">SCN_HOTSPOTDOUBLECLICK</b><br />
7286 <b id="SCN_HOTSPOTRELEASECLICK">SCN_HOTSPOTRELEASECLICK</b><br />
7287 These notifications are generated when the user clicks or double clicks on
7288 text that is in a style with the hotspot attribute set.
7289 This notification can be used to link to variable definitions or web pages.
7290 The <code>position</code> field is set the text position of the click or
7291 double click and the <code>modifiers</code> field set to the key modifiers
7292 held down in a similar manner to <a class="message" href="#SCN_KEY">SCN_KEY</a>.
7293 Only the state of the Ctrl key is reported for <code>SCN_HOTSPOTRELEASECLICK</code>.</p>
7296 <b id="SCN_INDICATORCLICK">SCN_INDICATORCLICK</b><br />
7297 <b id="SCN_INDICATORRELEASE">SCN_INDICATORRELEASE</b><br />
7298 These notifications are generated when the user clicks or releases the mouse on
7299 text that has an indicator.
7300 The <code>position</code> field is set the text position of the click or
7301 double click and the <code>modifiers</code> field set to the key modifiers
7302 held down in a similar manner to <a class="message" href="#SCN_KEY">SCN_KEY</a>.</p>
7304 <p><b id="SCN_CALLTIPCLICK">SCN_CALLTIPCLICK</b><br />
7305 This notification is generated when the user clicks on a calltip.
7306 This notification can be used to display the next function prototype when a
7307 function name is overloaded with different arguments.
7308 The <code>position</code> field is set to 1 if the click is in an up arrow,
7309 2 if in a down arrow, and 0 if elsewhere.</p>
7311 <p><b id="SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</b><br />
7312 The user has selected an item in an <a class="jump" href="#Autocompletion">autocompletion list</a>. The
7313 notification is sent before the selection is inserted. Automatic insertion can be cancelled by sending a
7314 <code><a class="message" href="#SCI_AUTOCCANCEL">SCI_AUTOCCANCEL</a></code> message
7315 before returning from the notification. The <code>SCNotification</code> fields used are:</p>
7317 <table cellpadding="1" cellspacing="2" border="0" summary="Autocompletion list notification">
7318 <tbody>
7319 <tr>
7320 <th align="left">Field</th>
7322 <th align="left">Usage</th>
7323 </tr>
7324 </tbody>
7326 <tbody valign="top">
7327 <tr>
7328 <td align="left"><code>position</code></td>
7330 <td align="left">The start position of the word being completed.</td>
7331 </tr>
7332 <tr>
7333 <td align="left"><code>text</code></td>
7335 <td align="left">The text of the selection.</td>
7336 </tr>
7337 </tbody>
7338 </table>
7340 <p><b id="SCN_AUTOCCANCELLED">SCN_AUTOCCANCELLED</b><br />
7341 The user has cancelled an <a class="jump" href="#Autocompletion">autocompletion list</a>.
7342 There is no other information in SCNotification.</p>
7344 <p><b id="SCN_AUTOCCHARDELETED">SCN_AUTOCCHARDELETED</b><br />
7345 The user deleted a character while autocompletion list was active.
7346 There is no other information in SCNotification.</p>
7348 <p><b id="SCN_FOCUSIN">SCN_FOCUSIN</b><br />
7349 <b id="SCN_FOCUSOUT">SCN_FOCUSOUT</b><br />
7350 <code>SCN_FOCUSIN</code> (2028) is fired when Scintilla receives focus and
7351 <code>SCN_FOCUSOUT</code> (2029) when it loses focus.</p>
7353 <h2 id="Images">Images</h2>
7355 <p>Two formats are supported for images used in margin markers and autocompletion lists, RGBA and XPM.</p>
7357 <h3 id="RGBA">RGBA</h3>
7359 <p>The RGBA format allows translucency with an <a class="jump" href="#alpha">alpha</a>
7360 value for each pixel. It is simpler than
7361 <code>XPM</code> and more capable.</p>
7363 <p>The data is a sequence of 4 byte pixel values starting with the pixels for the top line, with the
7364 leftmost pixel first, then continuing with the pixels for subsequent lines. There is no gap between
7365 lines for alignment reasons.</p>
7367 <p>Each pixel consists of, in order, a red byte, a green byte, a blue byte and an alpha byte.
7368 The colour bytes are not premultiplied by the alpha value. That is, a fully red pixel that is
7369 25% opaque will be [FF, 00, 00, 3F]</p>
7371 <p>Since the RGBA pixel data does not include any size information the
7372 width and height must previously been set with the
7373 <a class="message" href="#SCI_RGBAIMAGESETWIDTH"><code>SCI_RGBAIMAGESETWIDTH</code></a> and
7374 <a class="message" href="#SCI_RGBAIMAGESETHEIGHT"><code>SCI_RGBAIMAGESETHEIGHT</code></a> messages.</p>
7376 <p>GUI platforms often include functions for reading image file formats like PNG into memory
7377 in the RGBA form or a similar form.
7378 If there is no suitable platform support, the <a href="http://lodev.org/lodepng/">LodePNG and picoPNG</a> libraries are small libraries
7379 for loading and decoding PNG files available under a BSD-style license.</p>
7381 <p>RGBA format is supported on Windows, GTK+ and OS X Cocoa.</p>
7383 <h3 id="XPM">XPM</h3>
7385 <p>The XPM format is
7386 <a class="jump" href="http://en.wikipedia.org/wiki/X_PixMap">described here</a>.
7387 Scintilla is only able to handle XPM pixmaps that use one character per pixel with no named colours.
7388 There may be a completely transparent colour named "None".</p>
7389 <p>There are two forms of data structure used for XPM images, the first "lines form" format is well suited
7390 to embedding an image inside C source code and the "text form" is suited to reading from a file.
7391 In the lines form, an array of strings is used with the first string indicating the dimensions and number of colours
7392 used. This is followed by a string for each colour and that section is followed by the image with one string per line.
7393 The text form contains the same data as one null terminated block formatted as C source code starting
7394 with a "/* XPM */" comment to mark the format.</p>
7395 <p>Either format may be used with Scintilla APIs with the bytes at the location pointed to examined
7396 to determine which format: if the bytes start with "/* XPM */" then it is treated as text form,
7397 otherwise it is treated as lines form.</p>
7399 <p>XPM format is supported on on all platforms.</p>
7401 <h2 id="GTK">GTK+</h2>
7402 <p>On GTK+, the following functions create a Scintilla widget, communicate with it and allow
7403 resources to be released after all Scintilla widgets have been destroyed.</p>
7404 <code><a class="message" href="#scintilla_new">GtkWidget *scintilla_new()</a><br />
7405 <a class="message" href="#scintilla_set_id">void scintilla_set_id(ScintillaObject *sci, uptr_t id)</a><br />
7406 <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 />
7407 <a class="message" href="#scintilla_release_resources">void scintilla_release_resources()</a><br />
7408 </code>
7410 <p><b id="scintilla_new">GtkWidget *scintilla_new()</b><br />
7411 Create a new Scintilla widget. The returned pointer can be added to a container and displayed in the same way as other
7412 widgets.</p>
7414 <p><b id="scintilla_set_id">void scintilla_set_id(ScintillaObject *sci, uptr_t id)</b><br />
7415 Set the control ID which will be used in the idFrom field of the NotifyHeader structure of all
7416 notifications for this instance.
7417 This is equivalent to <a class="message" href="#SCI_SETIDENTIFIER">SCI_SETIDENTIFIER</a>.</p>
7419 <p><b id="scintilla_send_message">sptr_t scintilla_send_message(ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam)</b><br />
7420 The main entry point allows sending any of the messages described in this document.</p>
7422 <p><b id="scintilla_release_resources">void scintilla_release_resources()</b><br />
7423 Call this to free any remaining resources after all the Scintilla widgets have been destroyed.</p>
7425 <h2 id="ProvisionalMessages">Provisional messages</h2>
7427 <p>Complex new features may be added as 'provisional' to allow further changes to the API.
7428 Provisional features may even be removed if experience shows they are a mistake.</p>
7430 <p>Provisional features are displayed in this document with <span class="provisional">a distinctive background colour</span>.</p>
7432 <p>There are currently no provisional messages.
7433 The <code class="provisional">SC_TECHNOLOGY_DIRECTWRITERETAIN</code> value for
7434 <a class="message" href="#SCI_SETTECHNOLOGY">SCI_SETTECHNOLOGY</a> is provisional.</p>
7436 <p>Some developers may want to only use features that are stable and have graduated from
7437 provisional status. To avoid using provisional messages compile with the symbol
7438 <code>SCI_DISABLE_PROVISIONAL</code> defined.</p>
7440 <h2 id="DeprecatedMessages">Deprecated messages and notifications</h2>
7442 <p>The following messages are currently supported to emulate existing Windows controls, but
7443 they will be removed in future versions of Scintilla. If you use these messages you should
7444 replace them with the Scintilla equivalent.</p>
7445 <pre>
7446 WM_GETTEXT(int length, char *text)
7447 WM_SETTEXT(&lt;unused&gt;, const char *text)
7448 EM_GETLINE(int line, char *text)
7449 EM_REPLACESEL(&lt;unused&gt;, const char *text)
7450 EM_SETREADONLY
7451 EM_GETTEXTRANGE(&lt;unused&gt;, TEXTRANGE *tr)
7452 WM_CUT
7453 WM_COPY
7454 WM_PASTE
7455 WM_CLEAR
7456 WM_UNDO
7457 EM_CANUNDO
7458 EM_EMPTYUNDOBUFFER
7459 WM_GETTEXTLENGTH
7460 EM_GETFIRSTVISIBLELINE
7461 EM_GETLINECOUNT
7462 EM_GETMODIFY
7463 EM_SETMODIFY(bool isModified)
7464 EM_GETRECT(RECT *rect)
7465 EM_GETSEL(int *start, int *end)
7466 EM_EXGETSEL(&lt;unused&gt;, CHARRANGE *cr)
7467 EM_SETSEL(int start, int end)
7468 EM_EXSETSEL(&lt;unused&gt;, CHARRANGE *cr)
7469 EM_GETSELTEXT(&lt;unused&gt;, char *text)
7470 EM_LINEFROMCHAR(int position)
7471 EM_EXLINEFROMCHAR(int position)
7472 EM_LINEINDEX(int line)
7473 EM_LINELENGTH(int position)
7474 EM_SCROLL(int line)
7475 EM_LINESCROLL(int column, int line)
7476 EM_SCROLLCARET()
7477 EM_CANPASTE
7478 EM_CHARFROMPOS(&lt;unused&gt;, POINT *location)
7479 EM_POSFROMCHAR(int position, POINT *location)
7480 EM_SELECTIONTYPE
7481 EM_HIDESELECTION(bool hide)
7482 EM_FINDTEXT(int flags, FINDTEXTEX *ft)
7483 EM_FINDTEXTEX(int flags, FINDTEXTEX *ft)
7484 EM_GETMARGINS
7485 EM_SETMARGINS(EC_LEFTMARGIN or EC_RIGHTMARGIN or EC_USEFONTINFO, int val)
7486 EM_FORMATRANGE
7487 </pre>
7489 <p>The following are features that are only included if you define
7490 <code>INCLUDE_DEPRECATED_FEATURES</code> in <code>Scintilla.h</code>. To ensure future
7491 compatibility you should change them as indicated.</p>
7493 <p><b id="SC_CP_DBCS">SC_CP_DBCS</b> Deprecated<br />
7494 This was used to set a DBCS (Double Byte Character Set) mode on GTK+.
7495 An explicit DBCS code page should be used when calling <a class="message" href="#SCI_SETCODEPAGE">SCI_SETCODEPAGE</a></p>
7497 <p><b id="SCI_SETUSEPALETTE">SCI_SETUSEPALETTE(bool allowPaletteUse)</b> Deprecated<br />
7498 <b id="SCI_GETUSEPALETTE">SCI_GETUSEPALETTE</b> Deprecated<br />
7499 Scintilla no longer supports palette mode. The last version to support palettes was 2.29.
7500 Any calls to these methods should be removed.</p>
7502 <p>The following are features that should be removed from calling code but are still
7503 defined to avoid breaking callers.</p>
7505 <p id="StyleByteIndicators"><b id="SCI_SETSTYLEBITS">SCI_SETSTYLEBITS(int bits)</b> Deprecated<br />
7506 <b id="SCI_GETSTYLEBITS">SCI_GETSTYLEBITS</b> Deprecated<br />
7507 <b id="SCI_GETSTYLEBITSNEEDED">SCI_GETSTYLEBITSNEEDED</b> Deprecated<br />
7508 <code>INDIC0_MASK</code>, <code>INDIC1_MASK</code>, <code>INDIC2_MASK</code>, <code>INDICS_MASK</code> Deprecated<br />
7509 Scintilla no longer supports style byte indicators. The last version to support style byte indicators was 3.4.2.
7510 Any use of these symbols should be removed and replaced with <a href="#Indicators">standard indicators</a>.
7511 <code>SCI_GETSTYLEBITS</code> and <code>SCI_GETSTYLEBITSNEEDED</code> always return 8,
7512 indicating that 8 bits are used for styling and there are 256 styles.</p>
7513 </p>
7516 <h2 id="EditMessagesNeverSupportedByScintilla">Edit messages never supported by Scintilla</h2>
7517 <pre>
7518 EM_GETWORDBREAKPROC EM_GETWORDBREAKPROCEX
7519 EM_SETWORDBREAKPROC EM_SETWORDBREAKPROCEX
7520 EM_GETWORDWRAPMODE EM_SETWORDWRAPMODE
7521 EM_LIMITTEXT EM_EXLIMITTEXT
7522 EM_SETRECT EM_SETRECTNP
7523 EM_FMTLINES
7524 EM_GETHANDLE EM_SETHANDLE
7525 EM_GETPASSWORDCHAR EM_SETPASSWORDCHAR
7526 EM_SETTABSTOPS
7527 EM_FINDWORDBREAK
7528 EM_GETCHARFORMAT EM_SETCHARFORMAT
7529 EM_GETOLEINTERFACE EM_SETOLEINTERFACE
7530 EM_SETOLECALLBACK
7531 EM_GETPARAFORMAT EM_SETPARAFORMAT
7532 EM_PASTESPECIAL
7533 EM_REQUESTRESIZE
7534 EM_GETBKGNDCOLOR EM_SETBKGNDCOLOR
7535 EM_STREAMIN EM_STREAMOUT
7536 EM_GETIMECOLOR EM_SETIMECOLOR
7537 EM_GETIMEOPTIONS EM_SETIMEOPTIONS
7538 EM_GETOPTIONS EM_SETOPTIONS
7539 EM_GETPUNCTUATION EM_SETPUNCTUATION
7540 EM_GETTHUMB
7541 EM_GETEVENTMASK
7542 EM_SETEVENTMASK
7543 EM_DISPLAYBAND
7544 EM_SETTARGETDEVICE
7545 </pre>
7547 <p>Scintilla tries to be a superset of the standard windows Edit and RichEdit controls wherever
7548 that makes sense. As it is not intended for use in a word processor, some edit messages can not
7549 be sensibly handled. Unsupported messages have no effect.</p>
7551 <h2 id="RemovedFeatures">Removed features</h2>
7553 <p>Previous versions of Scintilla allowed indicators to be stord in bits of each style byte.
7554 This was deprecated in 2007 and removed in 2014 with release 3.4.3.
7555 All uses of style byte indicators should be replaced with <a href="#Indicators">standard indicators</a>.</p>
7557 <h2 id="BuildingScintilla">Building Scintilla</h2>
7559 <p>To build Scintilla or SciTE, see the README file present in both the Scintilla and SciTE
7560 directories. For Windows, GCC 4.7 or Microsoft Visual C++ 2010 can be used
7561 for building. For GTK+, GCC 4.1 or newer should be used. GTK+ 2.8+ and 3.x are
7562 supported. The version of GTK+ installed should be detected automatically.
7563 When both GTK+ 2 and GTK+ 3 are present, building for GTK+ 3.x requires defining GTK3
7564 on the command line.</p>
7566 <h3>Static linking</h3>
7568 <p>On Windows, Scintilla is normally used as a dynamic library as a .DLL file. If you want to
7569 link Scintilla directly into your application .EXE or .DLL file, then the
7570 <code>STATIC_BUILD</code> preprocessor symbol should be defined and
7571 <code>Scintilla_RegisterClasses</code> called. <code>STATIC_BUILD</code> prevents compiling the
7572 <code>DllMain</code> function which will conflict with any <code>DllMain</code> defined in your
7573 code. <code>Scintilla_RegisterClasses</code> takes the <code>HINSTANCE</code> of your
7574 application and ensures that the "Scintilla" window class is registered.</p>
7576 <h3>Ensuring lexers are linked into Scintilla</h3>
7578 <p>Depending on the compiler and linker used, the lexers may be stripped out. This is most
7579 often caused when building a static library. To ensure the lexers are linked in, the
7580 <code>Scintilla_LinkLexers()</code> function may be called.</p>
7582 <h3>Changing set of lexers</h3>
7584 <p>To change the set of lexers in Scintilla, add and remove lexer source files
7585 (<code>Lex*.cxx</code>) from the <code>scintilla/lexers directory</code> and run the
7586 <code>scripts/LexGen.py</code> script from the <code>scripts</code> directory to update the make files
7587 and <code>Catalogue.cxx</code>. <code>LexGen.py</code> requires Python 2.5 or later. If you do
7588 not have access to Python, you can hand edit <code>Catalogue.cxx</code> in a simple-minded way,
7589 following the patterns of other lexers. The important thing is to include
7590 <code>LINK_LEXER(lmMyLexer);</code> to correspond with the <code>LexerModule
7591 lmMyLexer(...);</code> in your lexer source code.</p>
7593 <h3>Building with an alternative Regular Expression implementation</h3>
7595 <p id="AlternativeRegEx">A simple interface provides support for switching the Regular Expressions engine at
7596 compile time. You must implement <code>RegexSearchBase</code> for your chosen engine,
7597 look at the built-in implementation <code>BuiltinRegex</code> to see how this is done.
7598 You then need to implement the factory method <code>CreateRegexSearch</code>
7599 to create an instance of your class. You must disable the built-in implementation by defining
7600 <code>SCI_OWNREGEX</code>.</p>
7602 </body>
7603 </html>