Upgraded to scintilla 3.2.3
[TortoiseGit.git] / ext / scintilla / doc / ScintillaDoc.html
blob4eda3ca0391daaf922756f26c66fa9d828875c67
1 <?xml version="1.0"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5 <html xmlns="http://www.w3.org/1999/xhtml">
6 <head>
7 <meta name="generator"
8 content="HTML Tidy for Windows (vers 1st August 2002), see www.w3.org" />
9 <meta name="generator" content="SciTE" />
10 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
12 <title>Scintilla Documentation</title>
14 <style type="text/css">
15 <!--
16 /*<![CDATA[*/
17 CODE { font-weight: bold; font-family: Consolas,Bitstream Vera Sans Mono,Courier New,monospace; }
18 A:visited { color: blue; }
19 A:hover { text-decoration: underline ! important; }
20 A.message { text-decoration: none; font-weight: bold; font-family: Consolas,Bitstream Vera Sans Mono,Courier New,monospace; }
21 A.toc { text-decoration: none; }
22 A.jump { text-decoration: none; }
23 .S0 {
24 color: #808080;
26 .S2 {
27 font-family: 'Comic Sans MS';
28 color: #007F00;
29 font-size: 9pt;
31 .S3 {
32 font-family: 'Comic Sans MS';
33 color: #3F703F;
34 font-size: 9pt;
36 .S4 {
37 color: #007F7F;
39 .S5 {
40 font-weight: bold;
41 color: #00007F;
43 .S9 {
44 color: #7F7F00;
46 .S10 {
47 font-weight: bold;
48 color: #000000;
50 .S17 {
51 font-family: 'Comic Sans MS';
52 color: #3060A0;
53 font-size: 9pt;
55 DIV.highlighted {
56 background: #F7FCF7;
57 border: 1px solid #C0D7C0;
58 margin: 0.3em 3em;
59 padding: 0.3em 0.6em;
60 font-family: 'Verdana';
61 color: #000000;
62 font-size: 10pt;
64 /*]]>*/
65 -->
66 </style>
67 </head>
69 <body bgcolor="#FFFFFF" text="#000000">
70 <table bgcolor="#000000" width="100%" cellspacing="0" cellpadding="0" border="0"
71 summary="Banner">
72 <tr>
73 <td><img src="SciTEIco.png" border="3" height="64" width="64" alt="Scintilla icon" /></td>
75 <td><a href="index.html"
76 style="color:white;text-decoration:none;font-size:200%">Scintilla</a></td>
77 </tr>
78 </table>
80 <h1>Scintilla Documentation</h1>
82 <p>Last edited 21/July/2012 NH</p>
84 <p>There is <a class="jump" href="Design.html">an overview of the internal design of
85 Scintilla</a>.<br />
86 <a class="jump" href="ScintillaUsage.html">Some notes on using Scintilla</a>.<br />
87 <a class="jump" href="Steps.html">How to use the Scintilla Edit Control on Windows</a>.<br />
88 <a class="jump" href="http://www.scintilla.org/dmapp.zip">A simple sample using Scintilla from
89 C++ on Windows</a>.<br />
90 <a class="jump" href="http://www.scintilla.org/SciTry.vb">A simple sample using Scintilla from
91 Visual Basic</a>.<br />
92 <a class="jump" href="http://www.scintilla.org/bait.zip">Bait is a tiny sample using Scintilla
93 on GTK+</a>.<br />
94 <a class="jump" href="Lexer.txt">A detailed description of how to write a lexer, including a
95 discussion of folding</a>.<br />
96 <a class="jump" href="http://sphere.sourceforge.net/flik/docs/scintilla-container_lexer.html">
97 How to implement a lexer in the container</a>.<br />
98 <a class="jump" href="http://sphere.sourceforge.net/flik/docs/scintilla-folding.html">
99 How to implement folding</a>.<br />
100 The <a class="jump" href="SciCoding.html">coding style</a> used in Scintilla and SciTE is
101 worth following if you want to contribute code to Scintilla but is not compulsory.</p>
103 <h2>Introduction</h2>
105 <p>The Windows version of Scintilla is a Windows Control. As such, its primary programming
106 interface is through Windows messages. Early versions of Scintilla emulated much of the API
107 defined by the standard Windows Edit and RichEdit controls but those APIs are now deprecated in
108 favour of Scintilla's own, more consistent API. In addition to messages performing the actions
109 of a normal Edit control, Scintilla allows control of syntax styling, folding, markers, autocompletion
110 and call tips.</p>
112 <p>The GTK+ version also uses messages in a similar way to the Windows version. This is
113 different to normal GTK+ practice but made it easier to implement rapidly.</p>
115 <p>Scintilla does not properly support right-to-left languages like Arabic and Hebrew.
116 While text in these languages may appear correct, it is not possible to interact with this text
117 as is normal with other editing components.</p>
119 <p>This documentation describes the individual messages and notifications used by Scintilla. It
120 does not describe how to link them together to form a useful editor. For now, the best way to
121 work out how to develop using Scintilla is to see how SciTE uses it. SciTE exercises most of
122 Scintilla's facilities.</p>
124 <p>In the descriptions that follow, the messages are described as function calls with zero, one
125 or two arguments. These two arguments are the standard <code>wParam</code> and
126 <code>lParam</code> familiar to Windows programmers. These parameters are integers that
127 are large enough to hold pointers, and the return value is also an integer large enough to contain a
128 pointer.
129 Although the commands only use the
130 arguments described, because all messages have two arguments whether Scintilla uses them or
131 not, it is strongly recommended that any unused arguments are set to 0. This allows future
132 enhancement of messages without the risk of breaking existing code. Common argument types
133 are:</p>
135 <table cellpadding="1" cellspacing="2" border="0" summary="Common argument types">
136 <tbody valign="top">
137 <tr>
138 <th align="left">bool</th>
140 <td>Arguments expect the values 0 for <code>false</code> and 1 for
141 <code>true</code>.</td>
142 </tr>
144 <tr>
145 <th align="left">int</th>
147 <td>Arguments are 32-bit signed integers.</td>
148 </tr>
150 <tr>
151 <th align="left">const&nbsp;char&nbsp;*</th>
153 <td>Arguments point at text that is being passed to Scintilla but not modified. The text
154 may be zero terminated or another argument may specify the character count, the
155 description will make this clear.</td>
156 </tr>
158 <tr>
159 <th align="left">char *</th>
161 <td>Arguments point at text buffers that Scintilla will fill with text. In some cases,
162 another argument will tell Scintilla the buffer size. In others, you must make sure that
163 the buffer is big enough to hold the requested text. If a NULL pointer (0) is passed
164 then, for SCI_* calls, the length that should be allocated is returned.</td>
165 </tr>
167 <tr>
168 <th align="left" id="colour">colour</th>
170 <td>Colours are set using the RGB format (Red, Green, Blue). The intensity of each colour
171 is set in the range 0 to 255. If you have three such intensities, they are combined as:
172 red | (green &lt;&lt; 8) | (blue &lt;&lt; 16). If you set all intensities to 255, the
173 colour is white. If you set all intensities to 0, the colour is black. When you set a
174 colour, you are making a request. What you will get depends on the capabilities of the
175 system and the current screen mode.</td>
176 </tr>
178 <tr>
179 <th align="left" id="alpha">alpha</th>
181 <td>Translucency is set using an alpha value.
182 Alpha ranges from 0 (SC_ALPHA_TRANSPARENT) which is completely transparent to
183 255 (SC_ALPHA_OPAQUE) which is opaque. The value 256 (SC_ALPHA_NOALPHA)
184 is opaque and uses code that is not alpha-aware and may be faster. Not all platforms support
185 translucency and only some Scintilla features implement translucency.
186 The default alpha value for most features is SC_ALPHA_NOALPHA.</td>
187 </tr>
189 <tr>
190 <th align="left">&lt;unused&gt;</th>
192 <td>This is an unused argument. Setting it to 0 will ensure compatibility with future
193 enhancements.</td>
194 </tr>
195 </tbody>
196 </table>
198 <h2 id="MessageCategories">Contents</h2>
200 <table cellpadding="4" cellspacing="2" border="0" summary="Message categories">
201 <tbody>
202 <tr>
203 <td>o <a class="toc" href="#TextRetrievalAndModification">Text retrieval and
204 modification</a></td>
206 <td>o <a class="toc" href="#Searching">Searching and replacing</a></td>
208 <td>o <a class="toc" href="#Overtype">Overtype</a></td>
209 </tr>
211 <tr>
212 <td>o <a class="toc" href="#CutCopyAndPaste">Cut, copy and paste</a></td>
214 <td>o <a class="toc" href="#ErrorHandling">Error handling</a></td>
216 <td>o <a class="toc" href="#UndoAndRedo">Undo and Redo</a></td>
217 </tr>
219 <tr>
220 <td>o <a class="toc" href="#SelectionAndInformation">Selection and information</a></td>
222 <td>o <a class="toc" href="#MultipleSelectionAndVirtualSpace">Multiple Selection and Virtual Space</a></td>
224 <td>o <a class="toc" href="#ScrollingAndAutomaticScrolling">Scrolling and automatic
225 scrolling</a></td>
226 </tr>
228 <tr>
229 <td>o <a class="toc" href="#WhiteSpace">White space</a></td>
231 <td>o <a class="toc" href="#Cursor">Cursor</a></td>
233 <td>o <a class="toc" href="#MouseCapture">Mouse capture</a></td>
234 </tr>
236 <tr>
237 <td>o <a class="toc" href="#LineEndings">Line endings</a></td>
239 <td>o <a class="toc" href="#Styling">Styling</a></td>
241 <td>o <a class="toc" href="#StyleDefinition">Style definition</a></td>
242 </tr>
244 <tr>
245 <td>o <a class="toc" href="#CaretAndSelectionStyles">Caret, selection, and hotspot styles</a></td>
247 <td>o <a class="toc" href="#Margins">Margins</a></td>
249 <td>o <a class="toc" href="#Annotations">Annotations</a></td>
250 </tr>
252 <tr>
253 <td>o <a class="toc" href="#OtherSettings">Other settings</a></td>
255 <td>o <a class="toc" href="#BraceHighlighting">Brace highlighting</a></td>
257 <td>o <a class="toc" href="#TabsAndIndentationGuides">Tabs and Indentation
258 Guides</a></td>
259 </tr>
261 <tr>
262 <td>o <a class="toc" href="#Markers">Markers</a></td>
264 <td>o <a class="toc" href="#Indicators">Indicators</a></td>
266 <td>o <a class="toc" href="#Autocompletion">Autocompletion</a></td>
267 </tr>
269 <tr>
270 <td>o <a class="toc" href="#UserLists">User lists</a></td>
272 <td>o <a class="toc" href="#CallTips">Call tips</a></td>
274 <td>o <a class="toc" href="#KeyboardCommands">Keyboard commands</a></td>
275 </tr>
277 <tr>
278 <td>o <a class="toc" href="#KeyBindings">Key bindings</a></td>
280 <td>o <a class="toc" href="#PopupEditMenu">Popup edit menu</a></td>
282 <td>o <a class="toc" href="#MacroRecording">Macro recording</a></td>
283 </tr>
285 <tr>
286 <td>o <a class="toc" href="#Printing">Printing</a></td>
288 <td>o <a class="toc" href="#DirectAccess">Direct access</a></td>
290 <td>o <a class="toc" href="#MultipleViews">Multiple views</a></td>
291 </tr>
293 <tr>
294 <td>o <a class="toc" href="#BackgroundLoadSave">Background loading and saving</a></td>
296 <td>o <a class="toc" href="#Folding">Folding</a></td>
298 <td>o <a class="toc" href="#LineWrapping">Line wrapping</a></td>
299 </tr>
301 <tr>
302 <td>o <a class="toc" href="#Zooming">Zooming</a></td>
304 <td>o <a class="toc" href="#LongLines">Long lines</a></td>
306 <td>o <a class="toc" href="#Lexer">Lexer</a></td>
307 </tr>
309 <tr>
310 <td>o <a class="toc" href="#LexerObjects">Lexer objects</a></td>
312 <td>o <a class="toc" href="#Notifications">Notifications</a></td>
314 <td>o <a class="toc" href="#Images">Images</a></td>
315 </tr>
317 <tr>
318 <td>o <a class="toc" href="#GTK">GTK+</a></td>
320 <td>o <a class="toc" href="#DeprecatedMessages">Deprecated messages</a></td>
322 <td>o <a class="toc" href="#EditMessagesNeverSupportedByScintilla">Edit messages never
323 supported by Scintilla</a></td>
325 </tr>
327 <tr>
328 <td>o <a class="toc" href="#BuildingScintilla">Building Scintilla</a></td>
329 </tr>
330 </tbody>
331 </table>
333 <p>Messages with names of the form <code>SCI_SETxxxxx</code> often have a companion
334 <code>SCI_GETxxxxx</code>. To save tedious repetition, if the <code>SCI_GETxxxxx</code> message
335 returns the value set by the <code>SCI_SETxxxxx</code> message, the <code>SET</code> routine is
336 described and the <code>GET</code> routine is left to your imagination.</p>
338 <h2 id="TextRetrievalAndModification">Text retrieval and modification</h2>
340 <p>Each byte in a Scintilla document is followed by an associated byte of styling
341 information. The combination of a character byte and a style byte is called a cell. Style bytes
342 are interpreted an index into an array of styles.
343 Style bytes may be split into an index and a set of indicator bits
344 but this use is discouraged and indicators should now use
345 <a class="message" href ="#SCI_INDICATORFILLRANGE">SCI_INDICATORFILLRANGE</a>
346 and related calls.
347 The default split is with the index in the low 5 bits and 3 high bits as <a class="jump"
348 href="#Indicators">indicators</a>. This allows 32 fundamental styles, which is enough for most
349 languages, and three independent indicators so that, for example, syntax errors, deprecated
350 names and bad indentation could all be displayed at once. The number of bits used for styles
351 can be altered with <a class="message"
352 href="#SCI_SETSTYLEBITS"><code>SCI_SETSTYLEBITS</code></a> up to a maximum of 8 bits.
353 The remaining bits can be used for indicators.</p>
355 <p>In this document, 'character' normally refers to a byte even when multi-byte characters are used.
356 Lengths measure the numbers of bytes, not the amount of characters in those bytes.</p>
358 <p>Positions within the Scintilla document refer to a character or the gap before that
359 character. The first character in a document is 0, the second 1 and so on. If a document
360 contains <code>nLen</code> characters, the last character is numbered <code>nLen</code>-1.
361 The caret exists between character positions and can be located from before the first character (0)
362 to after the last character (<code>nLen</code>).</p>
364 <p>There are places where the caret can not go where two character bytes make up one character.
365 This occurs when a DBCS character from a language like Japanese is included in the document or
366 when line ends are marked with the CP/M standard of a carriage return followed by a line feed.
367 The <code>INVALID_POSITION</code> constant (-1) represents an invalid position within the
368 document.</p>
370 <p>All lines of text in Scintilla are the same height, and this height is calculated from the
371 largest font in any current style. This restriction is for performance; if lines differed in
372 height then calculations involving positioning of text would require the text to be styled
373 first.</p>
374 <code><a class="message" href="#SCI_GETTEXT">SCI_GETTEXT(int length, char *text)</a><br />
375 <a class="message" href="#SCI_SETTEXT">SCI_SETTEXT(&lt;unused&gt;, const char *text)</a><br />
376 <a class="message" href="#SCI_SETSAVEPOINT">SCI_SETSAVEPOINT</a><br />
377 <a class="message" href="#SCI_GETLINE">SCI_GETLINE(int line, char *text)</a><br />
378 <a class="message" href="#SCI_REPLACESEL">SCI_REPLACESEL(&lt;unused&gt;, const char
379 *text)</a><br />
380 <a class="message" href="#SCI_SETREADONLY">SCI_SETREADONLY(bool readOnly)</a><br />
381 <a class="message" href="#SCI_GETREADONLY">SCI_GETREADONLY</a><br />
382 <a class="message" href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE(&lt;unused&gt;, Sci_TextRange
383 *tr)</a><br />
384 <a class="message" href="#SCI_ALLOCATE">SCI_ALLOCATE(int bytes, &lt;unused&gt;)</a><br />
385 <a class="message" href="#SCI_ADDTEXT">SCI_ADDTEXT(int length, const char *s)</a><br />
386 <a class="message" href="#SCI_ADDSTYLEDTEXT">SCI_ADDSTYLEDTEXT(int length, cell *s)</a><br />
387 <a class="message" href="#SCI_APPENDTEXT">SCI_APPENDTEXT(int length, const char *s)</a><br />
388 <a class="message" href="#SCI_INSERTTEXT">SCI_INSERTTEXT(int pos, const char *text)</a><br />
389 <a class="message" href="#SCI_CLEARALL">SCI_CLEARALL</a><br />
390 <a class="message" href="#SCI_DELETERANGE">SCI_DELETERANGE(int pos, int deleteLength)</a><br />
391 <a class="message" href="#SCI_CLEARDOCUMENTSTYLE">SCI_CLEARDOCUMENTSTYLE</a><br />
392 <a class="message" href="#SCI_GETCHARAT">SCI_GETCHARAT(int position)</a><br />
393 <a class="message" href="#SCI_GETSTYLEAT">SCI_GETSTYLEAT(int position)</a><br />
394 <a class="message" href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT(&lt;unused&gt;, Sci_TextRange
395 *tr)</a><br />
396 <a class="message" href="#SCI_SETSTYLEBITS">SCI_SETSTYLEBITS(int bits)</a><br />
397 <a class="message" href="#SCI_GETSTYLEBITS">SCI_GETSTYLEBITS</a><br />
398 <a class="message" href="#SCI_TARGETASUTF8">SCI_TARGETASUTF8(&lt;unused&gt;, char *s)</a><br />
399 <a class="message" href="#SCI_ENCODEDFROMUTF8">SCI_ENCODEDFROMUTF8(const char *utf8, char *encoded)</a><br />
400 <a class="message" href="#SCI_SETLENGTHFORENCODE">SCI_SETLENGTHFORENCODE(int bytes)</a><br />
401 </code>
403 <p><b id="SCI_GETTEXT">SCI_GETTEXT(int length, char *text)</b><br />
404 This returns <code>length</code>-1 characters of text from the start of the document plus one
405 terminating 0 character. To collect all the text in a document, use <code>SCI_GETLENGTH</code>
406 to get the number of characters in the document (<code>nLen</code>), allocate a character
407 buffer of length <code>nLen+1</code> bytes, then call <code>SCI_GETTEXT(nLen+1, char
408 *text)</code>. If the text argument is 0 then the length that should be allocated to store the
409 entire document is returned.
410 If you then save the text, you should use <code>SCI_SETSAVEPOINT</code> to mark
411 the text as unmodified.</p>
413 <p>See also: <code><a class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>, <a
414 class="message" href="#SCI_GETCURLINE">SCI_GETCURLINE</a>, <a class="message"
415 href="#SCI_GETLINE">SCI_GETLINE</a>, <a class="message"
416 href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>, <a class="message"
417 href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a></code></p>
419 <p><b id="SCI_SETTEXT">SCI_SETTEXT(&lt;unused&gt;, const char *text)</b><br />
420 This replaces all the text in the document with the zero terminated text string you pass
421 in.</p>
423 <p><b id="SCI_SETSAVEPOINT">SCI_SETSAVEPOINT</b><br />
424 This message tells Scintilla that the current state of the document is unmodified. This is
425 usually done when the file is saved or loaded, hence the name "save point". As Scintilla
426 performs undo and redo operations, it notifies the container that it has entered or left the
427 save point with <code><a class="message"
428 href="#SCN_SAVEPOINTREACHED">SCN_SAVEPOINTREACHED</a></code> and <code><a class="message"
429 href="#SCN_SAVEPOINTLEFT">SCN_SAVEPOINTLEFT</a></code> <a class="jump"
430 href="#Notifications">notification messages</a>, allowing the container to know if the file
431 should be considered dirty or not.</p>
433 <p>See also: <code><a class="message" href="#SCI_EMPTYUNDOBUFFER">SCI_EMPTYUNDOBUFFER</a>, <a
434 class="message" href="#SCI_GETMODIFY">SCI_GETMODIFY</a></code></p>
436 <p><b id="SCI_GETLINE">SCI_GETLINE(int line, char *text)</b><br />
437 This fills the buffer defined by text with the contents of the nominated line (lines start at
438 0). The buffer is not terminated by a 0 character. It is up to you to make sure that the buffer
439 is long enough for the text, use <a class="message"
440 href="#SCI_LINELENGTH"><code>SCI_LINELENGTH(int line)</code></a>. The returned value is the
441 number of characters copied to the buffer. The returned text includes any end of line
442 characters. If you ask for a line number outside the range of lines in the document, 0
443 characters are copied. If the text argument is 0 then the length that should be allocated
444 to store the entire line is returned.</p>
446 <p>See also: <code><a class="message" href="#SCI_GETCURLINE">SCI_GETCURLINE</a>, <a
447 class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>, <a class="message"
448 href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a>, <a class="message"
449 href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>, <a class="message"
450 href="#SCI_GETTEXT">SCI_GETTEXT</a></code></p>
452 <p><b id="SCI_REPLACESEL">SCI_REPLACESEL(&lt;unused&gt;, const char *text)</b><br />
453 The currently selected text between the <a class="jump" href="#SelectionAndInformation">anchor
454 and the current position</a> is replaced by the 0 terminated text string. If the anchor and
455 current position are the same, the text is inserted at the caret position. The caret is
456 positioned after the inserted text and the caret is scrolled into view.</p>
458 <p><b id="SCI_SETREADONLY">SCI_SETREADONLY(bool readOnly)</b><br />
459 <b id="SCI_GETREADONLY">SCI_GETREADONLY</b><br />
460 These messages set and get the read-only flag for the document. If you mark a document as read
461 only, attempts to modify the text cause the <a class="message"
462 href="#SCN_MODIFYATTEMPTRO"><code>SCN_MODIFYATTEMPTRO</code></a> notification.</p>
464 <p><b id="SCI_GETTEXTRANGE">SCI_GETTEXTRANGE(&lt;unused&gt;, <a class="jump"
465 href="#Sci_TextRange">Sci_TextRange</a> *tr)</b><br />
466 This collects the text between the positions <code>cpMin</code> and <code>cpMax</code> and
467 copies it to <code>lpstrText</code> (see <code>struct Sci_TextRange</code> in
468 <code>Scintilla.h</code>). If <code>cpMax</code> is -1, text is returned to the end of the
469 document. The text is 0 terminated, so you must supply a buffer that is at least 1 character
470 longer than the number of characters you wish to read. The return value is the length of the
471 returned text not including the terminating 0.</p>
473 <p>See also: <code><a class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>, <a
474 class="message" href="#SCI_GETLINE">SCI_GETLINE</a>, <a class="message"
475 href="#SCI_GETCURLINE">SCI_GETCURLINE</a>, <a class="message"
476 href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>, <a class="message"
477 href="#SCI_GETTEXT">SCI_GETTEXT</a></code></p>
479 <p><b id="SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT(&lt;unused&gt;, <a class="jump"
480 href="#Sci_TextRange">Sci_TextRange</a> *tr)</b><br />
481 This collects styled text into a buffer using two bytes for each cell, with the character at
482 the lower address of each pair and the style byte at the upper address. Characters between the
483 positions <code>cpMin</code> and <code>cpMax</code> are copied to <code>lpstrText</code> (see
484 <code>struct Sci_TextRange</code> in <code>Scintilla.h</code>). Two 0 bytes are added to the end of
485 the text, so the buffer that <code>lpstrText</code> points at must be at least
486 <code>2*(cpMax-cpMin)+2</code> bytes long. No check is made for sensible values of
487 <code>cpMin</code> or <code>cpMax</code>. Positions outside the document return character codes
488 and style bytes of 0.</p>
490 <p>See also: <code><a class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>, <a
491 class="message" href="#SCI_GETLINE">SCI_GETLINE</a>, <a class="message"
492 href="#SCI_GETCURLINE">SCI_GETCURLINE</a>, <a class="message"
493 href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a>, <a class="message"
494 href="#SCI_GETTEXT">SCI_GETTEXT</a></code></p>
496 <p><b id="SCI_ALLOCATE">SCI_ALLOCATE(int bytes, &lt;unused&gt;)</b><br />
497 Allocate a document buffer large enough to store a given number of bytes.
498 The document will not be made smaller than its current contents.</p>
500 <p><b id="SCI_ADDTEXT">SCI_ADDTEXT(int length, const char *s)</b><br />
501 This inserts the first <code>length</code> characters from the string <code>s</code>
502 at the current position. This will include any 0's in the string that you might have expected
503 to stop the insert operation. The current position is set at the end of the inserted text,
504 but it is not scrolled into view.</p>
506 <p><b id="SCI_ADDSTYLEDTEXT">SCI_ADDSTYLEDTEXT(int length, cell *s)</b><br />
507 This behaves just like <code>SCI_ADDTEXT</code>, but inserts styled text.</p>
509 <p><b id="SCI_APPENDTEXT">SCI_APPENDTEXT(int length, const char *s)</b><br />
510 This adds the first <code>length</code> characters from the string <code>s</code> to the end
511 of the document. This will include any 0's in the string that you might have expected to stop
512 the operation. The current selection is not changed and the new text is not scrolled into
513 view.</p>
515 <p><b id="SCI_INSERTTEXT">SCI_INSERTTEXT(int pos, const char *text)</b><br />
516 This inserts the zero terminated <code>text</code> string at position <code>pos</code> or at
517 the current position if <code>pos</code> is -1. If the current position is after the insertion point
518 then it is moved along with its surrounding text but no scrolling is performed.</p>
520 <p><b id="SCI_CLEARALL">SCI_CLEARALL</b><br />
521 Unless the document is read-only, this deletes all the text.</p>
523 <p><b id="SCI_DELETERANGE">SCI_DELETERANGE(int pos, int deleteLength)</b><br />
524 Deletes a range of text in the document.</p>
526 <p><b id="SCI_CLEARDOCUMENTSTYLE">SCI_CLEARDOCUMENTSTYLE</b><br />
527 When wanting to completely restyle the document, for example after choosing a lexer, the
528 <code>SCI_CLEARDOCUMENTSTYLE</code> can be used to clear all styling information and reset the
529 folding state.</p>
531 <p><b id="SCI_GETCHARAT">SCI_GETCHARAT(int pos)</b><br />
532 This returns the character at <code>pos</code> in the document or 0 if <code>pos</code> is
533 negative or past the end of the document.</p>
535 <p><b id="SCI_GETSTYLEAT">SCI_GETSTYLEAT(int pos)</b><br />
536 This returns the style at <code>pos</code> in the document, or 0 if <code>pos</code> is
537 negative or past the end of the document.</p>
539 <p><b id="SCI_SETSTYLEBITS">SCI_SETSTYLEBITS(int bits)</b><br />
540 <b id="SCI_GETSTYLEBITS">SCI_GETSTYLEBITS</b><br />
541 This pair of routines sets and reads back the number of bits in each cell to use for styling,
542 to a maximum of 8 style bits. The remaining bits can be used as indicators. The standard
543 setting is <code>SCI_SETSTYLEBITS(5)</code>.
544 The number of styling bits needed by the current lexer can be found with
545 <a class="message" href="#SCI_GETSTYLEBITSNEEDED">SCI_GETSTYLEBITSNEEDED</a>.</p>
547 <p><b id="Sci_TextRange">Sci_TextRange</b> and <b id="Sci_CharacterRange">Sci_CharacterRange</b><br />
548 These structures are defined to be exactly the same shape as the Win32 <code>TEXTRANGE</code>
549 and <code>CHARRANGE</code>, so that older code that treats Scintilla as a RichEdit will
550 work.</p>
551 <pre>
552 struct Sci_CharacterRange {
553 long cpMin;
554 long cpMax;
557 struct Sci_TextRange {
558 struct Sci_CharacterRange chrg;
559 char *lpstrText;
561 </pre>
563 <h3 id="EncodedAccess">GTK+-specific: Access to encoded text</h3>
565 <p><b id="SCI_TARGETASUTF8">SCI_TARGETASUTF8(&lt;unused&gt;, char *s)</b><br />
566 This method retrieves the value of the target encoded as UTF-8 which is the default
567 encoding of GTK+ so is useful for retrieving text for use in other parts of the user interface,
568 such as find and replace dialogs. The length of the encoded text in bytes is returned.
569 </p>
571 <p><b id="SCI_ENCODEDFROMUTF8">SCI_ENCODEDFROMUTF8(const char *utf8, char *encoded)</b><br />
572 <b id="SCI_SETLENGTHFORENCODE">SCI_SETLENGTHFORENCODE(int bytes)</b><br />
573 <code>SCI_ENCODEDFROMUTF8</code> converts a UTF-8 string into the document's
574 encoding which is useful for taking the results of a find dialog, for example, and receiving
575 a string of bytes that can be searched for in the document. Since the text can contain nul bytes,
576 the <code>SCI_SETLENGTHFORENCODE</code> method can be used to set the
577 length that will be converted. If set to -1, the length is determined by finding a nul byte.
578 The length of the converted string is returned.
579 </p>
582 <h2 id="Searching">Searching</h2>
584 There are methods to search for text and for regular expressions. The regular expression support
585 is limited and should only be used for simple cases and initial development. A different regular expression
586 library can be <a class="jump" href="#AlternativeRegEx">integrated into Scintilla</a>
587 or can be called from the container using direct access to the buffer contents through
588 <a class="message" href="#SCI_GETCHARACTERPOINTER">SCI_GETCHARACTERPOINTER</a>.
589 </p>
590 <code><a class="message" href="#SCI_FINDTEXT">SCI_FINDTEXT(int flags, Sci_TextToFind
591 *ttf)</a><br />
592 <a class="message" href="#SCI_SEARCHANCHOR">SCI_SEARCHANCHOR</a><br />
593 <a class="message" href="#SCI_SEARCHNEXT">SCI_SEARCHNEXT(int searchFlags, const char
594 *text)</a><br />
595 <a class="message" href="#SCI_SEARCHPREV">SCI_SEARCHPREV(int searchFlags, const char
596 *text)</a><br />
597 <a class="jump" href="#SearchAndReplaceUsingTheTarget">Search and replace using the
598 target</a><br />
599 </code>
601 <p><b id="searchFlags"><code>searchFlags</code></b><br />
602 Several of the search routines use flag options, which include a simple regular expression
603 search. Combine the flag options by adding them:</p>
605 <table border="0" summary="Search flags">
606 <tbody>
607 <tr>
608 <td><code>SCFIND_MATCHCASE</code></td>
610 <td>A match only occurs with text that matches the case of the search string.</td>
611 </tr>
613 <tr>
614 <td><code>SCFIND_WHOLEWORD</code></td>
616 <td>A match only occurs if the characters before and after are not word characters.</td>
617 </tr>
619 <tr>
620 <td><code>SCFIND_WORDSTART</code></td>
622 <td>A match only occurs if the character before is not a word character.</td>
623 </tr>
625 <tr>
626 <td><code>SCFIND_REGEXP</code></td>
628 <td>The search string should be interpreted as a regular expression.</td>
629 </tr>
630 <tr>
631 <td><code>SCFIND_POSIX</code></td>
633 <td>Treat regular expression in a more POSIX compatible manner
634 by interpreting bare ( and ) for tagged sections rather than \( and \).</td>
635 </tr>
636 </tbody>
637 </table>
639 <p>You can
640 search backwards to find the previous occurrence of a search string by setting the end of the
641 search range before the start.</p>
643 <p>In a regular expression, special characters interpreted are:</p>
645 <table border="0" summary="Regular expression synopsis">
646 <tbody>
647 <tr>
648 <td><code>.</code></td>
650 <td>Matches any character</td>
651 </tr>
653 <tr>
654 <td><code>\(</code></td>
656 <td>This marks the start of a region for tagging a match.</td>
657 </tr>
659 <tr>
660 <td><code>\)</code></td>
662 <td>This marks the end of a tagged region.</td>
663 </tr>
665 <tr>
666 <td><code>\n</code></td>
668 <td>Where <code>n</code> is 1 through 9 refers to the first through ninth tagged region
669 when replacing. For example, if the search string was <code>Fred\([1-9]\)XXX</code> and
670 the replace string was <code>Sam\1YYY</code>, when applied to <code>Fred2XXX</code> this
671 would generate <code>Sam2YYY</code>.
672 <code>\0</code> refers to all of the matching text.</td>
673 </tr>
675 <tr>
676 <td><code>\&lt;</code></td>
678 <td>This matches the start of a word using Scintilla's definitions of words.</td>
679 </tr>
681 <tr>
682 <td><code>\&gt;</code></td>
684 <td>This matches the end of a word using Scintilla's definition of words.</td>
685 </tr>
687 <tr>
688 <td><code>\x</code></td>
690 <td>This allows you to use a character x that would otherwise have a special meaning. For
691 example, \[ would be interpreted as [ and not as the start of a character set.</td>
692 </tr>
694 <tr>
695 <td><code>[...]</code></td>
697 <td>This indicates a set of characters, for example, [abc] means any of the characters a,
698 b or c. You can also use ranges, for example [a-z] for any lower case character.</td>
699 </tr>
701 <tr>
702 <td><code>[^...]</code></td>
704 <td>The complement of the characters in the set. For example, [^A-Za-z] means any
705 character except an alphabetic character.</td>
706 </tr>
708 <tr>
709 <td><code>^</code></td>
711 <td>This matches the start of a line (unless used inside a set, see above).</td>
712 </tr>
714 <tr>
715 <td><code>$</code></td>
717 <td>This matches the end of a line.</td>
718 </tr>
720 <tr>
721 <td><code>*</code></td>
723 <td>This matches 0 or more times. For example, <code>Sa*m</code> matches <code>Sm</code>,
724 <code>Sam</code>, <code>Saam</code>, <code>Saaam</code> and so on.</td>
725 </tr>
727 <tr>
728 <td><code>+</code></td>
730 <td>This matches 1 or more times. For example, <code>Sa+m</code> matches
731 <code>Sam</code>, <code>Saam</code>, <code>Saaam</code> and so on.</td>
732 </tr>
733 </tbody>
734 </table>
736 <p>Regular expressions will only match ranges within a single line, never matching over multiple lines.</p>
738 <p><b id="SCI_FINDTEXT">SCI_FINDTEXT(int searchFlags, <a class="jump"
739 href="#Sci_TextToFind">Sci_TextToFind</a> *ttf)</b><br />
740 This message searches for text in the document. It does not use or move the current selection.
741 The <a class="jump" href="#searchFlags"><code>searchFlags</code></a> argument controls the
742 search type, which includes regular expression searches.</p>
744 <p>The <code>Sci_TextToFind</code> structure is defined in <code>Scintilla.h</code>; set
745 <code>chrg.cpMin</code> and <code>chrg.cpMax</code> with the range of positions in the document
746 to search. You can search backwards by
747 setting <code>chrg.cpMax</code> less than <code>chrg.cpMin</code>.
748 Set the <code>lpstrText</code> member of <code>Sci_TextToFind</code> to point at a zero terminated
749 text string holding the search pattern. If your language makes the use of <code>Sci_TextToFind</code>
750 difficult, you should consider using <code>SCI_SEARCHINTARGET</code> instead.</p>
752 <p>The return value is -1 if the search fails or the position of the start of the found text if
753 it succeeds. The <code>chrgText.cpMin</code> and <code>chrgText.cpMax</code> members of
754 <code>Sci_TextToFind</code> are filled in with the start and end positions of the found text.</p>
756 <p>See also: <code><a class="message"
757 href="#SCI_SEARCHINTARGET">SCI_SEARCHINTARGET</a></code></p>
759 <p><b id="Sci_TextToFind">Sci_TextToFind</b><br />
760 This structure is defined to have exactly the same shape as the Win32 structure
761 <code>FINDTEXTEX</code> for old code that treated Scintilla as a RichEdit control.</p>
762 <pre>
763 struct Sci_TextToFind {
764 struct <a class="jump" href="#Sci_CharacterRange">Sci_CharacterRange</a> chrg; // range to search
765 char *lpstrText; // the search pattern (zero terminated)
766 struct Sci_CharacterRange chrgText; // returned as position of matching text
768 </pre>
770 <p><b id="SCI_SEARCHANCHOR">SCI_SEARCHANCHOR</b><br />
771 <b id="SCI_SEARCHNEXT">SCI_SEARCHNEXT(int searchFlags, const char *text)</b><br />
772 <b id="SCI_SEARCHPREV">SCI_SEARCHPREV(int searchFlags, const char *text)</b><br />
773 These messages provide relocatable search support. This allows multiple incremental
774 interactive searches to be macro recorded while still setting the selection to found text so
775 the find/select operation is self-contained. These three messages send <a class="message"
776 href="#SCN_MACRORECORD"><code>SCN_MACRORECORD</code></a> <a class="jump"
777 href="#Notifications">notifications</a> if macro recording is enabled.</p>
779 <p><code>SCI_SEARCHANCHOR</code> sets the search start point used by
780 <code>SCI_SEARCHNEXT</code> and <code>SCI_SEARCHPREV</code> to the start of the current
781 selection, that is, the end of the selection that is nearer to the start of the document. You
782 should always call this before calling either of <code>SCI_SEARCHNEXT</code> or
783 <code>SCI_SEARCHPREV</code>.</p>
785 <p><code>SCI_SEARCHNEXT</code> and <code>SCI_SEARCHPREV</code> search for the next and previous
786 occurrence of the zero terminated search string pointed at by text. The search is modified by
787 the <a class="jump" href="#searchFlags"><code>searchFlags</code></a>. </p>
789 <p>The return value is -1 if nothing is found, otherwise the return value is the start position
790 of the matching text. The selection is updated to show the matched text, but is not scrolled
791 into view.</p>
793 <p>See also: <a class="message" href="#SCI_SEARCHINTARGET"><code>SCI_SEARCHINTARGET</code></a>,
794 <a class="message" href="#SCI_FINDTEXT"><code>SCI_FINDTEXT</code></a></p>
796 <h3 id="SearchAndReplaceUsingTheTarget">Search and replace using the target</h3>
798 <p>Using <a class="message" href="#SCI_REPLACESEL"><code>SCI_REPLACESEL</code></a>,
799 modifications cause scrolling and other visible changes, which may take some time and cause
800 unwanted display updates. If performing many changes, such as a replace all command, the target
801 can be used instead. First, set the target, ie. the range to be replaced. Then call
802 <code>SCI_REPLACETARGET</code> or <code>SCI_REPLACETARGETRE</code>.</p>
804 <p>Searching can be performed within the target range with <code>SCI_SEARCHINTARGET</code>,
805 which uses a counted string to allow searching for null characters. It returns the
806 position of the start of the matching text range or -1 for failure, in which case the target is not moved. The flags used by
807 <code>SCI_SEARCHINTARGET</code> such as <code>SCFIND_MATCHCASE</code>,
808 <code>SCFIND_WHOLEWORD</code>, <code>SCFIND_WORDSTART</code>, and <code>SCFIND_REGEXP</code>
809 can be set with <code>SCI_SETSEARCHFLAGS</code>. <code>SCI_SEARCHINTARGET</code> may be simpler
810 for some clients to use than <a class="message"
811 href="#SCI_FINDTEXT"><code>SCI_FINDTEXT</code></a>, as that requires using a pointer to a
812 structure.</p>
813 <code><a class="message" href="#SCI_SETTARGETSTART">SCI_SETTARGETSTART(int pos)</a><br />
814 <a class="message" href="#SCI_GETTARGETSTART">SCI_GETTARGETSTART</a><br />
815 <a class="message" href="#SCI_SETTARGETEND">SCI_SETTARGETEND(int pos)</a><br />
816 <a class="message" href="#SCI_GETTARGETEND">SCI_GETTARGETEND</a><br />
817 <a class="message" href="#SCI_TARGETFROMSELECTION">SCI_TARGETFROMSELECTION</a><br />
818 <a class="message" href="#SCI_SETSEARCHFLAGS">SCI_SETSEARCHFLAGS(int searchFlags)</a><br />
819 <a class="message" href="#SCI_GETSEARCHFLAGS">SCI_GETSEARCHFLAGS</a><br />
820 <a class="message" href="#SCI_SEARCHINTARGET">SCI_SEARCHINTARGET(int length, const char
821 *text)</a><br />
822 <a class="message" href="#SCI_REPLACETARGET">SCI_REPLACETARGET(int length, const char
823 *text)</a><br />
824 <a class="message" href="#SCI_REPLACETARGETRE">SCI_REPLACETARGETRE(int length, const char
825 *text)</a><br />
826 <a class="message" href="#SCI_GETTAG">SCI_GETTAG(int tagNumber, char *tagValue)</a><br />
827 </code>
829 <p><b id="SCI_SETTARGETSTART">SCI_SETTARGETSTART(int pos)</b><br />
830 <b id="SCI_GETTARGETSTART">SCI_GETTARGETSTART</b><br />
831 <b id="SCI_SETTARGETEND">SCI_SETTARGETEND(int pos)</b><br />
832 <b id="SCI_GETTARGETEND">SCI_GETTARGETEND</b><br />
833 These functions set and return the start and end of the target. When searching in non-regular
834 expression mode, you can set start greater than end to find the last matching text in the
835 target rather than the first matching text. The target is also set by a successful
836 <code>SCI_SEARCHINTARGET</code>.</p>
838 <p><b id="SCI_TARGETFROMSELECTION">SCI_TARGETFROMSELECTION</b><br />
839 Set the target start and end to the start and end positions of the selection.</p>
841 <p><b id="SCI_SETSEARCHFLAGS">SCI_SETSEARCHFLAGS(int searchFlags)</b><br />
842 <b id="SCI_GETSEARCHFLAGS">SCI_GETSEARCHFLAGS</b><br />
843 These get and set the <a class="jump" href="#searchFlags"><code>searchFlags</code></a> used by
844 <code>SCI_SEARCHINTARGET</code>. There are several option flags including a simple regular
845 expression search.</p>
847 <p><b id="SCI_SEARCHINTARGET">SCI_SEARCHINTARGET(int length, const char *text)</b><br />
848 This searches for the first occurrence of a text string in the target defined by
849 <code>SCI_SETTARGETSTART</code> and <code>SCI_SETTARGETEND</code>. The text string is not zero
850 terminated; the size is set by <code>length</code>. The search is modified by the search flags
851 set by <code>SCI_SETSEARCHFLAGS</code>. If the search succeeds, the target is set to the found
852 text and the return value is the position of the start of the matching text. If the search
853 fails, the result is -1.</p>
855 <p><b id="SCI_REPLACETARGET">SCI_REPLACETARGET(int length, const char *text)</b><br />
856 If <code>length</code> is -1, <code>text</code> is a zero terminated string, otherwise
857 <code>length</code> sets the number of character to replace the target with.
858 After replacement, the target range refers to the replacement text.
859 The return value
860 is the length of the replacement string.<br />
861 Note that the recommended way to delete text in the document is to set the target to the text to be removed,
862 and to perform a replace target with an empty string.</p>
864 <p><b id="SCI_REPLACETARGETRE">SCI_REPLACETARGETRE(int length, const char *text)</b><br />
865 This replaces the target using regular expressions. If <code>length</code> is -1,
866 <code>text</code> is a zero terminated string, otherwise <code>length</code> is the number of
867 characters to use. The replacement string is formed from the text string with any sequences of
868 <code>\1</code> through <code>\9</code> replaced by tagged matches from the most recent regular
869 expression search. <code>\0</code> is replaced with all the matched text from the most recent search.
870 After replacement, the target range refers to the replacement text.
871 The return value is the length of the replacement string.</p>
873 <p><b id="SCI_GETTAG">SCI_GETTAG(int tagNumber, char *tagValue)</b><br />
874 Discover what text was matched by tagged expressions in a regular expression search.
875 This is useful if the application wants to interpret the replacement string itself.</p>
877 <p>See also: <a class="message" href="#SCI_FINDTEXT"><code>SCI_FINDTEXT</code></a></p>
879 <h2 id="Overtype">Overtype</h2>
881 <p><b id="SCI_SETOVERTYPE">SCI_SETOVERTYPE(bool overType)</b><br />
882 <b id="SCI_GETOVERTYPE">SCI_GETOVERTYPE</b><br />
883 When overtype is enabled, each typed character replaces the character to the right of the text
884 caret. When overtype is disabled, characters are inserted at the caret.
885 <code>SCI_GETOVERTYPE</code> returns <code>TRUE</code> (1) if overtyping is active, otherwise
886 <code>FALSE</code> (0) will be returned. Use <code>SCI_SETOVERTYPE</code> to set the overtype
887 mode.</p>
889 <h2 id="CutCopyAndPaste">Cut, copy and paste</h2>
891 <code><a class="message" href="#SCI_CUT">SCI_CUT</a><br />
892 <a class="message" href="#SCI_COPY">SCI_COPY</a><br />
893 <a class="message" href="#SCI_PASTE">SCI_PASTE</a><br />
894 <a class="message" href="#SCI_CLEAR">SCI_CLEAR</a><br />
895 <a class="message" href="#SCI_CANPASTE">SCI_CANPASTE</a><br />
896 <a class="message" href="#SCI_COPYRANGE">SCI_COPYRANGE(int start, int end)</a><br />
897 <a class="message" href="#SCI_COPYTEXT">SCI_COPYTEXT(int length,
898 const char *text)</a><br />
899 <a class="message" href="#SCI_COPYALLOWLINE">SCI_COPYALLOWLINE</a><br />
900 <a class="message" href="#SCI_SETPASTECONVERTENDINGS">SCI_SETPASTECONVERTENDINGS(bool convert)</a><br />
901 <a class="message" href="#SCI_GETPASTECONVERTENDINGS">SCI_GETPASTECONVERTENDINGS</a><br />
902 </code>
904 <p><b id="SCI_CUT">SCI_CUT</b><br />
905 <b id="SCI_COPY">SCI_COPY</b><br />
906 <b id="SCI_PASTE">SCI_PASTE</b><br />
907 <b id="SCI_CLEAR">SCI_CLEAR</b><br />
908 <b id="SCI_CANPASTE">SCI_CANPASTE</b><br />
909 <b id="SCI_COPYALLOWLINE">SCI_COPYALLOWLINE</b><br />
910 These commands perform the standard tasks of cutting and copying data to the clipboard,
911 pasting from the clipboard into the document, and clearing the document.
912 <code>SCI_CANPASTE</code> returns non-zero if the document isn't read-only and if the selection
913 doesn't contain protected text. If you need a "can copy" or "can cut", use
914 <code>SCI_GETSELECTIONEMPTY()</code>, which will be zero if there are any non-empty
915 selection ranges implying that a copy or cut to the clipboard should work.</p>
917 <p>GTK+ does not really support <code>SCI_CANPASTE</code> and always returns <code>TRUE</code>
918 unless the document is read-only.</p>
920 <p>On X, the clipboard is asynchronous and may require several messages between
921 the destination and source applications. Data from SCI_PASTE will not arrive in the
922 document immediately.</p>
924 <p><code>SCI_COPYALLOWLINE</code> works the same as SCI_COPY except that if the
925 selection is empty then the current line is copied. On Windows, an extra "MSDEVLineSelect" marker
926 is added to the clipboard which is then used in <code>SCI_PASTE</code> to paste
927 the whole line before the current line.</p>
929 <b id="SCI_COPYRANGE">SCI_COPYRANGE(int start, int end)</b><br />
930 <b id="SCI_COPYTEXT">SCI_COPYTEXT(int length, const char *text)</b><br />
931 <p><code>SCI_COPYRANGE</code> copies a range of text from the document to
932 the system clipboard and <code>SCI_COPYTEXT</code> copies a supplied piece of
933 text to the system clipboard.</p>
935 <p><b id="SCI_SETPASTECONVERTENDINGS">SCI_SETPASTECONVERTENDINGS(bool convert)</b><br />
936 <b id="SCI_GETPASTECONVERTENDINGS">SCI_GETPASTECONVERTENDINGS</b><br />
937 If this property is set then when text is pasted any line ends are converted to match the document's
938 end of line mode as set with
939 <a class="message" href="#SCI_SETEOLMODE">SCI_SETEOLMODE</a>.
940 Currently only changeable on Windows. On GTK+ pasted text is always converted.</p>
942 <h2 id="ErrorHandling">Error handling</h2>
944 <p><b id="SCI_SETSTATUS">SCI_SETSTATUS(int status)</b><br />
945 <b id="SCI_GETSTATUS">SCI_GETSTATUS</b><br />
946 If an error occurs, Scintilla may set an internal error number that can be retrieved with
947 <code>SCI_GETSTATUS</code>.
948 To clear the error status call <code>SCI_SETSTATUS(0)</code>.
949 The currently defined statuses are:
950 </p>
952 <table cellpadding="1" cellspacing="2" border="0" summary="Status values">
953 <tbody valign="top">
954 <tr>
955 <th align="left">SC_STATUS_OK</th>
956 <td>0</td>
957 <td>No failures</td>
958 </tr>
960 <tr>
961 <th align="left">SC_STATUS_FAILURE</th>
962 <td>1</td>
963 <td>Generic failure</td>
964 </tr>
966 <tr>
967 <th align="left">SC_STATUS_BADALLOC</th>
968 <td>2</td>
969 <td>Memory is exhausted</td>
970 </tr>
972 </tbody>
973 </table>
975 <h2 id="UndoAndRedo">Undo and Redo</h2>
977 <p>Scintilla has multiple level undo and redo. It will continue to collect undoable actions
978 until memory runs out. Scintilla saves actions that change the document. Scintilla does not
979 save caret and selection movements, view scrolling and the like. Sequences of typing or
980 deleting are compressed into single transactions to make it easier to undo and redo at a sensible
981 level of detail. Sequences of actions can be combined into transactions that are undone as a unit.
982 These sequences occur between <code>SCI_BEGINUNDOACTION</code> and
983 <code>SCI_ENDUNDOACTION</code> messages. These transactions can be nested and only the top-level
984 sequences are undone as units.</p>
985 <code><a class="message" href="#SCI_UNDO">SCI_UNDO</a><br />
986 <a class="message" href="#SCI_CANUNDO">SCI_CANUNDO</a><br />
987 <a class="message" href="#SCI_EMPTYUNDOBUFFER">SCI_EMPTYUNDOBUFFER</a><br />
988 <a class="message" href="#SCI_REDO">SCI_REDO</a><br />
989 <a class="message" href="#SCI_CANREDO">SCI_CANREDO</a><br />
990 <a class="message" href="#SCI_SETUNDOCOLLECTION">SCI_SETUNDOCOLLECTION(bool
991 collectUndo)</a><br />
992 <a class="message" href="#SCI_GETUNDOCOLLECTION">SCI_GETUNDOCOLLECTION</a><br />
993 <a class="message" href="#SCI_BEGINUNDOACTION">SCI_BEGINUNDOACTION</a><br />
994 <a class="message" href="#SCI_ENDUNDOACTION">SCI_ENDUNDOACTION</a><br />
995 <a class="message" href="#SCI_ADDUNDOACTION">SCI_ADDUNDOACTION(int token, int flags)</a><br />
996 </code>
998 <p><b id="SCI_UNDO">SCI_UNDO</b><br />
999 <b id="SCI_CANUNDO">SCI_CANUNDO</b><br />
1000 <code>SCI_UNDO</code> undoes one action, or if the undo buffer has reached a
1001 <code>SCI_ENDUNDOACTION</code> point, all the actions back to the corresponding
1002 <code>SCI_BEGINUNDOACTION</code>.</p>
1004 <p><code>SCI_CANUNDO</code> returns 0 if there is nothing to undo, and 1 if there is. You would
1005 typically use the result of this message to enable/disable the Edit menu Undo command.</p>
1007 <p><b id="SCI_REDO">SCI_REDO</b><br />
1008 <b id="SCI_CANREDO">SCI_CANREDO</b><br />
1009 <code>SCI_REDO</code> undoes the effect of the last <code>SCI_UNDO</code> operation.</p>
1011 <p><code>SCI_CANREDO</code> returns 0 if there is no action to redo and 1 if there are undo
1012 actions to redo. You could typically use the result of this message to enable/disable the Edit
1013 menu Redo command.</p>
1015 <p><b id="SCI_EMPTYUNDOBUFFER">SCI_EMPTYUNDOBUFFER</b><br />
1016 This command tells Scintilla to forget any saved undo or redo history. It also sets the save
1017 point to the start of the undo buffer, so the document will appear to be unmodified. This does
1018 not cause the <code><a class="message"
1019 href="#SCN_SAVEPOINTREACHED">SCN_SAVEPOINTREACHED</a></code> notification to be sent to the
1020 container.</p>
1022 <p>See also: <a class="message" href="#SCI_SETSAVEPOINT"><code>SCI_SETSAVEPOINT</code></a></p>
1024 <p><b id="SCI_SETUNDOCOLLECTION">SCI_SETUNDOCOLLECTION(bool collectUndo)</b><br />
1025 <b id="SCI_GETUNDOCOLLECTION">SCI_GETUNDOCOLLECTION</b><br />
1026 You can control whether Scintilla collects undo information with
1027 <code>SCI_SETUNDOCOLLECTION</code>. Pass in <code>true</code> (1) to collect information and
1028 <code>false</code> (0) to stop collecting. If you stop collection, you should also use
1029 <code>SCI_EMPTYUNDOBUFFER</code> to avoid the undo buffer being unsynchronized with the data in
1030 the buffer.</p>
1032 <p>You might wish to turn off saving undo information if you use the Scintilla to store text
1033 generated by a program (a Log view) or in a display window where text is often deleted and
1034 regenerated.</p>
1036 <p><b id="SCI_BEGINUNDOACTION">SCI_BEGINUNDOACTION</b><br />
1037 <b id="SCI_ENDUNDOACTION">SCI_ENDUNDOACTION</b><br />
1038 Send these two messages to Scintilla to mark the beginning and end of a set of operations that
1039 you want to undo all as one operation but that you have to generate as several operations.
1040 Alternatively, you can use these to mark a set of operations that you do not want to have
1041 combined with the preceding or following operations if they are undone.</p>
1043 <p><b id="SCI_ADDUNDOACTION">SCI_ADDUNDOACTION(int token, int flags)</b><br />
1044 The container can add its own actions into the undo stack by calling
1045 <code>SCI_ADDUNDOACTION</code> and an <code>SCN_MODIFIED</code>
1046 notification will be sent to the container with the
1047 <a class="message" href="#SC_MOD_CONTAINER"><code>SC_MOD_CONTAINER</code></a>
1048 flag when it is time to undo (<code>SC_PERFORMED_UNDO</code>) or
1049 redo (<code>SC_PERFORMED_REDO</code>) the action. The token argument supplied is
1050 returned in the <code>token</code> field of the notification.</p>
1051 <p>For example, if the container wanted to allow undo and redo of a 'toggle bookmark' command then
1052 it could call <code>SCI_ADDUNDOACTION(line, 0)</code> each time the command is performed.
1053 Then when it receives a notification to undo or redo it toggles a bookmark on the line given by
1054 the token field. If there are different types of commands or parameters that need to be stored into the undo
1055 stack then the container should maintain a stack of its own for the document and use the current
1056 position in that stack as the argument to <code>SCI_ADDUNDOACTION(line)</code>.
1057 <code>SCI_ADDUNDOACTION</code> commands are not combined together
1058 into a single undo transaction unless grouped with <code>SCI_BEGINUNDOACTION</code>
1059 and <code>SCI_ENDUNDOACTION</code>.</p>
1061 <p>The flags argument can be <code>UNDO_MAY_COALESCE</code> (1) if the container action may be
1062 coalesced along with any insertion and deletion actions into a single compound action, otherwise 0.
1063 Coalescing treats coalescible container actions as transparent so will still only group together insertions that
1064 look like typing or deletions that look like multiple uses of the Backspace or Delete keys.
1065 </p>
1066 <h2 id="SelectionAndInformation">Selection and information</h2>
1068 <p>Scintilla maintains a selection that stretches between two points, the anchor and the
1069 current position. If the anchor and the current position are the same, there is no selected
1070 text. Positions in the document range from 0 (before the first character), to the document size
1071 (after the last character). If you use messages, there is nothing to stop you setting a
1072 position that is in the middle of a CRLF pair, or in the middle of a 2 byte character. However,
1073 keyboard commands will not move the caret into such positions.</p>
1074 <code><a class="message" href="#SCI_GETTEXTLENGTH">SCI_GETTEXTLENGTH</a><br />
1075 <a class="message" href="#SCI_GETLENGTH">SCI_GETLENGTH</a><br />
1076 <a class="message" href="#SCI_GETLINECOUNT">SCI_GETLINECOUNT</a><br />
1077 <a class="message" href="#SCI_SETFIRSTVISIBLELINE">SCI_SETFIRSTVISIBLELINE(int lineDisplay)</a><br />
1078 <a class="message" href="#SCI_GETFIRSTVISIBLELINE">SCI_GETFIRSTVISIBLELINE</a><br />
1079 <a class="message" href="#SCI_LINESONSCREEN">SCI_LINESONSCREEN</a><br />
1080 <a class="message" href="#SCI_GETMODIFY">SCI_GETMODIFY</a><br />
1081 <a class="message" href="#SCI_SETSEL">SCI_SETSEL(int anchorPos, int currentPos)</a><br />
1082 <a class="message" href="#SCI_GOTOPOS">SCI_GOTOPOS(int position)</a><br />
1083 <a class="message" href="#SCI_GOTOLINE">SCI_GOTOLINE(int line)</a><br />
1084 <a class="message" href="#SCI_SETCURRENTPOS">SCI_SETCURRENTPOS(int position)</a><br />
1085 <a class="message" href="#SCI_GETCURRENTPOS">SCI_GETCURRENTPOS</a><br />
1086 <a class="message" href="#SCI_SETANCHOR">SCI_SETANCHOR(int position)</a><br />
1087 <a class="message" href="#SCI_GETANCHOR">SCI_GETANCHOR</a><br />
1088 <a class="message" href="#SCI_SETSELECTIONSTART">SCI_SETSELECTIONSTART(int position)</a><br />
1089 <a class="message" href="#SCI_GETSELECTIONSTART">SCI_GETSELECTIONSTART</a><br />
1090 <a class="message" href="#SCI_SETSELECTIONEND">SCI_SETSELECTIONEND(int position)</a><br />
1091 <a class="message" href="#SCI_GETSELECTIONEND">SCI_GETSELECTIONEND</a><br />
1092 <a class="message" href="#SCI_SETEMPTYSELECTION">SCI_SETEMPTYSELECTION(int pos)</a><br />
1093 <a class="message" href="#SCI_SELECTALL">SCI_SELECTALL</a><br />
1094 <a class="message" href="#SCI_LINEFROMPOSITION">SCI_LINEFROMPOSITION(int position)</a><br />
1095 <a class="message" href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(int line)</a><br />
1096 <a class="message" href="#SCI_GETLINEENDPOSITION">SCI_GETLINEENDPOSITION(int line)</a><br />
1097 <a class="message" href="#SCI_LINELENGTH">SCI_LINELENGTH(int line)</a><br />
1098 <a class="message" href="#SCI_GETCOLUMN">SCI_GETCOLUMN(int position)</a><br />
1099 <a class="message" href="#SCI_FINDCOLUMN">SCI_FINDCOLUMN(int line, int column)</a><br />
1100 <a class="message" href="#SCI_POSITIONFROMPOINT">SCI_POSITIONFROMPOINT(int x, int y)</a><br />
1101 <a class="message" href="#SCI_POSITIONFROMPOINTCLOSE">SCI_POSITIONFROMPOINTCLOSE(int x, int
1102 y)</a><br />
1103 <a class="message" href="#SCI_CHARPOSITIONFROMPOINT">SCI_CHARPOSITIONFROMPOINT(int x, int y)</a><br />
1104 <a class="message" href="#SCI_CHARPOSITIONFROMPOINTCLOSE">SCI_CHARPOSITIONFROMPOINTCLOSE(int x, int
1105 y)</a><br />
1106 <a class="message" href="#SCI_POINTXFROMPOSITION">SCI_POINTXFROMPOSITION(&lt;unused&gt;, int
1107 position)</a><br />
1108 <a class="message" href="#SCI_POINTYFROMPOSITION">SCI_POINTYFROMPOSITION(&lt;unused&gt;, int
1109 position)</a><br />
1110 <a class="message" href="#SCI_HIDESELECTION">SCI_HIDESELECTION(bool hide)</a><br />
1111 <a class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT(&lt;unused&gt;, char *text)</a><br />
1112 <a class="message" href="#SCI_GETCURLINE">SCI_GETCURLINE(int textLen, char *text)</a><br />
1113 <a class="message" href="#SCI_SELECTIONISRECTANGLE">SCI_SELECTIONISRECTANGLE</a><br />
1114 <a class="message" href="#SCI_SETSELECTIONMODE">SCI_SETSELECTIONMODE(int mode)</a><br />
1115 <a class="message" href="#SCI_GETSELECTIONMODE">SCI_GETSELECTIONMODE</a><br />
1116 <a class="message" href="#SCI_GETLINESELSTARTPOSITION">SCI_GETLINESELSTARTPOSITION(int line)</a><br />
1117 <a class="message" href="#SCI_GETLINESELENDPOSITION">SCI_GETLINESELENDPOSITION(int line)</a><br />
1118 <a class="message" href="#SCI_MOVECARETINSIDEVIEW">SCI_MOVECARETINSIDEVIEW</a><br />
1119 <a class="message" href="#SCI_WORDENDPOSITION">SCI_WORDENDPOSITION(int position, bool
1120 onlyWordCharacters)</a><br />
1121 <a class="message" href="#SCI_WORDSTARTPOSITION">SCI_WORDSTARTPOSITION(int position, bool
1122 onlyWordCharacters)</a><br />
1123 <a class="message" href="#SCI_POSITIONBEFORE">SCI_POSITIONBEFORE(int position)</a><br />
1124 <a class="message" href="#SCI_POSITIONAFTER">SCI_POSITIONAFTER(int position)</a><br />
1125 <a class="message" href="#SCI_COUNTCHARACTERS">SCI_COUNTCHARACTERS(int startPos, int endPos)</a><br />
1126 <a class="message" href="#SCI_TEXTWIDTH">SCI_TEXTWIDTH(int styleNumber, const char *text)</a><br />
1127 <a class="message" href="#SCI_TEXTHEIGHT">SCI_TEXTHEIGHT(int line)</a><br />
1128 <a class="message" href="#SCI_CHOOSECARETX">SCI_CHOOSECARETX</a><br />
1129 <a class="message" href="#SCI_MOVESELECTEDLINESUP">SCI_MOVESELECTEDLINESUP</a><br />
1130 <a class="message" href="#SCI_MOVESELECTEDLINESDOWN">SCI_MOVESELECTEDLINESDOWN</a><br />
1131 </code>
1133 <p><b id="SCI_GETTEXTLENGTH">SCI_GETTEXTLENGTH</b><br />
1134 <b id="SCI_GETLENGTH">SCI_GETLENGTH</b><br />
1135 Both these messages return the length of the document in bytes.</p>
1137 <p><b id="SCI_GETLINECOUNT">SCI_GETLINECOUNT</b><br />
1138 This returns the number of lines in the document. An empty document contains 1 line. A
1139 document holding only an end of line sequence has 2 lines.</p>
1141 <p><b id="SCI_SETFIRSTVISIBLELINE">SCI_SETFIRSTVISIBLELINE(int lineDisplay)</b><br />
1142 <b id="SCI_GETFIRSTVISIBLELINE">SCI_GETFIRSTVISIBLELINE</b><br />
1143 These messages retrieve and set the line number of the first visible line in the Scintilla view. The first line
1144 in the document is numbered 0. The value is a visible line rather than a document line.</p>
1146 <p><b id="SCI_LINESONSCREEN">SCI_LINESONSCREEN</b><br />
1147 This returns the number of complete lines visible on the screen. With a constant line height,
1148 this is the vertical space available divided by the line separation. Unless you arrange to size
1149 your window to an integral number of lines, there may be a partial line visible at the bottom
1150 of the view.</p>
1152 <p><b id="SCI_GETMODIFY">SCI_GETMODIFY</b><br />
1153 This returns non-zero if the document is modified and 0 if it is unmodified. The modified
1154 status of a document is determined by the undo position relative to the save point. The save
1155 point is set by <a class="message" href="#SCI_SETSAVEPOINT"><code>SCI_SETSAVEPOINT</code></a>,
1156 usually when you have saved data to a file.</p>
1158 <p>If you need to be notified when the document becomes modified, Scintilla notifies the
1159 container that it has entered or left the save point with the <a class="message"
1160 href="#SCN_SAVEPOINTREACHED"><code>SCN_SAVEPOINTREACHED</code></a> and <a class="message"
1161 href="#SCN_SAVEPOINTLEFT"><code>SCN_SAVEPOINTLEFT</code></a> <a class="jump"
1162 href="#Notifications">notification messages</a>.</p>
1164 <p><b id="SCI_SETSEL">SCI_SETSEL(int anchorPos, int currentPos)</b><br />
1165 This message sets both the anchor and the current position. If <code>currentPos</code> is
1166 negative, it means the end of the document. If <code>anchorPos</code> is negative, it means
1167 remove any selection (i.e. set the anchor to the same position as <code>currentPos</code>). The
1168 caret is scrolled into view after this operation.</p>
1170 <p><b id="SCI_GOTOPOS">SCI_GOTOPOS(int pos)</b><br />
1171 This removes any selection, sets the caret at <code>pos</code> and scrolls the view to make
1172 the caret visible, if necessary. It is equivalent to
1173 <code>SCI_SETSEL(pos, pos)</code>. The anchor position is set the same as the current
1174 position.</p>
1176 <p><b id="SCI_GOTOLINE">SCI_GOTOLINE(int line)</b><br />
1177 This removes any selection and sets the caret at the start of line number <code>line</code>
1178 and scrolls the view (if needed) to make it visible. The anchor position is set the same as the
1179 current position. If <code>line</code> is outside the lines in the document (first line is 0),
1180 the line set is the first or last.</p>
1182 <p><b id="SCI_SETCURRENTPOS">SCI_SETCURRENTPOS(int pos)</b><br />
1183 This sets the current position and creates a selection between the anchor and the current
1184 position. The caret is not scrolled into view.</p>
1186 <p>See also: <a class="message" href="#SCI_SCROLLCARET"><code>SCI_SCROLLCARET</code></a></p>
1188 <p><b id="SCI_GETCURRENTPOS">SCI_GETCURRENTPOS</b><br />
1189 This returns the current position.</p>
1191 <p><b id="SCI_SETANCHOR">SCI_SETANCHOR(int pos)</b><br />
1192 This sets the anchor position and creates a selection between the anchor position and the
1193 current position. The caret is not scrolled into view.</p>
1195 <p>See also: <a class="message" href="#SCI_SCROLLCARET"><code>SCI_SCROLLCARET</code></a></p>
1197 <p><b id="SCI_GETANCHOR">SCI_GETANCHOR</b><br />
1198 This returns the current anchor position.</p>
1200 <p><b id="SCI_SETSELECTIONSTART">SCI_SETSELECTIONSTART(int pos)</b><br />
1201 <b id="SCI_SETSELECTIONEND">SCI_SETSELECTIONEND(int pos)</b><br />
1202 These set the selection based on the assumption that the anchor position is less than the
1203 current position. They do not make the caret visible. The table shows the positions of the
1204 anchor and the current position after using these messages.</p>
1206 <table cellpadding="3" cellspacing="0" border="1" summary="SetSelection caret positioning">
1207 <thead align="center">
1208 <tr>
1209 <th>
1210 </th>
1212 <th>anchor</th>
1214 <th>current</th>
1215 </tr>
1216 </thead>
1218 <tbody align="center">
1219 <tr>
1220 <th><code>SCI_SETSELECTIONSTART</code></th>
1222 <td><code>pos</code></td>
1224 <td><code>Max(pos, current)</code></td>
1225 </tr>
1227 <tr>
1228 <th><code>SCI_SETSELECTIONEND</code></th>
1230 <td><code>Min(anchor, pos)</code></td>
1232 <td><code>pos</code></td>
1233 </tr>
1234 </tbody>
1235 </table>
1237 <p>See also: <a class="message" href="#SCI_SCROLLCARET"><code>SCI_SCROLLCARET</code></a></p>
1239 <p><b id="SCI_GETSELECTIONSTART">SCI_GETSELECTIONSTART</b><br />
1240 <b id="SCI_GETSELECTIONEND">SCI_GETSELECTIONEND</b><br />
1241 These return the start and end of the selection without regard to which end is the current
1242 position and which is the anchor. <code>SCI_GETSELECTIONSTART</code> returns the smaller of the
1243 current position or the anchor position. <code>SCI_GETSELECTIONEND</code> returns the larger of
1244 the two values.</p>
1246 <p><b id="SCI_SETEMPTYSELECTION">SCI_SETEMPTYSELECTION(int pos)</b><br />
1247 This removes any selection and sets the caret at <code>pos</code>. The caret is not scrolled into view.</p>
1249 <p><b id="SCI_SELECTALL">SCI_SELECTALL</b><br />
1250 This selects all the text in the document. The current position is not scrolled into view.</p>
1252 <p><b id="SCI_LINEFROMPOSITION">SCI_LINEFROMPOSITION(int pos)</b><br />
1253 This message returns the line that contains the position <code>pos</code> in the document. The
1254 return value is 0 if <code>pos</code> &lt;= 0. The return value is the last line if
1255 <code>pos</code> is beyond the end of the document.</p>
1257 <p><b id="SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(int line)</b><br />
1258 This returns the document position that corresponds with the start of the line. If
1259 <code>line</code> is negative, the position of the line holding the start of the selection is
1260 returned. If <code>line</code> is greater than the lines in the document, the return value is
1261 -1. If <code>line</code> is equal to the number of lines in the document (i.e. 1 line past the
1262 last line), the return value is the end of the document.</p>
1264 <p><b id="SCI_GETLINEENDPOSITION">SCI_GETLINEENDPOSITION(int line)</b><br />
1265 This returns the position at the end of the line, before any line end characters. If <code>line</code>
1266 is the last line in the document (which does not have any end of line characters), the result is the size of the
1267 document. If <code>line</code> is negative or <code>line</code> &gt;= <a class="message"
1268 href="#SCI_GETLINECOUNT"><code>SCI_GETLINECOUNT()</code></a>, the result is undefined.</p>
1270 <p><b id="SCI_LINELENGTH">SCI_LINELENGTH(int line)</b><br />
1271 This returns the length of the line, including any line end characters. If <code>line</code>
1272 is negative or beyond the last line in the document, the result is 0. If you want the length of
1273 the line not including any end of line characters, use <a class="message"
1274 href="#SCI_GETLINEENDPOSITION"><code>SCI_GETLINEENDPOSITION(line)</code></a> - <a class="message"
1275 href="#SCI_POSITIONFROMLINE"><code>SCI_POSITIONFROMLINE(line)</code></a>.</p>
1277 <p><b id="SCI_GETSELTEXT">SCI_GETSELTEXT(&lt;unused&gt;, char *text)</b><br />
1278 This copies the currently selected text and a terminating 0 byte to the <code>text</code>
1279 buffer. The buffer size should be determined by calling with a NULL pointer for the <code>text</code> argument
1280 <code>SCI_GETSELTEXT(0,0)</code>.
1281 This allows for rectangular and discontiguous selections as well as simple selections.
1282 See <a class="toc" href="#MultipleSelectionAndVirtualSpace">Multiple Selection</a> for information on
1283 how multiple and rectangular selections and virtual space are copied.</p>
1285 <p>See also: <code><a class="message" href="#SCI_GETCURLINE">SCI_GETCURLINE</a>,
1286 <a class="message" href="#SCI_GETLINE">SCI_GETLINE</a>,
1287 <a class="message" href="#SCI_GETTEXT">SCI_GETTEXT</a>,
1288 <a class="message" href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>,
1289 <a class="message" href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a>
1290 </code></p>
1292 <p><b id="SCI_GETCURLINE">SCI_GETCURLINE(int textLen, char *text)</b><br />
1293 This retrieves the text of the line containing the caret and returns the position within the
1294 line of the caret. Pass in <code>char* text</code> pointing at a buffer large enough to hold
1295 the text you wish to retrieve and a terminating 0 character.
1296 Set <code>textLen</code> to the
1297 length of the buffer which must be at least 1 to hold the terminating 0 character.
1298 If the text argument is 0 then the length that should be allocated
1299 to store the entire current line is returned.</p>
1301 <p>See also: <code><a class="message" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>, <a
1302 class="message" href="#SCI_GETLINE">SCI_GETLINE</a>, <a class="message"
1303 href="#SCI_GETTEXT">SCI_GETTEXT</a>, <a class="message"
1304 href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>, <a class="message"
1305 href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a></code></p>
1307 <p><b id="SCI_SELECTIONISRECTANGLE">SCI_SELECTIONISRECTANGLE</b><br />
1308 This returns 1 if the current selection is in rectangle mode, 0 if not.</p>
1310 <p><b id="SCI_SETSELECTIONMODE">SCI_SETSELECTIONMODE(int mode)</b><br />
1311 <b id="SCI_GETSELECTIONMODE">SCI_GETSELECTIONMODE</b><br />
1312 The two functions set and get the selection mode, which can be
1313 stream (<code>SC_SEL_STREAM</code>=0) or
1314 rectangular (<code>SC_SEL_RECTANGLE</code>=1) or
1315 by lines (<code>SC_SEL_LINES</code>=2)
1316 or thin rectangular (<code>SC_SEL_THIN</code>=3).
1317 When set in these modes, regular caret moves will extend or reduce the selection,
1318 until the mode is cancelled by a call with same value or with <code>SCI_CANCEL</code>.
1319 The get function returns the current mode even if the selection was made by mouse
1320 or with regular extended moves.
1321 <code>SC_SEL_THIN</code> is the mode after a rectangular selection has been typed into and ensures
1322 that no characters are selected.</p>
1324 <p><b id="SCI_GETLINESELSTARTPOSITION">SCI_GETLINESELSTARTPOSITION(int line)</b><br />
1325 <b id="SCI_GETLINESELENDPOSITION">SCI_GETLINESELENDPOSITION(int line)</b><br />
1326 Retrieve the position of the start and end of the selection at the given line with
1327 INVALID_POSITION returned if no selection on this line.</p>
1329 <p><b id="SCI_MOVECARETINSIDEVIEW">SCI_MOVECARETINSIDEVIEW</b><br />
1330 If the caret is off the top or bottom of the view, it is moved to the nearest line that is
1331 visible to its current position. Any selection is lost.</p>
1333 <p><b id="SCI_WORDENDPOSITION">SCI_WORDENDPOSITION(int position, bool
1334 onlyWordCharacters)</b><br />
1335 <b id="SCI_WORDSTARTPOSITION">SCI_WORDSTARTPOSITION(int position, bool
1336 onlyWordCharacters)</b><br />
1337 These messages return the start and end of words using the same definition of words as used
1338 internally within Scintilla. You can set your own list of characters that count as words with
1339 <a class="message" href="#SCI_SETWORDCHARS"><code>SCI_SETWORDCHARS</code></a>. The position
1340 sets the start or the search, which is forwards when searching for the end and backwards when
1341 searching for the start.</p>
1343 <p>Set <code>onlyWordCharacters</code> to <code>true</code> (1) to stop searching at the first
1344 non-word character in the search direction. If <code>onlyWordCharacters</code> is
1345 <code>false</code> (0), the first character in the search direction sets the type of the search
1346 as word or non-word and the search stops at the first non-matching character. Searches are also
1347 terminated by the start or end of the document.</p>
1349 <p>If "w" represents word characters and "." represents non-word characters and "|" represents
1350 the position and <code>true</code> or <code>false</code> is the state of
1351 <code>onlyWordCharacters</code>:</p>
1353 <table cellpadding="3" cellspacing="0" border="1" summary="Word start and end positions">
1354 <thead align="center">
1355 <tr>
1356 <th>Initial state</th>
1358 <th>end, true</th>
1360 <th>end, false</th>
1362 <th>start, true</th>
1364 <th>start, false</th>
1365 </tr>
1366 </thead>
1368 <tbody align="center">
1369 <tr>
1370 <td>..ww..|..ww..</td>
1372 <td>..ww..|..ww..</td>
1374 <td>..ww....|ww..</td>
1376 <td>..ww..|..ww..</td>
1378 <td>..ww|....ww..</td>
1379 </tr>
1381 <tr>
1382 <td>....ww|ww....</td>
1384 <td>....wwww|....</td>
1386 <td>....wwww|....</td>
1388 <td>....|wwww....</td>
1390 <td>....|wwww....</td>
1391 </tr>
1393 <tr>
1394 <td>..ww|....ww..</td>
1396 <td>..ww|....ww..</td>
1398 <td>..ww....|ww..</td>
1400 <td>..|ww....ww..</td>
1402 <td>..|ww....ww..</td>
1403 </tr>
1405 <tr>
1406 <td>..ww....|ww..</td>
1408 <td>..ww....ww|..</td>
1410 <td>..ww....ww|..</td>
1412 <td>..ww....|ww..</td>
1414 <td>..ww|....ww..</td>
1415 </tr>
1416 </tbody>
1417 </table>
1419 <p><b id="SCI_POSITIONBEFORE">SCI_POSITIONBEFORE(int position)</b><br />
1420 <b id="SCI_POSITIONAFTER">SCI_POSITIONAFTER(int position)</b><br />
1421 These messages return the position before and after another position
1422 in the document taking into account the current code page. The minimum
1423 position returned is 0 and the maximum is the last position in the document.
1424 If called with a position within a multi byte character will return the position
1425 of the start/end of that character.</p>
1427 <p><b id="SCI_COUNTCHARACTERS">SCI_COUNTCHARACTERS(int startPos, int endPos)</b><br />
1428 Returns the number of whole characters between two positions..</p>
1430 <p><b id="SCI_TEXTWIDTH">SCI_TEXTWIDTH(int styleNumber, const char *text)</b><br />
1431 This returns the pixel width of a string drawn in the given <code>styleNumber</code> which can
1432 be used, for example, to decide how wide to make the line number margin in order to display a
1433 given number of numerals.</p>
1435 <p><b id="SCI_TEXTHEIGHT">SCI_TEXTHEIGHT(int line)</b><br />
1436 This returns the height in pixels of a particular line. Currently all lines are the same
1437 height.</p>
1439 <p><b id="SCI_GETCOLUMN">SCI_GETCOLUMN(int pos)</b><br />
1440 This message returns the column number of a position <code>pos</code> within the document
1441 taking the width of tabs into account. This returns the column number of the last tab on the
1442 line before <code>pos</code>, plus the number of characters between the last tab and
1443 <code>pos</code>. If there are no tab characters on the line, the return value is the number of
1444 characters up to the position on the line. In both cases, double byte characters count as a
1445 single character. This is probably only useful with monospaced fonts.</p>
1447 <p><b id="SCI_FINDCOLUMN">SCI_FINDCOLUMN(int line, int column)</b><br />
1448 This message returns the position of a <code>column</code> on a <code>line</code>
1449 taking the width of tabs into account. It treats a multi-byte character as a single column.
1450 Column numbers, like lines start at 0.</p>
1452 <p><b id="SCI_POSITIONFROMPOINT">SCI_POSITIONFROMPOINT(int x, int y)</b><br />
1453 <b id="SCI_POSITIONFROMPOINTCLOSE">SCI_POSITIONFROMPOINTCLOSE(int x, int y)</b><br />
1454 <code>SCI_POSITIONFROMPOINT</code> finds the closest character position to a point and
1455 <code>SCI_POSITIONFROMPOINTCLOSE</code> is similar but returns -1 if the point is outside the
1456 window or not close to any characters.</p>
1458 <p><b id="SCI_CHARPOSITIONFROMPOINT">SCI_CHARPOSITIONFROMPOINT(int x, int y)</b><br />
1459 <b id="SCI_CHARPOSITIONFROMPOINTCLOSE">SCI_CHARPOSITIONFROMPOINTCLOSE(int x, int y)</b><br />
1460 <code>SCI_CHARPOSITIONFROMPOINT</code> finds the closest character to a point and
1461 <code>SCI_CHARPOSITIONFROMPOINTCLOSE</code> is similar but returns -1 if the point is outside the
1462 window or not close to any characters. This is similar to the previous methods but finds characters rather than
1463 inter-character positions.</p>
1465 <p><b id="SCI_POINTXFROMPOSITION">SCI_POINTXFROMPOSITION(&lt;unused&gt;, int pos)</b><br />
1466 <b id="SCI_POINTYFROMPOSITION">SCI_POINTYFROMPOSITION(&lt;unused&gt;, int pos)</b><br />
1467 These messages return the x and y display pixel location of text at position <code>pos</code>
1468 in the document.</p>
1470 <p><b id="SCI_HIDESELECTION">SCI_HIDESELECTION(bool hide)</b><br />
1471 The normal state is to make the selection visible by drawing it as set by <a class="message"
1472 href="#SCI_SETSELFORE"><code>SCI_SETSELFORE</code></a> and <a class="message"
1473 href="#SCI_SETSELBACK"><code>SCI_SETSELBACK</code></a>. However, if you hide the selection, it
1474 is drawn as normal text.</p>
1476 <p><b id="SCI_CHOOSECARETX">SCI_CHOOSECARETX</b><br />
1477 Scintilla remembers the x value of the last position horizontally moved to explicitly by the
1478 user and this value is then used when moving vertically such as by using the up and down keys.
1479 This message sets the current x position of the caret as the remembered value.</p>
1481 <p><b id="SCI_MOVESELECTEDLINESUP">SCI_MOVESELECTEDLINESUP</b><br />
1482 Move the selected lines up one line, shifting the line above after the selection.
1483 The selection will be automatically extended to the beginning of the selection's first line and the end of the seletion's last line.
1484 If nothing was selected, the line the cursor is currently at will be selected.</p>
1486 <p><b id="SCI_MOVESELECTEDLINESDOWN">SCI_MOVESELECTEDLINESDOWN</b><br />
1487 Move the selected lines down one line, shifting the line below before the selection.
1488 The selection will be automatically extended to the beginning of the selection's first line and the end of the seletion's last line.
1489 If nothing was selected, the line the cursor is currently at will be selected.</p>
1491 <h2 id="MultipleSelectionAndVirtualSpace">Multiple Selection and Virtual Space</h2>
1493 <code>
1494 <a class="message" href="#SCI_SETMULTIPLESELECTION">SCI_SETMULTIPLESELECTION(bool multipleSelection)</a><br />
1495 <a class="message" href="#SCI_GETMULTIPLESELECTION">SCI_GETMULTIPLESELECTION</a><br />
1496 <a class="message" href="#SCI_SETADDITIONALSELECTIONTYPING">SCI_SETADDITIONALSELECTIONTYPING(bool additionalSelectionTyping)</a><br />
1497 <a class="message" href="#SCI_GETADDITIONALSELECTIONTYPING">SCI_GETADDITIONALSELECTIONTYPING</a><br />
1498 <a class="message" href="#SCI_SETMULTIPASTE">SCI_SETMULTIPASTE(int multiPaste)</a><br />
1499 <a class="message" href="#SCI_GETMULTIPASTE">SCI_GETMULTIPASTE</a><br />
1500 <a class="message" href="#SCI_SETVIRTUALSPACEOPTIONS">SCI_SETVIRTUALSPACEOPTIONS(int virtualSpaceOptions)</a><br />
1501 <a class="message" href="#SCI_GETVIRTUALSPACEOPTIONS">SCI_GETVIRTUALSPACEOPTIONS</a><br />
1502 <a class="message" href="#SCI_SETRECTANGULARSELECTIONMODIFIER">SCI_SETRECTANGULARSELECTIONMODIFIER(int modifier)</a><br />
1503 <a class="message" href="#SCI_GETRECTANGULARSELECTIONMODIFIER">SCI_GETRECTANGULARSELECTIONMODIFIER</a><br />
1504 <br />
1506 <a class="message" href="#SCI_GETSELECTIONS">SCI_GETSELECTIONS</a><br />
1507 <a class="message" href="#SCI_GETSELECTIONEMPTY">SCI_GETSELECTIONEMPTY</a><br />
1508 <a class="message" href="#SCI_CLEARSELECTIONS">SCI_CLEARSELECTIONS</a><br />
1509 <a class="message" href="#SCI_SETSELECTION">SCI_SETSELECTION(int caret, int anchor)</a><br />
1510 <a class="message" href="#SCI_ADDSELECTION">SCI_ADDSELECTION(int caret, int anchor)</a><br />
1511 <a class="message" href="#SCI_SETMAINSELECTION">SCI_SETMAINSELECTION(int selection)</a><br />
1512 <a class="message" href="#SCI_GETMAINSELECTION">SCI_GETMAINSELECTION</a><br />
1513 <br />
1515 <a class="message" href="#SCI_SETSELECTIONNCARET">SCI_SETSELECTIONNCARET(int selection, int pos)</a><br />
1516 <a class="message" href="#SCI_GETSELECTIONNCARET">SCI_GETSELECTIONNCARET(int selection)</a><br />
1517 <a class="message" href="#SCI_SETSELECTIONNCARETVIRTUALSPACE">SCI_SETSELECTIONNCARETVIRTUALSPACE(int selection, int space)</a><br />
1518 <a class="message" href="#SCI_GETSELECTIONNCARETVIRTUALSPACE">SCI_GETSELECTIONNCARETVIRTUALSPACE(int selection)</a><br />
1519 <a class="message" href="#SCI_SETSELECTIONNANCHOR">SCI_SETSELECTIONNANCHOR(int selection, int posAnchor)</a><br />
1520 <a class="message" href="#SCI_GETSELECTIONNANCHOR">SCI_GETSELECTIONNANCHOR(int selection)</a><br />
1521 <a class="message" href="#SCI_SETSELECTIONNANCHORVIRTUALSPACE">SCI_SETSELECTIONNANCHORVIRTUALSPACE(int selection, int space)</a><br />
1522 <a class="message" href="#SCI_GETSELECTIONNANCHORVIRTUALSPACE">SCI_GETSELECTIONNANCHORVIRTUALSPACE(int selection)</a><br />
1523 <a class="message" href="#SCI_SETSELECTIONNSTART">SCI_SETSELECTIONNSTART(int selection, int pos)</a><br />
1524 <a class="message" href="#SCI_GETSELECTIONNSTART">SCI_GETSELECTIONNSTART(int selection)</a><br />
1525 <a class="message" href="#SCI_SETSELECTIONNEND">SCI_SETSELECTIONNEND(int selection, int pos)</a><br />
1526 <a class="message" href="#SCI_GETSELECTIONNEND">SCI_GETSELECTIONNEND(int selection)</a><br />
1527 <br />
1529 <a class="message" href="#SCI_SETRECTANGULARSELECTIONCARET">SCI_SETRECTANGULARSELECTIONCARET(int pos)</a><br />
1530 <a class="message" href="#SCI_GETRECTANGULARSELECTIONCARET">SCI_GETRECTANGULARSELECTIONCARET</a><br />
1531 <a class="message" href="#SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE">SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE(int space)</a><br />
1532 <a class="message" href="#SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE">SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE</a><br />
1533 <a class="message" href="#SCI_SETRECTANGULARSELECTIONANCHOR">SCI_SETRECTANGULARSELECTIONANCHOR(int posAnchor)</a><br />
1534 <a class="message" href="#SCI_GETRECTANGULARSELECTIONANCHOR">SCI_GETRECTANGULARSELECTIONANCHOR</a><br />
1535 <a class="message" href="#SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE">SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE(int space)</a><br />
1536 <a class="message" href="#SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE">SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE</a><br />
1537 <br />
1539 <a class="message" href="#SCI_SETADDITIONALSELALPHA">SCI_SETADDITIONALSELALPHA(int alpha)</a><br />
1540 <a class="message" href="#SCI_GETADDITIONALSELALPHA">SCI_GETADDITIONALSELALPHA</a><br />
1541 <a class="message" href="#SCI_SETADDITIONALSELFORE">SCI_SETADDITIONALSELFORE(int colour)</a><br />
1542 <a class="message" href="#SCI_SETADDITIONALSELBACK">SCI_SETADDITIONALSELBACK(int colour)</a><br />
1543 <a class="message" href="#SCI_SETADDITIONALCARETFORE">SCI_SETADDITIONALCARETFORE(int colour)</a><br />
1544 <a class="message" href="#SCI_GETADDITIONALCARETFORE">SCI_GETADDITIONALCARETFORE</a><br />
1545 <a class="message" href="#SCI_SETADDITIONALCARETSBLINK">SCI_SETADDITIONALCARETSBLINK(bool additionalCaretsBlink)</a><br />
1546 <a class="message" href="#SCI_GETADDITIONALCARETSBLINK">SCI_GETADDITIONALCARETSBLINK</a><br />
1547 <a class="message" href="#SCI_SETADDITIONALCARETSVISIBLE">SCI_SETADDITIONALCARETSVISIBLE(bool additionalCaretsVisible)</a><br />
1548 <a class="message" href="#SCI_GETADDITIONALCARETSVISIBLE">SCI_GETADDITIONALCARETSVISIBLE</a><br />
1549 <br />
1551 <a class="message" href="#SCI_SWAPMAINANCHORCARET">SCI_SWAPMAINANCHORCARET</a><br />
1552 <a class="message" href="#SCI_ROTATESELECTION">SCI_ROTATESELECTION</a><br />
1553 </code>
1556 There may be multiple selections active at one time.
1557 More selections are made by holding down the Ctrl key while dragging with the mouse.
1558 The most recent selection is the main selection and determines which part of the document is shown automatically.
1559 Any selection apart from the main selection is called an additional selection.
1560 The calls in the previous section operate on the main selection.
1561 There is always at least one selection.
1562 </p>
1565 Rectangular selections are handled as multiple selections although the original rectangular range is remembered so that
1566 subsequent operations may be handled differently for rectangular selections. For example, pasting a rectangular selection
1567 places each piece in a vertical column.
1568 </p>
1571 Virtual space is space beyond the end of each line. The caret may be moved into virtual space but no real space will be
1572 added to the document until there is some text typed or some other text insertion command is used.
1573 </p>
1575 <p>When discontiguous selections are copied to the clipboard, each selection is added to the clipboard text
1576 in order with no delimiting characters.
1577 For rectangular selections the document's line end is added after each line's text. Rectangular selections
1578 are always copied from top line to bottom, not in the in order of selection.Virtual space is not copied.</p>
1581 <b id="SCI_SETMULTIPLESELECTION">SCI_SETMULTIPLESELECTION(bool multipleSelection)</b><br />
1582 <b id="SCI_GETMULTIPLESELECTION">SCI_GETMULTIPLESELECTION</b><br />
1583 Enable or disable multiple selection. When multiple selection is disabled, it is not possible to select
1584 multiple ranges by holding down the Ctrl key while dragging with the mouse.</p>
1587 <b id="SCI_SETADDITIONALSELECTIONTYPING">SCI_SETADDITIONALSELECTIONTYPING(bool additionalSelectionTyping)</b><br />
1588 <b id="SCI_GETADDITIONALSELECTIONTYPING">SCI_GETADDITIONALSELECTIONTYPING</b><br />
1589 Whether typing, backspace, or delete works with multiple selections simultaneously.</p>
1592 <b id="SCI_SETMULTIPASTE">SCI_SETMULTIPASTE(int multiPaste)</b><br />
1593 <b id="SCI_GETMULTIPASTE">SCI_GETMULTIPASTE</b><br />
1594 When pasting into multiple selections, the pasted text can go into just the main selection with <code>SC_MULTIPASTE_ONCE</code>=0
1595 or into each selection with <code>SC_MULTIPASTE_EACH</code>=1. <code>SC_MULTIPASTE_ONCE</code> is the default.</p>
1598 <b id="SCI_SETVIRTUALSPACEOPTIONS">SCI_SETVIRTUALSPACEOPTIONS(int virtualSpace)</b><br />
1599 <b id="SCI_GETVIRTUALSPACEOPTIONS">SCI_GETVIRTUALSPACEOPTIONS</b><br />
1600 Virtual space can be enabled or disabled for rectangular selections or in other circumstances or in both.
1601 There are two bit flags <code>SCVS_RECTANGULARSELECTION</code>=1 and
1602 <code>SCVS_USERACCESSIBLE</code>=2 which can be set independently.
1603 <code>SCVS_NONE</code>=0, the default, disables all use of virtual space.</p>
1606 <b id="SCI_SETRECTANGULARSELECTIONMODIFIER">SCI_SETRECTANGULARSELECTIONMODIFIER(int modifier)</b><br />
1607 <b id="SCI_GETRECTANGULARSELECTIONMODIFIER">SCI_GETRECTANGULARSELECTIONMODIFIER</b><br />
1608 On GTK+, the key used to indicate that a rectangular selection should be created when combined with a mouse drag can be set.
1609 The three possible values are <code>SCMOD_CTRL</code>=2 (default), <code>SCMOD_ALT</code>=4 or <code>SCMOD_SUPER</code>=8.
1610 Since <code>SCMOD_ALT</code> is often already used by a window manager, the window manager may need configuring to allow this choice.
1611 <code>SCMOD_SUPER</code> is often a system dependent modifier key such as the Left Windows key on a Windows keyboard or the
1612 Command key on a Mac.</p>
1615 <b id="SCI_GETSELECTIONS">SCI_GETSELECTIONS</b><br />
1616 Return the number of selections currently active.</p>
1619 <b id="SCI_GETSELECTIONEMPTY">SCI_GETSELECTIONEMPTY</b><br />
1620 Return 1 if every selected range is empty else 0.</p>
1623 <b id="SCI_CLEARSELECTIONS">SCI_CLEARSELECTIONS</b><br />
1624 Set a single empty selection at 0 as the only selection.</p>
1627 <b id="SCI_SETSELECTION">SCI_SETSELECTION(int caret, int anchor)</b><br />
1628 Set a single selection from <code>anchor</code> to <code>caret</code> as the only selection.</p>
1631 <b id="SCI_ADDSELECTION">SCI_ADDSELECTION(int caret, int anchor)</b><br />
1632 Add a new selection from <code>anchor</code> to <code>caret</code> as the main selection retaining all other
1633 selections as additional selections.
1634 Since there is always at least one selection, to set a list of selections, the first selection should be
1635 added with <code>SCI_SETSELECTION</code> and later selections added with <code>SCI_ADDSELECTION</code></p>
1638 <b id="SCI_SETMAINSELECTION">SCI_SETMAINSELECTION(int selection)</b><br />
1639 <b id="SCI_GETMAINSELECTION">SCI_GETMAINSELECTION</b><br />
1640 One of the selections is the main selection which is used to determine what range of text is automatically visible.
1641 The main selection may be displayed in different colours or with a differently styled caret.
1642 Only an already existing selection can be made main.</p>
1645 <b id="SCI_SETSELECTIONNCARET">SCI_SETSELECTIONNCARET(int selection, int pos)</b><br />
1646 <b id="SCI_GETSELECTIONNCARET">SCI_GETSELECTIONNCARET(int selection)</b><br />
1647 <b id="SCI_SETSELECTIONNCARETVIRTUALSPACE">SCI_SETSELECTIONNCARETVIRTUALSPACE(int selection, int space)</b><br />
1648 <b id="SCI_GETSELECTIONNCARETVIRTUALSPACE">SCI_GETSELECTIONNCARETVIRTUALSPACE(int selection)</b><br />
1649 <b id="SCI_SETSELECTIONNANCHOR">SCI_SETSELECTIONNANCHOR(int selection, int posAnchor)</b><br />
1650 <b id="SCI_GETSELECTIONNANCHOR">SCI_GETSELECTIONNANCHOR(int selection)</b><br />
1651 <b id="SCI_SETSELECTIONNANCHORVIRTUALSPACE">SCI_SETSELECTIONNANCHORVIRTUALSPACE(int selection, int space)</b><br />
1652 <b id="SCI_GETSELECTIONNANCHORVIRTUALSPACE">SCI_GETSELECTIONNANCHORVIRTUALSPACE(int selection)</b><br />
1653 Set or query the position and amount of virtual space for the caret and anchor of each already existing selection.</p>
1656 <b id="SCI_SETSELECTIONNSTART">SCI_SETSELECTIONNSTART(int selection, int pos)</b><br />
1657 <b id="SCI_GETSELECTIONNSTART">SCI_GETSELECTIONNSTART(int selection)</b><br />
1658 <b id="SCI_SETSELECTIONNEND">SCI_SETSELECTIONNEND(int selection, int pos)</b><br />
1659 <b id="SCI_GETSELECTIONNEND">SCI_GETSELECTIONNEND(int selection)</b><br />
1660 Set or query the start and end position of each already existing selection.
1661 Mostly of use to query each range for its text.</p>
1664 <b id="SCI_SETRECTANGULARSELECTIONCARET">SCI_SETRECTANGULARSELECTIONCARET(int pos)</b><br />
1665 <b id="SCI_GETRECTANGULARSELECTIONCARET">SCI_GETRECTANGULARSELECTIONCARET</b><br />
1666 <b id="SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE">SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE(int space)</b><br />
1667 <b id="SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE">SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE</b><br />
1668 <b id="SCI_SETRECTANGULARSELECTIONANCHOR">SCI_SETRECTANGULARSELECTIONANCHOR(int posAnchor)</b><br />
1669 <b id="SCI_GETRECTANGULARSELECTIONANCHOR">SCI_GETRECTANGULARSELECTIONANCHOR</b><br />
1670 <b id="SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE">SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE(int space)</b><br />
1671 <b id="SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE">SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE</b><br />
1672 Set or query the position and amount of virtual space for the caret and anchor of the rectangular selection.
1673 After setting the rectangular selection, this is broken down into multiple selections, one for each line.</p>
1676 <b id="SCI_SETADDITIONALSELALPHA">SCI_SETADDITIONALSELALPHA(int alpha)</b><br />
1677 <b id="SCI_GETADDITIONALSELALPHA">SCI_GETADDITIONALSELALPHA</b><br />
1678 <b id="SCI_SETADDITIONALSELFORE">SCI_SETADDITIONALSELFORE(int <a class="jump" href="#colour">colour</a>)</b><br />
1679 <b id="SCI_SETADDITIONALSELBACK">SCI_SETADDITIONALSELBACK(int <a class="jump" href="#colour">colour</a>)</b><br />
1680 Modify the appearence of additional selections so that they can be differentiated from the main selection which has its appearence set with
1681 <a class="message" href="#SCI_SETSELALPHA"><code>SCI_SETSELALPHA</code></a>,
1682 <a class="message" href="#SCI_GETSELALPHA"><code>SCI_GETSELALPHA</code></a>,
1683 <a class="message" href="#SCI_SETSELFORE"><code>SCI_SETSELFORE</code></a>, and
1684 <a class="message" href="#SCI_SETSELBACK"><code>SCI_SETSELBACK</code></a>.</p>
1687 <b id="SCI_SETADDITIONALCARETFORE">SCI_SETADDITIONALCARETFORE(int <a class="jump" href="#colour">colour</a>)</b><br />
1688 <b id="SCI_GETADDITIONALCARETFORE">SCI_GETADDITIONALCARETFORE</b><br />
1689 <b id="SCI_SETADDITIONALCARETSBLINK">SCI_SETADDITIONALCARETSBLINK(bool additionalCaretsBlink)</b><br />
1690 <b id="SCI_GETADDITIONALCARETSBLINK">SCI_GETADDITIONALCARETSBLINK</b><br />
1691 Modify the appearence of additional carets so that they can be differentiated from the main caret which has its appearence set with
1692 <a class="message" href="#SCI_SETCARETFORE"><code>SCI_SETCARETFORE</code></a>,
1693 <a class="message" href="#SCI_GETCARETFORE"><code>SCI_GETCARETFORE</code></a>,
1694 <a class="message" href="#SCI_SETCARETPERIOD"><code>SCI_SETCARETPERIOD</code></a>, and
1695 <a class="message" href="#SCI_GETCARETPERIOD"><code>SCI_GETCARETPERIOD</code></a>.</p>
1698 <b id="SCI_SETADDITIONALCARETSVISIBLE">SCI_SETADDITIONALCARETSVISIBLE(bool additionalCaretsVisible)</b><br />
1699 <b id="SCI_GETADDITIONALCARETSVISIBLE">SCI_GETADDITIONALCARETSVISIBLE</b><br />
1700 Determine whether to show additional carets (defaults to <code>true</code>).</p>
1703 <b id="SCI_SWAPMAINANCHORCARET">SCI_SWAPMAINANCHORCARET</b><br />
1704 <b id="SCI_ROTATESELECTION">SCI_ROTATESELECTION</b><br />
1705 These commands may be assigned to keys to make it possible to manipulate multiple selections.
1706 <code>SCI_SWAPMAINANCHORCARET</code> moves the caret to the opposite end of the main selection.
1707 <code>SCI_ROTATESELECTION</code> makes the next selection be the main selection.
1708 </p>
1710 <h2 id="ScrollingAndAutomaticScrolling">Scrolling and automatic scrolling</h2>
1711 <code><a class="message" href="#SCI_LINESCROLL">SCI_LINESCROLL(int column, int line)</a><br />
1712 <a class="message" href="#SCI_SCROLLCARET">SCI_SCROLLCARET</a><br />
1713 <a class="message" href="#SCI_SETXCARETPOLICY">SCI_SETXCARETPOLICY(int caretPolicy, int
1714 caretSlop)</a><br />
1715 <a class="message" href="#SCI_SETYCARETPOLICY">SCI_SETYCARETPOLICY(int caretPolicy, int
1716 caretSlop)</a><br />
1717 <a class="message" href="#SCI_SETVISIBLEPOLICY">SCI_SETVISIBLEPOLICY(int caretPolicy, int
1718 caretSlop)</a><br />
1719 <a class="message" href="#SCI_SETHSCROLLBAR">SCI_SETHSCROLLBAR(bool visible)</a><br />
1720 <a class="message" href="#SCI_GETHSCROLLBAR">SCI_GETHSCROLLBAR</a><br />
1721 <a class="message" href="#SCI_SETVSCROLLBAR">SCI_SETVSCROLLBAR(bool visible)</a><br />
1722 <a class="message" href="#SCI_GETVSCROLLBAR">SCI_GETVSCROLLBAR</a><br />
1723 <a class="message" href="#SCI_GETXOFFSET">SCI_GETXOFFSET</a><br />
1724 <a class="message" href="#SCI_SETXOFFSET">SCI_SETXOFFSET(int xOffset)</a><br />
1725 <a class="message" href="#SCI_SETSCROLLWIDTH">SCI_SETSCROLLWIDTH(int pixelWidth)</a><br />
1726 <a class="message" href="#SCI_GETSCROLLWIDTH">SCI_GETSCROLLWIDTH</a><br />
1727 <a class="message" href="#SCI_SETSCROLLWIDTHTRACKING">SCI_SETSCROLLWIDTHTRACKING(bool tracking)</a><br />
1728 <a class="message" href="#SCI_GETSCROLLWIDTHTRACKING">SCI_GETSCROLLWIDTHTRACKING</a><br />
1729 <a class="message" href="#SCI_SETENDATLASTLINE">SCI_SETENDATLASTLINE(bool
1730 endAtLastLine)</a><br />
1731 <a class="message" href="#SCI_GETENDATLASTLINE">SCI_GETENDATLASTLINE</a><br />
1732 </code>
1734 <p><b id="SCI_LINESCROLL">SCI_LINESCROLL(int column, int line)</b><br />
1735 This will attempt to scroll the display by the number of columns and lines that you specify.
1736 Positive line values increase the line number at the top of the screen (i.e. they move the text
1737 upwards as far as the user is concerned), Negative line values do the reverse.</p>
1739 <p>The column measure is the width of a space in the default style. Positive values increase
1740 the column at the left edge of the view (i.e. they move the text leftwards as far as the user
1741 is concerned). Negative values do the reverse.</p>
1743 <p>See also: <a class="message" href="#SCI_SETXOFFSET"><code>SCI_SETXOFFSET</code></a></p>
1745 <p><b id="SCI_SCROLLCARET">SCI_SCROLLCARET</b><br />
1746 If the current position (this is the caret if there is no selection) is not visible, the view
1747 is scrolled to make it visible according to the current caret policy.</p>
1749 <p><b id="SCI_SETXCARETPOLICY">SCI_SETXCARETPOLICY(int caretPolicy, int caretSlop)</b><br />
1750 <b id="SCI_SETYCARETPOLICY">SCI_SETYCARETPOLICY(int caretPolicy, int caretSlop)</b><br />
1751 These set the caret policy. The value of <code>caretPolicy</code> is a combination of
1752 <code>CARET_SLOP</code>, <code>CARET_STRICT</code>, <code>CARET_JUMPS</code> and
1753 <code>CARET_EVEN</code>.</p>
1755 <table cellpadding="1" cellspacing="2" border="0" summary="Caret policy">
1756 <tbody valign="top">
1757 <tr>
1758 <th align="left"><code>CARET_SLOP</code></th>
1760 <td>If set, we can define a slop value: <code>caretSlop</code>. This value defines an
1761 unwanted zone (UZ) where the caret is... unwanted. This zone is defined as a number of
1762 pixels near the vertical margins, and as a number of lines near the horizontal margins.
1763 By keeping the caret away from the edges, it is seen within its context. This makes it
1764 likely that the identifier that the caret is on can be completely seen, and that the
1765 current line is seen with some of the lines following it, which are often dependent on
1766 that line.</td>
1767 </tr>
1769 <tr>
1770 <th align="left"><code>CARET_STRICT</code></th>
1772 <td>If set, the policy set by <code>CARET_SLOP</code> is enforced... strictly. The caret
1773 is centred on the display if <code>caretSlop</code> is not set, and cannot go in the UZ
1774 if <code>caretSlop</code> is set.</td>
1775 </tr>
1777 <tr>
1778 <th align="left"><code>CARET_JUMPS</code></th>
1780 <td>If set, the display is moved more energetically so the caret can move in the same
1781 direction longer before the policy is applied again. '3UZ' notation is used to indicate
1782 three time the size of the UZ as a distance to the margin.</td>
1783 </tr>
1785 <tr>
1786 <th align="left"><code>CARET_EVEN</code></th>
1788 <td>If not set, instead of having symmetrical UZs, the left and bottom UZs are extended
1789 up to right and top UZs respectively. This way, we favour the displaying of useful
1790 information: the beginning of lines, where most code reside, and the lines after the
1791 caret, for example, the body of a function.</td>
1792 </tr>
1793 </tbody>
1794 </table>
1796 <table cellpadding="3" cellspacing="0" border="1" summary="Caret positioning">
1797 <thead align="center">
1798 <tr>
1799 <th>slop</th>
1801 <th>strict</th>
1803 <th>jumps</th>
1805 <th>even</th>
1807 <th>Caret can go to the margin</th>
1809 <th>On reaching limit (going out of visibility<br />
1810 or going into the UZ) display is...</th>
1811 </tr>
1812 </thead>
1814 <tbody align="center">
1815 <tr>
1816 <td>0</td>
1818 <td>0</td>
1820 <td>0</td>
1822 <td>0</td>
1824 <td>Yes</td>
1826 <td>moved to put caret on top/on right</td>
1827 </tr>
1829 <tr>
1830 <td>0</td>
1832 <td>0</td>
1834 <td>0</td>
1836 <td>1</td>
1838 <td>Yes</td>
1840 <td>moved by one position</td>
1841 </tr>
1843 <tr>
1844 <td>0</td>
1846 <td>0</td>
1848 <td>1</td>
1850 <td>0</td>
1852 <td>Yes</td>
1854 <td>moved to put caret on top/on right</td>
1855 </tr>
1857 <tr>
1858 <td>0</td>
1860 <td>0</td>
1862 <td>1</td>
1864 <td>1</td>
1866 <td>Yes</td>
1868 <td>centred on the caret</td>
1869 </tr>
1871 <tr>
1872 <td>0</td>
1874 <td>1</td>
1876 <td>-</td>
1878 <td>0</td>
1880 <td>Caret is always on top/on right of display</td>
1882 <td>-</td>
1883 </tr>
1885 <tr>
1886 <td>0</td>
1888 <td>1</td>
1890 <td>-</td>
1892 <td>1</td>
1894 <td>No, caret is always centred</td>
1896 <td>-</td>
1897 </tr>
1899 <tr>
1900 <td>1</td>
1902 <td>0</td>
1904 <td>0</td>
1906 <td>0</td>
1908 <td>Yes</td>
1910 <td>moved to put caret out of the asymmetrical UZ</td>
1911 </tr>
1913 <tr>
1914 <td>1</td>
1916 <td>0</td>
1918 <td>0</td>
1920 <td>1</td>
1922 <td>Yes</td>
1924 <td>moved to put caret out of the UZ</td>
1925 </tr>
1927 <tr>
1928 <td>1</td>
1930 <td>0</td>
1932 <td>1</td>
1934 <td>0</td>
1936 <td>Yes</td>
1938 <td>moved to put caret at 3UZ of the top or right margin</td>
1939 </tr>
1941 <tr>
1942 <td>1</td>
1944 <td>0</td>
1946 <td>1</td>
1948 <td>1</td>
1950 <td>Yes</td>
1952 <td>moved to put caret at 3UZ of the margin</td>
1953 </tr>
1955 <tr>
1956 <td>1</td>
1958 <td>1</td>
1960 <td>-</td>
1962 <td>0</td>
1964 <td>Caret is always at UZ of top/right margin</td>
1966 <td>-</td>
1967 </tr>
1969 <tr>
1970 <td>1</td>
1972 <td>1</td>
1974 <td>0</td>
1976 <td>1</td>
1978 <td>No, kept out of UZ</td>
1980 <td>moved by one position</td>
1981 </tr>
1983 <tr>
1984 <td>1</td>
1986 <td>1</td>
1988 <td>1</td>
1990 <td>0</td>
1992 <td>No, kept out of UZ</td>
1994 <td>moved to put caret at 3UZ of the margin</td>
1995 </tr>
1996 </tbody>
1997 </table>
1999 <p><b id="SCI_SETVISIBLEPOLICY">SCI_SETVISIBLEPOLICY(int caretPolicy, int caretSlop)</b><br />
2000 This determines how the vertical positioning is determined when <a class="message"
2001 href="#SCI_ENSUREVISIBLEENFORCEPOLICY"><code>SCI_ENSUREVISIBLEENFORCEPOLICY</code></a> is
2002 called. It takes <code>VISIBLE_SLOP</code> and <code>VISIBLE_STRICT</code> flags for the policy
2003 parameter. It is similar in operation to <a class="message"
2004 href="#SCI_SETYCARETPOLICY"><code>SCI_SETYCARETPOLICY(int caretPolicy, int
2005 caretSlop)</code></a>.</p>
2007 <p><b id="SCI_SETHSCROLLBAR">SCI_SETHSCROLLBAR(bool visible)</b><br />
2008 <b id="SCI_GETHSCROLLBAR">SCI_GETHSCROLLBAR</b><br />
2009 The horizontal scroll bar is only displayed if it is needed for the assumed width.
2010 If you never wish to see it, call
2011 <code>SCI_SETHSCROLLBAR(0)</code>. Use <code>SCI_SETHSCROLLBAR(1)</code> to enable it again.
2012 <code>SCI_GETHSCROLLBAR</code> returns the current state. The default state is to display it
2013 when needed.</p>
2014 <p>See also: <a class="message" href="#SCI_SETSCROLLWIDTH">SCI_SETSCROLLWIDTH</a>.</p>
2016 <p><b id="SCI_SETVSCROLLBAR">SCI_SETVSCROLLBAR(bool visible)</b><br />
2017 <b id="SCI_GETVSCROLLBAR">SCI_GETVSCROLLBAR</b><br />
2018 By default, the vertical scroll bar is always displayed when required. You can choose to hide
2019 or show it with <code>SCI_SETVSCROLLBAR</code> and get the current state with
2020 <code>SCI_GETVSCROLLBAR</code>.</p>
2022 <p><b id="SCI_SETXOFFSET">SCI_SETXOFFSET(int xOffset)</b><br />
2023 <b id="SCI_GETXOFFSET">SCI_GETXOFFSET</b><br />
2024 The <code>xOffset</code> is the horizontal scroll position in pixels of the start of the text
2025 view. A value of 0 is the normal position with the first text column visible at the left of the
2026 view.</p>
2028 <p>See also: <a class="message" href="#SCI_LINESCROLL"><code>SCI_LINESCROLL</code></a></p>
2030 <p><b id="SCI_SETSCROLLWIDTH">SCI_SETSCROLLWIDTH(int pixelWidth)</b><br />
2031 <b id="SCI_GETSCROLLWIDTH">SCI_GETSCROLLWIDTH</b><br />
2032 For performance, Scintilla does not measure the display width of the document to determine
2033 the properties of the horizontal scroll bar. Instead, an assumed width is used.
2034 These messages set and get the document width in pixels assumed by Scintilla.
2035 The default value is 2000.
2036 To ensure the width of the currently visible lines can be scrolled use
2037 <a class="message" href="#SCI_SETSCROLLWIDTHTRACKING"><code>SCI_SETSCROLLWIDTHTRACKING</code></a></p>
2039 <p><b id="SCI_SETSCROLLWIDTHTRACKING">SCI_SETSCROLLWIDTHTRACKING(bool tracking)</b><br />
2040 <b id="SCI_GETSCROLLWIDTHTRACKING">SCI_GETSCROLLWIDTHTRACKING</b><br />
2041 If scroll width tracking is enabled then the scroll width is adjusted to ensure that all of the lines currently
2042 displayed can be completely scrolled. This mode never adjusts the scroll width to be narrower.</p>
2044 <p><b id="SCI_SETENDATLASTLINE">SCI_SETENDATLASTLINE(bool endAtLastLine)</b><br />
2045 <b id="SCI_GETENDATLASTLINE">SCI_GETENDATLASTLINE</b><br />
2046 <code>SCI_SETENDATLASTLINE</code> sets the scroll range so that maximum scroll position has
2047 the last line at the bottom of the view (default). Setting this to <code>false</code> allows
2048 scrolling one page below the last line.</p>
2050 <h2 id="WhiteSpace">White space</h2>
2051 <code><a class="message" href="#SCI_SETVIEWWS">SCI_SETVIEWWS(int wsMode)</a><br />
2052 <a class="message" href="#SCI_GETVIEWWS">SCI_GETVIEWWS</a><br />
2053 <a class="message" href="#SCI_SETWHITESPACEFORE">SCI_SETWHITESPACEFORE(bool
2054 useWhitespaceForeColour, int colour)</a><br />
2055 <a class="message" href="#SCI_SETWHITESPACEBACK">SCI_SETWHITESPACEBACK(bool
2056 useWhitespaceBackColour, int colour)</a><br />
2057 <a class="message" href="#SCI_SETWHITESPACESIZE">SCI_SETWHITESPACESIZE(int
2058 size)</a><br />
2059 <a class="message" href="#SCI_GETWHITESPACESIZE">SCI_GETWHITESPACESIZE</a><br />
2060 <a class="message" href="#SCI_SETEXTRAASCENT">SCI_SETEXTRAASCENT(int extraAscent)</a><br />
2061 <a class="message" href="#SCI_GETEXTRAASCENT">SCI_GETEXTRAASCENT</a><br />
2062 <a class="message" href="#SCI_SETEXTRADESCENT">SCI_SETEXTRADESCENT(int extraDescent)</a><br />
2063 <a class="message" href="#SCI_GETEXTRADESCENT">SCI_GETEXTRADESCENT</a><br />
2064 </code>
2066 <p><b id="SCI_SETVIEWWS">SCI_SETVIEWWS(int wsMode)</b><br />
2067 <b id="SCI_GETVIEWWS">SCI_GETVIEWWS</b><br />
2068 White space can be made visible which may be useful for languages in which white space is
2069 significant, such as Python. Space characters appear as small centred dots and tab characters
2070 as light arrows pointing to the right. There are also ways to control the display of <a
2071 class="jump" href="#LineEndings">end of line characters</a>. The two messages set and get the
2072 white space display mode. The <code>wsMode</code> argument can be one of:</p>
2074 <table cellpadding="1" cellspacing="2" border="0" summary="White space policy">
2075 <tbody valign="top">
2076 <tr>
2077 <th align="left"><code>SCWS_INVISIBLE</code></th>
2079 <td>0</td>
2081 <td>The normal display mode with white space displayed as an empty background
2082 colour.</td>
2083 </tr>
2085 <tr>
2086 <th align="left"><code>SCWS_VISIBLEALWAYS</code></th>
2088 <td>1</td>
2090 <td>White space characters are drawn as dots and arrows,</td>
2091 </tr>
2093 <tr>
2094 <th align="left"><code>SCWS_VISIBLEAFTERINDENT</code></th>
2096 <td>2</td>
2098 <td>White space used for indentation is displayed normally but after the first visible
2099 character, it is shown as dots and arrows.</td>
2100 </tr>
2101 </tbody>
2102 </table>
2104 <p>The effect of using any other <code>wsMode</code> value is undefined.</p>
2106 <p><b id="SCI_SETWHITESPACEFORE">SCI_SETWHITESPACEFORE(bool useWhitespaceForeColour, int <a
2107 class="jump" href="#colour">colour</a>)</b><br />
2108 <b id="SCI_SETWHITESPACEBACK">SCI_SETWHITESPACEBACK(bool useWhitespaceBackColour, int <a
2109 class="jump" href="#colour">colour</a>)</b><br />
2110 By default, the colour of visible white space is determined by the lexer in use. The
2111 foreground and/or background colour of all visible white space can be set globally, overriding
2112 the lexer's colours with <code>SCI_SETWHITESPACEFORE</code> and
2113 <code>SCI_SETWHITESPACEBACK</code>.</p>
2115 <p><b id="SCI_SETWHITESPACESIZE">SCI_SETWHITESPACESIZE(int size)</b><br />
2116 <b id="SCI_GETWHITESPACESIZE">SCI_GETWHITESPACESIZE</b><br />
2117 <code>SCI_SETWHITESPACESIZE</code> sets the size of the dots used for mark space characters.
2118 The <code>SCI_GETWHITESPACESIZE</code> message retrieves the current size.
2119 </p>
2122 <b id="SCI_SETEXTRAASCENT">SCI_SETEXTRAASCENT(int extraAscent)</b><br />
2123 <b id="SCI_GETEXTRAASCENT">SCI_GETEXTRAASCENT</b><br />
2124 <b id="SCI_SETEXTRADESCENT">SCI_SETEXTRADESCENT(int extraDescent)</b><br />
2125 <b id="SCI_GETEXTRADESCENT">SCI_GETEXTRADESCENT</b><br />
2126 Text is drawn with the base of each character on a 'baseline'. The height of a line is found from the maximum
2127 that any style extends above the baseline (its 'ascent'), added to the maximum that any style extends below the
2128 baseline (its 'descent').
2129 Space may be added to the maximum ascent (<code>SCI_SETEXTRAASCENT</code>) and the
2130 maximum descent (<code>SCI_SETEXTRADESCENT</code>) to allow for more space between lines.
2131 This may done to make the text easier to read or to accomodate underlines or highlights.
2132 </p>
2134 <h2 id="Cursor">Cursor</h2>
2136 <p><b id="SCI_SETCURSOR">SCI_SETCURSOR(int curType)</b><br />
2137 <b id="SCI_GETCURSOR">SCI_GETCURSOR</b><br />
2138 The cursor is normally chosen in a context sensitive way, so it will be different over the
2139 margin than when over the text. When performing a slow action, you may wish to change to a wait
2140 cursor. You set the cursor type with <code>SCI_SETCURSOR</code>. The <code>curType</code>
2141 argument can be:</p>
2143 <table cellpadding="1" cellspacing="2" border="0" summary="Mouse cursors">
2144 <tbody valign="top">
2145 <tr>
2146 <th align="left"><code>SC_CURSORNORMAL</code></th>
2148 <td>-1</td>
2150 <td>The normal cursor is displayed.</td>
2151 </tr>
2153 <tr>
2154 <th align="left"><code>SC_CURSORWAIT</code></th>
2156 <td>&nbsp;4</td>
2158 <td>The wait cursor is displayed when the mouse is over or owned by the Scintilla
2159 window.</td>
2160 </tr>
2161 </tbody>
2162 </table>
2164 <p>Cursor values 1 through 7 have defined cursors, but only <code>SC_CURSORWAIT</code> is
2165 usefully controllable. Other values of <code>curType</code> cause a pointer to be displayed.
2166 The <code>SCI_GETCURSOR</code> message returns the last cursor type you set, or
2167 <code>SC_CURSORNORMAL</code> (-1) if you have not set a cursor type.</p>
2169 <h2 id="MouseCapture">Mouse capture</h2>
2171 <p><b id="SCI_SETMOUSEDOWNCAPTURES">SCI_SETMOUSEDOWNCAPTURES(bool captures)</b><br />
2172 <b id="SCI_GETMOUSEDOWNCAPTURES">SCI_GETMOUSEDOWNCAPTURES</b><br />
2173 When the mouse is pressed inside Scintilla, it is captured so future mouse movement events are
2174 sent to Scintilla. This behavior may be turned off with
2175 <code>SCI_SETMOUSEDOWNCAPTURES(0)</code>.</p>
2177 <h2 id="LineEndings">Line endings</h2>
2179 <p>Scintilla can interpret any of the three major line end conventions, Macintosh (\r), Unix
2180 (\n) and CP/M / DOS / Windows (\r\n). When the user presses the Enter key, one of these line
2181 end strings is inserted into the buffer. The default is \r\n in Windows and \n in Unix, but
2182 this can be changed with the <code>SCI_SETEOLMODE</code> message. You can also convert the
2183 entire document to one of these line endings with <code>SCI_CONVERTEOLS</code>. Finally, you
2184 can choose to display the line endings with <code>SCI_SETVIEWEOL</code>.</p>
2185 <code><a class="message" href="#SCI_SETEOLMODE">SCI_SETEOLMODE(int eolMode)</a><br />
2186 <a class="message" href="#SCI_GETEOLMODE">SCI_GETEOLMODE</a><br />
2187 <a class="message" href="#SCI_CONVERTEOLS">SCI_CONVERTEOLS(int eolMode)</a><br />
2188 <a class="message" href="#SCI_SETVIEWEOL">SCI_SETVIEWEOL(bool visible)</a><br />
2189 <a class="message" href="#SCI_GETVIEWEOL">SCI_GETVIEWEOL</a><br />
2190 </code>
2192 <p><b id="SCI_SETEOLMODE">SCI_SETEOLMODE(int eolMode)</b><br />
2193 <b id="SCI_GETEOLMODE">SCI_GETEOLMODE</b><br />
2194 <code>SCI_SETEOLMODE</code> sets the characters that are added into the document when the user
2195 presses the Enter key. You can set <code>eolMode</code> to one of <code>SC_EOL_CRLF</code> (0),
2196 <code>SC_EOL_CR</code> (1), or <code>SC_EOL_LF</code> (2). The <code>SCI_GETEOLMODE</code>
2197 message retrieves the current state.</p>
2199 <p><b id="SCI_CONVERTEOLS">SCI_CONVERTEOLS(int eolMode)</b><br />
2200 This message changes all the end of line characters in the document to match
2201 <code>eolMode</code>. Valid values are: <code>SC_EOL_CRLF</code> (0), <code>SC_EOL_CR</code>
2202 (1), or <code>SC_EOL_LF</code> (2).</p>
2204 <p><b id="SCI_SETVIEWEOL">SCI_SETVIEWEOL(bool visible)</b><br />
2205 <b id="SCI_GETVIEWEOL">SCI_GETVIEWEOL</b><br />
2206 Normally, the end of line characters are hidden, but <code>SCI_SETVIEWEOL</code> allows you to
2207 display (or hide) them by setting <code>visible</code> <code>true</code> (or
2208 <code>false</code>). The visible rendering of the end of line characters is similar to
2209 <code>(CR)</code>, <code>(LF)</code>, or <code>(CR)(LF)</code>. <code>SCI_GETVIEWEOL</code>
2210 returns the current state.</p>
2212 <h2 id="Styling">Styling</h2>
2214 <p>The styling messages allow you to assign styles to text. The standard Scintilla settings
2215 divide the 8 style bits available for each character into 5 bits (0 to 4 = <a class="jump"
2216 href="#StyleDefinition">styles 0 to 31</a>) that set a style and three bits (5 to 7) that
2217 define <a class="jump" href="#Indicators">indicators</a>. You can change the balance between
2218 styles and indicators with <a class="message"
2219 href="#SCI_SETSTYLEBITS"><code>SCI_SETSTYLEBITS</code></a>. If your styling needs can be met by
2220 one of the standard lexers, or if you can write your own, then a lexer is probably the easiest
2221 way to style your document. If you choose to use the container to do the styling you can use
2222 the <a class="message" href="#SCI_SETLEXER"><code>SCI_SETLEXER</code></a> command to select
2223 <code>SCLEX_CONTAINER</code>, in which case the container is sent a <a class="message"
2224 href="#SCN_STYLENEEDED"><code>SCN_STYLENEEDED</code></a> <a class="jump"
2225 href="#Notifications">notification</a> each time text needs styling for display. As another
2226 alternative, you might use idle time to style the document. Even if you use a lexer, you might
2227 use the styling commands to mark errors detected by a compiler. The following commands can be
2228 used.</p>
2229 <code><a class="message" href="#SCI_GETENDSTYLED">SCI_GETENDSTYLED</a><br />
2230 <a class="message" href="#SCI_STARTSTYLING">SCI_STARTSTYLING(int position, int mask)</a><br />
2231 <a class="message" href="#SCI_SETSTYLING">SCI_SETSTYLING(int length, int style)</a><br />
2232 <a class="message" href="#SCI_SETSTYLINGEX">SCI_SETSTYLINGEX(int length, const char
2233 *styles)</a><br />
2234 <a class="message" href="#SCI_SETLINESTATE">SCI_SETLINESTATE(int line, int value)</a><br />
2235 <a class="message" href="#SCI_GETLINESTATE">SCI_GETLINESTATE(int line)</a><br />
2236 <a class="message" href="#SCI_GETMAXLINESTATE">SCI_GETMAXLINESTATE</a><br />
2237 </code>
2239 <p><b id="SCI_GETENDSTYLED">SCI_GETENDSTYLED</b><br />
2240 Scintilla keeps a record of the last character that is likely to be styled correctly. This is
2241 moved forwards when characters after it are styled and moved backwards if changes are made to
2242 the text of the document before it. Before drawing text, this position is checked to see if any
2243 styling is needed and, if so, a <code><a class="message"
2244 href="#SCN_STYLENEEDED">SCN_STYLENEEDED</a></code> notification message is sent to the
2245 container. The container can send <code>SCI_GETENDSTYLED</code> to work out where it needs to
2246 start styling. Scintilla will always ask to style whole lines.</p>
2248 <p><b id="SCI_STARTSTYLING">SCI_STARTSTYLING(int pos, int mask)</b><br />
2249 This prepares for styling by setting the styling position <code>pos</code> to start at and a
2250 <code>mask</code> indicating which bits of the style bytes can be set. The mask allows styling
2251 to occur over several passes, with, for example, basic styling done on an initial pass to
2252 ensure that the text of the code is seen quickly and correctly, and then a second slower pass,
2253 detecting syntax errors and using indicators to show where these are. For example, with the
2254 standard settings of 5 style bits and 3 indicator bits, you would use a <code>mask</code> value
2255 of 31 (0x1f) if you were setting text styles and did not want to change the indicators. After
2256 <code>SCI_STARTSTYLING</code>, send multiple <code>SCI_SETSTYLING</code> messages for each
2257 lexical entity to style.</p>
2259 <p><b id="SCI_SETSTYLING">SCI_SETSTYLING(int length, int style)</b><br />
2260 This message sets the style of <code>length</code> characters starting at the styling position
2261 and then increases the styling position by <code>length</code>, ready for the next call. If
2262 <code>sCell</code> is the style byte, the operation is:<br />
2263 <code>if ((sCell &amp; mask) != style) sCell = (sCell &amp; ~mask) | (style &amp;
2264 mask);</code><br />
2265 </p>
2267 <p><b id="SCI_SETSTYLINGEX">SCI_SETSTYLINGEX(int length, const char *styles)</b><br />
2268 As an alternative to <code>SCI_SETSTYLING</code>, which applies the same style to each byte,
2269 you can use this message which specifies the styles for each of <code>length</code> bytes from
2270 the styling position and then increases the styling position by <code>length</code>, ready for
2271 the next call. The <code>length</code> styling bytes pointed at by <code>styles</code> should
2272 not contain any bits not set in mask.</p>
2274 <p><b id="SCI_SETLINESTATE">SCI_SETLINESTATE(int line, int value)</b><br />
2275 <b id="SCI_GETLINESTATE">SCI_GETLINESTATE(int line)</b><br />
2276 As well as the 8 bits of lexical state stored for each character there is also an integer
2277 stored for each line. This can be used for longer lived parse states such as what the current
2278 scripting language is in an ASP page. Use <code>SCI_SETLINESTATE</code> to set the integer
2279 value and <code>SCI_GETLINESTATE</code> to get the value.
2280 Changing the value produces a <a class="message" href="#SC_MOD_CHANGELINESTATE">SC_MOD_CHANGELINESTATE</a> notification.
2281 </p>
2283 <p><b id="SCI_GETMAXLINESTATE">SCI_GETMAXLINESTATE</b><br />
2284 This returns the last line that has any line state.</p>
2286 <h2 id="StyleDefinition">Style definition</h2>
2288 <p>While the style setting messages mentioned above change the style numbers associated with
2289 text, these messages define how those style numbers are interpreted visually. There are 256
2290 lexer styles that can be set, numbered 0 to <code>STYLE_MAX</code> (255). Unless you use <a
2291 class="message" href="#SCI_SETSTYLEBITS"><code>SCI_SETSTYLEBITS</code></a> to change the number
2292 of style bits, styles 0 to 31 are used to set the text attributes. There are also some
2293 predefined numbered styles starting at 32, The following <code>STYLE_</code>* constants are
2294 defined.</p>
2296 <table cellpadding="1" cellspacing="2" border="0" summary="Preset styles">
2297 <tbody valign="top">
2298 <tr>
2299 <th align="left"><code>STYLE_DEFAULT</code></th>
2301 <td>32</td>
2303 <td>This style defines the attributes that all styles receive when the
2304 <code>SCI_STYLECLEARALL</code> message is used.</td>
2305 </tr>
2307 <tr>
2308 <th align="left"><code>STYLE_LINENUMBER</code></th>
2310 <td>33</td>
2312 <td>This style sets the attributes of the text used to display line numbers in a line
2313 number margin. The background colour set for this style also sets the background colour
2314 for all margins that do not have any folding mask bits set. That is, any margin for which
2315 <code>mask &amp; SC_MASK_FOLDERS</code> is 0. See <a class="message"
2316 href="#SCI_SETMARGINMASKN"><code>SCI_SETMARGINMASKN</code></a> for more about masks.</td>
2317 </tr>
2319 <tr>
2320 <th align="left"><code>STYLE_BRACELIGHT</code></th>
2322 <td>34</td>
2324 <td>This style sets the attributes used when highlighting braces with the <a
2325 class="message" href="#BraceHighlighting"><code>SCI_BRACEHIGHLIGHT</code></a> message and
2326 when highlighting the corresponding indentation with <a class="message"
2327 href="#SCI_SETHIGHLIGHTGUIDE"><code>SCI_SETHIGHLIGHTGUIDE</code></a>.</td>
2328 </tr>
2330 <tr>
2331 <th align="left"><code>STYLE_BRACEBAD</code></th>
2333 <td>35</td>
2335 <td>This style sets the display attributes used when marking an unmatched brace with the
2336 <a class="message" href="#BraceHighlighting"><code>SCI_BRACEBADLIGHT</code></a>
2337 message.</td>
2338 </tr>
2340 <tr>
2341 <th align="left"><code>STYLE_CONTROLCHAR</code></th>
2343 <td>36</td>
2345 <td>This style sets the font used when drawing control characters.
2346 Only the font, size, bold, italics, and character set attributes are used and not
2347 the colour attributes. See
2348 also: <a class="message"
2349 href="#SCI_SETCONTROLCHARSYMBOL"><code>SCI_SETCONTROLCHARSYMBOL</code></a>.</td>
2350 </tr>
2352 <tr>
2353 <th align="left"><code>STYLE_INDENTGUIDE</code></th>
2355 <td>37</td>
2357 <td>This style sets the foreground and background colours used when drawing the
2358 indentation guides.</td>
2359 </tr>
2361 <tr>
2362 <th align="left"><code>STYLE_CALLTIP</code></th>
2364 <td>38</td>
2366 <td> Call tips normally use the font attributes defined by <code>STYLE_DEFAULT</code>.
2367 Use of <a class="message" href="#SCI_CALLTIPUSESTYLE"><code>SCI_CALLTIPUSESTYLE</code></a>
2368 causes call tips to use this style instead. Only the font face name, font size,
2369 foreground and background colours and character set attributes are used.</td>
2370 </tr>
2372 <tr>
2373 <th align="left"><code>STYLE_LASTPREDEFINED</code></th>
2375 <td>39</td>
2377 <td>To make it easier for client code to discover the range of styles that are
2378 predefined, this is set to the style number of the last predefined style. This is
2379 currently set to 39 and the last style with an identifier is 38, which reserves space
2380 for one future predefined style.</td>
2381 </tr>
2383 <tr>
2384 <th align="left"><code>STYLE_MAX</code></th>
2386 <td>255</td>
2388 <td>This is not a style but is the number of the maximum style that can be set. Styles
2389 between <code>STYLE_LASTPREDEFINED</code> and <code>STYLE_MAX</code> would be appropriate
2390 if you used <a class="message" href="#SCI_SETSTYLEBITS"><code>SCI_SETSTYLEBITS</code></a>
2391 to set more than 5 style bits.</td>
2392 </tr>
2393 </tbody>
2394 </table>
2396 <p>For each style you can set the font name, size and use of bold, italic and underline,
2397 foreground and background colour and the character set. You can also choose to hide text with a
2398 given style, display all characters as upper or lower case and fill from the last character on
2399 a line to the end of the line (for embedded languages). There is also an experimental attribute
2400 to make text read-only.</p>
2402 <p>It is entirely up to you how you use styles. If you want to use syntax colouring you might
2403 use style 0 for white space, style 1 for numbers, style 2 for keywords, style 3 for strings,
2404 style 4 for preprocessor, style 5 for operators, and so on.</p>
2405 <code><a class="message" href="#SCI_STYLERESETDEFAULT">SCI_STYLERESETDEFAULT</a><br />
2406 <a class="message" href="#SCI_STYLECLEARALL">SCI_STYLECLEARALL</a><br />
2407 <a class="message" href="#SCI_STYLESETFONT">SCI_STYLESETFONT(int styleNumber, char
2408 *fontName)</a><br />
2409 <a class="message" href="#SCI_STYLEGETFONT">SCI_STYLEGETFONT(int styleNumber, char *fontName)</a><br />
2410 <a class="message" href="#SCI_STYLESETSIZE">SCI_STYLESETSIZE(int styleNumber, int
2411 sizeInPoints)</a><br />
2412 <a class="message" href="#SCI_STYLEGETSIZE">SCI_STYLEGETSIZE(int styleNumber)</a><br />
2413 <a class="message" href="#SCI_STYLESETSIZEFRACTIONAL">SCI_STYLESETSIZEFRACTIONAL(int styleNumber, int
2414 sizeInHundredthPoints)</a><br />
2415 <a class="message" href="#SCI_STYLEGETSIZEFRACTIONAL">SCI_STYLEGETSIZEFRACTIONAL(int styleNumber)</a><br />
2416 <a class="message" href="#SCI_STYLESETBOLD">SCI_STYLESETBOLD(int styleNumber, bool
2417 bold)</a><br />
2418 <a class="message" href="#SCI_STYLEGETBOLD">SCI_STYLEGETBOLD(int styleNumber)</a><br />
2419 <a class="message" href="#SCI_STYLESETWEIGHT">SCI_STYLESETWEIGHT(int styleNumber, int
2420 weight)</a><br />
2421 <a class="message" href="#SCI_STYLEGETWEIGHT">SCI_STYLEGETWEIGHT(int styleNumber)</a><br />
2422 <a class="message" href="#SCI_STYLESETITALIC">SCI_STYLESETITALIC(int styleNumber, bool
2423 italic)</a><br />
2424 <a class="message" href="#SCI_STYLEGETITALIC">SCI_STYLEGETITALIC(int styleNumber)</a><br />
2425 <a class="message" href="#SCI_STYLESETUNDERLINE">SCI_STYLESETUNDERLINE(int styleNumber, bool
2426 underline)</a><br />
2427 <a class="message" href="#SCI_STYLEGETUNDERLINE">SCI_STYLEGETUNDERLINE(int styleNumber)</a><br />
2428 <a class="message" href="#SCI_STYLESETFORE">SCI_STYLESETFORE(int styleNumber, int
2429 colour)</a><br />
2430 <a class="message" href="#SCI_STYLEGETFORE">SCI_STYLEGETFORE(int styleNumber)</a><br />
2431 <a class="message" href="#SCI_STYLESETBACK">SCI_STYLESETBACK(int styleNumber, int
2432 colour)</a><br />
2433 <a class="message" href="#SCI_STYLEGETBACK">SCI_STYLEGETBACK(int styleNumber)</a><br />
2434 <a class="message" href="#SCI_STYLESETEOLFILLED">SCI_STYLESETEOLFILLED(int styleNumber, bool
2435 eolFilled)</a><br />
2436 <a class="message" href="#SCI_STYLEGETEOLFILLED">SCI_STYLEGETEOLFILLED(int styleNumber)</a><br />
2437 <a class="message" href="#SCI_STYLESETCHARACTERSET">SCI_STYLESETCHARACTERSET(int styleNumber,
2438 int charSet)</a><br />
2439 <a class="message" href="#SCI_STYLEGETCHARACTERSET">SCI_STYLEGETCHARACTERSET(int styleNumber)</a><br />
2440 <a class="message" href="#SCI_STYLESETCASE">SCI_STYLESETCASE(int styleNumber, int
2441 caseMode)</a><br />
2442 <a class="message" href="#SCI_STYLEGETCASE">SCI_STYLEGETCASE(int styleNumber)</a><br />
2443 <a class="message" href="#SCI_STYLESETVISIBLE">SCI_STYLESETVISIBLE(int styleNumber, bool
2444 visible)</a><br />
2445 <a class="message" href="#SCI_STYLEGETVISIBLE">SCI_STYLEGETVISIBLE(int styleNumber)</a><br />
2446 <a class="message" href="#SCI_STYLESETCHANGEABLE">SCI_STYLESETCHANGEABLE(int styleNumber, bool
2447 changeable)</a><br />
2448 <a class="message" href="#SCI_STYLEGETCHANGEABLE">SCI_STYLEGETCHANGEABLE(int styleNumber)</a><br />
2449 <a class="message" href="#SCI_STYLESETHOTSPOT">SCI_STYLESETHOTSPOT(int styleNumber, bool
2450 hotspot)</a><br />
2451 <a class="message" href="#SCI_STYLEGETHOTSPOT">SCI_STYLEGETHOTSPOT(int styleNumber)</a><br />
2452 </code>
2454 <p><b id="SCI_STYLERESETDEFAULT">SCI_STYLERESETDEFAULT</b><br />
2455 This message resets <code>STYLE_DEFAULT</code> to its state when Scintilla was
2456 initialised.</p>
2458 <p><b id="SCI_STYLECLEARALL">SCI_STYLECLEARALL</b><br />
2459 This message sets all styles to have the same attributes as <code>STYLE_DEFAULT</code>. If you
2460 are setting up Scintilla for syntax colouring, it is likely that the lexical styles you set
2461 will be very similar. One way to set the styles is to:<br />
2462 1. Set <code>STYLE_DEFAULT</code> to the common features of all styles.<br />
2463 2. Use <code>SCI_STYLECLEARALL</code> to copy this to all styles.<br />
2464 3. Set the style attributes that make your lexical styles different.</p>
2466 <p><b id="SCI_STYLESETFONT">SCI_STYLESETFONT(int styleNumber, const char *fontName)</b><br />
2467 <b id="SCI_STYLEGETFONT">SCI_STYLEGETFONT(int styleNumber, char *fontName)</b><br />
2468 <b id="SCI_STYLESETSIZE">SCI_STYLESETSIZE(int styleNumber, int sizeInPoints)</b><br />
2469 <b id="SCI_STYLEGETSIZE">SCI_STYLEGETSIZE(int styleNumber)</b><br />
2470 <b id="SCI_STYLESETSIZEFRACTIONAL">SCI_STYLESETSIZEFRACTIONAL(int styleNumber, int sizeInHundredthPoints)</b><br />
2471 <b id="SCI_STYLEGETSIZEFRACTIONAL">SCI_STYLEGETSIZEFRACTIONAL(int styleNumber)</b><br />
2472 <b id="SCI_STYLESETBOLD">SCI_STYLESETBOLD(int styleNumber, bool bold)</b><br />
2473 <b id="SCI_STYLEGETBOLD">SCI_STYLEGETBOLD(int styleNumber)</b><br />
2474 <b id="SCI_STYLESETWEIGHT">SCI_STYLESETWEIGHT(int styleNumber, int weight)</b><br />
2475 <b id="SCI_STYLEGETWEIGHT">SCI_STYLEGETWEIGHT(int styleNumber)</b><br />
2476 <b id="SCI_STYLESETITALIC">SCI_STYLESETITALIC(int styleNumber, bool italic)</b><br />
2477 <b id="SCI_STYLEGETITALIC">SCI_STYLEGETITALIC(int styleNumber)</b><br />
2478 These messages (plus <a class="message"
2479 href="#SCI_STYLESETCHARACTERSET"><code>SCI_STYLESETCHARACTERSET</code></a>) set the font
2480 attributes that are used to match the fonts you request to those available. The
2481 <code>fontName</code> is a zero terminated string holding the name of a font. Under Windows,
2482 only the first 32 characters of the name are used and the name is not case sensitive. For
2483 internal caching, Scintilla tracks fonts by name and does care about the casing of font names,
2484 so please be consistent. On GTK+, Pango is used to display text.</p>
2485 <p>Sizes can be set to a whole number of points with <code>SCI_STYLESETSIZE</code>
2486 or to a fractional point size in hundredths of a point with <code>SCI_STYLESETSIZEFRACTIONAL</code>
2487 by multiplying the size by 100 (<code>SC_FONT_SIZE_MULTIPLIER</code>).
2488 For example, a text size of 9.4 points is set with <code>SCI_STYLESETSIZEFRACTIONAL(&lt;style&gt;, 940)</code>.
2489 </p>
2490 <p>The weight or boldness of a font can be set with <code>SCI_STYLESETBOLD</code>
2491 or <code>SCI_STYLESETWEIGHT</code>. The weight is a number between 1 and 999 with 1 being very light
2492 and 999 very heavy. While any value can be used, fonts often only support between 2 and 4 weights with three weights
2493 being common enough to have symbolic names:
2494 <code>SC_WEIGHT_NORMAL</code> (400),
2495 <code>SC_WEIGHT_SEMIBOLD</code> (600), and
2496 <code>SC_WEIGHT_BOLD</code> (700).
2497 The <code>SCI_STYLESETBOLD</code> message takes a boolean argument with 0 choosing <code>SC_WEIGHT_NORMAL</code>
2498 and 1 <code>SC_WEIGHT_BOLD</code>.
2499 </p>
2501 <p><b id="SCI_STYLESETUNDERLINE">SCI_STYLESETUNDERLINE(int styleNumber, bool
2502 underline)</b><br />
2503 <b id="SCI_STYLEGETUNDERLINE">SCI_STYLEGETUNDERLINE(int styleNumber)</b><br />
2504 You can set a style to be underlined. The underline is drawn in the foreground colour. All
2505 characters with a style that includes the underline attribute are underlined, even if they are
2506 white space.</p>
2508 <p><b id="SCI_STYLESETFORE">SCI_STYLESETFORE(int styleNumber, int <a class="jump"
2509 href="#colour">colour</a>)</b><br />
2510 <b id="SCI_STYLEGETFORE">SCI_STYLEGETFORE(int styleNumber)</b><br />
2511 <b id="SCI_STYLESETBACK">SCI_STYLESETBACK(int styleNumber, int <a class="jump"
2512 href="#colour">colour</a>)</b><br />
2513 <b id="SCI_STYLEGETBACK">SCI_STYLEGETBACK(int styleNumber)</b><br />
2514 Text is drawn in the foreground colour. The space in each character cell that is not occupied
2515 by the character is drawn in the background colour.</p>
2517 <p><b id="SCI_STYLESETEOLFILLED">SCI_STYLESETEOLFILLED(int styleNumber, bool
2518 eolFilled)</b><br />
2519 <b id="SCI_STYLEGETEOLFILLED">SCI_STYLEGETEOLFILLED(int styleNumber)</b><br />
2520 If the last character in the line has a style with this attribute set, the remainder of the
2521 line up to the right edge of the window is filled with the background colour set for the last
2522 character. This is useful when a document contains embedded sections in another language such
2523 as HTML pages with embedded JavaScript. By setting <code>eolFilled</code> to <code>true</code>
2524 and a consistent background colour (different from the background colour set for the HTML
2525 styles) to all JavaScript styles then JavaScript sections will be easily distinguished from
2526 HTML.</p>
2528 <p><b id="SCI_STYLESETCHARACTERSET">SCI_STYLESETCHARACTERSET(int styleNumber, int
2529 charSet)</b><br />
2530 <b id="SCI_STYLEGETCHARACTERSET">SCI_STYLEGETCHARACTERSET(int styleNumber)</b><br />
2531 You can set a style to use a different character set than the default. The places where such
2532 characters sets are likely to be useful are comments and literal strings. For example,
2533 <code>SCI_STYLESETCHARACTERSET(SCE_C_STRING, SC_CHARSET_RUSSIAN)</code> would ensure that
2534 strings in Russian would display correctly in C and C++ (<code>SCE_C_STRING</code> is the style
2535 number used by the C and C++ lexer to display literal strings; it has the value 6). This
2536 feature works differently on Windows and GTK+.</p>
2538 <p>The character sets supported on Windows are:<br />
2539 <code>SC_CHARSET_ANSI</code>, <code>SC_CHARSET_ARABIC</code>, <code>SC_CHARSET_BALTIC</code>,
2540 <code>SC_CHARSET_CHINESEBIG5</code>, <code>SC_CHARSET_DEFAULT</code>,
2541 <code>SC_CHARSET_EASTEUROPE</code>, <code>SC_CHARSET_GB2312</code>,
2542 <code>SC_CHARSET_GREEK</code>, <code>SC_CHARSET_HANGUL</code>, <code>SC_CHARSET_HEBREW</code>,
2543 <code>SC_CHARSET_JOHAB</code>, <code>SC_CHARSET_MAC</code>, <code>SC_CHARSET_OEM</code>,
2544 <code>SC_CHARSET_RUSSIAN</code> (code page 1251),
2545 <code>SC_CHARSET_SHIFTJIS</code>, <code>SC_CHARSET_SYMBOL</code>, <code>SC_CHARSET_THAI</code>,
2546 <code>SC_CHARSET_TURKISH</code>, and <code>SC_CHARSET_VIETNAMESE</code>.</p>
2548 <p>The character sets supported on GTK+ are:<br />
2549 <code>SC_CHARSET_ANSI</code>, <code>SC_CHARSET_CYRILLIC</code> (code page 1251),
2550 <code>SC_CHARSET_EASTEUROPE</code>,
2551 <code>SC_CHARSET_GB2312</code>, <code>SC_CHARSET_HANGUL</code>,
2552 <code>SC_CHARSET_RUSSIAN</code> (KOI8-R), <code>SC_CHARSET_SHIFTJIS</code>, and
2553 <code>SC_CHARSET_8859_15</code>.</p>
2555 <p><b id="SCI_STYLESETCASE">SCI_STYLESETCASE(int styleNumber, int caseMode)</b><br />
2556 <b id="SCI_STYLEGETCASE">SCI_STYLEGETCASE(int styleNumber)</b><br />
2557 The value of caseMode determines how text is displayed. You can set upper case
2558 (<code>SC_CASE_UPPER</code>, 1) or lower case (<code>SC_CASE_LOWER</code>, 2) or display
2559 normally (<code>SC_CASE_MIXED</code>, 0). This does not change the stored text, only how it is
2560 displayed.</p>
2562 <p><b id="SCI_STYLESETVISIBLE">SCI_STYLESETVISIBLE(int styleNumber, bool visible)</b><br />
2563 <b id="SCI_STYLEGETVISIBLE">SCI_STYLEGETVISIBLE(int styleNumber)</b><br />
2564 Text is normally visible. However, you can completely hide it by giving it a style with the
2565 <code>visible</code> set to 0. This could be used to hide embedded formatting instructions or
2566 hypertext keywords in HTML or XML.</p>
2568 <p><b id="SCI_STYLESETCHANGEABLE">SCI_STYLESETCHANGEABLE(int styleNumber, bool
2569 changeable)</b><br />
2570 <b id="SCI_STYLEGETCHANGEABLE">SCI_STYLEGETCHANGEABLE(int styleNumber)</b><br />
2571 This is an experimental and incompletely implemented style attribute. The default setting is
2572 <code>changeable</code> set <code>true</code> but when set <code>false</code> it makes text
2573 read-only. Currently it only stops the caret from being within not-changeable text and does not
2574 yet stop deleting a range that contains not-changeable text.</p>
2576 <p><b id="SCI_STYLESETHOTSPOT">SCI_STYLESETHOTSPOT(int styleNumber, bool
2577 hotspot)</b><br />
2578 <b id="SCI_STYLEGETHOTSPOT">SCI_STYLEGETHOTSPOT(int styleNumber)</b><br />
2579 This style is used to mark ranges of text that can detect mouse clicks.
2580 The cursor changes to a hand over hotspots, and the foreground, and background colours
2581 may change and an underline appear to indicate that these areas are sensitive to clicking.
2582 This may be used to allow hyperlinks to other documents.</p>
2584 <h2 id="CaretAndSelectionStyles">Caret, selection, and hotspot styles</h2>
2586 <p>The selection is shown by changing the foreground and/or background colours. If one of these
2587 is not set then that attribute is not changed for the selection. The default is to show the
2588 selection by changing the background to light gray and leaving the foreground the same as when
2589 it was not selected. When there is no selection, the current insertion point is marked by the
2590 text caret. This is a vertical line that is normally blinking on and off to attract the users
2591 attention.</p>
2592 <code><a class="message" href="#SCI_SETSELFORE">SCI_SETSELFORE(bool useSelectionForeColour, int colour)</a><br />
2593 <a class="message" href="#SCI_SETSELBACK">SCI_SETSELBACK(bool useSelectionBackColour, int colour)</a><br />
2594 <a class="message" href="#SCI_SETSELALPHA">SCI_SETSELALPHA(int alpha)</a><br />
2595 <a class="message" href="#SCI_GETSELALPHA">SCI_GETSELALPHA</a><br />
2596 <a class="message" href="#SCI_SETSELEOLFILLED">SCI_SETSELEOLFILLED(bool filled)</a><br />
2597 <a class="message" href="#SCI_GETSELEOLFILLED">SCI_GETSELEOLFILLED</a><br />
2598 <a class="message" href="#SCI_SETCARETFORE">SCI_SETCARETFORE(int colour)</a><br />
2599 <a class="message" href="#SCI_GETCARETFORE">SCI_GETCARETFORE</a><br />
2600 <a class="message" href="#SCI_SETCARETLINEVISIBLE">SCI_SETCARETLINEVISIBLE(bool show)</a><br />
2601 <a class="message" href="#SCI_GETCARETLINEVISIBLE">SCI_GETCARETLINEVISIBLE</a><br />
2602 <a class="message" href="#SCI_SETCARETLINEBACK">SCI_SETCARETLINEBACK(int colour)</a><br />
2603 <a class="message" href="#SCI_GETCARETLINEBACK">SCI_GETCARETLINEBACK</a><br />
2604 <a class="message" href="#SCI_SETCARETLINEBACKALPHA">SCI_SETCARETLINEBACKALPHA(int alpha)</a><br />
2605 <a class="message" href="#SCI_GETCARETLINEBACKALPHA">SCI_GETCARETLINEBACKALPHA</a><br />
2606 <a class="message" href="#SCI_SETCARETPERIOD">SCI_SETCARETPERIOD(int milliseconds)</a><br />
2607 <a class="message" href="#SCI_GETCARETPERIOD">SCI_GETCARETPERIOD</a><br />
2608 <a class="message" href="#SCI_SETCARETSTYLE">SCI_SETCARETSTYLE(int style)</a><br />
2609 <a class="message" href="#SCI_GETCARETSTYLE">SCI_GETCARETSTYLE</a><br />
2610 <a class="message" href="#SCI_SETCARETWIDTH">SCI_SETCARETWIDTH(int pixels)</a><br />
2611 <a class="message" href="#SCI_GETCARETWIDTH">SCI_GETCARETWIDTH</a><br />
2612 <a class="message" href="#SCI_SETHOTSPOTACTIVEFORE">SCI_SETHOTSPOTACTIVEFORE(bool useSetting, int colour)</a><br />
2613 <a class="message" href="#SCI_GETHOTSPOTACTIVEFORE">SCI_GETHOTSPOTACTIVEFORE</a><br />
2614 <a class="message" href="#SCI_SETHOTSPOTACTIVEBACK">SCI_SETHOTSPOTACTIVEBACK(bool useSetting, int colour)</a><br />
2615 <a class="message" href="#SCI_GETHOTSPOTACTIVEBACK">SCI_GETHOTSPOTACTIVEBACK</a><br />
2616 <a class="message" href="#SCI_SETHOTSPOTACTIVEUNDERLINE">SCI_SETHOTSPOTACTIVEUNDERLINE(bool underline)</a><br />
2617 <a class="message" href="#SCI_GETHOTSPOTACTIVEUNDERLINE">SCI_GETHOTSPOTACTIVEUNDERLINE</a><br />
2618 <a class="message" href="#SCI_SETHOTSPOTSINGLELINE">SCI_SETHOTSPOTSINGLELINE(bool singleLine)</a><br />
2619 <a class="message" href="#SCI_GETHOTSPOTSINGLELINE">SCI_GETHOTSPOTSINGLELINE</a><br />
2620 <a class="message" href="#SCI_SETCONTROLCHARSYMBOL">SCI_SETCONTROLCHARSYMBOL(int symbol)</a><br />
2621 <a class="message" href="#SCI_GETCONTROLCHARSYMBOL">SCI_GETCONTROLCHARSYMBOL</a><br />
2622 <a class="message" href="#SCI_SETCARETSTICKY">SCI_SETCARETSTICKY(int useCaretStickyBehaviour)</a><br />
2623 <a class="message" href="#SCI_GETCARETSTICKY">SCI_GETCARETSTICKY</a><br />
2624 <a class="message" href="#SCI_TOGGLECARETSTICKY">SCI_TOGGLECARETSTICKY</a><br />
2625 </code>
2627 <p><b id="SCI_SETSELFORE">SCI_SETSELFORE(bool useSelectionForeColour, int <a class="jump"
2628 href="#colour">colour</a>)</b><br />
2629 <b id="SCI_SETSELBACK">SCI_SETSELBACK(bool useSelectionBackColour, int <a class="jump"
2630 href="#colour">colour</a>)</b><br />
2631 You can choose to override the default selection colouring with these two messages. The colour
2632 you provide is used if you set <code>useSelection*Colour</code> to <code>true</code>. If it is
2633 set to <code>false</code>, the default styled colouring is used and the <code>colour</code>
2634 argument has no effect.</p>
2635 <p><b id="SCI_SETSELALPHA">SCI_SETSELALPHA(int <a class="jump" href="#alpha">alpha</a>)</b><br />
2636 <b id="SCI_GETSELALPHA">SCI_GETSELALPHA</b><br />
2637 The selection can be drawn translucently in the selection background colour by
2638 setting an alpha value.</p>
2640 <p><b id="SCI_SETSELEOLFILLED">SCI_SETSELEOLFILLED(bool filled)</b><br />
2641 <b id="SCI_GETSELEOLFILLED">SCI_GETSELEOLFILLED</b><br />
2642 The selection can be drawn up to the right hand border by setting this property.</p>
2644 <p><b id="SCI_SETCARETFORE">SCI_SETCARETFORE(int <a class="jump"
2645 href="#colour">colour</a>)</b><br />
2646 <b id="SCI_GETCARETFORE">SCI_GETCARETFORE</b><br />
2647 The colour of the caret can be set with <code>SCI_SETCARETFORE</code> and retrieved with
2648 <code>SCI_GETCARETFORE</code>.</p>
2650 <p><b id="SCI_SETCARETLINEVISIBLE">SCI_SETCARETLINEVISIBLE(bool show)</b><br />
2651 <b id="SCI_GETCARETLINEVISIBLE">SCI_GETCARETLINEVISIBLE</b><br />
2652 <b id="SCI_SETCARETLINEBACK">SCI_SETCARETLINEBACK(int <a class="jump"
2653 href="#colour">colour</a>)</b><br />
2654 <b id="SCI_GETCARETLINEBACK">SCI_GETCARETLINEBACK</b><br />
2655 <b id="SCI_SETCARETLINEBACKALPHA">SCI_SETCARETLINEBACKALPHA(int <a class="jump" href="#alpha">alpha</a>)</b><br />
2656 <b id="SCI_GETCARETLINEBACKALPHA">SCI_GETCARETLINEBACKALPHA</b><br />
2657 You can choose to make the background colour of the line containing the caret different with
2658 these messages. To do this, set the desired background colour with
2659 <code>SCI_SETCARETLINEBACK</code>, then use <code>SCI_SETCARETLINEVISIBLE(true)</code> to
2660 enable the effect. You can cancel the effect with <code>SCI_SETCARETLINEVISIBLE(false)</code>.
2661 The two <code>SCI_GETCARET*</code> functions return the state and the colour. This form of
2662 background colouring has highest priority when a line has markers that would otherwise change
2663 the background colour.
2664 The caret line may also be drawn translucently which allows other background colours to show
2665 through. This is done by setting the alpha (translucency) value by calling
2666 SCI_SETCARETLINEBACKALPHA. When the alpha is not SC_ALPHA_NOALPHA,
2667 the caret line is drawn after all other features so will affect the colour of all other features.
2668 </p>
2670 <p><b id="SCI_SETCARETPERIOD">SCI_SETCARETPERIOD(int milliseconds)</b><br />
2671 <b id="SCI_GETCARETPERIOD">SCI_GETCARETPERIOD</b><br />
2672 The rate at which the caret blinks can be set with <code>SCI_SETCARETPERIOD</code> which
2673 determines the time in milliseconds that the caret is visible or invisible before changing
2674 state. Setting the period to 0 stops the caret blinking. The default value is 500 milliseconds.
2675 <code>SCI_GETCARETPERIOD</code> returns the current setting.</p>
2677 <p><b id="SCI_SETCARETSTYLE">SCI_SETCARETSTYLE(int style)</b><br />
2678 <b id="SCI_GETCARETSTYLE">SCI_GETCARETSTYLE</b><br />
2679 The style of the caret can be set with <code>SCI_SETCARETSTYLE</code> to be a line caret
2680 (CARETSTYLE_LINE=1), a block caret (CARETSTYLE_BLOCK=2) or to not draw at all
2681 (CARETSTYLE_INVISIBLE=0). The default value is the line caret (CARETSTYLE_LINE=1).
2682 You can determine the current caret style setting using <code>SCI_GETCARETSTYLE</code>.</p>
2684 <p>The block character draws most combining and multibyte character sequences successfully,
2685 though some fonts like Thai Fonts (and possibly others) can sometimes appear strange when
2686 the cursor is positioned at these characters, which may result in only drawing a part of the
2687 cursor character sequence. This is most notable on Windows platforms.</p>
2689 <p><b id="SCI_SETCARETWIDTH">SCI_SETCARETWIDTH(int pixels)</b><br />
2690 <b id="SCI_GETCARETWIDTH">SCI_GETCARETWIDTH</b><br />
2691 The width of the line caret can be set with <code>SCI_SETCARETWIDTH</code> to a value of
2692 0, 1, 2 or 3 pixels. The default width is 1 pixel. You can read back the current width with
2693 <code>SCI_GETCARETWIDTH</code>. A width of 0 makes the caret invisible (added at version
2694 1.50), similar to setting the caret style to CARETSTYLE_INVISIBLE (though not interchangable).
2695 This setting only affects the width of the cursor when the cursor style is set to line caret
2696 mode, it does not affect the width for a block caret.</p>
2698 <p><b id="SCI_SETHOTSPOTACTIVEFORE">SCI_SETHOTSPOTACTIVEFORE(bool useHotSpotForeColour, int <a class="jump"
2699 href="#colour">colour</a>)</b><br />
2700 <b id="SCI_GETHOTSPOTACTIVEFORE">SCI_GETHOTSPOTACTIVEFORE</b><br />
2701 <b id="SCI_SETHOTSPOTACTIVEBACK">SCI_SETHOTSPOTACTIVEBACK(bool useHotSpotBackColour, int <a class="jump"
2702 href="#colour">colour</a>)</b><br />
2703 <b id="SCI_GETHOTSPOTACTIVEBACK">SCI_GETHOTSPOTACTIVEBACK</b><br />
2704 <b id="SCI_SETHOTSPOTACTIVEUNDERLINE">SCI_SETHOTSPOTACTIVEUNDERLINE(bool underline)</b><br />
2705 <b id="SCI_GETHOTSPOTACTIVEUNDERLINE">SCI_GETHOTSPOTACTIVEUNDERLINE</b><br />
2706 <b id="SCI_SETHOTSPOTSINGLELINE">SCI_SETHOTSPOTSINGLELINE(bool singleLine)</b><br />
2707 <b id="SCI_GETHOTSPOTSINGLELINE">SCI_GETHOTSPOTSINGLELINE</b><br />
2708 While the cursor hovers over text in a style with the hotspot attribute set,
2709 the default colouring can be modified and an underline drawn with these settings.
2710 Single line mode stops a hotspot from wrapping onto next line.</p>
2712 <p><b id="SCI_SETCONTROLCHARSYMBOL">SCI_SETCONTROLCHARSYMBOL(int symbol)</b><br />
2713 <b id="SCI_GETCONTROLCHARSYMBOL">SCI_GETCONTROLCHARSYMBOL</b><br />
2714 By default, Scintilla displays control characters (characters with codes less than 32) in a
2715 rounded rectangle as ASCII mnemonics: "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
2716 "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", "DLE", "DC1", "DC2", "DC3", "DC4", "NAK",
2717 "SYN", "ETB", "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US". These mnemonics come from the
2718 early days of signaling, though some are still used (LF = Line Feed, BS = Back Space, CR =
2719 Carriage Return, for example).</p>
2721 <p>You can choose to replace these mnemonics by a nominated symbol with an ASCII code in the
2722 range 32 to 255. If you set a symbol value less than 32, all control characters are displayed
2723 as mnemonics. The symbol you set is rendered in the font of the style set for the character.
2724 You can read back the current symbol with the <code>SCI_GETCONTROLCHARSYMBOL</code> message.
2725 The default symbol value is 0.</p>
2727 <p><b id="SCI_SETCARETSTICKY">SCI_SETCARETSTICKY(int useCaretStickyBehaviour)</b><br />
2728 <b id="SCI_GETCARETSTICKY">SCI_GETCARETSTICKY</b><br />
2729 <b id="SCI_TOGGLECARETSTICKY">SCI_TOGGLECARETSTICKY</b><br />
2730 These messages set, get or toggle the caretSticky setting which controls when the last position
2731 of the caret on the line is saved.</p>
2733 <p>When set to <code>SC_CARETSTICKY_OFF</code> (0), the sticky flag is off; all text changes
2734 (and all caret position changes) will remember the
2735 caret's new horizontal position when moving to different lines. This is the default.</p>
2737 <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
2738 horizontal caret position is moving the caret with mouse or keyboard (left/right arrow keys, home/end keys, etc). </p>
2740 <p>When set to <code>SC_CARETSTICKY_WHITESPACE</code> (2), the caret acts like mode 0 (sticky off) except under one
2741 special case; when space or tab characters are inserted. (Including pasting <b>only space/tabs</b> -- undo, redo,
2742 etc. do not exhibit this behavior..).</p>
2744 <p><code>SCI_TOGGLECARETSTICKY</code> switches from <code>SC_CARETSTICKY_ON</code> and <code>SC_CARETSTICKY_WHITESPACE</code>
2745 to <code>SC_CARETSTICKY_OFF</code> and from <code>SC_CARETSTICKY_OFF</code> to <code>SC_CARETSTICKY_ON</code>.</p>
2747 <h2 id="Margins">Margins</h2>
2749 <p>There may be up to five margins to the left of the text display, plus a gap either side of
2750 the text. Each margin can be set to display only symbols, line numbers, or text with <a
2751 class="message" href="#SCI_SETMARGINTYPEN"><code>SCI_SETMARGINTYPEN</code></a>.
2752 Textual margins may also display symbols.
2753 The markers
2754 that can be displayed in each margin are set with <a class="message"
2755 href="#SCI_SETMARGINMASKN"><code>SCI_SETMARGINMASKN</code></a>. Any markers not associated with
2756 a visible margin will be displayed as changes in background colour in the text. A width in
2757 pixels can be set for each margin. Margins with a zero width are ignored completely. You can
2758 choose if a mouse click in a margin sends a <a class="message"
2759 href="#SCN_MARGINCLICK"><code>SCN_MARGINCLICK</code></a> notification to the container or
2760 selects a line of text.</p>
2762 <p>The margins are numbered 0 to 4. Using a margin number outside the valid range has no
2763 effect. By default, margin 0 is set to display line numbers, but is given a width of 0, so it
2764 is hidden. Margin 1 is set to display non-folding symbols and is given a width of 16 pixels, so
2765 it is visible. Margin 2 is set to display the folding symbols, but is given a width of 0, so it
2766 is hidden. Of course, you can set the margins to be whatever you wish.</p>
2768 <p>Styled text margins used to show revision and blame information:</p>
2769 <p><img src="styledmargin.png" alt="Styled text margins used to show revision and blame information" /></p>
2771 <code><a class="message" href="#SCI_SETMARGINTYPEN">SCI_SETMARGINTYPEN(int margin, int
2772 type)</a><br />
2773 <a class="message" href="#SCI_GETMARGINTYPEN">SCI_GETMARGINTYPEN(int margin)</a><br />
2774 <a class="message" href="#SCI_SETMARGINWIDTHN">SCI_SETMARGINWIDTHN(int margin, int
2775 pixelWidth)</a><br />
2776 <a class="message" href="#SCI_GETMARGINWIDTHN">SCI_GETMARGINWIDTHN(int margin)</a><br />
2777 <a class="message" href="#SCI_SETMARGINMASKN">SCI_SETMARGINMASKN(int margin, int
2778 mask)</a><br />
2779 <a class="message" href="#SCI_GETMARGINMASKN">SCI_GETMARGINMASKN(int margin)</a><br />
2780 <a class="message" href="#SCI_SETMARGINSENSITIVEN">SCI_SETMARGINSENSITIVEN(int margin, bool
2781 sensitive)</a><br />
2782 <a class="message" href="#SCI_GETMARGINSENSITIVEN">SCI_GETMARGINSENSITIVEN(int
2783 margin)</a><br />
2784 <a class="message" href="#SCI_SETMARGINCURSORN">SCI_SETMARGINCURSORN(int margin, int
2785 cursor)</a><br />
2786 <a class="message" href="#SCI_GETMARGINCURSORN">SCI_GETMARGINCURSORN(int
2787 margin)</a><br />
2788 <a class="message" href="#SCI_SETMARGINLEFT">SCI_SETMARGINLEFT(&lt;unused&gt;, int
2789 pixels)</a><br />
2790 <a class="message" href="#SCI_GETMARGINLEFT">SCI_GETMARGINLEFT</a><br />
2791 <a class="message" href="#SCI_SETMARGINRIGHT">SCI_SETMARGINRIGHT(&lt;unused&gt;, int
2792 pixels)</a><br />
2793 <a class="message" href="#SCI_GETMARGINRIGHT">SCI_GETMARGINRIGHT</a><br />
2794 <a class="message" href="#SCI_SETFOLDMARGINCOLOUR">SCI_SETFOLDMARGINCOLOUR(bool useSetting, int colour)</a><br />
2795 <a class="message" href="#SCI_SETFOLDMARGINHICOLOUR">SCI_SETFOLDMARGINHICOLOUR(bool useSetting, int colour)</a><br />
2796 <a class="message" href="#SCI_MARGINSETTEXT">SCI_MARGINSETTEXT(int line, char *text)</a><br />
2797 <a class="message" href="#SCI_MARGINGETTEXT">SCI_MARGINGETTEXT(int line, char *text)</a><br />
2798 <a class="message" href="#SCI_MARGINSETSTYLE">SCI_MARGINSETSTYLE(int line, int style)</a><br />
2799 <a class="message" href="#SCI_MARGINGETSTYLE">SCI_MARGINGETSTYLE(int line)</a><br />
2800 <a class="message" href="#SCI_MARGINSETSTYLES">SCI_MARGINSETSTYLES(int line, char *styles)</a><br />
2801 <a class="message" href="#SCI_MARGINGETSTYLES">SCI_MARGINGETSTYLES(int line, char *styles)</a><br />
2802 <a class="message" href="#SCI_MARGINTEXTCLEARALL">SCI_MARGINTEXTCLEARALL</a><br />
2803 <a class="message" href="#SCI_MARGINSETSTYLEOFFSET">SCI_MARGINSETSTYLEOFFSET(int style)</a><br />
2804 <a class="message" href="#SCI_MARGINGETSTYLEOFFSET">SCI_MARGINGETSTYLEOFFSET</a><br />
2805 <a class="message" href="#SCI_SETMARGINOPTIONS">SCI_SETMARGINOPTIONS(int marginOptions)</a><br />
2806 <a class="message" href="#SCI_GETMARGINOPTIONS">SCI_GETMARGINOPTIONS</a><br />
2807 </code>
2809 <p><b id="SCI_SETMARGINTYPEN">SCI_SETMARGINTYPEN(int margin, int iType)</b><br />
2810 <b id="SCI_GETMARGINTYPEN">SCI_GETMARGINTYPEN(int margin)</b><br />
2811 These two routines set and get the type of a margin. The margin argument should be 0, 1, 2, 3 or 4.
2812 You can use the predefined constants <code>SC_MARGIN_SYMBOL</code> (0) and
2813 <code>SC_MARGIN_NUMBER</code> (1) to set a margin as either a line number or a symbol margin.
2814 A margin with application defined text may use <code>SC_MARGIN_TEXT</code> (4) or
2815 <code>SC_MARGIN_RTEXT</code> (5) to right justify the text.
2816 By convention, margin 0 is used for line numbers and the next two are used for symbols. You can
2817 also use the constants <code>SC_MARGIN_BACK</code> (2) and <code>SC_MARGIN_FORE</code> (3) for
2818 symbol margins that set their background colour to match the STYLE_DEFAULT background and
2819 foreground colours.</p>
2821 <p><b id="SCI_SETMARGINWIDTHN">SCI_SETMARGINWIDTHN(int margin, int pixelWidth)</b><br />
2822 <b id="SCI_GETMARGINWIDTHN">SCI_GETMARGINWIDTHN(int margin)</b><br />
2823 These routines set and get the width of a margin in pixels. A margin with zero width is
2824 invisible. By default, Scintilla sets margin 1 for symbols with a width of 16 pixels, so this
2825 is a reasonable guess if you are not sure what would be appropriate. Line number margins widths
2826 should take into account the number of lines in the document and the line number style. You
2827 could use something like <a class="message"
2828 href="#SCI_TEXTWIDTH"><code>SCI_TEXTWIDTH(STYLE_LINENUMBER, "_99999")</code></a> to get a
2829 suitable width.</p>
2831 <p><b id="SCI_SETMARGINMASKN">SCI_SETMARGINMASKN(int margin, int mask)</b><br />
2832 <b id="SCI_GETMARGINMASKN">SCI_GETMARGINMASKN(int margin)</b><br />
2833 The mask is a 32-bit value. Each bit corresponds to one of 32 logical symbols that can be
2834 displayed in a margin that is enabled for symbols. There is a useful constant,
2835 <code>SC_MASK_FOLDERS</code> (0xFE000000 or -33554432), that is a mask for the 7 logical
2836 symbols used to denote folding. You can assign a wide range of symbols and colours to each of
2837 the 32 logical symbols, see <a href="#Markers">Markers</a> for more information. If <code>(mask
2838 &amp; SC_MASK_FOLDERS)==0</code>, the margin background colour is controlled by style 33 (<a
2839 class="message" href="#StyleDefinition"><code>STYLE_LINENUMBER</code></a>).</p>
2841 <p>You add logical markers to a line with <a class="message"
2842 href="#SCI_MARKERADD"><code>SCI_MARKERADD</code></a>. If a line has an associated marker that
2843 does not appear in the mask of any margin with a non-zero width, the marker changes the
2844 background colour of the line. For example, suppose you decide to use logical marker 10 to mark
2845 lines with a syntax error and you want to show such lines by changing the background colour.
2846 The mask for this marker is 1 shifted left 10 times (1&lt;&lt;10) which is 0x400. If you make
2847 sure that no symbol margin includes 0x400 in its mask, any line with the marker gets the
2848 background colour changed.</p>
2850 <p>To set a non-folding margin 1 use <code>SCI_SETMARGINMASKN(1, ~SC_MASK_FOLDERS)</code>
2851 which is the default set by Scintilla.
2852 To set a folding margin 2 use <code>SCI_SETMARGINMASKN(2, SC_MASK_FOLDERS)</code>.
2853 <code>~SC_MASK_FOLDERS</code> is 0x1FFFFFF in hexadecimal or 33554431
2854 decimal. Of course, you may need to display all 32 symbols in a margin, in which case use
2855 <code>SCI_SETMARGINMASKN(margin, -1)</code>.</p>
2857 <p><b id="SCI_SETMARGINSENSITIVEN">SCI_SETMARGINSENSITIVEN(int margin, bool
2858 sensitive)</b><br />
2859 <b id="SCI_GETMARGINSENSITIVEN">SCI_GETMARGINSENSITIVEN(int margin)</b><br />
2860 Each of the five margins can be set sensitive or insensitive to mouse clicks. A click in a
2861 sensitive margin sends a <a class="message"
2862 href="#SCN_MARGINCLICK"><code>SCN_MARGINCLICK</code></a> <a class="jump"
2863 href="#Notifications">notification</a> to the container. Margins that are not sensitive act as
2864 selection margins which make it easy to select ranges of lines. By default, all margins are
2865 insensitive.</p>
2867 <p><b id="SCI_SETMARGINCURSORN">SCI_SETMARGINCURSORN(int margin, int
2868 cursor)</b><br />
2869 <b id="SCI_GETMARGINCURSORN">SCI_GETMARGINCURSORN(int margin)</b><br />
2870 A reversed arrow cursor is normally shown over all margins. This may be changed to a normal arrow with
2871 <code>SCI_SETMARGINCURSORN(margin, SC_CURSORARROW)</code> or restored to a
2872 reversed arrow with
2873 <code>SCI_SETMARGINCURSORN(margin, SC_CURSORREVERSEARROW)</code>.</p>
2875 <p><b id="SCI_SETMARGINLEFT">SCI_SETMARGINLEFT(&lt;unused&gt;, int pixels)</b><br />
2876 <b id="SCI_GETMARGINLEFT">SCI_GETMARGINLEFT</b><br />
2877 <b id="SCI_SETMARGINRIGHT">SCI_SETMARGINRIGHT(&lt;unused&gt;, int pixels)</b><br />
2878 <b id="SCI_GETMARGINRIGHT">SCI_GETMARGINRIGHT</b><br />
2879 These messages set and get the width of the blank margin on both sides of the text in pixels.
2880 The default is to one pixel on each side.</p>
2882 <p><b id="SCI_SETFOLDMARGINCOLOUR">SCI_SETFOLDMARGINCOLOUR(bool useSetting, int colour)</b><br />
2883 <b id="SCI_SETFOLDMARGINHICOLOUR">SCI_SETFOLDMARGINHICOLOUR(bool useSetting, int colour)</b><br />
2884 These messages allow changing the colour of the fold margin and fold margin highlight.
2885 On Windows the fold margin colour defaults to ::GetSysColor(COLOR_3DFACE) and the fold margin highlight
2886 colour to ::GetSysColor(COLOR_3DHIGHLIGHT).</p>
2889 <b id="SCI_MARGINSETTEXT">SCI_MARGINSETTEXT(int line, char *text)</b><br />
2890 <b id="SCI_MARGINGETTEXT">SCI_MARGINGETTEXT(int line, char *text)</b><br />
2891 <b id="SCI_MARGINSETSTYLE">SCI_MARGINSETSTYLE(int line, int style)</b><br />
2892 <b id="SCI_MARGINGETSTYLE">SCI_MARGINGETSTYLE(int line)</b><br />
2893 <b id="SCI_MARGINSETSTYLES">SCI_MARGINSETSTYLES(int line, char *styles)</b><br />
2894 <b id="SCI_MARGINGETSTYLES">SCI_MARGINGETSTYLES(int line, char *styles)</b><br />
2895 <b id="SCI_MARGINTEXTCLEARALL">SCI_MARGINTEXTCLEARALL</b><br />
2896 Text margins are created with the type SC_MARGIN_TEXT or SC_MARGIN_RTEXT.
2897 A different string may be set for each line with <code>SCI_MARGINSETTEXT</code>.
2898 The whole of the text margin on a line may be displayed in a particular style with
2899 <code>SCI_MARGINSETSTYLE</code> or each character may be individually styled with
2900 <code>SCI_MARGINSETSTYLES</code> which uses an array of bytes with each byte setting the style
2901 of the corresponding text byte similar to <code>SCI_SETSTYLINGEX</code>.
2902 Setting a text margin will cause a
2903 <a class="message" href="#SC_MOD_CHANGEMARGIN"><code>SC_MOD_CHANGEMARGIN</code></a>
2904 notification to be sent.
2905 </p>
2907 Only some style attributes are active in text margins: font, size/sizeFractional, bold/weight, italics, fore, back, and characterSet.
2908 </p>
2910 <b id="SCI_MARGINSETSTYLEOFFSET">SCI_MARGINSETSTYLEOFFSET(int style)</b><br />
2911 <b id="SCI_MARGINGETSTYLEOFFSET">SCI_MARGINGETSTYLEOFFSET</b><br />
2912 Margin styles may be completely separated from standard text styles by setting a style offset. For example,
2913 <code>SCI_MARGINSETSTYLEOFFSET(256)</code> would allow the margin styles to be numbered from
2914 256 upto 511 so they do not overlap styles set by lexers. Each style number set with <code>SCI_MARGINSETSTYLE</code>
2915 or <code>SCI_MARGINSETSTYLES</code> has the offset added before looking up the style.
2916 </p>
2918 <b id="SCI_SETMARGINOPTIONS">SCI_SETMARGINOPTIONS(int marginOptions)</b><br />
2919 <b id="SCI_GETMARGINOPTIONS">SCI_GETMARGINOPTIONS</b><br />
2920 Define margin options by enabling appropriate bit flags. At the moment, only one flag is available
2921 <code>SC_MARGINOPTION_SUBLINESELECT</code>=1, which controls how wrapped lines are selected when clicking
2922 on margin in front of them. If <code>SC_MARGINOPTION_SUBLINESELECT</code> is set only sub line of wrapped
2923 line is selected, otherwise whole wrapped line is selected. Margin options are set to
2924 <code>SC_MARGINOPTION_NONE</code>=0 by default.
2925 </p>
2927 <h2 id="Annotations">Annotations</h2>
2929 <p>Annotations are read-only lines of text underneath each line of editable text.
2930 An annotation may consist of multiple lines separated by '\n'.
2931 Annotations can be used to display an assembler version of code for debugging or to show diagnostic messages inline or to
2932 line up different versions of text in a merge tool.</p>
2933 <p>Annotations used for inline diagnostics:</p>
2934 <p><img src="annotations.png" alt="Annotations used for inline diagnostics" /></p>
2936 <code>
2937 <a class="message" href="#SCI_ANNOTATIONSETTEXT">SCI_ANNOTATIONSETTEXT(int line, char *text)</a><br />
2938 <a class="message" href="#SCI_ANNOTATIONGETTEXT">SCI_ANNOTATIONGETTEXT(int line, char *text)</a><br />
2939 <a class="message" href="#SCI_ANNOTATIONSETSTYLE">SCI_ANNOTATIONSETSTYLE(int line, int style)</a><br />
2940 <a class="message" href="#SCI_ANNOTATIONGETSTYLE">SCI_ANNOTATIONGETSTYLE(int line)</a><br />
2941 <a class="message" href="#SCI_ANNOTATIONSETSTYLES">SCI_ANNOTATIONSETSTYLES(int line, char *styles)</a><br />
2942 <a class="message" href="#SCI_ANNOTATIONGETSTYLES">SCI_ANNOTATIONGETSTYLES(int line, char *styles)</a><br />
2943 <a class="message" href="#SCI_ANNOTATIONGETLINES">SCI_ANNOTATIONGETLINES(int line)</a><br />
2944 <a class="message" href="#SCI_ANNOTATIONCLEARALL">SCI_ANNOTATIONCLEARALL</a><br />
2945 <a class="message" href="#SCI_ANNOTATIONSETVISIBLE">SCI_ANNOTATIONSETVISIBLE(int visible)</a><br />
2946 <a class="message" href="#SCI_ANNOTATIONGETVISIBLE">SCI_ANNOTATIONGETVISIBLE</a><br />
2947 <a class="message" href="#SCI_ANNOTATIONSETSTYLEOFFSET">SCI_ANNOTATIONSETSTYLEOFFSET(int style)</a><br />
2948 <a class="message" href="#SCI_ANNOTATIONGETSTYLEOFFSET">SCI_ANNOTATIONGETSTYLEOFFSET</a><br />
2949 </code>
2952 <b id="SCI_ANNOTATIONSETTEXT">SCI_ANNOTATIONSETTEXT(int line, char *text)</b><br />
2953 <b id="SCI_ANNOTATIONGETTEXT">SCI_ANNOTATIONGETTEXT(int line, char *text)</b><br />
2954 <b id="SCI_ANNOTATIONSETSTYLE">SCI_ANNOTATIONSETSTYLE(int line, int style)</b><br />
2955 <b id="SCI_ANNOTATIONGETSTYLE">SCI_ANNOTATIONGETSTYLE(int line)</b><br />
2956 <b id="SCI_ANNOTATIONSETSTYLES">SCI_ANNOTATIONSETSTYLES(int line, char *styles)</b><br />
2957 <b id="SCI_ANNOTATIONGETSTYLES">SCI_ANNOTATIONGETSTYLES(int line, char *styles)</b><br />
2958 <b id="SCI_ANNOTATIONGETLINES">SCI_ANNOTATIONGETLINES(int line)</b><br />
2959 <b id="SCI_ANNOTATIONCLEARALL">SCI_ANNOTATIONCLEARALL</b><br />
2960 A different string may be set for each line with <code>SCI_ANNOTATIONSETTEXT</code>.
2961 To clear annotations call <code>SCI_ANNOTATIONSETTEXT</code> with a NULL pointer.
2962 The whole of the text ANNOTATION on a line may be displayed in a particular style with
2963 <code>SCI_ANNOTATIONSETSTYLE</code> or each character may be individually styled with
2964 <code>SCI_ANNOTATIONSETSTYLES</code> which uses an array of bytes with each byte setting the style
2965 of the corresponding text byte similar to <code>SCI_SETSTYLINGEX</code>. The text must be set first as it
2966 specifies how long the annotation is so how many bytes of styling to read.
2967 Setting an annotation will cause a
2968 <a class="message" href="#SC_MOD_CHANGEANNOTATION"><code>SC_MOD_CHANGEANNOTATION</code></a>
2969 notification to be sent.
2970 </p>
2972 The number of lines annotating a line can be retrieved with <code>SCI_ANNOTATIONGETLINES</code>.
2973 All the lines can be cleared of annotations with <code>SCI_ANNOTATIONCLEARALL</code>
2974 which is equivalent to clearing each line (setting to 0) and then deleting other memory used for this feature.
2975 </p>
2977 Only some style attributes are active in annotations: font, size/sizeFractional, bold/weight, italics, fore, back, and characterSet.
2978 </p>
2980 <b id="SCI_ANNOTATIONSETVISIBLE">SCI_ANNOTATIONSETVISIBLE(int visible)</b><br />
2981 <b id="SCI_ANNOTATIONGETVISIBLE">SCI_ANNOTATIONGETVISIBLE</b><br />
2982 Annotations can be made visible in a view and there is a choice of display style when visible.
2983 The two messages set and get the annotation display mode. The <code>visible</code>
2984 argument can be one of:</p>
2986 <table cellpadding="1" cellspacing="2" border="0" summary="Annotation visibility">
2987 <tbody valign="top">
2988 <tr>
2989 <th align="left"><code>ANNOTATION_HIDDEN</code></th>
2991 <td>0</td>
2993 <td>Annotations are not displayed.</td>
2994 </tr>
2996 <tr>
2997 <th align="left"><code>ANNOTATION_STANDARD</code></th>
2999 <td>1</td>
3001 <td>Annotations are drawn left justified with no adornment.</td>
3002 </tr>
3004 <tr>
3005 <th align="left"><code>ANNOTATION_BOXED</code></th>
3007 <td>2</td>
3009 <td>Annotations are indented to match the text and are surrounded by a box.</td>
3010 </tr>
3011 </tbody>
3012 </table>
3015 <b id="SCI_ANNOTATIONSETSTYLEOFFSET">SCI_ANNOTATIONSETSTYLEOFFSET(int style)</b><br />
3016 <b id="SCI_ANNOTATIONGETSTYLEOFFSET">SCI_ANNOTATIONGETSTYLEOFFSET</b><br />
3017 Annotation styles may be completely separated from standard text styles by setting a style offset. For example,
3018 <code>SCI_ANNOTATIONSETSTYLEOFFSET(512)</code> would allow the annotation styles to be numbered from
3019 512 upto 767 so they do not overlap styles set by lexers (or margins if margins offset is 256).
3020 Each style number set with <code>SCI_ANNOTATIONSETSTYLE</code>
3021 or <code>SCI_ANNOTATIONSETSTYLES</code> has the offset added before looking up the style.
3022 </p>
3024 <h2 id="OtherSettings">Other settings</h2>
3025 <code><a class="message" href="#SCI_SETUSEPALETTE">SCI_SETUSEPALETTE(bool
3026 allowPaletteUse)</a><br />
3027 <a class="message" href="#SCI_GETUSEPALETTE">SCI_GETUSEPALETTE</a><br />
3028 <a class="message" href="#SCI_SETBUFFEREDDRAW">SCI_SETBUFFEREDDRAW(bool isBuffered)</a><br />
3029 <a class="message" href="#SCI_GETBUFFEREDDRAW">SCI_GETBUFFEREDDRAW</a><br />
3030 <a class="message" href="#SCI_SETTWOPHASEDRAW">SCI_SETTWOPHASEDRAW(bool twoPhase)</a><br />
3031 <a class="message" href="#SCI_GETTWOPHASEDRAW">SCI_GETTWOPHASEDRAW</a><br />
3032 <a class="message" href="#SCI_SETTECHNOLOGY">SCI_SETTECHNOLOGY(int technology)</a><br />
3033 <a class="message" href="#SCI_GETTECHNOLOGY">SCI_GETTECHNOLOGY</a><br />
3034 <a class="message" href="#SCI_SETFONTQUALITY">SCI_SETFONTQUALITY(int fontQuality)</a><br />
3035 <a class="message" href="#SCI_GETFONTQUALITY">SCI_GETFONTQUALITY</a><br />
3036 <a class="message" href="#SCI_SETCODEPAGE">SCI_SETCODEPAGE(int codePage)</a><br />
3037 <a class="message" href="#SCI_GETCODEPAGE">SCI_GETCODEPAGE</a><br />
3038 <a class="message" href="#SCI_SETKEYSUNICODE">SCI_SETKEYSUNICODE(bool keysUnicode)</a><br />
3039 <a class="message" href="#SCI_GETKEYSUNICODE">SCI_GETKEYSUNICODE</a><br />
3040 <a class="message" href="#SCI_SETWORDCHARS">SCI_SETWORDCHARS(&lt;unused&gt;, const char *characters)</a><br />
3041 <a class="message" href="#SCI_GETWORDCHARS">SCI_GETWORDCHARS(&lt;unused&gt;, char *characters)</a><br />
3042 <a class="message" href="#SCI_SETWHITESPACECHARS">SCI_SETWHITESPACECHARS(&lt;unused&gt;, const char *characters)</a><br />
3043 <a class="message" href="#SCI_GETWHITESPACECHARS">SCI_GETWHITESPACECHARS(&lt;unused&gt;, char *characters)</a><br />
3044 <a class="message" href="#SCI_SETPUNCTUATIONCHARS">SCI_SETPUNCTUATIONCHARS(&lt;unused&gt;, const char *characters)</a><br />
3045 <a class="message" href="#SCI_GETPUNCTUATIONCHARS">SCI_GETPUNCTUATIONCHARS(&lt;unused&gt;, char *characters)</a><br />
3046 <a class="message" href="#SCI_SETCHARSDEFAULT">SCI_SETCHARSDEFAULT</a><br />
3047 <a class="message" href="#SCI_GRABFOCUS">SCI_GRABFOCUS</a><br />
3048 <a class="message" href="#SCI_SETFOCUS">SCI_SETFOCUS(bool focus)</a><br />
3049 <a class="message" href="#SCI_GETFOCUS">SCI_GETFOCUS</a><br />
3050 </code>
3052 <p>To forward a message <code>(WM_XXXX, WPARAM, LPARAM)</code> to Scintilla, you can use
3053 <code>SendMessage(hScintilla, WM_XXXX, WPARAM, LPARAM)</code> where <code>hScintilla</code> is
3054 the handle to the Scintilla window you created as your editor.</p>
3056 <p>While we are on the subject of forwarding messages in Windows, the top level window should
3057 forward any <code>WM_SETTINGCHANGE</code> messages to Scintilla (this is currently used to
3058 collect changes to mouse settings, but could be used for other user interface items in the
3059 future).</p>
3061 <p><b id="SCI_SETBUFFEREDDRAW">SCI_SETBUFFEREDDRAW(bool isBuffered)</b><br />
3062 <b id="SCI_GETBUFFEREDDRAW">SCI_GETBUFFEREDDRAW</b><br />
3063 These messages turn buffered drawing on or off and report the buffered drawing state. Buffered
3064 drawing draws each line into a bitmap rather than directly to the screen and then copies the
3065 bitmap to the screen. This avoids flickering although it does take longer. The default is for
3066 drawing to be buffered.</p>
3068 <p><b id="SCI_SETTWOPHASEDRAW">SCI_SETTWOPHASEDRAW(bool twoPhase)</b><br />
3069 <b id="SCI_GETTWOPHASEDRAW">SCI_GETTWOPHASEDRAW</b><br />
3070 Two phase drawing is a better but slower way of drawing text.
3071 In single phase drawing each run of characters in one style is drawn along with its background.
3072 If a character overhangs the end of a run, such as in "<i>V</i>_" where the
3073 "<i>V</i>" is in a different style from the "_", then this can cause the right hand
3074 side of the "<i>V</i>" to be overdrawn by the background of the "_" which
3075 cuts it off. Two phase drawing
3076 fixes this by drawing all the backgrounds first and then drawing the text in
3077 transparent mode. Two phase drawing may flicker more than single phase
3078 unless buffered drawing is on. The default is for drawing to be two phase.</p>
3080 <p><b id="SCI_SETTECHNOLOGY">SCI_SETTECHNOLOGY(int technology)</b><br />
3081 <b id="SCI_GETTECHNOLOGY">SCI_GETTECHNOLOGY</b><br />
3082 The technology property allows choosing between different drawing APIs and options.
3083 On most platforms, the only choice is <code>SC_TECHNOLOGY_DEFAULT</code> (0).
3084 On Windows Vista or later, <code>SC_TECHNOLOGY_DIRECTWRITE</code> (1)
3085 can be chosen to use the Direct2D and DirectWrite APIs for higher quality antialiased drawing.
3086 Since Direct2D buffers drawing, Scintilla's buffering can be turned off with
3087 <code>SCI_SETBUFFEREDDRAW(0)</code>.</p>
3089 <p><b id="SCI_SETFONTQUALITY">SCI_SETFONTQUALITY(int fontQuality)</b><br />
3090 <b id="SCI_GETFONTQUALITY">SCI_GETFONTQUALITY</b><br />
3091 Manage font quality (antialiasing method). Currently, the following values are available on Windows:
3092 <code>SC_EFF_QUALITY_DEFAULT</code> (backward compatible),
3093 <code>SC_EFF_QUALITY_NON_ANTIALIASED</code>,
3094 <code>SC_EFF_QUALITY_ANTIALIASED</code>,
3095 <code>SC_EFF_QUALITY_LCD_OPTIMIZED</code>.</p>
3096 <p>In case it is necessary to squeeze more options into this property, only a limited number of bits defined
3097 by SC_EFF_QUALITY_MASK (0xf) will be used for quality.</p>
3099 <p><b id="SCI_SETCODEPAGE">SCI_SETCODEPAGE(int codePage)</b><br />
3100 <b id="SCI_GETCODEPAGE">SCI_GETCODEPAGE</b><br />
3101 Scintilla has some support for Japanese, Chinese and Korean DBCS. Use this message with
3102 <code>codePage</code> set to the code page number to set Scintilla to use code page information
3103 to ensure double byte characters are treated as one character rather than two. This also stops
3104 the caret from moving between the two bytes in a double byte character.
3105 Do not use this message to choose between different single byte character sets: it doesn't do that.
3106 Call with
3107 <code>codePage</code> set to zero to disable DBCS support. The default is
3108 <code>SCI_SETCODEPAGE(0)</code>.</p>
3110 <p>Code page <code>SC_CP_UTF8</code> (65001) sets Scintilla into Unicode mode with the document
3111 treated as a sequence of characters expressed in UTF-8. The text is converted to the platform's
3112 normal Unicode encoding before being drawn by the OS and thus can display Hebrew, Arabic,
3113 Cyrillic, and Han characters. Languages which can use two characters stacked vertically in one
3114 horizontal space, such as Thai, will mostly work but there are some issues where the characters
3115 are drawn separately leading to visual glitches. Bi-directional text is not supported. </p>
3117 <p>Code page can be set to 932 (Japanese Shift-JIS), 936 (Simplified Chinese GBK),
3118 949 (Korean Unified Hangul Code), 950 (Traditional Chinese Big5), or 1361 (Korean Johab)
3119 although these may require installation of language specific support.</p>
3121 <p><b id="SCI_SETKEYSUNICODE">SCI_SETKEYSUNICODE(bool keysUnicode)</b><br />
3122 <b id="SCI_GETKEYSUNICODE">SCI_GETKEYSUNICODE</b><br />
3123 On Windows, character keys are normally handled differently depending on whether Scintilla is a wide
3124 or narrow character window with character messages treated as Unicode when wide and as 8 bit otherwise.
3125 Set this property to always treat as Unicode. This option is needed for Delphi.</p>
3127 <p><b id="SCI_SETWORDCHARS">SCI_SETWORDCHARS(&lt;unused&gt;, const char *characters)</b><br />
3128 Scintilla has several functions that operate on words, which are defined to be contiguous
3129 sequences of characters from a particular set of characters. This message defines which
3130 characters are members of that set. The character sets are set to default values before processing this
3131 function.
3132 For example, if you don't allow '_' in your set of characters
3133 use:<br />
3134 <code>SCI_SETWORDCHARS(0, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")</code>;</p>
3136 <p><b id="SCI_GETWORDCHARS">SCI_GETWORDCHARS(&lt;unused&gt;, char *characters)</b><br />
3137 This fills the characters parameter with all the characters included in words.
3138 The characters parameter must be large enough to hold all of the characters.
3139 If the characters parameter is 0 then the length that should be allocated
3140 to store the entire set is returned.</p>
3142 <p><b id="SCI_SETWHITESPACECHARS">SCI_SETWHITESPACECHARS(&lt;unused&gt;, const char *characters)</b><br />
3143 <b id="SCI_GETWHITESPACECHARS">SCI_GETWHITESPACECHARS(&lt;unused&gt;, char *characters)</b><br />
3144 Similar to <code>SCI_SETWORDCHARS</code>, this message allows the user to define which chars Scintilla considers
3145 as whitespace. Setting the whitespace chars allows the user to fine-tune Scintilla's behaviour doing
3146 such things as moving the cursor to the start or end of a word; for example, by defining punctuation chars
3147 as whitespace, they will be skipped over when the user presses ctrl+left or ctrl+right.
3148 This function should be called after <code>SCI_SETWORDCHARS</code> as it will
3149 reset the whitespace characters to the default set.
3150 <code>SCI_GETWHITESPACECHARS</code> behaves similarly to <code>SCI_GETWORDCHARS</code>.</p>
3152 <p><b id="SCI_SETPUNCTUATIONCHARS">SCI_SETPUNCTUATIONCHARS(&lt;unused&gt;, const char *characters)</b><br />
3153 <b id="SCI_GETPUNCTUATIONCHARS">SCI_GETPUNCTUATIONCHARS(&lt;unused&gt;, char *characters)</b><br />
3154 Similar to <code>SCI_SETWORDCHARS</code> and <code>SCI_SETWHITESPACECHARS</code>, this message
3155 allows the user to define which chars Scintilla considers as punctuation.
3156 <code>SCI_GETPUNCTUATIONCHARS</code> behaves similarly to <code>SCI_GETWORDCHARS</code>.</p>
3158 <p><b id="SCI_SETCHARSDEFAULT">SCI_SETCHARSDEFAULT</b><br />
3159 Use the default sets of word and whitespace characters. This sets whitespace to space, tab and other
3160 characters with codes less than 0x20, with word characters set to alphanumeric and '_'.
3161 </p>
3164 <p><b id="SCI_GRABFOCUS">SCI_GRABFOCUS</b><br />
3165 <b id="SCI_SETFOCUS">SCI_SETFOCUS(bool focus)</b><br />
3166 <b id="SCI_GETFOCUS">SCI_GETFOCUS</b><br />
3167 Scintilla can be told to grab the focus with this message. This is needed more on GTK+ where
3168 focus handling is more complicated than on Windows.</p>
3170 <p>The internal focus flag can be set with <code>SCI_SETFOCUS</code>. This is used by clients
3171 that have complex focus requirements such as having their own window that gets the real focus
3172 but with the need to indicate that Scintilla has the logical focus.</p>
3174 <h2 id="BraceHighlighting">Brace highlighting</h2>
3175 <code><a class="message" href="#SCI_BRACEHIGHLIGHT">SCI_BRACEHIGHLIGHT(int pos1, int
3176 pos2)</a><br />
3177 <a class="message" href="#SCI_BRACEBADLIGHT">SCI_BRACEBADLIGHT(int pos1)</a><br />
3178 <a class="message" href="#SCI_BRACEHIGHLIGHTINDICATOR">SCI_BRACEHIGHLIGHTINDICATOR(bool useBraceHighlightIndicator, int indicatorNumber)</a><br />
3179 <a class="message" href="#SCI_BRACEBADLIGHTINDICATOR">SCI_BRACEBADLIGHTINDICATOR(bool useBraceBadLightIndicator, int indicatorNumber)</a><br />
3180 <a class="message" href="#SCI_BRACEMATCH">SCI_BRACEMATCH(int position, int
3181 maxReStyle)</a><br />
3182 </code>
3184 <p><b id="SCI_BRACEHIGHLIGHT">SCI_BRACEHIGHLIGHT(int pos1, int pos2)</b><br />
3185 Up to two characters can be highlighted in a 'brace highlighting style', which is defined as
3186 style number <a class="message" href="#StyleDefinition"><code>STYLE_BRACELIGHT</code></a> (34).
3187 If you have enabled indent guides, you may also wish to highlight the indent that corresponds
3188 with the brace. You can locate the column with <a class="message"
3189 href="#SCI_GETCOLUMN"><code>SCI_GETCOLUMN</code></a> and highlight the indent with <a
3190 class="message" href="#SCI_SETHIGHLIGHTGUIDE"><code>SCI_SETHIGHLIGHTGUIDE</code></a>.</p>
3192 <p><b id="SCI_BRACEBADLIGHT">SCI_BRACEBADLIGHT(int pos1)</b><br />
3193 If there is no matching brace then the <a class="jump" href="#StyleDefinition">brace
3194 badlighting style</a>, style <code>STYLE_BRACEBAD</code> (35), can be used to show the brace
3195 that is unmatched. Using a position of <code>INVALID_POSITION</code> (-1) removes the
3196 highlight.</p>
3198 <p><b id="#SCI_BRACEHIGHLIGHTINDICATOR">SCI_BRACEHIGHLIGHTINDICATOR(bool useBraceHighlightIndicator, int indicatorNumber)</b><br />
3199 Use specified indicator to highlight matching braces instead of changing their style.</p>
3201 <p><b id="#SCI_BRACEBADLIGHTINDICATOR">SCI_BRACEBADLIGHTINDICATOR(bool useBraceBadLightIndicator, int indicatorNumber)</b><br />
3202 Use specified indicator to highlight non matching brace instead of changing its style.</p>
3204 <p><b id="SCI_BRACEMATCH">SCI_BRACEMATCH(int pos, int maxReStyle)</b><br />
3205 The <code>SCI_BRACEMATCH</code> message finds a corresponding matching brace given
3206 <code>pos</code>, the position of one brace. The brace characters handled are '(', ')', '[',
3207 ']', '{', '}', '&lt;', and '&gt;'. The search is forwards from an opening brace and backwards
3208 from a closing brace. If the character at position is not a brace character, or a matching
3209 brace cannot be found, the return value is -1. Otherwise, the return value is the position of
3210 the matching brace.</p>
3212 <p>A match only occurs if the style of the matching brace is the same as the starting brace or
3213 the matching brace is beyond the end of styling. Nested braces are handled correctly. The
3214 <code>maxReStyle</code> parameter must currently be 0 - it may be used in the future to limit
3215 the length of brace searches.</p>
3217 <h2 id="TabsAndIndentationGuides">Tabs and Indentation Guides</h2>
3219 <p>Indentation (the white space at the start of a line) is often used by programmers to clarify
3220 program structure and in some languages, for example Python, it may be part of the language
3221 syntax. Tabs are normally used in editors to insert a tab character or to pad text with spaces
3222 up to the next tab.</p>
3224 <p>Scintilla can be set to treat tab and backspace in the white space at the start of a line in
3225 a special way: inserting a tab indents the line to the next indent position rather than just
3226 inserting a tab at the current character position and backspace unindents the line rather than
3227 deleting a character. Scintilla can also display indentation guides (vertical lines) to help
3228 you to generate code.</p>
3229 <code><a class="message" href="#SCI_SETTABWIDTH">SCI_SETTABWIDTH(int widthInChars)</a><br />
3230 <a class="message" href="#SCI_GETTABWIDTH">SCI_GETTABWIDTH</a><br />
3231 <a class="message" href="#SCI_SETUSETABS">SCI_SETUSETABS(bool useTabs)</a><br />
3232 <a class="message" href="#SCI_GETUSETABS">SCI_GETUSETABS</a><br />
3233 <a class="message" href="#SCI_SETINDENT">SCI_SETINDENT(int widthInChars)</a><br />
3234 <a class="message" href="#SCI_GETINDENT">SCI_GETINDENT</a><br />
3235 <a class="message" href="#SCI_SETTABINDENTS">SCI_SETTABINDENTS(bool tabIndents)</a><br />
3236 <a class="message" href="#SCI_GETTABINDENTS">SCI_GETTABINDENTS</a><br />
3237 <a class="message" href="#SCI_SETBACKSPACEUNINDENTS">SCI_SETBACKSPACEUNINDENTS(bool
3238 bsUnIndents)</a><br />
3239 <a class="message" href="#SCI_GETBACKSPACEUNINDENTS">SCI_GETBACKSPACEUNINDENTS</a><br />
3240 <a class="message" href="#SCI_SETLINEINDENTATION">SCI_SETLINEINDENTATION(int line, int
3241 indentation)</a><br />
3242 <a class="message" href="#SCI_GETLINEINDENTATION">SCI_GETLINEINDENTATION(int line)</a><br />
3243 <a class="message" href="#SCI_GETLINEINDENTPOSITION">SCI_GETLINEINDENTPOSITION(int
3244 line)</a><br />
3245 <a class="message" href="#SCI_SETINDENTATIONGUIDES">SCI_SETINDENTATIONGUIDES(int indentView)</a><br />
3246 <a class="message" href="#SCI_GETINDENTATIONGUIDES">SCI_GETINDENTATIONGUIDES</a><br />
3247 <a class="message" href="#SCI_SETHIGHLIGHTGUIDE">SCI_SETHIGHLIGHTGUIDE(int column)</a><br />
3248 <a class="message" href="#SCI_GETHIGHLIGHTGUIDE">SCI_GETHIGHLIGHTGUIDE</a><br />
3249 </code>
3251 <p><b id="SCI_SETTABWIDTH">SCI_SETTABWIDTH(int widthInChars)</b><br />
3252 <b id="SCI_GETTABWIDTH">SCI_GETTABWIDTH</b><br />
3253 <code>SCI_SETTABWIDTH</code> sets the size of a tab as a multiple of the size of a space
3254 character in <code>STYLE_DEFAULT</code>. The default tab width is 8 characters. There are no
3255 limits on tab sizes, but values less than 1 or large values may have undesirable effects.</p>
3257 <p><b id="SCI_SETUSETABS">SCI_SETUSETABS(bool useTabs)</b><br />
3258 <b id="SCI_GETUSETABS">SCI_GETUSETABS</b><br />
3259 <code>SCI_SETUSETABS</code> determines whether indentation should be created out of a mixture
3260 of tabs and spaces or be based purely on spaces. Set <code>useTabs</code> to <code>false</code>
3261 (0) to create all tabs and indents out of spaces. The default is <code>true</code>. You can use
3262 <a class="message" href="#SCI_GETCOLUMN"><code>SCI_GETCOLUMN</code></a> to get the column of a
3263 position taking the width of a tab into account.</p>
3264 <p><b id="SCI_SETINDENT">SCI_SETINDENT(int widthInChars)</b><br />
3265 <b id="SCI_GETINDENT">SCI_GETINDENT</b><br />
3266 <code>SCI_SETINDENT</code> sets the size of indentation in terms of the width of a space in <a
3267 class="message" href="#StyleDefinition"><code>STYLE_DEFAULT</code></a>. If you set a width of
3268 0, the indent size is the same as the tab size. There are no limits on indent sizes, but values
3269 less than 0 or large values may have undesirable effects.
3270 </p>
3272 <p><b id="SCI_SETTABINDENTS">SCI_SETTABINDENTS(bool tabIndents)</b><br />
3273 <b id="SCI_GETTABINDENTS">SCI_GETTABINDENTS</b><br />
3274 <b id="SCI_SETBACKSPACEUNINDENTS">SCI_SETBACKSPACEUNINDENTS(bool bsUnIndents)</b><br />
3275 <b id="SCI_GETBACKSPACEUNINDENTS">SCI_GETBACKSPACEUNINDENTS</b><br />
3276 </p>
3278 <p>Inside indentation white space, the tab and backspace keys can be made to indent and
3279 unindent rather than insert a tab character or delete a character with the
3280 <code>SCI_SETTABINDENTS</code> and <code>SCI_SETBACKSPACEUNINDENTS</code> functions.</p>
3282 <p><b id="SCI_SETLINEINDENTATION">SCI_SETLINEINDENTATION(int line, int indentation)</b><br />
3283 <b id="SCI_GETLINEINDENTATION">SCI_GETLINEINDENTATION(int line)</b><br />
3284 The amount of indentation on a line can be discovered and set with
3285 <code>SCI_GETLINEINDENTATION</code> and <code>SCI_SETLINEINDENTATION</code>. The indentation is
3286 measured in character columns, which correspond to the width of space characters.</p>
3288 <p><b id="SCI_GETLINEINDENTPOSITION">SCI_GETLINEINDENTPOSITION(int line)</b><br />
3289 This returns the position at the end of indentation of a line.</p>
3291 <p><b id="SCI_SETINDENTATIONGUIDES">SCI_SETINDENTATIONGUIDES(int indentView)</b><br />
3292 <b id="SCI_GETINDENTATIONGUIDES">SCI_GETINDENTATIONGUIDES</b><br />
3293 Indentation guides are dotted vertical lines that appear within indentation white space every
3294 indent size columns. They make it easy to see which constructs line up especially when they
3295 extend over multiple pages. Style <a class="message"
3296 href="#StyleDefinition"><code>STYLE_INDENTGUIDE</code></a> (37) is used to specify the
3297 foreground and background colour of the indentation guides.</p>
3299 <p>There are 4 indentation guide views.
3300 SC_IV_NONE turns the feature off but the other 3 states determine how far the guides appear on
3301 empty lines. </p>
3302 <table border="0" summary="Search flags">
3303 <tbody>
3304 <tr>
3305 <td><code>SC_IV_NONE</code></td>
3306 <td>No indentation guides are shown.</td>
3307 </tr>
3309 <tr>
3310 <td><code>SC_IV_REAL</code></td>
3311 <td>Indentation guides are shown inside real indentation white space.</td>
3312 </tr>
3314 <tr>
3315 <td><code>SC_IV_LOOKFORWARD</code></td>
3316 <td>Indentation guides are shown beyond the actual indentation up to the level of the
3317 next non-empty line.
3318 If the previous non-empty line was a fold header then indentation guides are shown for
3319 one more level of indent than that line. This setting is good for Python.</td>
3320 </tr>
3322 <tr>
3323 <td><code>SC_IV_LOOKBOTH</code></td>
3324 <td>Indentation guides are shown beyond the actual indentation up to the level of the
3325 next non-empty line or previous non-empty line whichever is the greater.
3326 This setting is good for most languages.</td>
3327 </tr>
3329 </tbody>
3330 </table>
3332 <p><b id="SCI_SETHIGHLIGHTGUIDE">SCI_SETHIGHLIGHTGUIDE(int column)</b><br />
3333 <b id="SCI_GETHIGHLIGHTGUIDE">SCI_GETHIGHLIGHTGUIDE</b><br />
3334 When brace highlighting occurs, the indentation guide corresponding to the braces may be
3335 highlighted with the brace highlighting style, <a class="message"
3336 href="#StyleDefinition"><code>STYLE_BRACELIGHT</code></a> (34). Set <code>column</code> to 0 to
3337 cancel this highlight.</p>
3339 <h2 id="Markers">Markers</h2>
3341 <p>There are 32 markers, numbered 0 to <code>MARKER_MAX</code> (31), and you can assign any combination of them to each
3342 line in the document. Markers appear in the <a class="jump" href="#Margins">selection
3343 margin</a> to the left of the text. If the selection margin is set to zero width, the
3344 background colour of the whole line is changed instead. Marker numbers 25 to 31 are used by
3345 Scintilla in folding margins, and have symbolic names of the form <code>SC_MARKNUM_</code>*,
3346 for example <code>SC_MARKNUM_FOLDEROPEN</code>.</p>
3348 <p>Marker numbers 0 to 24 have no pre-defined function; you can use them to mark syntax errors
3349 or the current point of execution, break points, or whatever you need marking. If you do not
3350 need folding, you can use all 32 for any purpose you wish.</p>
3352 <p>Each marker number has a symbol associated with it. You can also set the foreground and
3353 background colour for each marker number, so you can use the same symbol more than once with
3354 different colouring for different uses. Scintilla has a set of symbols you can assign
3355 (<code>SC_MARK_</code>*) or you can use characters. By default, all 32 markers are set to
3356 <code>SC_MARK_CIRCLE</code> with a black foreground and a white background.</p>
3358 <p>The markers are drawn in the order of their numbers, so higher numbered markers appear on
3359 top of lower numbered ones. Markers try to move with their text by tracking where the start of
3360 their line moves. When a line is deleted, its markers are combined, by an <code>OR</code>
3361 operation, with the markers of the previous line.</p>
3362 <code><a class="message" href="#SCI_MARKERDEFINE">SCI_MARKERDEFINE(int markerNumber, int
3363 markerSymbols)</a><br />
3364 <a class="message" href="#SCI_MARKERDEFINEPIXMAP">SCI_MARKERDEFINEPIXMAP(int markerNumber,
3365 const char *xpm)</a><br />
3366 <a class="message" href="#SCI_RGBAIMAGESETWIDTH">SCI_RGBAIMAGESETWIDTH(int width)</a><br />
3367 <a class="message" href="#SCI_RGBAIMAGESETHEIGHT">SCI_RGBAIMAGESETHEIGHT(int height)</a><br />
3368 <a class="message" href="#SCI_RGBAIMAGESETSCALE">SCI_RGBAIMAGESETSCALE(int scalePercent)</a><br />
3369 <a class="message" href="#SCI_MARKERDEFINERGBAIMAGE">SCI_MARKERDEFINERGBAIMAGE(int markerNumber,
3370 const char *pixels)</a><br />
3371 <a class="message" href="#SCI_MARKERSYMBOLDEFINED">SCI_MARKERSYMBOLDEFINED(int markerNumber)
3372 </a><br />
3373 <a class="message" href="#SCI_MARKERSETFORE">SCI_MARKERSETFORE(int markerNumber, int
3374 colour)</a><br />
3375 <a class="message" href="#SCI_MARKERSETBACK">SCI_MARKERSETBACK(int markerNumber, int
3376 colour)</a><br />
3377 <a class="message" href="#SCI_MARKERSETBACKSELECTED">SCI_MARKERSETBACKSELECTED(int markerNumber, int
3378 colour)</a><br />
3379 <a class="message" href="#SCI_MARKERENABLEHIGHLIGHT">SCI_MARKERENABLEHIGHLIGHT(int enabled)</a><br />
3380 <a class="message" href="#SCI_MARKERSETALPHA">SCI_MARKERSETALPHA(int markerNumber, int
3381 alpha)</a><br />
3382 <a class="message" href="#SCI_MARKERADD">SCI_MARKERADD(int line, int markerNumber)</a><br />
3383 <a class="message" href="#SCI_MARKERADDSET">SCI_MARKERADDSET(int line, int markerMask)</a><br />
3384 <a class="message" href="#SCI_MARKERDELETE">SCI_MARKERDELETE(int line, int
3385 markerNumber)</a><br />
3386 <a class="message" href="#SCI_MARKERDELETEALL">SCI_MARKERDELETEALL(int markerNumber)</a><br />
3387 <a class="message" href="#SCI_MARKERGET">SCI_MARKERGET(int line)</a><br />
3388 <a class="message" href="#SCI_MARKERNEXT">SCI_MARKERNEXT(int lineStart, int
3389 markerMask)</a><br />
3390 <a class="message" href="#SCI_MARKERPREVIOUS">SCI_MARKERPREVIOUS(int lineStart, int
3391 markerMask)</a><br />
3392 <a class="message" href="#SCI_MARKERLINEFROMHANDLE">SCI_MARKERLINEFROMHANDLE(int
3393 handle)</a><br />
3394 <a class="message" href="#SCI_MARKERDELETEHANDLE">SCI_MARKERDELETEHANDLE(int handle)</a><br />
3395 </code>
3397 <p><b id="SCI_MARKERDEFINE">SCI_MARKERDEFINE(int markerNumber, int markerSymbols)</b><br />
3398 This message associates a marker number in the range 0 to 31 with one of the marker symbols or
3399 an ASCII character. The general-purpose marker symbols currently available are:<br />
3400 <code>SC_MARK_CIRCLE</code>, <code>SC_MARK_ROUNDRECT</code>, <code>SC_MARK_ARROW</code>,
3401 <code>SC_MARK_SMALLRECT</code>, <code>SC_MARK_SHORTARROW</code>, <code>SC_MARK_EMPTY</code>,
3402 <code>SC_MARK_ARROWDOWN</code>, <code>SC_MARK_MINUS</code>, <code>SC_MARK_PLUS</code>,
3403 <code>SC_MARK_ARROWS</code>, <code>SC_MARK_DOTDOTDOT</code>,
3404 <code>SC_MARK_BACKGROUND</code>, <code>SC_MARK_LEFTRECT</code>,
3405 <code>SC_MARK_FULLRECT</code>, and <code>SC_MARK_UNDERLINE</code>.</p>
3407 <p>The <code>SC_MARK_BACKGROUND</code> marker changes the background colour of the line only.
3408 The <code>SC_MARK_FULLRECT</code> symbol mirrors this, changing only the margin background colour.
3409 <code>SC_MARK_UNDERLINE</code> draws an underline across the text.
3410 The <code>SC_MARK_EMPTY</code> symbol is invisible, allowing client code to track the movement
3411 of lines. You would also use it if you changed the folding style and wanted one or more of the
3412 <code>SC_FOLDERNUM_</code>* markers to have no associated symbol.</p>
3414 <p>Applications may use the marker symbol <code>SC_MARK_AVAILABLE</code> to indicate that
3415 plugins may allocate that marker number.
3416 </p>
3418 <p>There are also marker symbols designed for use in the folding margin in a flattened tree
3419 style.<br />
3420 <code>SC_MARK_BOXMINUS</code>, <code>SC_MARK_BOXMINUSCONNECTED</code>,
3421 <code>SC_MARK_BOXPLUS</code>, <code>SC_MARK_BOXPLUSCONNECTED</code>,
3422 <code>SC_MARK_CIRCLEMINUS</code>, <code>SC_MARK_CIRCLEMINUSCONNECTED</code>,
3423 <code>SC_MARK_CIRCLEPLUS</code>, <code>SC_MARK_CIRCLEPLUSCONNECTED</code>,
3424 <code>SC_MARK_LCORNER</code>, <code>SC_MARK_LCORNERCURVE</code>, <code>SC_MARK_TCORNER</code>,
3425 <code>SC_MARK_TCORNERCURVE</code>, and <code>SC_MARK_VLINE</code>.</p>
3426 Characters can be used as markers by adding the ASCII value of the character to
3427 <code>SC_MARK_CHARACTER</code> (10000). For example, to use 'A' (ASCII code 65) as marker
3428 number 1 use:<br />
3429 <code>SCI_MARKERDEFINE(1, SC_MARK_CHARACTER+65)</code>. <br />
3431 <p>The marker numbers <code>SC_MARKNUM_FOLDER</code> and <code>SC_MARKNUM_FOLDEROPEN</code> are
3432 used for showing that a fold is present and open or closed. Any symbols may be assigned for
3433 this purpose although the (<code>SC_MARK_PLUS</code>, <code>SC_MARK_MINUS</code>) pair or the
3434 (<code>SC_MARK_ARROW</code>, <code>SC_MARK_ARROWDOWN</code>) pair are good choices. As well as
3435 these two, more assignments are needed for the flattened tree style:
3436 <code>SC_MARKNUM_FOLDEREND</code>, <code>SC_MARKNUM_FOLDERMIDTAIL</code>,
3437 <code>SC_MARKNUM_FOLDEROPENMID</code>, <code>SC_MARKNUM_FOLDERSUB</code>, and
3438 <code>SC_MARKNUM_FOLDERTAIL</code>. The bits used for folding are specified by
3439 <code>SC_MASK_FOLDERS</code>, which is commonly used as an argument to
3440 <code>SCI_SETMARGINMASKN</code> when defining a margin to be used for folding.</p>
3442 <p>This table shows which <code>SC_MARK_</code>* symbols should be assigned to which
3443 <code>SC_MARKNUM_</code>* marker numbers to obtain four folding styles: Arrow (mimics
3444 Macintosh), plus/minus shows folded lines as '+' and opened folds as '-', Circle tree, Box
3445 tree.</p>
3447 <table cellpadding="1" cellspacing="2" border="0" summary="Markers used for folding">
3448 <thead align="left">
3449 <tr>
3450 <th><code>SC_MARKNUM_</code>*</th>
3452 <th>Arrow</th>
3454 <th>Plus/minus</th>
3456 <th>Circle tree</th>
3458 <th>Box tree</th>
3459 </tr>
3460 </thead>
3462 <tbody valign="top">
3463 <tr>
3464 <th align="left"><code>FOLDEROPEN</code></th>
3466 <td><code>ARROWDOWN</code></td>
3468 <td><code>MINUS</code></td>
3470 <td><code>CIRCLEMINUS</code></td>
3472 <td><code>BOXMINUS</code></td>
3473 </tr>
3475 <tr>
3476 <th align="left"><code>FOLDER</code></th>
3478 <td><code>ARROW</code></td>
3480 <td><code>PLUS</code></td>
3482 <td><code>CIRCLEPLUS</code></td>
3484 <td><code>BOXPLUS</code></td>
3485 </tr>
3487 <tr>
3488 <th align="left"><code>FOLDERSUB</code></th>
3490 <td><code>EMPTY</code></td>
3492 <td><code>EMPTY</code></td>
3494 <td><code>VLINE</code></td>
3496 <td><code>VLINE</code></td>
3497 </tr>
3499 <tr>
3500 <th align="left"><code>FOLDERTAIL</code></th>
3502 <td><code>EMPTY</code></td>
3504 <td><code>EMPTY</code></td>
3506 <td><code>LCORNERCURVE</code></td>
3508 <td><code>LCORNER</code></td>
3509 </tr>
3511 <tr>
3512 <th align="left"><code>FOLDEREND</code></th>
3514 <td><code>EMPTY</code></td>
3516 <td><code>EMPTY</code></td>
3518 <td><code>CIRCLEPLUSCONNECTED</code></td>
3520 <td><code>BOXPLUSCONNECTED</code></td>
3521 </tr>
3523 <tr>
3524 <th align="left"><code>FOLDEROPENMID</code></th>
3526 <td><code>EMPTY</code></td>
3528 <td><code>EMPTY</code></td>
3530 <td><code>CIRCLEMINUSCONNECTED</code></td>
3532 <td><code>BOXMINUSCONNECTED</code></td>
3533 </tr>
3535 <tr>
3536 <th align="left"><code>FOLDERMIDTAIL</code></th>
3538 <td><code>EMPTY</code></td>
3540 <td><code>EMPTY</code></td>
3542 <td><code>TCORNERCURVE</code></td>
3544 <td><code>TCORNER</code></td>
3545 </tr>
3546 </tbody>
3547 </table>
3549 <p><b id="SCI_MARKERDEFINEPIXMAP">SCI_MARKERDEFINEPIXMAP(int markerNumber, const char
3550 *xpm)</b><br />
3551 Markers can be set to pixmaps with this message. The
3552 <a class="jump" href="#XPM">XPM format</a> is used for the pixmap.
3553 Pixmaps use the <code>SC_MARK_PIXMAP</code> marker symbol. </p>
3556 <b id="SCI_RGBAIMAGESETWIDTH">SCI_RGBAIMAGESETWIDTH(int width)</b><br />
3557 <b id="SCI_RGBAIMAGESETHEIGHT">SCI_RGBAIMAGESETHEIGHT(int height)</b><br />
3558 <b id="SCI_RGBAIMAGESETSCALE">SCI_RGBAIMAGESETSCALE(int scalePercent)</b><br />
3559 <b id="SCI_MARKERDEFINERGBAIMAGE">SCI_MARKERDEFINERGBAIMAGE(int markerNumber, const char *pixels)</b><br />
3560 Markers can be set to translucent pixmaps with this message. The
3561 <a class="jump" href="#RGBA">RGBA format</a> is used for the pixmap.
3562 The width and height must previously been set with the <code>SCI_RGBAIMAGESETWIDTH</code> and
3563 <code>SCI_RGBAIMAGESETHEIGHT</code> messages.</p>
3564 <p>A scale factor in percent may be set with <code>SCI_RGBAIMAGESETSCALE</code>. This is useful on OS X with
3565 a retina display where each display unit is 2 pixels: use a factor of 200 so that each image pixel is dsplayed using a screen pixel.
3566 The default scale, 100, will stretch each image pixel to cover 4 screen pixels on a retina display.</p>
3567 <p>Pixmaps use the <code>SC_MARK_RGBAIMAGE</code> marker symbol. </p>
3569 <p><b id="SCI_MARKERSYMBOLDEFINED">SCI_MARKERSYMBOLDEFINED(int markerNumber)</b><br />
3570 Returns the symbol defined for a markerNumber with <code>SCI_MARKERDEFINE</code>
3571 or <code>SC_MARK_PIXMAP</code> if defined with <code>SCI_MARKERDEFINEPIXMAP</code>
3572 or <code>SC_MARK_RGBAIMAGE</code> if defined with <code>SCI_MARKERDEFINERGBAIMAGE</code>.</p>
3574 <p><b id="SCI_MARKERSETFORE">SCI_MARKERSETFORE(int markerNumber, int <a class="jump"
3575 href="#colour">colour</a>)</b><br />
3576 <b id="SCI_MARKERSETBACK">SCI_MARKERSETBACK(int markerNumber, int <a class="jump"
3577 href="#colour">colour</a>)</b><br />
3578 These two messages set the foreground and background colour of a marker number.<br />
3579 <b id="SCI_MARKERSETBACKSELECTED">SCI_MARKERSETBACKSELECTED(int markerNumber, int <a class="jump"
3580 href="#colour">colour</a>)</b><br />
3581 This message sets the highlight background colour of a marker number when its folding block is selected. The default colour is #FF0000.</p>
3582 <p><b id="SCI_MARKERENABLEHIGHLIGHT">SCI_MARKERENABLEHIGHLIGHT(bool enabled)</b><br />
3583 This message allows to enable/disable the highlight folding block when it is selected. (i.e. block that contains the caret)</p>
3584 <p><b id="SCI_MARKERSETALPHA">SCI_MARKERSETALPHA(int markerNumber, int <a class="jump"
3585 href="#alpha">alpha</a>)</b><br />
3586 When markers are drawn in the content area, either because there is no margin for them or
3587 they are of <code>SC_MARK_BACKGROUND</code> or <code>SC_MARK_UNDERLINE</code> types, they may be drawn translucently by
3588 setting an alpha value.</p>
3590 <p><b id="SCI_MARKERADD">SCI_MARKERADD(int line, int markerNumber)</b><br />
3591 This message adds marker number <code>markerNumber</code> to a line. The message returns -1 if
3592 this fails (illegal line number, out of memory) or it returns a marker handle number that
3593 identifies the added marker. You can use this returned handle with <a class="message"
3594 href="#SCI_MARKERLINEFROMHANDLE"><code>SCI_MARKERLINEFROMHANDLE</code></a> to find where a
3595 marker is after moving or combining lines and with <a class="message"
3596 href="#SCI_MARKERDELETEHANDLE"><code>SCI_MARKERDELETEHANDLE</code></a> to delete the marker
3597 based on its handle. The message does not check the value of markerNumber, nor does it
3598 check if the line already contains the marker.</p>
3600 <p><b id="SCI_MARKERADDSET">SCI_MARKERADDSET(int line, int markerMask)</b><br />
3601 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
3602 <a class="message" href="#SCI_MARKERGET"><code>SCI_MARKERGET</code></a>
3603 (and used by the mask-based marker search functions
3604 <a class="message" href="#SCI_MARKERNEXT"><code>SCI_MARKERNEXT</code></a> and
3605 <a class="message" href="#SCI_MARKERPREVIOUS"><code>SCI_MARKERPREVIOUS</code></a>).
3606 As with
3607 <a class="message" href="#SCI_MARKERADD"><code>SCI_MARKERADD</code></a>, no check is made
3608 to see if any of the markers are already present on the targeted line.</p>
3610 <p><b id="SCI_MARKERDELETE">SCI_MARKERDELETE(int line, int markerNumber)</b><br />
3611 This searches the given line number for the given marker number and deletes it if it is
3612 present. If you added the same marker more than once to the line, this will delete one copy
3613 each time it is used. If you pass in a marker number of -1, all markers are deleted from the
3614 line.</p>
3616 <p><b id="SCI_MARKERDELETEALL">SCI_MARKERDELETEALL(int markerNumber)</b><br />
3617 This removes markers of the given number from all lines. If markerNumber is -1, it deletes all
3618 markers from all lines.</p>
3620 <p><b id="SCI_MARKERGET">SCI_MARKERGET(int line)</b><br />
3621 This returns a 32-bit integer that indicates which markers were present on the line. Bit 0 is
3622 set if marker 0 is present, bit 1 for marker 1 and so on.</p>
3624 <p><b id="SCI_MARKERNEXT">SCI_MARKERNEXT(int lineStart, int markerMask)</b><br />
3625 <b id="SCI_MARKERPREVIOUS">SCI_MARKERPREVIOUS(int lineStart, int markerMask)</b><br />
3626 These messages search efficiently for lines that include a given set of markers. The search
3627 starts at line number <code>lineStart</code> and continues forwards to the end of the file
3628 (<code>SCI_MARKERNEXT</code>) or backwards to the start of the file
3629 (<code>SCI_MARKERPREVIOUS</code>). The <code>markerMask</code> argument should have one bit set
3630 for each marker you wish to find. Set bit 0 to find marker 0, bit 1 for marker 1 and so on. The
3631 message returns the line number of the first line that contains one of the markers in
3632 <code>markerMask</code> or -1 if no marker is found.</p>
3634 <p><b id="SCI_MARKERLINEFROMHANDLE">SCI_MARKERLINEFROMHANDLE(int markerHandle)</b><br />
3635 The <code>markerHandle</code> argument is an identifier for a marker returned by <a
3636 class="message" href="#SCI_MARKERADD"><code>SCI_MARKERADD</code></a>. This function searches
3637 the document for the marker with this handle and returns the line number that contains it or -1
3638 if it is not found.</p>
3640 <p><b id="SCI_MARKERDELETEHANDLE">SCI_MARKERDELETEHANDLE(int markerHandle)</b><br />
3641 The <code>markerHandle</code> argument is an identifier for a marker returned by <a
3642 class="message" href="#SCI_MARKERADD"><code>SCI_MARKERADD</code></a>. This function searches
3643 the document for the marker with this handle and deletes the marker if it is found.</p>
3645 <h2 id="Indicators">Indicators</h2>
3647 <p>Indicators are used to display additional information over the top of styling.
3648 They can be used to show, for example, syntax errors, deprecated names and bad indentation
3649 by drawing underlines under text or boxes around text. Originally, Scintilla stored indicator information in
3650 the style bytes but this has proved limiting, so now up to 32 separately stored indicators may be used.
3651 While style byte indicators currently still work, they will soon be removed so all the bits in each style
3652 byte can be used for lexical states.</p>
3654 <p>Indicators may be displayed as simple underlines, squiggly underlines, a
3655 line of small 'T' shapes, a line of diagonal hatching, a strike-out or a rectangle around the text.</p>
3657 <p>The <code>SCI_INDIC*</code> messages allow you to get and set the visual appearance of the
3658 indicators. They all use an <code>indicatorNumber</code> argument in the range 0 to INDIC_MAX(31)
3659 to set the indicator to style. To prevent interference the set of indicators is divided up into a range for use
3660 by lexers (0..7) and a range for use by containers
3661 (8=<code>INDIC_CONTAINER</code> .. 31=<code>INDIC_MAX</code>).</p>
3663 <code><a class="message" href="#SCI_INDICSETSTYLE">SCI_INDICSETSTYLE(int indicatorNumber, int
3664 indicatorStyle)</a><br />
3665 <a class="message" href="#SCI_INDICGETSTYLE">SCI_INDICGETSTYLE(int indicatorNumber)</a><br />
3666 <a class="message" href="#SCI_INDICSETFORE">SCI_INDICSETFORE(int indicatorNumber, int
3667 colour)</a><br />
3668 <a class="message" href="#SCI_INDICGETFORE">SCI_INDICGETFORE(int indicatorNumber)</a><br />
3669 <a class="message" href="#SCI_INDICSETALPHA">SCI_INDICSETALPHA(int indicatorNumber, int alpha)</a><br />
3670 <a class="message" href="#SCI_INDICGETALPHA">SCI_INDICGETALPHA(int indicatorNumber)</a><br />
3671 <a class="message" href="#SCI_INDICSETOUTLINEALPHA">SCI_INDICSETOUTLINEALPHA(int indicatorNumber, int alpha)</a><br />
3672 <a class="message" href="#SCI_INDICGETOUTLINEALPHA">SCI_INDICGETOUTLINEALPHA(int indicatorNumber)</a><br />
3673 <a class="message" href="#SCI_INDICSETUNDER">SCI_INDICSETUNDER(int indicatorNumber, bool under)</a><br />
3674 <a class="message" href="#SCI_INDICGETUNDER">SCI_INDICGETUNDER(int indicatorNumber)</a><br />
3675 </code>
3677 <p><b id="SCI_INDICSETSTYLE">SCI_INDICSETSTYLE(int indicatorNumber, int
3678 indicatorStyle)</b><br />
3679 <b id="SCI_INDICGETSTYLE">SCI_INDICGETSTYLE(int indicatorNumber)</b><br />
3680 These two messages set and get the style for a particular indicator. The indicator styles
3681 currently available are:</p>
3683 <table cellpadding="1" cellspacing="2" border="0" summary="Indicators">
3684 <tbody>
3685 <tr>
3686 <th align="left">Symbol</th>
3688 <th>Value</th>
3690 <th align="left">Visual effect</th>
3691 </tr>
3692 </tbody>
3694 <tbody valign="top">
3695 <tr>
3696 <td align="left"><code>INDIC_PLAIN</code></td>
3698 <td align="center">0</td>
3700 <td>Underlined with a single, straight line.</td>
3701 </tr>
3703 <tr>
3704 <td align="left"><code>INDIC_SQUIGGLE</code></td>
3706 <td align="center">1</td>
3708 <td>A squiggly underline. Requires 3 pixels of descender space.</td>
3709 </tr>
3711 <tr>
3712 <td align="left"><code>INDIC_TT</code></td>
3714 <td align="center">2</td>
3716 <td>A line of small T shapes.</td>
3717 </tr>
3719 <tr>
3720 <td align="left"><code>INDIC_DIAGONAL</code></td>
3722 <td align="center">3</td>
3724 <td>Diagonal hatching.</td>
3725 </tr>
3727 <tr>
3728 <td align="left"><code>INDIC_STRIKE</code></td>
3730 <td align="center">4</td>
3732 <td>Strike out.</td>
3733 </tr>
3735 <tr>
3736 <td align="left"><code>INDIC_HIDDEN</code></td>
3738 <td align="center">5</td>
3740 <td>An indicator with no visual effect.</td>
3741 </tr>
3743 <tr>
3744 <td align="left"><code>INDIC_BOX</code></td>
3746 <td align="center">6</td>
3748 <td>A rectangle around the text.</td>
3749 </tr>
3751 <tr>
3752 <td align="left"><code>INDIC_ROUNDBOX</code></td>
3754 <td align="center">7</td>
3756 <td>A rectangle with rounded corners around the text using translucent drawing with the
3757 interior usually more transparent than the border. You can use
3758 <a class="message" href="#SCI_INDICSETALPHA">SCI_INDICSETALPHA</a> and
3759 <a class="message" href="#SCI_INDICSETOUTLINEALPHA">SCI_INDICSETOUTLINEALPHA</a>
3760 to control the alpha transparency values. The default alpha values are 30 for fill colour and 50 for outline colour.</td>
3761 </tr>
3763 <tr>
3764 <td align="left"><code>INDIC_STRAIGHTBOX</code></td>
3766 <td align="center">8</td>
3768 <td>A rectangle around the text using translucent drawing with the
3769 interior usually more transparent than the border. You can use
3770 <a class="message" href="#SCI_INDICSETALPHA">SCI_INDICSETALPHA</a> and
3771 <a class="message" href="#SCI_INDICSETOUTLINEALPHA">SCI_INDICSETOUTLINEALPHA</a>
3772 to control the alpha transparency values. The default alpha values are 30 for fill colour and 50 for outline colour.</td>
3773 </tr>
3775 <tr>
3776 <td align="left"><code>INDIC_DASH</code></td>
3778 <td align="center">9</td>
3780 <td>A dashed underline.</td>
3781 </tr>
3783 <tr>
3784 <td align="left"><code>INDIC_DOTS</code></td>
3786 <td align="center">10</td>
3788 <td>A dotted underline.</td>
3789 </tr>
3791 <tr>
3792 <td align="left"><code>INDIC_SQUIGGLELOW</code></td>
3794 <td align="center">11</td>
3796 <td>Similar to <code>INDIC_SQUIGGLE</code> but only using 2 vertical pixels
3797 so will fit under small fonts.</td>
3798 </tr>
3800 <tr>
3801 <td align="left"><code>INDIC_DOTBOX</code></td>
3803 <td align="center">12</td>
3805 <td>A dotted rectangle around the text using translucent drawing.
3806 Translucency alternates between the alpha and outline alpha settings with the top-left pixel using the alpha setting.
3807 <a class="message" href="#SCI_INDICSETALPHA">SCI_INDICSETALPHA</a> and
3808 <a class="message" href="#SCI_INDICSETOUTLINEALPHA">SCI_INDICSETOUTLINEALPHA</a>
3809 control the alpha transparency values. The default values are 30 for alpha and 50 for outline alpha.
3810 To avoid excessive memory allocation the maximum width of a dotted box is 4000 pixels.
3811 Not available for OS X Carbon.</td>
3812 </tr>
3814 <tr>
3815 <td align="left"><code>INDIC_SQUIGGLEPIXMAP</code></td>
3817 <td align="center">13</td>
3819 <td>A version of <code>INDIC_SQUIGGLE</code> that draws using a pixmap instead of
3820 as a series of line segments for performance.
3821 Measured to be between 3 and 6 times faster than <code>INDIC_SQUIGGLE</code> on GTK+.
3822 Apperance will not be as good as <code>INDIC_SQUIGGLE</code> on OS X in HiDPI mode.</td>
3823 </tr>
3825 </tbody>
3826 </table>
3828 <p>The default indicator styles are equivalent to:<br />
3829 <code>SCI_INDICSETSTYLE(0, INDIC_SQUIGGLE);</code><br />
3830 <code>SCI_INDICSETSTYLE(1, INDIC_TT);</code><br />
3831 <code>SCI_INDICSETSTYLE(2, INDIC_PLAIN);</code></p>
3833 <p><b id="SCI_INDICSETFORE">SCI_INDICSETFORE(int indicatorNumber, int <a class="jump" href="#colour">colour</a>)</b><br />
3834 <b id="SCI_INDICGETFORE">SCI_INDICGETFORE(int indicatorNumber)</b><br />
3835 These two messages set and get the colour used to draw an indicator. The default indicator
3836 colours are equivalent to:<br />
3837 <code>SCI_INDICSETFORE(0, 0x007f00);</code> (dark green)<br />
3838 <code>SCI_INDICSETFORE(1, 0xff0000);</code> (light blue)<br />
3839 <code>SCI_INDICSETFORE(2, 0x0000ff);</code> (light red)</p>
3841 <p><b id="SCI_INDICSETALPHA">SCI_INDICSETALPHA(int indicatorNumber, int alpha)</b><br />
3842 <b id="SCI_INDICGETALPHA">SCI_INDICGETALPHA(int indicatorNumber)</b><br />
3843 These two messages set and get the alpha transparency used for drawing the
3844 fill colour of the INDIC_ROUNDBOX and INDIC_STRAIGHTBOX rectangle. The alpha value can range from
3845 0 (completely transparent) to 255 (no transparency).
3846 </p>
3848 <p><b id="SCI_INDICSETOUTLINEALPHA">SCI_INDICSETOUTLINEALPHA(int indicatorNumber, int alpha)</b><br />
3849 <b id="SCI_INDICGETOUTLINEALPHA">SCI_INDICGETOUTLINEALPHA(int indicatorNumber)</b><br />
3850 These two messages set and get the alpha transparency used for drawing the
3851 outline colour of the INDIC_ROUNDBOX and INDIC_STRAIGHTBOX rectangle. The alpha value can range from
3852 0 (completely transparent) to 255 (no transparency).
3853 </p>
3855 <p><b id="SCI_INDICSETUNDER">SCI_INDICSETUNDER(int indicatorNumber, bool under)</b><br />
3856 <b id="SCI_INDICGETUNDER">SCI_INDICGETUNDER(int indicatorNumber)</b><br />
3857 These two messages set and get whether an indicator is drawn under text or over(default).
3858 Drawing under text works only for modern indicators when <a class="message" href="#SCI_SETTWOPHASEDRAW">two phase drawing</a>
3859 is enabled.</p>
3861 <h3 id="ModernIndicators">Modern Indicators</h3>
3863 <p>Modern indicators are stored in a format similar to run length encoding which is efficient in both
3864 speed and storage for sparse information.</p>
3865 <p>An indicator may store different values for each range but currently all values are drawn the same.
3866 In the future, it may be possible to draw different values in different styles.</p>
3868 <b id="SCI_SETINDICATORCURRENT">SCI_SETINDICATORCURRENT(int indicator)</b><br />
3869 <b id="SCI_GETINDICATORCURRENT">SCI_GETINDICATORCURRENT</b><br />
3870 These two messages set and get the indicator that will be affected by calls to
3871 <a class="message" href="#SCI_INDICATORFILLRANGE">SCI_INDICATORFILLRANGE(int position, int fillLength)</a> and
3872 <a class="message" href="#SCI_INDICATORCLEARRANGE">SCI_INDICATORCLEARRANGE(int position, int clearLength)</a>.
3873 </p>
3876 <b id="SCI_SETINDICATORVALUE">SCI_SETINDICATORVALUE(int value)</b><br />
3877 <b id="SCI_GETINDICATORVALUE">SCI_GETINDICATORVALUE</b><br />
3878 These two messages set and get the value that will be set by calls to
3879 <a class="message" href="#SCI_INDICATORFILLRANGE">SCI_INDICATORFILLRANGE</a>.
3880 </p>
3883 <b id="SCI_INDICATORFILLRANGE">SCI_INDICATORFILLRANGE(int position, int fillLength)</b><br />
3884 <b id="SCI_INDICATORCLEARRANGE">SCI_INDICATORCLEARRANGE(int position, int clearLength)</b><br />
3885 These two messages fill or clear a range for the current indicator.
3886 <code>SCI_INDICATORFILLRANGE</code> fills with the
3887 the current value.
3888 </p>
3891 <b id="SCI_INDICATORALLONFOR">SCI_INDICATORALLONFOR(int position)</b><br />
3892 Retrieve a bitmap value representing which indicators are non-zero at a position.
3893 </p>
3896 <b id="SCI_INDICATORVALUEAT">SCI_INDICATORVALUEAT(int indicator, int position)</b><br />
3897 Retrieve the value of a particular indicator at a position.
3898 </p>
3901 <b id="SCI_INDICATORSTART">SCI_INDICATORSTART(int indicator, int position)</b><br />
3902 <b id="SCI_INDICATOREND">SCI_INDICATOREND(int indicator, int position)</b><br />
3903 Find the start or end of a range with one value from a position within the range.
3904 Can be used to iterate through the document to discover all the indicator positions.
3905 </p>
3907 <h3 id="FindIndicators">OS X Find Indicator</h3>
3909 <p>On OS X search matches are highlighted with an animated gold rounded rectangle.
3910 The indicator shows, then briefly grows 25% and shrinks to the original size to draw the user's attention.
3911 While this feature is currently only implemented on OS X, it may be implemented on other platforms
3912 in the future.</p>
3914 <p><b id="SCI_FINDINDICATORSHOW">SCI_FINDINDICATORSHOW(int start, int end)</b><br />
3915 <b id="SCI_FINDINDICATORFLASH">SCI_FINDINDICATORFLASH(int start, int end)</b><br />
3916 These two messages show and animate the find indicator. The indicator remains visible with
3917 <code>SCI_FINDINDICATORSHOW</code> and fades out after showing for half a second with
3918 <code>SCI_FINDINDICATORFLASH</code>.
3919 <code>SCI_FINDINDICATORSHOW</code> behaves similarly to the OS X TextEdit and Safari applications
3920 and is best suited to editing documentation where the search target is often a word.
3921 <code>SCI_FINDINDICATORFLASH</code> is similar to Xcode and is suited to editing source code
3922 where the match will often be located next to operators which would otherwise be hidden under the indicator's
3923 padding.
3924 </p>
3926 <p><b id="SCI_FINDINDICATORHIDE">SCI_FINDINDICATORHIDE</b><br />
3927 This message hides the find indicator.
3928 </p>
3930 <h3 id="StyleByteIndicators">Style Byte Indicators (deprecated)</h3>
3931 <p>By default, Scintilla organizes the style byte associated with each text byte as 5 bits of
3932 style information (for 32 styles) and 3 bits of indicator information for 3 independent
3933 indicators so that, for example, syntax errors, deprecated names and bad indentation could all
3934 be displayed at once.</p>
3936 <p>The indicators are set using <a class="message"
3937 href="#SCI_STARTSTYLING"><code>SCI_STARTSTYLING</code></a> with a <code>INDICS_MASK</code> mask
3938 and <a class="message" href="#SCI_SETSTYLING"><code>SCI_SETSTYLING</code></a> with the values
3939 <code>INDIC0_MASK</code>, <code>INDIC1_MASK</code> and <code>INDIC2_MASK</code>.</p>
3941 <p>If you are using indicators in a buffer that has a lexer active
3942 (see <a class="message" href="#SCI_SETLEXER"><code>SCI_SETLEXER</code></a>),
3943 you must save lexing state information before setting any indicators and restore it afterwards.
3944 Use <a class="message" href="#SCI_GETENDSTYLED"><code>SCI_GETENDSTYLED</code></a>
3945 to retrieve the current "styled to" position and
3946 <a class="message" href="#SCI_STARTSTYLING"><code>SCI_STARTSTYLING</code></a>
3947 to reset the styling position and mask (<code>0x1f </code> in the default layout of 5 style bits and 3 indicator bits)
3948 when you are done.</p>
3950 <p>The number of bits used for styles can be altered with <a class="message"
3951 href="#SCI_SETSTYLEBITS"><code>SCI_SETSTYLEBITS</code></a> from 0 to 8 bits. The remaining bits
3952 can be used for indicators, so there can be from 1 to 8 indicators. However, the
3953 <code>INDIC*_MASK</code> constants defined in <code>Scintilla.h</code> all assume 5 bits of
3954 styling information and 3 indicators. If you use a different arrangement, you must define your
3955 own constants.</p>
3958 <h2 id="Autocompletion">Autocompletion</h2>
3960 <p>Autocompletion displays a list box showing likely identifiers based upon the user's typing.
3961 The user chooses the currently selected item by pressing the tab character or another character
3962 that is a member of the fillup character set defined with <code>SCI_AUTOCSETFILLUPS</code>.
3963 Autocompletion is triggered by your application. For example, in C if you detect that the user
3964 has just typed <code>fred.</code> you could look up <code>fred</code>, and if it has a known
3965 list of members, you could offer them in an autocompletion list. Alternatively, you could
3966 monitor the user's typing and offer a list of likely items once their typing has narrowed down
3967 the choice to a reasonable list. As yet another alternative, you could define a key code to
3968 activate the list.</p>
3970 <p>When the user makes a selection from the list the container is sent a <code><a class="message"
3971 href="#SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</a></code> <a class="jump"
3972 href="#Notifications">notification message</a>. On return from the notification Scintilla will insert
3973 the selected text unless the autocompletion list has been cancelled, for example by the container sending
3974 <code><a class="message" href="#SCI_AUTOCCANCEL">SCI_AUTOCCANCEL</a></code>.</p>
3976 <p>To make use of autocompletion you must monitor each character added to the document. See
3977 <code>SciTEBase::CharAdded()</code> in SciTEBase.cxx for an example of autocompletion.</p>
3978 <code><a class="message" href="#SCI_AUTOCSHOW">SCI_AUTOCSHOW(int lenEntered, const char
3979 *list)</a><br />
3980 <a class="message" href="#SCI_AUTOCCANCEL">SCI_AUTOCCANCEL</a><br />
3981 <a class="message" href="#SCI_AUTOCACTIVE">SCI_AUTOCACTIVE</a><br />
3982 <a class="message" href="#SCI_AUTOCPOSSTART">SCI_AUTOCPOSSTART</a><br />
3983 <a class="message" href="#SCI_AUTOCCOMPLETE">SCI_AUTOCCOMPLETE</a><br />
3984 <a class="message" href="#SCI_AUTOCSTOPS">SCI_AUTOCSTOPS(&lt;unused&gt;, const char
3985 *chars)</a><br />
3986 <a class="message" href="#SCI_AUTOCSETSEPARATOR">SCI_AUTOCSETSEPARATOR(char
3987 separator)</a><br />
3988 <a class="message" href="#SCI_AUTOCGETSEPARATOR">SCI_AUTOCGETSEPARATOR</a><br />
3989 <a class="message" href="#SCI_AUTOCSELECT">SCI_AUTOCSELECT(&lt;unused&gt;, const char
3990 *select)</a><br />
3991 <a class="message" href="#SCI_AUTOCGETCURRENT">SCI_AUTOCGETCURRENT</a><br />
3992 <a class="message" href="#SCI_AUTOCGETCURRENTTEXT">SCI_AUTOCGETCURRENTTEXT(&lt;unused&gt;,
3993 char *text)</a><br />
3994 <a class="message" href="#SCI_AUTOCSETCANCELATSTART">SCI_AUTOCSETCANCELATSTART(bool
3995 cancel)</a><br />
3996 <a class="message" href="#SCI_AUTOCGETCANCELATSTART">SCI_AUTOCGETCANCELATSTART</a><br />
3997 <a class="message" href="#SCI_AUTOCSETFILLUPS">SCI_AUTOCSETFILLUPS(&lt;unused&gt;, const char
3998 *chars)</a><br />
3999 <a class="message" href="#SCI_AUTOCSETCHOOSESINGLE">SCI_AUTOCSETCHOOSESINGLE(bool
4000 chooseSingle)</a><br />
4001 <a class="message" href="#SCI_AUTOCGETCHOOSESINGLE">SCI_AUTOCGETCHOOSESINGLE</a><br />
4002 <a class="message" href="#SCI_AUTOCSETIGNORECASE">SCI_AUTOCSETIGNORECASE(bool
4003 ignoreCase)</a><br />
4004 <a class="message" href="#SCI_AUTOCGETIGNORECASE">SCI_AUTOCGETIGNORECASE</a><br />
4005 <a class="message" href="#SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR">SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR(int behaviour)</a><br>
4006 <a class="message" href="#SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR">SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR</a><br>
4007 <a class="message" href="#SCI_AUTOCSETAUTOHIDE">SCI_AUTOCSETAUTOHIDE(bool autoHide)</a><br />
4008 <a class="message" href="#SCI_AUTOCGETAUTOHIDE">SCI_AUTOCGETAUTOHIDE</a><br />
4009 <a class="message" href="#SCI_AUTOCSETDROPRESTOFWORD">SCI_AUTOCSETDROPRESTOFWORD(bool
4010 dropRestOfWord)</a><br />
4011 <a class="message" href="#SCI_AUTOCGETDROPRESTOFWORD">SCI_AUTOCGETDROPRESTOFWORD</a><br />
4012 <a class="message" href="#SCI_REGISTERIMAGE">SCI_REGISTERIMAGE(int type, const char *xpmData)</a><br />
4013 <a class="message" href="#SCI_REGISTERRGBAIMAGE">SCI_REGISTERRGBAIMAGE(int type, const char *pixels)</a><br />
4014 <a class="message" href="#SCI_CLEARREGISTEREDIMAGES">SCI_CLEARREGISTEREDIMAGES</a><br />
4015 <a class="message" href="#SCI_AUTOCSETTYPESEPARATOR">SCI_AUTOCSETTYPESEPARATOR(char separatorCharacter)</a><br />
4016 <a class="message" href="#SCI_AUTOCGETTYPESEPARATOR">SCI_AUTOCGETTYPESEPARATOR</a><br />
4017 <a class="message" href="#SCI_AUTOCSETMAXHEIGHT">SCI_AUTOCSETMAXHEIGHT(int rowCount)</a><br />
4018 <a class="message" href="#SCI_AUTOCGETMAXHEIGHT">SCI_AUTOCGETMAXHEIGHT</a><br />
4019 <a class="message" href="#SCI_AUTOCSETMAXWIDTH">SCI_AUTOCSETMAXWIDTH(int characterCount)</a><br />
4020 <a class="message" href="#SCI_AUTOCGETMAXWIDTH">SCI_AUTOCGETMAXWIDTH</a><br />
4021 </code>
4023 <p><b id="SCI_AUTOCSHOW">SCI_AUTOCSHOW(int lenEntered, const char *list)</b><br />
4024 This message causes a list to be displayed. <code>lenEntered</code> is the number of
4025 characters of the word already entered and <code>list</code> is the list of words separated by
4026 separator characters. The initial separator character is a space but this can be set or got
4027 with <a class="message" href="#SCI_AUTOCSETSEPARATOR"><code>SCI_AUTOCSETSEPARATOR</code></a>
4028 and <a class="message"
4029 href="#SCI_AUTOCGETSEPARATOR"><code>SCI_AUTOCGETSEPARATOR</code></a>.</p>
4031 <p>The list of words should be in sorted order. If set to ignore case mode with <a class="message" href="#SCI_AUTOCSETIGNORECASE"><code>SCI_AUTOCSETIGNORECASE</code></a>, then
4032 strings are matched after being converted to upper case. One result of this is that the list
4033 should be sorted with the punctuation characters '[', '\', ']', '^', '_', and '`' sorted after
4034 letters.</p>
4036 <p><b id="SCI_AUTOCCANCEL">SCI_AUTOCCANCEL</b><br />
4037 This message cancels any displayed autocompletion list. When in autocompletion mode, the list
4038 should disappear when the user types a character that can not be part of the autocompletion,
4039 such as '.', '(' or '[' when typing an identifier. A set of characters that will cancel
4040 autocompletion can be specified with <a class="message"
4041 href="#SCI_AUTOCSTOPS"><code>SCI_AUTOCSTOPS</code></a>.</p>
4043 <p><b id="SCI_AUTOCACTIVE">SCI_AUTOCACTIVE</b><br />
4044 This message returns non-zero if there is an active autocompletion list and zero if there is
4045 not.</p>
4047 <p><b id="SCI_AUTOCPOSSTART">SCI_AUTOCPOSSTART</b><br />
4048 This returns the value of the current position when <code>SCI_AUTOCSHOW</code> started display
4049 of the list.</p>
4051 <p><b id="SCI_AUTOCCOMPLETE">SCI_AUTOCCOMPLETE</b><br />
4052 This message triggers autocompletion. This has the same effect as the tab key.</p>
4054 <p><b id="SCI_AUTOCSTOPS">SCI_AUTOCSTOPS(&lt;unused&gt;, const char *chars)</b><br />
4055 The <code>chars</code> argument is a string containing a list of characters that will
4056 automatically cancel the autocompletion list. When you start the editor, this list is
4057 empty.</p>
4059 <p><b id="SCI_AUTOCSETSEPARATOR">SCI_AUTOCSETSEPARATOR(char separator)</b><br />
4060 <b id="SCI_AUTOCGETSEPARATOR">SCI_AUTOCGETSEPARATOR</b><br />
4061 These two messages set and get the separator character used to separate words in the
4062 <code>SCI_AUTOCSHOW</code> list. The default is the space character.</p>
4064 <p><b id="SCI_AUTOCSELECT">SCI_AUTOCSELECT(&lt;unused&gt;, const char *select)</b><br />
4065 <b id="SCI_AUTOCGETCURRENT">SCI_AUTOCGETCURRENT</b><br />
4066 This message selects an item in the autocompletion list. It searches the list of words for the
4067 first that matches <code>select</code>. By default, comparisons are case sensitive, but you can
4068 change this with <a class="message"
4069 href="#SCI_AUTOCSETIGNORECASE"><code>SCI_AUTOCSETIGNORECASE</code></a>. The match is character
4070 by character for the length of the <code>select</code> string. That is, if select is "Fred" it
4071 will match "Frederick" if this is the first item in the list that begins with "Fred". If an
4072 item is found, it is selected. If the item is not found, the autocompletion list closes if
4073 auto-hide is true (see <a class="message"
4074 href="#SCI_AUTOCSETAUTOHIDE"><code>SCI_AUTOCSETAUTOHIDE</code></a>).<br />
4075 The current selection index can be retrieved with <code>SCI_AUTOCGETCURRENT</code>.</p>
4077 <p><b id="SCI_AUTOCGETCURRENTTEXT">SCI_AUTOCGETCURRENTTEXT(&lt;unused&gt;, char *text)</b><br />
4078 This message retrieves the current selected text in the autocompletion list. Normally the
4079 <a class="message" href="#SCN_AUTOCSELECTION"><code>SCN_AUTOCSELECTION</code></a> notification
4080 is used instead.</p>
4082 <p>The value is copied to the <code>text</code> buffer, returning the length (not including the
4083 terminating 0). If not found, an empty string is copied to the buffer and 0 is returned.</p>
4085 <p>If the value argument is 0 then the length that should be allocated to store the value is
4086 returned; again, the terminating 0 is not included.</p>
4088 <p><b id="SCI_AUTOCSETCANCELATSTART">SCI_AUTOCSETCANCELATSTART(bool cancel)</b><br />
4089 <b id="SCI_AUTOCGETCANCELATSTART">SCI_AUTOCGETCANCELATSTART</b><br />
4090 The default behavior is for the list to be cancelled if the caret moves to the location it
4091 was at when the list was displayed. By calling this message with a <code>false</code> argument,
4092 the list is not cancelled until the caret moves at least one character before the word being
4093 completed.</p>
4095 <p><b id="SCI_AUTOCSETFILLUPS">SCI_AUTOCSETFILLUPS(&lt;unused&gt;, const char *chars)</b><br />
4096 If a fillup character is typed with an autocompletion list active, the currently selected item
4097 in the list is added into the document, then the fillup character is added. Common fillup
4098 characters are '(', '[' and '.' but others are possible depending on the language. By default,
4099 no fillup characters are set.</p>
4101 <p><b id="SCI_AUTOCSETCHOOSESINGLE">SCI_AUTOCSETCHOOSESINGLE(bool chooseSingle)</b><br />
4102 <b id="SCI_AUTOCGETCHOOSESINGLE">SCI_AUTOCGETCHOOSESINGLE</b><br />
4103 If you use <code>SCI_AUTOCSETCHOOSESINGLE(1)</code> and a list has only one item, it is
4104 automatically added and no list is displayed. The default is to display the list even if there
4105 is only a single item.</p>
4107 <p><b id="SCI_AUTOCSETIGNORECASE">SCI_AUTOCSETIGNORECASE(bool ignoreCase)</b><br />
4108 <b id="SCI_AUTOCGETIGNORECASE">SCI_AUTOCGETIGNORECASE</b><br />
4109 By default, matching of characters to list members is case sensitive. These messages let you
4110 set and get case sensitivity.</p>
4112 <p><b id="SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR">SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR(int behaviour)</b><br>
4113 <b id="SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR">SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR</b><br>
4114 When autocompletion is set to ignore case (<code>SCI_AUTOCSETIGNORECASE</code>), by default it will
4115 nonetheless select the first list member that matches in a case sensitive way to entered characters.
4116 This corresponds to a behaviour property of <code>SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE</code> (0).
4117 If you want autocompletion to ignore case at all, choose <code>SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE</code> (1).</p>
4119 <p><b id="SCI_AUTOCSETAUTOHIDE">SCI_AUTOCSETAUTOHIDE(bool autoHide)</b><br />
4120 <b id="SCI_AUTOCGETAUTOHIDE">SCI_AUTOCGETAUTOHIDE</b><br />
4121 By default, the list is cancelled if there are no viable matches (the user has typed
4122 characters that no longer match a list entry). If you want to keep displaying the original
4123 list, set <code>autoHide</code> to <code>false</code>. This also effects <a class="message"
4124 href="#SCI_AUTOCSELECT"><code>SCI_AUTOCSELECT</code></a>.</p>
4126 <p><b id="SCI_AUTOCSETDROPRESTOFWORD">SCI_AUTOCSETDROPRESTOFWORD(bool dropRestOfWord)</b><br />
4127 <b id="SCI_AUTOCGETDROPRESTOFWORD">SCI_AUTOCGETDROPRESTOFWORD</b><br />
4128 When an item is selected, any word characters following the caret are first erased if
4129 <code>dropRestOfWord</code> is set <code>true</code>. The default is <code>false</code>.</p>
4132 <b id="SCI_REGISTERIMAGE">SCI_REGISTERIMAGE(int type, const char *xpmData)</b><br />
4133 <b id="SCI_REGISTERRGBAIMAGE">SCI_REGISTERRGBAIMAGE(int type, const char *pixels)</b><br />
4134 <b id="SCI_CLEARREGISTEREDIMAGES">SCI_CLEARREGISTEREDIMAGES</b><br />
4135 <b id="SCI_AUTOCSETTYPESEPARATOR">SCI_AUTOCSETTYPESEPARATOR(char separatorCharacter)</b><br />
4136 <b id="SCI_AUTOCGETTYPESEPARATOR">SCI_AUTOCGETTYPESEPARATOR</b><br />
4138 Autocompletion list items may display an image as well as text. Each image is first registered with an integer
4139 type. Then this integer is included in the text of the list separated by a '?' from the text. For example,
4140 "fclose?2 fopen" displays image 2 before the string "fclose" and no image before "fopen".
4141 The images are in either the <a class="jump" href="#XPM">XPM format</a> (<code>SCI_REGISTERIMAGE</code>) or
4142 <a class="jump" href="#RGBA">RGBA format</a> (<code>SCI_REGISTERRGBAIMAGE</code>).
4143 For <code>SCI_REGISTERRGBAIMAGE</code> the width and height must previously been set with
4144 the <a class="message" href="#SCI_RGBAIMAGESETWIDTH"><code>SCI_RGBAIMAGESETWIDTH</code></a> and
4145 <a class="message" href="#SCI_RGBAIMAGESETHEIGHT"><code>SCI_RGBAIMAGESETHEIGHT</code></a> messages.
4146 The set of registered images can be cleared with <code>SCI_CLEARREGISTEREDIMAGES</code> and the '?' separator changed
4147 with <code>SCI_AUTOCSETTYPESEPARATOR</code>.
4148 </p>
4151 <b id="SCI_AUTOCSETMAXHEIGHT">SCI_AUTOCSETMAXHEIGHT(int rowCount)</b><br />
4152 <b id="SCI_AUTOCGETMAXHEIGHT">SCI_AUTOCGETMAXHEIGHT</b><br />
4154 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
4155 scrollbar is shown. The default is 5.
4156 </p>
4159 <b id="SCI_AUTOCSETMAXWIDTH">SCI_AUTOCSETMAXWIDTH(int characterCount)</b><br />
4160 <b id="SCI_AUTOCGETMAXWIDTH">SCI_AUTOCGETMAXWIDTH</b><br />
4162 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.
4163 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
4164 the available width are indicated by the presence of ellipsis.
4165 </p>
4167 <h2 id="UserLists">User lists</h2>
4169 <p>User lists use the same internal mechanisms as autocompletion lists, and all the calls
4170 listed for autocompletion work on them; you cannot display a user list at the same time as an
4171 autocompletion list is active. They differ in the following respects:</p>
4173 <p>o The <code><a class="message"
4174 href="#SCI_AUTOCSETCHOOSESINGLE">SCI_AUTOCSETCHOOSESINGLE</a></code> message has no
4175 effect.<br />
4176 o When the user makes a selection you are sent a <code><a class="message"
4177 href="#SCN_USERLISTSELECTION">SCN_USERLISTSELECTION</a></code> <a class="jump"
4178 href="#Notifications">notification message</a> rather than <code><a class="message"
4179 href="#SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</a></code>.</p>
4181 <p>BEWARE: if you have set fillup characters or stop characters, these will still be active
4182 with the user list, and may result in items being selected or the user list cancelled due to
4183 the user typing into the editor.</p>
4185 <p><b id="SCI_USERLISTSHOW">SCI_USERLISTSHOW(int listType, const char *list)</b><br />
4186 The <code>listType</code> parameter is returned to the container as the <code>wParam</code>
4187 field of the <a class="message" href="#SCNotification"><code>SCNotification</code></a>
4188 structure. It must be greater than 0 as this is how Scintilla tells the difference between an
4189 autocompletion list and a user list. If you have different types of list, for example a list of
4190 buffers and a list of macros, you can use <code>listType</code> to tell which one has returned
4191 a selection. </p>
4193 <h2 id="CallTips">Call tips</h2>
4195 <p>Call tips are small windows displaying the arguments to a function and are displayed after
4196 the user has typed the name of the function. They normally display characters using the font
4197 facename, size and character set defined by
4198 <code><a class="message" href="#StyleDefinition">STYLE_DEFAULT</a></code>. You can choose to
4199 use <code><a class="message" href="#StyleDefinition">STYLE_CALLTIP</a></code> to define the
4200 facename, size, foreground and background colours and character set with
4201 <code><a class="message" href="#SCI_CALLTIPUSESTYLE">SCI_CALLTIPUSESTYLE</a></code>.
4202 This also enables support for Tab characters.
4204 There is some interaction between call tips and autocompletion lists in that showing a
4205 call tip cancels any active autocompletion list, and vice versa.</p>
4207 <p>Call tips can highlight part of the text within them. You could use this to highlight the
4208 current argument to a function by counting the number of commas (or whatever separator your
4209 language uses). See <code>SciTEBase::CharAdded()</code> in <code>SciTEBase.cxx</code> for an
4210 example of call tip use.</p>
4212 <p>The mouse may be clicked on call tips and this causes a
4213 <code><a class="message" href="#SCN_CALLTIPCLICK">SCN_CALLTIPCLICK</a></code>
4214 notification to be sent to the container. Small up and down arrows may be displayed within
4215 a call tip by, respectively, including the characters '\001', or '\002'. This is useful
4216 for showing that there are overloaded variants of one function name and that the user can
4217 click on the arrows to cycle through the overloads.</p>
4219 <p>Alternatively, call tips can be displayed when you leave the mouse pointer for a while over
4220 a word in response to the <code><a class="message"
4221 href="#SCN_DWELLSTART">SCN_DWELLSTART</a></code> <a class="jump"
4222 href="#Notifications">notification</a> and cancelled in response to <code><a class="message"
4223 href="#SCN_DWELLEND">SCN_DWELLEND</a></code>. This method could be used in a debugger to give
4224 the value of a variable, or during editing to give information about the word under the
4225 pointer.</p>
4226 <code><a class="message" href="#SCI_CALLTIPSHOW">SCI_CALLTIPSHOW(int posStart, const char
4227 *definition)</a><br />
4228 <a class="message" href="#SCI_CALLTIPCANCEL">SCI_CALLTIPCANCEL</a><br />
4229 <a class="message" href="#SCI_CALLTIPACTIVE">SCI_CALLTIPACTIVE</a><br />
4230 <a class="message" href="#SCI_CALLTIPPOSSTART">SCI_CALLTIPPOSSTART</a><br />
4231 <a class="message" href="#SCI_CALLTIPSETHLT">SCI_CALLTIPSETHLT(int highlightStart, int
4232 highlightEnd)</a><br />
4233 <a class="message" href="#SCI_CALLTIPSETBACK">SCI_CALLTIPSETBACK(int colour)</a><br />
4234 <a class="message" href="#SCI_CALLTIPSETFORE">SCI_CALLTIPSETFORE(int colour)</a><br />
4235 <a class="message" href="#SCI_CALLTIPSETFOREHLT">SCI_CALLTIPSETFOREHLT(int colour)</a><br />
4236 <a class="message" href="#SCI_CALLTIPUSESTYLE">SCI_CALLTIPUSESTYLE(int tabsize)</a><br />
4237 <a class="message" href="#SCI_CALLTIPSETPOSITION">SCI_CALLTIPSETPOSITION(bool above)</a><br />
4238 </code>
4240 <p><b id="SCI_CALLTIPSHOW">SCI_CALLTIPSHOW(int posStart, const char *definition)</b><br />
4241 This message starts the process by displaying the call tip window. If a call tip is already
4242 active, this has no effect.<br />
4243 <code>posStart</code> is the position in the document at which to align the call tip. The call
4244 tip text is aligned to start 1 line below this character unless you have included up and/or
4245 down arrows in the call tip text in which case the tip is aligned to the right-hand edge of
4246 the rightmost arrow. The assumption is that you will start the text with something like
4247 "\001 1 of 3 \002".<br />
4248 <code>definition</code> is the call tip text. This can contain multiple lines separated by
4249 '\n' (Line Feed, ASCII code 10) characters. Do not include '\r' (Carriage Return, ASCII
4250 code 13), as this will most likely print as an empty box. '\t' (Tab, ASCII code 9) is
4251 supported if you set a tabsize with
4252 <code><a class="message" href="#SCI_CALLTIPUSESTYLE">SCI_CALLTIPUSESTYLE</a></code>.<br /></p>
4254 <p><b id="SCI_CALLTIPCANCEL">SCI_CALLTIPCANCEL</b><br />
4255 This message cancels any displayed call tip. Scintilla will also cancel call tips for you if
4256 you use any keyboard commands that are not compatible with editing the argument list of a
4257 function.</p>
4259 <p><b id="SCI_CALLTIPACTIVE">SCI_CALLTIPACTIVE</b><br />
4260 This returns 1 if a call tip is active and 0 if it is not active.</p>
4262 <p><b id="SCI_CALLTIPPOSSTART">SCI_CALLTIPPOSSTART</b><br />
4263 This message returns the value of the current position when <code>SCI_CALLTIPSHOW</code>
4264 started to display the tip.</p>
4266 <p><b id="SCI_CALLTIPSETHLT">SCI_CALLTIPSETHLT(int hlStart, int hlEnd)</b><br />
4267 This sets the region of the call tips text to display in a highlighted style.
4268 <code>hlStart</code> is the zero-based index into the string of the first character to
4269 highlight and <code>hlEnd</code> is the index of the first character after the highlight.
4270 <code>hlEnd</code> must be greater than <code>hlStart</code>; <code>hlEnd-hlStart</code> is the
4271 number of characters to highlight. Highlights can extend over line ends if this is
4272 required.</p>
4274 <p>Unhighlighted text is drawn in a mid gray. Selected text is drawn in a dark blue. The
4275 background is white. These can be changed with
4276 <code>SCI_CALLTIPSETBACK</code>,
4277 <code>SCI_CALLTIPSETFORE</code>, and
4278 <code>SCI_CALLTIPSETFOREHLT</code>.
4279 </p>
4281 <p><b id="SCI_CALLTIPSETBACK">SCI_CALLTIPSETBACK(int colour)</b><br />
4282 The background colour of call tips can be set with this message; the default colour is white.
4283 It is not a good idea to set a dark colour as the background as the default colour for normal
4284 calltip text is mid gray and the defaultcolour for highlighted text is dark blue. This also
4285 sets the background colour of <code>STYLE_CALLTIP</code>.</p>
4287 <p><b id="SCI_CALLTIPSETFORE">SCI_CALLTIPSETFORE(int colour)</b><br />
4288 The colour of call tip text can be set with this message; the default colour is mid gray.
4289 This also sets the foreground colour of <code>STYLE_CALLTIP</code>.</p>
4291 <p><b id="SCI_CALLTIPSETFOREHLT">SCI_CALLTIPSETFOREHLT(int colour)</b><br />
4292 The colour of highlighted call tip text can be set with this message; the default colour
4293 is dark blue.</p>
4295 <p><b id="SCI_CALLTIPUSESTYLE">SCI_CALLTIPUSESTYLE(int tabsize)</b><br />
4296 This message changes the style used for call tips from <code>STYLE_DEFAULT</code> to
4297 <code>STYLE_CALLTIP</code> and sets a tab size in screen pixels. If <code>tabsize</code> is
4298 less than 1, Tab characters are not treated specially. Once this call has been used, the
4299 call tip foreground and background colours are also taken from the style.</p>
4301 <p><b id="SCI_CALLTIPSETPOSITION">SCI_CALLTIPSETPOSITION(bool above)</b><br />
4302 By default the calltip is displayed below the text, setting above to <code>true</code>
4303 (1) will display it above the text.</p>
4306 <h2 id="KeyboardCommands">Keyboard commands</h2>
4308 <p>To allow the container application to perform any of the actions available to the user with
4309 keyboard, all the keyboard actions are messages. They do not take any parameters. These
4310 commands are also used when redefining the key bindings with the <a class="message"
4311 href="#SCI_ASSIGNCMDKEY"><code>SCI_ASSIGNCMDKEY</code></a> message.</p>
4313 <table border="0" summary="Keyboard commands">
4314 <tbody>
4315 <tr>
4316 <td><code>SCI_LINEDOWN</code></td>
4318 <td><code>SCI_LINEDOWNEXTEND</code></td>
4320 <td><code>SCI_LINEDOWNRECTEXTEND</code></td>
4322 <td><code>SCI_LINESCROLLDOWN</code></td>
4323 </tr>
4325 <tr>
4326 <td><code>SCI_LINEUP</code></td>
4328 <td><code>SCI_LINEUPEXTEND</code></td>
4330 <td><code>SCI_LINEUPRECTEXTEND</code></td>
4332 <td><code>SCI_LINESCROLLUP</code></td>
4333 </tr>
4335 <tr>
4336 <td><code>SCI_PARADOWN</code></td>
4338 <td><code>SCI_PARADOWNEXTEND</code></td>
4340 <td><code>SCI_PARAUP</code></td>
4342 <td><code>SCI_PARAUPEXTEND</code></td>
4343 </tr>
4345 <tr>
4346 <td><code>SCI_CHARLEFT</code></td>
4348 <td><code>SCI_CHARLEFTEXTEND</code></td>
4350 <td><code>SCI_CHARLEFTRECTEXTEND</code></td>
4351 </tr>
4353 <tr>
4354 <td><code>SCI_CHARRIGHT</code></td>
4356 <td><code>SCI_CHARRIGHTEXTEND</code></td>
4358 <td><code>SCI_CHARRIGHTRECTEXTEND</code></td>
4359 </tr>
4361 <tr>
4362 <td><code>SCI_WORDLEFT</code></td>
4364 <td><code>SCI_WORDLEFTEXTEND</code></td>
4366 <td><code>SCI_WORDRIGHT</code></td>
4368 <td><code>SCI_WORDRIGHTEXTEND</code></td>
4369 </tr>
4371 <tr>
4372 <td><code>SCI_WORDLEFTEND</code></td>
4374 <td><code>SCI_WORDLEFTENDEXTEND</code></td>
4376 <td><code>SCI_WORDRIGHTEND</code></td>
4378 <td><code>SCI_WORDRIGHTENDEXTEND</code></td>
4379 </tr>
4381 <tr>
4382 <td><code>SCI_WORDPARTLEFT</code></td>
4384 <td><code>SCI_WORDPARTLEFTEXTEND</code></td>
4386 <td><code>SCI_WORDPARTRIGHT</code></td>
4388 <td><code>SCI_WORDPARTRIGHTEXTEND</code></td>
4389 </tr>
4391 <tr>
4392 <td><code>SCI_HOME</code></td>
4394 <td><code>SCI_HOMEEXTEND</code></td>
4396 <td><code>SCI_HOMERECTEXTEND</code></td>
4397 </tr>
4399 <tr>
4400 <td><code>SCI_HOMEDISPLAY</code></td>
4402 <td><code>SCI_HOMEDISPLAYEXTEND</code></td>
4404 <td><code>SCI_HOMEWRAP</code></td>
4406 <td><code>SCI_HOMEWRAPEXTEND</code></td>
4407 </tr>
4409 <tr>
4410 <td><code>SCI_VCHOME</code></td>
4412 <td><code>SCI_VCHOMEEXTEND</code></td>
4414 <td><code>SCI_VCHOMERECTEXTEND</code></td>
4415 </tr>
4417 <tr>
4418 <td><code>SCI_VCHOMEWRAP</code></td>
4420 <td><code>SCI_VCHOMEWRAPEXTEND</code></td>
4422 <td><code>SCI_VCHOMEDISPLAY</code></td>
4424 <td><code>SCI_VCHOMEDISPLAYEXTEND</code></td>
4425 </tr>
4427 <tr>
4428 <td><code>SCI_LINEEND</code></td>
4430 <td><code>SCI_LINEENDEXTEND</code></td>
4432 <td><code>SCI_LINEENDRECTEXTEND</code></td>
4433 </tr>
4435 <tr>
4436 <td><code>SCI_LINEENDDISPLAY</code></td>
4438 <td><code>SCI_LINEENDDISPLAYEXTEND</code></td>
4440 <td><code>SCI_LINEENDWRAP</code></td>
4442 <td><code>SCI_LINEENDWRAPEXTEND</code></td>
4443 </tr>
4445 <tr>
4446 <td><code>SCI_DOCUMENTSTART</code></td>
4448 <td><code>SCI_DOCUMENTSTARTEXTEND</code></td>
4450 <td><code>SCI_DOCUMENTEND</code></td>
4452 <td><code>SCI_DOCUMENTENDEXTEND</code></td>
4453 </tr>
4455 <tr>
4456 <td><code>SCI_PAGEUP</code></td>
4458 <td><code>SCI_PAGEUPEXTEND</code></td>
4460 <td><code>SCI_PAGEUPRECTEXTEND</code></td>
4461 </tr>
4463 <tr>
4464 <td><code>SCI_PAGEDOWN</code></td>
4466 <td><code>SCI_PAGEDOWNEXTEND</code></td>
4468 <td><code>SCI_PAGEDOWNRECTEXTEND</code></td>
4469 </tr>
4472 <tr>
4473 <td><code>SCI_STUTTEREDPAGEUP</code></td>
4475 <td><code>SCI_STUTTEREDPAGEUPEXTEND</code></td>
4476 </tr>
4478 <tr>
4479 <td><code>SCI_STUTTEREDPAGEDOWN</code></td>
4481 <td><code>SCI_STUTTEREDPAGEDOWNEXTEND</code></td>
4482 </tr>
4484 <tr>
4485 <td><code>SCI_DELETEBACK</code></td>
4487 <td><code>SCI_DELETEBACKNOTLINE</code></td>
4488 </tr>
4490 <tr>
4491 <td><code>SCI_DELWORDLEFT</code></td>
4493 <td><code>SCI_DELWORDRIGHT</code></td>
4495 <td><code>SCI_DELWORDRIGHTEND</code></td>
4496 </tr>
4498 <tr>
4499 <td><code>SCI_DELLINELEFT</code></td>
4501 <td><code>SCI_DELLINERIGHT</code></td>
4503 <td><code>SCI_LINEDELETE</code></td>
4504 </tr>
4506 <tr>
4507 <td><code>SCI_LINECUT</code></td>
4509 <td><code>SCI_LINECOPY</code></td>
4511 <td><code>SCI_LINETRANSPOSE</code></td>
4513 <td><code>SCI_LINEDUPLICATE</code></td>
4514 </tr>
4516 <tr>
4517 <td><code>SCI_LOWERCASE</code></td>
4519 <td><code>SCI_UPPERCASE</code></td>
4521 <td><code>SCI_CANCEL</code></td>
4523 <td><code>SCI_EDITTOGGLEOVERTYPE</code></td>
4524 </tr>
4526 <tr>
4527 <td><code>SCI_NEWLINE</code></td>
4529 <td><code>SCI_FORMFEED</code></td>
4531 <td><code>SCI_TAB</code></td>
4533 <td><code>SCI_BACKTAB</code></td>
4534 </tr>
4536 <tr>
4537 <td><code>SCI_SELECTIONDUPLICATE</code></td>
4539 <td><code>SCI_VERTICALCENTRECARET</code></td>
4541 </tr>
4543 <tr>
4544 <td><code>SCI_MOVESELECTEDLINESUP</code></td>
4546 <td><code>SCI_MOVESELECTEDLINESDOWN</code></td>
4547 </tr>
4549 <tr>
4550 <td><code>SCI_SCROLLTOSTART</code></td>
4552 <td><code>SCI_SCROLLTOEND</code></td>
4553 </tr>
4554 </tbody>
4555 </table>
4557 <p>The <code>SCI_*EXTEND</code> messages extend the selection.</p>
4559 <p>The <code>SCI_*RECTEXTEND</code> messages extend the rectangular selection
4560 (and convert regular selection to rectangular one, if any).</p>
4562 <p>The <code>SCI_WORDPART*</code> commands are used to move between word segments marked by
4563 capitalisation (aCamelCaseIdentifier) or underscores (an_under_bar_ident).</p>
4565 <p>The <code>SCI_HOME*</code> commands move the caret to the start of the line, while the
4566 <code>SCI_VCHOME*</code> commands move the caret to the first non-blank character of the line
4567 (ie. just after the indentation) unless it is already there; in this case, it acts as SCI_HOME*.</p>
4569 <p>The <code>SCI_[HOME|LINEEND]DISPLAY*</code> commands are used when in line wrap mode to
4570 allow movement to the start or end of display lines as opposed to the normal
4571 <code>SCI_[HOME|LINEEND]</code> commands which move to the start or end of document lines.</p>
4573 <p>The <code>SCI_[[VC]HOME|LINEEND]WRAP*</code> commands are like their namesakes
4574 <code>SCI_[[VC]HOME|LINEEND]*</code> except they behave differently when word-wrap is enabled:
4575 They go first to the start / end of the display line, like <code>SCI_[HOME|LINEEND]DISPLAY*</code>,
4576 but if the cursor is already at the point, it goes on to the start or end of the document line,
4577 as appropriate for <code>SCI_[[VC]HOME|LINEEND]*</code>.
4578 </p>
4580 <p>The <code>SCI_SCROLLTO[START|END]</code> commands scroll the document to the start
4581 or end without changing the selection. These commands match OS X platform conventions for the behaviour of the
4582 <code>home</code> and <code>end</code> keys. Scintilla can be made to match OS X applications
4583 by binding the <code>home</code> and <code>end</code> keys to these commands.
4584 </p>
4586 <h2 id="KeyBindings">Key bindings</h2>
4588 <p>There is a default binding of keys to commands that is defined in the Scintilla source in
4589 the file <code>KeyMap.cxx</code> by the constant <code>KeyMap::MapDefault[]</code>. This table
4590 maps key definitions to <code>SCI_*</code> messages with no parameters (mostly the <a
4591 class="jump" href="#KeyboardCommands">keyboard commands</a> discussed above, but any Scintilla
4592 command that has no arguments can be mapped). You can change the mapping to suit your own
4593 requirements.</p>
4594 <code><a class="message" href="#SCI_ASSIGNCMDKEY">SCI_ASSIGNCMDKEY(int keyDefinition, int
4595 sciCommand)</a><br />
4596 <a class="message" href="#SCI_CLEARCMDKEY">SCI_CLEARCMDKEY(int keyDefinition)</a><br />
4597 <a class="message" href="#SCI_CLEARALLCMDKEYS">SCI_CLEARALLCMDKEYS</a><br />
4598 <a class="message" href="#SCI_NULL">SCI_NULL</a><br />
4599 </code>
4601 <p><b id="keyDefinition">keyDefinition</b><br />
4602 A key definition contains the key code in the low 16-bits and the key modifiers in the high
4603 16-bits. To combine <code>keyCode</code> and <code>keyMod</code> set:<br />
4604 <br />
4605 <code>keyDefinition = keyCode + (keyMod &lt;&lt; 16)</code></p>
4607 <p>The key code is a visible or control character or a key from the <code>SCK_*</code>
4608 enumeration, which contains:<br />
4609 <code>SCK_ADD</code>, <code>SCK_BACK</code>, <code>SCK_DELETE</code>, <code>SCK_DIVIDE</code>,
4610 <code>SCK_DOWN</code>, <code>SCK_END</code>, <code>SCK_ESCAPE</code>, <code>SCK_HOME</code>,
4611 <code>SCK_INSERT</code>, <code>SCK_LEFT</code>, <code>SCK_MENU</code>, <code>SCK_NEXT</code> (Page Down),
4612 <code>SCK_PRIOR</code> (Page Up), <code>SCK_RETURN</code>, <code>SCK_RIGHT</code>,
4613 <code>SCK_RWIN</code>,
4614 <code>SCK_SUBTRACT</code>, <code>SCK_TAB</code>, <code>SCK_UP</code>, and
4615 <code>SCK_WIN</code>.</p>
4617 <p>The modifiers are a combination of zero or more of <code>SCMOD_ALT</code>,
4618 <code>SCMOD_CTRL</code>, <code>SCMOD_SHIFT</code>, and <code>SCMOD_META</code>.
4619 On OS X, the Command key is mapped to <code>SCMOD_CTRL</code> and the Control key to
4620 <code>SCMOD_META</code>.
4621 If you are building a table, you might
4622 want to use <code>SCMOD_NORM</code>, which has the value 0, to mean no modifiers.</p>
4624 <p><b id="SCI_ASSIGNCMDKEY">SCI_ASSIGNCMDKEY(int <a class="jump"
4625 href="#keyDefinition">keyDefinition</a>, int sciCommand)</b><br />
4626 This assigns the given key definition to a Scintilla command identified by
4627 <code>sciCommand</code>. <code>sciCommand</code> can be any <code>SCI_*</code> command that has
4628 no arguments.</p>
4630 <p><b id="SCI_CLEARCMDKEY">SCI_CLEARCMDKEY(int <a class="jump"
4631 href="#keyDefinition">keyDefinition</a>)</b><br />
4632 This makes the given key definition do nothing by assigning the action <code>SCI_NULL</code>
4633 to it.</p>
4635 <p><b id="SCI_CLEARALLCMDKEYS">SCI_CLEARALLCMDKEYS</b><br />
4636 This command removes all keyboard command mapping by setting an empty mapping table.</p>
4638 <p><b id="SCI_NULL">SCI_NULL</b><br />
4639 The <code>SCI_NULL</code> does nothing and is the value assigned to keys that perform no
4640 action. SCI_NULL ensures that keys do not propagate to the parent window as that may
4641 cause focus to move. If you want the standard platform behaviour use the constant 0 instead.</p>
4643 <h2 id="PopupEditMenu">Popup edit menu</h2>
4645 <p><b id="SCI_USEPOPUP">SCI_USEPOPUP(bool bEnablePopup)</b><br />
4646 Clicking the wrong button on the mouse pops up a short default editing menu. This may be
4647 turned off with <code>SCI_USEPOPUP(0)</code>. If you turn it off, context menu commands (in
4648 Windows, <code>WM_CONTEXTMENU</code>) will not be handled by Scintilla, so the parent of the
4649 Scintilla window will have the opportunity to handle the message.</p>
4651 <h2 id="MacroRecording">Macro recording</h2>
4653 <p>Start and stop macro recording mode. In macro recording mode, actions are reported to the
4654 container through <code><a class="message" href="#SCN_MACRORECORD">SCN_MACRORECORD</a></code>
4655 <a class="jump" href="#Notifications">notifications</a>. It is then up to the container to
4656 record these actions for future replay.</p>
4658 <p><b id="SCI_STARTRECORD">SCI_STARTRECORD</b><br />
4659 <b id="SCI_STOPRECORD">SCI_STOPRECORD</b><br />
4660 These two messages turn macro recording on and off.</p>
4662 <h2 id="Printing">Printing</h2>
4664 <p><code>SCI_FORMATRANGE</code> can be used to draw the text onto a display surface
4665 which can include a printer display surface. Printed output shows text styling as on the
4666 screen, but it hides all margins except a line number margin. All special marker effects are
4667 removed and the selection and caret are hidden.</p>
4669 <p>Different platforms use different display surface ID types to print on. On Windows, these are
4670 <code>HDC</code>s., on GTK+ 3.x <code>cairo_t *</code>,
4671 and on Cocoa <code>CGContextRef</code> is used.</p>
4673 <code><a class="message" href="#SCI_FORMATRANGE">SCI_FORMATRANGE(bool bDraw, Sci_RangeToFormat
4674 *pfr)</a><br />
4675 <a class="message" href="#SCI_SETPRINTMAGNIFICATION">SCI_SETPRINTMAGNIFICATION(int
4676 magnification)</a><br />
4677 <a class="message" href="#SCI_GETPRINTMAGNIFICATION">SCI_GETPRINTMAGNIFICATION</a><br />
4678 <a class="message" href="#SCI_SETPRINTCOLOURMODE">SCI_SETPRINTCOLOURMODE(int mode)</a><br />
4679 <a class="message" href="#SCI_GETPRINTCOLOURMODE">SCI_GETPRINTCOLOURMODE</a><br />
4680 <a class="message" href="#SCI_SETPRINTWRAPMODE">SCI_SETPRINTWRAPMODE</a><br />
4681 <a class="message" href="#SCI_GETPRINTWRAPMODE">SCI_GETPRINTWRAPMODE</a><br />
4682 </code>
4684 <p><b id="SCI_FORMATRANGE">SCI_FORMATRANGE(bool bDraw, Sci_RangeToFormat *pfr)</b><br />
4685 This call renders a range of text into a device context. If you use
4686 this for printing, you will probably want to arrange a page header and footer; Scintilla does
4687 not do this for you. See <code>SciTEWin::Print()</code> in <code>SciTEWinDlg.cxx</code> for an
4688 example. Each use of this message renders a range of text into a rectangular area and returns
4689 the position in the document of the next character to print.</p>
4691 <p><code>bDraw</code> controls if any output is done. Set this to false if you are paginating
4692 (for example, if you use this with MFC you will need to paginate in
4693 <code>OnBeginPrinting()</code> before you output each page.</p>
4694 <pre>
4695 struct Sci_Rectangle { int left; int top; int right; int bottom; };
4697 struct Sci_RangeToFormat {
4698 Sci_SurfaceID hdc; // The Surface ID we print to
4699 Sci_SurfaceID hdcTarget; // The Surface ID we use for measuring (may be same as hdc)
4700 Sci_Rectangle rc; // Rectangle in which to print
4701 Sci_Rectangle rcPage; // Physically printable page size
4702 Sci_CharacterRange chrg; // Range of characters to print
4704 </pre>
4706 <p>On Windows, <code>hdc</code> and <code>hdcTarget</code> should both be set to the device context handle
4707 of the output device (usually a printer). If you print to a metafile these will not be the same
4708 as Windows metafiles (unlike extended metafiles) do not implement the full API for returning
4709 information. In this case, set <code>hdcTarget</code> to the screen DC.<br />
4710 <code>rcPage</code> is the rectangle <code>{0, 0, maxX, maxY}</code> where <code>maxX+1</code>
4711 and <code>maxY+1</code> are the number of physically printable pixels in x and y.<br />
4712 <code>rc</code> is the rectangle to render the text in (which will, of course, fit within the
4713 rectangle defined by rcPage).<br />
4714 <code>chrg.cpMin</code> and <code>chrg.cpMax</code> define the start position and maximum
4715 position of characters to output. All of each line within this character range is drawn.</p>
4717 <p>On Cocoa, the surface IDs for printing (<code>bDraw=1</code>) should be the graphics port of the current context
4718 (<code>(CGContextRef) [[NSGraphicsContext currentContext] graphicsPort]</code>) when the view's drawRect method is called.
4719 The Surface IDs are not really used for measurement (<code>bDraw=0</code>) but can be set
4720 to a bitmap context (created with <code>CGBitmapContextCreate</code>) to avoid runtime warnings.</p>
4722 <p>On GTK+, the surface IDs to use can be found from the printing context with
4723 <code>gtk_print_context_get_cairo_context(context)</code>.</p>
4725 <code>chrg.cpMin</code> and <code>chrg.cpMax</code> define the start position and maximum
4726 position of characters to output. All of each line within this character range is drawn.</p>
4728 <p>When printing, the most tedious part is always working out what the margins should be to
4729 allow for the non-printable area of the paper and printing a header and footer. If you look at
4730 the printing code in SciTE, you will find that most of it is taken up with this. The loop that
4731 causes Scintilla to render text is quite simple if you strip out all the margin, non-printable
4732 area, header and footer code.</p>
4734 <p><b id="SCI_SETPRINTMAGNIFICATION">SCI_SETPRINTMAGNIFICATION(int magnification)</b><br />
4735 <b id="SCI_GETPRINTMAGNIFICATION">SCI_GETPRINTMAGNIFICATION</b><br />
4736 <code>SCI_GETPRINTMAGNIFICATION</code> lets you to print at a different size than the screen
4737 font. <code>magnification</code> is the number of points to add to the size of each screen
4738 font. A value of -3 or -4 gives reasonably small print. You can get this value with
4739 <code>SCI_GETPRINTMAGNIFICATION</code>.</p>
4741 <p><b id="SCI_SETPRINTCOLOURMODE">SCI_SETPRINTCOLOURMODE(int mode)</b><br />
4742 <b id="SCI_GETPRINTCOLOURMODE">SCI_GETPRINTCOLOURMODE</b><br />
4743 These two messages set and get the method used to render coloured text on a printer that is
4744 probably using white paper. It is especially important to consider the treatment of colour if
4745 you use a dark or black screen background. Printing white on black uses up toner and ink very
4746 many times faster than the other way around. You can set the mode to one of:</p>
4748 <table cellpadding="1" cellspacing="2" border="0" summary="Colour printing modes">
4749 <tbody>
4750 <tr>
4751 <th align="left">Symbol</th>
4753 <th>Value</th>
4755 <th align="left">Purpose</th>
4756 </tr>
4757 </tbody>
4759 <tbody valign="top">
4760 <tr>
4761 <td align="left"><code>SC_PRINT_NORMAL</code></td>
4763 <td align="center">0</td>
4765 <td>Print using the current screen colours. This is the default.</td>
4766 </tr>
4768 <tr>
4769 <td align="left"><code>SC_PRINT_INVERTLIGHT</code></td>
4771 <td align="center">1</td>
4773 <td>If you use a dark screen background this saves ink by inverting the light value of
4774 all colours and printing on a white background.</td>
4775 </tr>
4777 <tr>
4778 <td align="left"><code>SC_PRINT_BLACKONWHITE</code></td>
4780 <td align="center">2</td>
4782 <td>Print all text as black on a white background.</td>
4783 </tr>
4785 <tr>
4786 <td align="left"><code>SC_PRINT_COLOURONWHITE</code></td>
4788 <td align="center">3</td>
4790 <td>Everything prints in its own colour on a white background.</td>
4791 </tr>
4793 <tr>
4794 <td align="left"><code>SC_PRINT_COLOURONWHITEDEFAULTBG</code></td>
4796 <td align="center">4</td>
4798 <td>Everything prints in its own colour on a white background except that line numbers
4799 use their own background colour.</td>
4800 </tr>
4801 </tbody>
4802 </table>
4804 <p><b id="SCI_SETPRINTWRAPMODE">SCI_SETPRINTWRAPMODE(int wrapMode)</b><br />
4805 <b id="SCI_GETPRINTWRAPMODE">SCI_GETPRINTWRAPMODE</b><br />
4806 These two functions get and set the printer wrap mode. <code>wrapMode</code> can be
4807 set to <code>SC_WRAP_NONE</code> (0), <code>SC_WRAP_WORD</code> (1) or
4808 <code>SC_WRAP_CHAR</code> (2). The default is
4809 <code>SC_WRAP_WORD</code>, which wraps printed output so that all characters fit
4810 into the print rectangle. If you set <code>SC_WRAP_NONE</code>, each line of text
4811 generates one line of output and the line is truncated if it is too long to fit
4812 into the print area.<br />
4813 <code>SC_WRAP_WORD</code> tries to wrap only between words as indicated by
4814 white space or style changes although if a word is longer than a line, it will be wrapped before
4815 the line end. <code>SC_WRAP_CHAR</code> is preferred to
4816 <code>SC_WRAP_WORD</code> for Asian languages where there is no white space
4817 between words.</p>
4819 <h2 id="DirectAccess">Direct access</h2>
4820 <code><a class="message" href="#SCI_GETDIRECTFUNCTION">SCI_GETDIRECTFUNCTION</a><br />
4821 <a class="message" href="#SCI_GETDIRECTPOINTER">SCI_GETDIRECTPOINTER</a><br />
4822 <a class="message" href="#SCI_GETCHARACTERPOINTER">SCI_GETCHARACTERPOINTER</a><br />
4823 <a class="message" href="#SCI_GETRANGEPOINTER">SCI_GETRANGEPOINTER(int position, int rangeLength)</a><br />
4824 <a class="message" href="#SCI_GETGAPPOSITION">SCI_GETGAPPOSITION</a><br />
4825 </code>
4827 <p>On Windows, the message-passing scheme used to communicate between the container and
4828 Scintilla is mediated by the operating system <code>SendMessage</code> function and can lead to
4829 bad performance when calling intensively. To avoid this overhead, Scintilla provides messages
4830 that allow you to call the Scintilla message function directly. The code to do this in C/C++ is
4831 of the form:</p>
4832 <pre>
4833 #include "Scintilla.h"
4834 SciFnDirect pSciMsg = (SciFnDirect)SendMessage(hSciWnd, SCI_GETDIRECTFUNCTION, 0, 0);
4835 sptr_t pSciWndData = (sptr_t)SendMessage(hSciWnd, SCI_GETDIRECTPOINTER, 0, 0);
4837 // now a wrapper to call Scintilla directly
4838 sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
4839 return pSciMsg(pSciWndData, iMessage, wParam, lParam);
4841 </pre>
4843 <p><code>SciFnDirect</code>, <code>sptr_t</code> and <code>uptr_t</code> are declared in
4844 <code>Scintilla.h</code>. <code>hSciWnd</code> is the window handle returned when you created
4845 the Scintilla window.</p>
4847 <p>While faster, this direct calling will cause problems if performed from a different thread
4848 to the native thread of the Scintilla window in which case <code>SendMessage(hSciWnd, SCI_*,
4849 wParam, lParam)</code> should be used to synchronize with the window's thread.</p>
4851 <p>This feature also works on GTK+ but has no significant impact on speed.</p>
4853 <p>From version 1.47 on Windows, Scintilla exports a function called
4854 <code>Scintilla_DirectFunction</code> that can be used the same as the function returned by
4855 <code>SCI_GETDIRECTFUNCTION</code>. This saves you the call to
4856 <code>SCI_GETDIRECTFUNCTION</code> and the need to call Scintilla indirectly via the function
4857 pointer.</p>
4859 <p><b id="SCI_GETDIRECTFUNCTION">SCI_GETDIRECTFUNCTION</b><br />
4860 This message returns the address of the function to call to handle Scintilla messages without
4861 the overhead of passing through the Windows messaging system. You need only call this once,
4862 regardless of the number of Scintilla windows you create.</p>
4864 <p><b id="SCI_GETDIRECTPOINTER">SCI_GETDIRECTPOINTER</b><br />
4865 This returns a pointer to data that identifies which Scintilla window is in use. You must call
4866 this once for each Scintilla window you create. When you call the direct function, you must
4867 pass in the direct pointer associated with the target window.</p>
4869 <p><b id="SCI_GETCHARACTERPOINTER">SCI_GETCHARACTERPOINTER</b><br />
4870 <b id="SCI_GETRANGEPOINTER">SCI_GETRANGEPOINTER(int position, int rangeLength)</b><br />
4871 <b id="SCI_GETGAPPOSITION">SCI_GETGAPPOSITION</b><br />
4872 Grant temporary direct read-only access to the memory used by Scintilla to store
4873 the document.</p>
4874 <p><code>SCI_GETCHARACTERPOINTER</code> moves the gap within Scintilla so that the
4875 text of the document is stored consecutively
4876 and ensure there is a NUL character after the text, then returns a pointer to the first character.
4877 Applications may then pass this to a function that accepts a character pointer such as a regular
4878 expression search or a parser. The pointer should <em>not</em> be written to as that may desynchronize
4879 the internal state of Scintilla.</p>
4880 <p>Since any action in Scintilla may change its internal state
4881 this pointer becomes invalid after any call or by allowing user interface activity. The application
4882 should reacquire the pointer after making any call to Scintilla or performing any user-interface calls such
4883 as modifying a progress indicator.</p>
4884 <p>This call takes similar time to inserting a character at the end of the document and this may
4885 include moving the document contents. Specifically, all the characters after the document gap
4886 are moved to before the gap. This compacted state should persist over calls and user interface
4887 actions that do not change the document contents so reacquiring the pointer afterwards is very
4888 quick. If this call is used to implement a global replace operation, then each replacement will
4889 move the gap so if <code>SCI_GETCHARACTERPOINTER</code> is called after
4890 each replacement then the operation will become O(n^2) rather than O(n). Instead, all
4891 matches should be found and remembered, then all the replacements performed.</p>
4893 <p><code>SCI_GETRANGEPOINTER</code> provides direct access to just the
4894 range requested. The gap is not moved unless it is within the requested range so this call
4895 can be faster than <code>SCI_GETCHARACTERPOINTER</code>.
4896 This can be used by application code that is able to act on blocks of text or ranges of lines.</p>
4898 <p><code>SCI_GETGAPPOSITION</code> returns the current gap position.
4899 This is a hint that applications can use to avoid calling <code>SCI_GETRANGEPOINTER</code>
4900 with a range that contains the gap and consequent costs of moving the gap.</p>
4902 <h2 id="MultipleViews">Multiple views</h2>
4904 <p>A Scintilla window and the document that it displays are separate entities. When you create
4905 a new window, you also create a new, empty document. Each document has a reference count that
4906 is initially set to 1. The document also has a list of the Scintilla windows that are linked to
4907 it so when any window changes the document, all other windows in which it appears are notified
4908 to cause them to update. The system is arranged in this way so that you can work with many
4909 documents in a single Scintilla window and so you can display a single document in multiple
4910 windows (for use with splitter windows).</p>
4912 <p>Although these messages use <code>document *pDoc</code>, to ensure compatibility with future
4913 releases of Scintilla you should treat <code>pDoc</code> as an opaque <code>void*</code>. That
4914 is, you can use and store the pointer as described in this section but you should not
4915 dereference it.</p>
4916 <code><a class="message" href="#SCI_GETDOCPOINTER">SCI_GETDOCPOINTER</a><br />
4917 <a class="message" href="#SCI_SETDOCPOINTER">SCI_SETDOCPOINTER(&lt;unused&gt;, document
4918 *pDoc)</a><br />
4919 <a class="message" href="#SCI_CREATEDOCUMENT">SCI_CREATEDOCUMENT</a><br />
4920 <a class="message" href="#SCI_ADDREFDOCUMENT">SCI_ADDREFDOCUMENT(&lt;unused&gt;, document
4921 *pDoc)</a><br />
4922 <a class="message" href="#SCI_RELEASEDOCUMENT">SCI_RELEASEDOCUMENT(&lt;unused&gt;, document
4923 *pDoc)</a><br />
4924 </code>
4926 <p><b id="SCI_GETDOCPOINTER">SCI_GETDOCPOINTER</b><br />
4927 This returns a pointer to the document currently in use by the window. It has no other
4928 effect.</p>
4930 <p><b id="SCI_SETDOCPOINTER">SCI_SETDOCPOINTER(&lt;unused&gt;, document *pDoc)</b><br />
4931 This message does the following:<br />
4932 1. It removes the current window from the list held by the current document.<br />
4933 2. It reduces the reference count of the current document by 1.<br />
4934 3. If the reference count reaches 0, the document is deleted.<br />
4935 4. <code>pDoc</code> is set as the new document for the window.<br />
4936 5. If <code>pDoc</code> was 0, a new, empty document is created and attached to the
4937 window.<br />
4938 6. If <code>pDoc</code> was not 0, its reference count is increased by 1.</p>
4940 <p><b id="SCI_CREATEDOCUMENT">SCI_CREATEDOCUMENT</b><br />
4941 This message creates a new, empty document and returns a pointer to it. This document is not
4942 selected into the editor and starts with a reference count of 1. This means that you have
4943 ownership of it and must either reduce its reference count by 1 after using
4944 <code>SCI_SETDOCPOINTER</code> so that the Scintilla window owns it or you must make sure that
4945 you reduce the reference count by 1 with <code>SCI_RELEASEDOCUMENT</code> before you close the
4946 application to avoid memory leaks.</p>
4948 <p><b id="SCI_ADDREFDOCUMENT">SCI_ADDREFDOCUMENT(&lt;unused&gt;, document *pDoc)</b><br />
4949 This increases the reference count of a document by 1. If you want to replace the current
4950 document in the Scintilla window and take ownership of the current document, for example if you
4951 are editing many documents in one window, do the following:<br />
4952 1. Use <code>SCI_GETDOCPOINTER</code> to get a pointer to the document,
4953 <code>pDoc</code>.<br />
4954 2. Use <code>SCI_ADDREFDOCUMENT(0, pDoc)</code> to increment the reference count.<br />
4955 3. Use <code>SCI_SETDOCPOINTER(0, pNewDoc)</code> to set a different document or
4956 <code>SCI_SETDOCPOINTER(0, 0)</code> to set a new, empty document.</p>
4958 <p><b id="SCI_RELEASEDOCUMENT">SCI_RELEASEDOCUMENT(&lt;unused&gt;, document *pDoc)</b><br />
4959 This message reduces the reference count of the document identified by <code>pDoc</code>. pDoc
4960 must be the result of <code>SCI_GETDOCPOINTER</code> or <code>SCI_CREATEDOCUMENT</code> and
4961 must point at a document that still exists. If you call this on a document with a reference
4962 count of 1 that is still attached to a Scintilla window, bad things will happen. To keep the
4963 world spinning in its orbit you must balance each call to <code>SCI_CREATEDOCUMENT</code> or
4964 <code>SCI_ADDREFDOCUMENT</code> with a call to <code>SCI_RELEASEDOCUMENT</code>.</p>
4966 <h2 id="BackgroundLoadSave">Background loading and saving</h2>
4968 <p>To ensure a responsive user interface, applications may decide to load and save documents using a separate thread
4969 from the user interface.</p>
4971 <h3 id="BackgroundLoad">Loading in the background</h2>
4973 <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
4974 into a Scintilla document on the user interface thread. That technique uses extra memory to store a complete copy of the
4975 file and also means that the time that Scintilla takes to perform initial line end discovery blocks the user interface.</p>
4977 <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>
4979 <p><b id="SCI_CREATELOADER">SCI_CREATELOADER(int bytes)</b><br />
4980 Create an object that supports the <code>ILoader</code> interface which can be used to load data and then
4981 be turned into a Scintilla document object for attachment to a view object.
4982 The <code>bytes</code> argument determines the initial memory allocation for the document as it is more efficient
4983 to allocate once rather than rely on the buffer growing as data is added.
4984 If <code>SCI_CREATELOADER</code> fails then 0 is returned.</p>
4986 <h4>ILoader</h4>
4988 <div class="highlighted">
4989 <span class="S5">class</span><span class="S0"> </span>ILoader<span class="S0"> </span><span class="S10">{</span><br />
4990 <span class="S5">public</span><span class="S10">:</span><br />
4991 <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 />
4992 <span class="S0">&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="S2">// Returns a status code from SC_STATUS_*</span><br />
4993 <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 />
4994 <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 />
4995 <span class="S10">};</span><br />
4996 </div>
4998 <p>The application should call the <code>AddData</code> method with each block of data read from the file.
4999 <code>AddData</code> will return SC_STATUS_OK unless a failure, such as memory exhaustion occurs.
5000 If a failure occurs in <code>AddData</code> or in a file reading call then loading can be abandoned and the loader released with
5001 the <code>Release</code> call.
5002 When the whole file has been read, the <code>ConvertToDocument</code> method should be called to produce a Scintilla
5003 document pointer which can be used in the same way as a document pointer returned from
5004 <a class="message" href="#SCI_CREATEDOCUMENT">SCI_CREATEDOCUMENT</a>.
5005 There is no need to call <code>Release</code> after <code>ConvertToDocument</code>.</p>
5007 <h3 id="BackgroundSave">Saving in the background</h2>
5009 <p>An application that wants to save in the background should lock the document with <code>SCI_SETREADONLY(1)</code>
5010 to prevent modifications and retrieve a pointer to the unified document contents with
5011 <a class="message" href="#SCI_GETCHARACTERPOINTER">SCI_GETCHARACTERPOINTER</a></code>.
5012 The buffer of a locked document will not move so the pointer is valid until the application calls <code>SCI_SETREADONLY(0)</code>.</p>
5014 <p>If the user tries to performs a modification while the document is locked then a <code><a class="message"
5015 href="#SCN_MODIFYATTEMPTRO">SCN_MODIFYATTEMPTRO</a></code> notification is sent to the application.
5016 The application may then decide to ignore the modification or to terminate the background saving thread and reenable
5017 modification before returning from the notification.</p>
5019 <h2 id="Folding">Folding</h2>
5021 <p>The fundamental operation in folding is making lines invisible or visible. Line visibility
5022 is a property of the view rather than the document so each view may be displaying a different
5023 set of lines. From the point of view of the user, lines are hidden and displayed using fold
5024 points. Generally, the fold points of a document are based on the hierarchical structure of the
5025 document contents. In Python, the hierarchy is determined by indentation and in C++ by brace
5026 characters. This hierarchy can be represented within a Scintilla document object by attaching a
5027 numeric "fold level" to each line. The fold level is most easily set by a lexer, but you can
5028 also set it with messages.</p>
5030 <p>It is up to your code to set the connection between user actions and folding and unfolding.
5031 The best way to see how this is done is to search the SciTE source code for the messages used
5032 in this section of the documentation and see how they are used. You will also need to use
5033 markers and a folding margin to complete your folding implementation.
5034 The <code>"fold"</code> property should be set to <code>"1"</code> with
5035 <code>SCI_SETPROPERTY("fold", "1")</code> to enable folding. </p>
5036 <code><a class="message" href="#SCI_VISIBLEFROMDOCLINE">SCI_VISIBLEFROMDOCLINE(int
5037 docLine)</a><br />
5038 <a class="message" href="#SCI_DOCLINEFROMVISIBLE">SCI_DOCLINEFROMVISIBLE(int
5039 displayLine)</a><br />
5040 <a class="message" href="#SCI_SHOWLINES">SCI_SHOWLINES(int lineStart, int lineEnd)</a><br />
5041 <a class="message" href="#SCI_HIDELINES">SCI_HIDELINES(int lineStart, int lineEnd)</a><br />
5042 <a class="message" href="#SCI_GETLINEVISIBLE">SCI_GETLINEVISIBLE(int line)</a><br />
5043 <a class="message" href="#SCI_GETALLLINESVISIBLE">SCI_GETALLLINESVISIBLE</a><br />
5044 <a class="message" href="#SCI_SETFOLDLEVEL">SCI_SETFOLDLEVEL(int line, int level)</a><br />
5045 <a class="message" href="#SCI_GETFOLDLEVEL">SCI_GETFOLDLEVEL(int line)</a><br />
5046 <a class="message" href="#SCI_SETFOLDFLAGS">SCI_SETFOLDFLAGS(int flags)</a><br />
5047 <a class="message" href="#SCI_GETLASTCHILD">SCI_GETLASTCHILD(int line, int level)</a><br />
5048 <a class="message" href="#SCI_GETFOLDPARENT">SCI_GETFOLDPARENT(int line)</a><br />
5049 <a class="message" href="#SCI_SETFOLDEXPANDED">SCI_SETFOLDEXPANDED(int line, bool
5050 expanded)</a><br />
5051 <a class="message" href="#SCI_GETFOLDEXPANDED">SCI_GETFOLDEXPANDED(int line)</a><br />
5052 <a class="message" href="#SCI_CONTRACTEDFOLDNEXT">SCI_CONTRACTEDFOLDNEXT(int lineStart)</a><br />
5053 <a class="message" href="#SCI_TOGGLEFOLD">SCI_TOGGLEFOLD(int line)</a><br />
5054 <a class="message" href="#SCI_ENSUREVISIBLE">SCI_ENSUREVISIBLE(int line)</a><br />
5055 <a class="message" href="#SCI_ENSUREVISIBLEENFORCEPOLICY">SCI_ENSUREVISIBLEENFORCEPOLICY(int
5056 line)</a><br />
5057 </code>
5059 <p><b id="SCI_VISIBLEFROMDOCLINE">SCI_VISIBLEFROMDOCLINE(int docLine)</b><br />
5060 When some lines are folded, then a particular line in the document may be displayed at a
5061 different position to its document position. If no lines are folded, this message returns
5062 <code>docLine</code>. Otherwise, this returns the display line (counting the very first visible
5063 line as 0). The display line of an invisible line is the same as the previous visible line. The
5064 display line number of the first line in the document is 0. If there is folding and
5065 <code>docLine</code> is outside the range of lines in the document, the return value is -1.
5066 Lines can occupy more than one display line if they wrap.</p>
5068 <p><b id="SCI_DOCLINEFROMVISIBLE">SCI_DOCLINEFROMVISIBLE(int displayLine)</b><br />
5069 When some lines are hidden, then a particular line in the document may be displayed at a
5070 different position to its document position. This message returns the document line number that
5071 corresponds to a display line (counting the display line of the first line in the document as
5072 0). If <code>displayLine</code> is less than or equal to 0, the result is 0. If
5073 <code>displayLine</code> is greater than or equal to the number of displayed lines, the result
5074 is the number of lines in the document.</p>
5076 <p><b id="SCI_SHOWLINES">SCI_SHOWLINES(int lineStart, int lineEnd)</b><br />
5077 <b id="SCI_HIDELINES">SCI_HIDELINES(int lineStart, int lineEnd)</b><br />
5078 <b id="SCI_GETLINEVISIBLE">SCI_GETLINEVISIBLE(int line)</b><br />
5079 <b id="SCI_GETALLLINESVISIBLE">SCI_GETALLLINESVISIBLE</b><br />
5080 The first two messages mark a range of lines as visible or invisible and then redraw the
5081 display.
5082 <code>SCI_GETLINEVISIBLE</code> reports on the visible state of a line and returns 1 if it is
5083 visible and 0 if it is not visible.
5084 <code>SCI_GETALLLINESVISIBLE</code> returns 1 if all lines are visible and 0
5085 if some lines are hidden.
5086 These messages have no effect on fold levels or fold
5087 flags. The first line can not be hidden.</p>
5089 <p><b id="SCI_SETFOLDLEVEL">SCI_SETFOLDLEVEL(int line, int level)</b><br />
5090 <b id="SCI_GETFOLDLEVEL">SCI_GETFOLDLEVEL(int line)</b><br />
5091 These two messages set and get a 32-bit value that contains the fold level of a line and some
5092 flags associated with folding. The fold level is a number in the range 0 to
5093 <code>SC_FOLDLEVELNUMBERMASK</code> (4095). However, the initial fold level is set to
5094 <code>SC_FOLDLEVELBASE</code> (1024) to allow unsigned arithmetic on folding levels. There are
5095 two addition flag bits. <code>SC_FOLDLEVELWHITEFLAG</code> indicates that the line is blank and
5096 allows it to be treated slightly different then its level may indicate. For example, blank
5097 lines should generally not be fold points and will be considered part of the preceding section even though
5098 they may have a lesser fold level.
5099 <code>SC_FOLDLEVELHEADERFLAG</code> indicates that
5100 the line is a header (fold point).</p>
5102 <p>Use <code>SCI_GETFOLDLEVEL(line) &amp; SC_FOLDLEVELNUMBERMASK</code> to get the fold level
5103 of a line. Likewise, use <code>SCI_GETFOLDLEVEL(line) &amp; SC_FOLDLEVEL*FLAG</code> to get the
5104 state of the flags. To set the fold level you must or in the associated flags. For instance, to
5105 set the level to <code>thisLevel</code> and mark a line as being a fold point use:
5106 <code>SCI_SETFOLDLEVEL(line, thisLevel | SC_FOLDLEVELHEADERFLAG)</code>.</p>
5107 If you use a lexer, you should not need to use <code>SCI_SETFOLDLEVEL</code> as this is far
5108 better handled by the lexer. You will need to use <code>SCI_GETFOLDLEVEL</code> to decide how
5109 to handle user folding requests. If you do change the fold levels, the folding margin will
5110 update to match your changes.
5112 <p><b id="SCI_SETFOLDFLAGS">SCI_SETFOLDFLAGS(int flags)</b><br />
5113 In addition to showing markers in the folding margin, you can indicate folds to the user by
5114 drawing lines in the text area. The lines are drawn in the foreground colour set for <a
5115 class="message" href="#StyleDefinition"><code>STYLE_DEFAULT</code></a>. Bits set in
5116 <code>flags</code> determine where folding lines are drawn:<br />
5117 </p>
5119 <table cellpadding="1" cellspacing="2" border="0" summary="Fold flags">
5120 <tbody>
5121 <tr>
5122 <th align="left">Symbol</th>
5123 <th align="left">Value</th>
5124 <th align="left">Effect</th>
5125 </tr>
5126 </tbody>
5128 <tbody valign="top">
5129 <tr>
5130 <td align="left"></td>
5131 <td align="left">1</td>
5132 <td align="left">Experimental feature that has been removed.</td>
5133 </tr>
5135 <tr>
5136 <td align="left">SC_FOLDFLAG_LINEBEFORE_EXPANDED</td>
5137 <td align="left">2</td>
5139 <td align="left">Draw above if expanded</td>
5140 </tr>
5142 <tr>
5143 <td align="left">SC_FOLDFLAG_LINEBEFORE_CONTRACTED</td>
5144 <td align="left">4</td>
5146 <td align="left">Draw above if not expanded</td>
5147 </tr>
5149 <tr>
5150 <td align="left">SC_FOLDFLAG_LINEAFTER_EXPANDED</td>
5151 <td align="left">8</td>
5153 <td align="left">Draw below if expanded</td>
5154 </tr>
5156 <tr>
5157 <td align="left">SC_FOLDFLAG_LINEAFTER_CONTRACTED</td>
5158 <td align="left">16</td>
5160 <td align="left">Draw below if not expanded</td>
5161 </tr>
5163 <tr>
5164 <td align="left">SC_FOLDFLAG_LEVELNUMBERS</td>
5165 <td align="left">64</td>
5167 <td align="left">display hexadecimal fold levels in line margin to aid debugging of
5168 folding. The appearance of this feature may change in the future.</td>
5169 </tr>
5170 </tbody>
5171 </table>
5173 <p>This message causes the display to redraw.</p>
5175 <p><b id="SCI_GETLASTCHILD">SCI_GETLASTCHILD(int startLine, int level)</b><br />
5176 This message searches for the next line after <code>startLine</code>, that has a folding level
5177 that is less than or equal to <code>level</code> and then returns the previous line number. If
5178 you set <code>level</code> to -1, <code>level</code> is set to the folding level of line
5179 <code>startLine</code>. If <code>from</code> is a fold point, <code>SCI_GETLASTCHILD(from,
5180 -1)</code> returns the last line that would be in made visible or hidden by toggling the fold
5181 state.</p>
5183 <p><b id="SCI_GETFOLDPARENT">SCI_GETFOLDPARENT(int startLine)</b><br />
5184 This message returns the line number of the first line before <code>startLine</code> that is
5185 marked as a fold point with <code>SC_FOLDLEVELHEADERFLAG</code> and has a fold level less than
5186 the <code>startLine</code>. If no line is found, or if the header flags and fold levels are
5187 inconsistent, the return value is -1.</p>
5189 <p><b id="SCI_TOGGLEFOLD">SCI_TOGGLEFOLD(int line)</b><br />
5190 Each fold point may be either expanded, displaying all its child lines, or contracted, hiding
5191 all the child lines. This message toggles the folding state of the given line as long as it has
5192 the <code>SC_FOLDLEVELHEADERFLAG</code> set. This message takes care of folding or expanding
5193 all the lines that depend on the line. The display updates after this message.</p>
5195 <p><b id="SCI_SETFOLDEXPANDED">SCI_SETFOLDEXPANDED(int line, bool expanded)</b><br />
5196 <b id="SCI_GETFOLDEXPANDED">SCI_GETFOLDEXPANDED(int line)</b><br />
5197 These messages set and get the expanded state of a single line. The set message has no effect
5198 on the visible state of the line or any lines that depend on it. It does change the markers in
5199 the folding margin. If you ask for the expansion state of a line that is outside the document,
5200 the result is <code>false</code> (0).</p>
5202 <p>If you just want to toggle the fold state of one line and handle all the lines that are
5203 dependent on it, it is much easier to use <code>SCI_TOGGLEFOLD</code>. You would use the
5204 <code>SCI_SETFOLDEXPANDED</code> message to process many folds without updating the display
5205 until you had finished. See <code>SciTEBase::FoldAll()</code> and
5206 <code>SciTEBase::Expand()</code> for examples of the use of these messages.</p>
5208 <p><b id="SCI_CONTRACTEDFOLDNEXT">SCI_CONTRACTEDFOLDNEXT(int lineStart)</b><br />
5209 Search efficiently for lines that are contracted fold headers.
5210 This is useful when saving the user's folding when switching documents or saving folding with a file.
5211 The search starts at line number <code>lineStart</code> and continues forwards to the end of the file.
5212 <code>lineStart</code> is returned if it is a contracted fold header otherwise the next contracted
5213 fold header is returned. If there are no more contracted fold headers then -1 is returned.</p>
5215 <p><b id="SCI_ENSUREVISIBLE">SCI_ENSUREVISIBLE(int line)</b><br />
5216 <b id="SCI_ENSUREVISIBLEENFORCEPOLICY">SCI_ENSUREVISIBLEENFORCEPOLICY(int line)</b><br />
5217 A line may be hidden because more than one of its parent lines is contracted. Both these
5218 message travels up the fold hierarchy, expanding any contracted folds until they reach the top
5219 level. The line will then be visible. If you use <code>SCI_ENSUREVISIBLEENFORCEPOLICY</code>,
5220 the vertical caret policy set by <a class="message"
5221 href="#SCI_SETVISIBLEPOLICY"><code>SCI_SETVISIBLEPOLICY</code></a> is then applied.</p>
5223 <h2 id="LineWrapping">Line wrapping</h2>
5225 <code><a class="message" href="#SCI_SETWRAPMODE">SCI_SETWRAPMODE(int wrapMode)</a><br />
5226 <a class="message" href="#SCI_GETWRAPMODE">SCI_GETWRAPMODE</a><br />
5227 <a class="message" href="#SCI_SETWRAPVISUALFLAGS">SCI_SETWRAPVISUALFLAGS(int wrapVisualFlags)</a><br />
5228 <a class="message" href="#SCI_GETWRAPVISUALFLAGS">SCI_GETWRAPVISUALFLAGS</a><br />
5229 <a class="message" href="#SCI_SETWRAPVISUALFLAGSLOCATION">SCI_SETWRAPVISUALFLAGSLOCATION(int wrapVisualFlagsLocation)</a><br />
5230 <a class="message" href="#SCI_GETWRAPVISUALFLAGSLOCATION">SCI_GETWRAPVISUALFLAGSLOCATION</a><br />
5231 <a class="message" href="#SCI_SETWRAPINDENTMODE">SCI_SETWRAPINDENTMODE(int indentMode)</a><br />
5232 <a class="message" href="#SCI_GETWRAPINDENTMODE">SCI_GETWRAPINDENTMODE</a><br />
5233 <a class="message" href="#SCI_SETWRAPSTARTINDENT">SCI_SETWRAPSTARTINDENT(int indent)</a><br />
5234 <a class="message" href="#SCI_GETWRAPSTARTINDENT">SCI_GETWRAPSTARTINDENT</a><br />
5235 <a class="message" href="#SCI_SETLAYOUTCACHE">SCI_SETLAYOUTCACHE(int cacheMode)</a><br />
5236 <a class="message" href="#SCI_GETLAYOUTCACHE">SCI_GETLAYOUTCACHE</a><br />
5237 <a class="message" href="#SCI_SETPOSITIONCACHE">SCI_SETPOSITIONCACHE(int size)</a><br />
5238 <a class="message" href="#SCI_GETPOSITIONCACHE">SCI_GETPOSITIONCACHE</a><br />
5239 <a class="message" href="#SCI_LINESSPLIT">SCI_LINESSPLIT(int pixelWidth)</a><br />
5240 <a class="message" href="#SCI_LINESJOIN">SCI_LINESJOIN</a><br />
5241 <a class="message" href="#SCI_WRAPCOUNT">SCI_WRAPCOUNT(int docLine)</a><br />
5242 </code>
5244 <p>By default, Scintilla does not wrap lines of text. If you enable line wrapping, lines wider
5245 than the window width are continued on the following lines. Lines are broken after space or tab
5246 characters or between runs of different styles. If this is not possible because a word in one
5247 style is wider than the window then the break occurs after the last character that completely
5248 fits on the line. The horizontal scroll bar does not appear when wrap mode is on.</p>
5250 <p>For wrapped lines Scintilla can draw visual flags (little arrows) at end of a a subline of a
5251 wrapped line and at begin of the next subline. These can be enabled individually, but if Scintilla
5252 draws the visual flag at the beginning of the next subline this subline will be indented by one char.
5253 Independent from drawing a visual flag at the begin the subline can have an indention.</p>
5255 <p>Much of the time used by Scintilla is spent on laying out and drawing text. The same text
5256 layout calculations may be performed many times even when the data used in these calculations
5257 does not change. To avoid these unnecessary calculations in some circumstances, the line layout
5258 cache can store the results of the calculations. The cache is invalidated whenever the
5259 underlying data, such as the contents or styling of the document changes. Caching the layout of
5260 the whole document has the most effect, making dynamic line wrap as much as 20 times faster but
5261 this requires 7 times the memory required by the document contents plus around 80 bytes per
5262 line.</p>
5264 <p>Wrapping is not performed immediately there is a change but is delayed until the display
5265 is redrawn. This delay improves peformance by allowing a set of changes to be performed
5266 and then wrapped and displayed once. Because of this, some operations may not occur as
5267 expected. If a file is read and the scroll position moved to a particular line in the text,
5268 such as occurs when a container tries to restore a previous editing session, then
5269 the scroll position will have been determined before wrapping so an unexpected range
5270 of text will be displayed. To scroll to the position correctly, delay the scroll until the
5271 wrapping has been performed by waiting for an initial
5272 <a class="message" href="#SCN_PAINTED">SCN_PAINTED</a> notification.</p>
5274 <p><b id="SCI_SETWRAPMODE">SCI_SETWRAPMODE(int wrapMode)</b><br />
5275 <b id="SCI_GETWRAPMODE">SCI_GETWRAPMODE</b><br />
5276 Set wrapMode to <code>SC_WRAP_WORD</code> (1) to enable wrapping
5277 on word boundaries, <code>SC_WRAP_CHAR</code> (2) to enable wrapping
5278 between any characters, and to <code>SC_WRAP_NONE</code> (0) to disable line
5279 wrapping. <code>SC_WRAP_CHAR</code> is preferred to
5280 <code>SC_WRAP_WORD</code> for Asian languages where there is no white space
5281 between words.</p>
5284 <p><b id="SCI_SETWRAPVISUALFLAGS">SCI_SETWRAPVISUALFLAGS(int wrapVisualFlags)</b><br />
5285 <b id="SCI_GETWRAPVISUALFLAGS">SCI_GETWRAPVISUALFLAGS</b><br />
5286 You can enable the drawing of visual flags to indicate a line is wrapped. Bits set in
5287 wrapVisualFlags determine which visual flags are drawn.
5288 </p>
5289 <table cellpadding="1" cellspacing="2" border="0" summary="Wrap visual flags">
5290 <tbody>
5291 <tr>
5292 <th align="left">Symbol</th>
5293 <th>Value</th>
5294 <th align="left">Effect</th>
5295 </tr>
5296 </tbody>
5298 <tbody valign="top">
5299 <tr>
5300 <td align="left"><code>SC_WRAPVISUALFLAG_NONE</code></td>
5301 <td align="center">0</td>
5302 <td>No visual flags</td>
5303 </tr>
5305 <tr>
5306 <td align="left"><code>SC_WRAPVISUALFLAG_END</code></td>
5307 <td align="center">1</td>
5308 <td>Visual flag at end of subline of a wrapped line.</td>
5309 </tr>
5311 <tr>
5312 <td align="left"><code>SC_WRAPVISUALFLAG_START</code></td>
5313 <td align="center">2</td>
5314 <td>Visual flag at begin of subline of a wrapped line.<br />
5315 Subline is indented by at least 1 to make room for the flag.<br />
5316 </td>
5317 </tr>
5319 <tr>
5320 <td align="left"><code>SC_WRAPVISUALFLAG_MARGIN</code></td>
5321 <td align="center">4</td>
5322 <td>Visual flag in line number margin.</td>
5323 </tr>
5324 </tbody>
5325 </table>
5327 <p><b id="SCI_SETWRAPVISUALFLAGSLOCATION">SCI_SETWRAPVISUALFLAGSLOCATION(int wrapVisualFlagsLocation)</b><br />
5328 <b id="SCI_GETWRAPVISUALFLAGSLOCATION">SCI_GETWRAPVISUALFLAGSLOCATION</b><br />
5329 You can set whether the visual flags to indicate a line is wrapped are drawn near the border or near the text.
5330 Bits set in wrapVisualFlagsLocation set the location to near the text for the corresponding visual flag.
5331 </p>
5333 <table cellpadding="1" cellspacing="2" border="0" summary="Wrap visual flags locations">
5334 <tbody>
5335 <tr>
5336 <th align="left">Symbol</th>
5337 <th>Value</th>
5338 <th align="left">Effect</th>
5339 </tr>
5340 </tbody>
5342 <tbody valign="top">
5343 <tr>
5344 <td align="left"><code>SC_WRAPVISUALFLAGLOC_DEFAULT</code></td>
5345 <td align="center">0</td>
5346 <td>Visual flags drawn near border</td>
5347 </tr>
5349 <tr>
5350 <td align="left"><code>SC_WRAPVISUALFLAGLOC_END_BY_TEXT</code></td>
5351 <td align="center">1</td>
5352 <td>Visual flag at end of subline drawn near text</td>
5353 </tr>
5355 <tr>
5356 <td align="left"><code>SC_WRAPVISUALFLAGLOC_START_BY_TEXT</code></td>
5357 <td align="center">2</td>
5358 <td>Visual flag at beginning of subline drawn near text</td>
5359 </tr>
5360 </tbody>
5361 </table>
5363 <p><b id="SCI_SETWRAPINDENTMODE">SCI_SETWRAPINDENTMODE(int indentMode)</b><br />
5364 <b id="SCI_GETWRAPINDENTMODE">SCI_GETWRAPINDENTMODE</b><br />
5365 Wrapped sublines can be indented to the position of their first subline or one more indent level.
5366 The default is <code>SC_WRAPINDENT_FIXED</code>.
5367 The modes are:
5368 </p>
5370 <table cellpadding="1" cellspacing="2" border="0" summary="Wrap visual flags locations">
5371 <tbody>
5372 <tr>
5373 <th align="left">Symbol</th>
5374 <th>Value</th>
5375 <th align="left">Effect</th>
5376 </tr>
5377 </tbody>
5379 <tbody valign="top">
5380 <tr>
5381 <td align="left"><code>SC_WRAPINDENT_FIXED</code></td>
5382 <td align="center">0</td>
5383 <td>Wrapped sublines aligned to left of window plus amount set by
5384 <a class="message" href="#SCI_SETWRAPSTARTINDENT">SCI_SETWRAPSTARTINDENT</a></td>
5385 </tr>
5387 <tr>
5388 <td align="left"><code>SC_WRAPINDENT_SAME</code></td>
5389 <td align="center">1</td>
5390 <td>Wrapped sublines are aligned to first subline indent</td>
5391 </tr>
5393 <tr>
5394 <td align="left"><code>SC_WRAPINDENT_INDENT</code></td>
5395 <td align="center">2</td>
5396 <td>Wrapped sublines are aligned to first subline indent plus one more level of indentation</td>
5397 </tr>
5398 </tbody>
5399 </table>
5401 <p><b id="SCI_SETWRAPSTARTINDENT">SCI_SETWRAPSTARTINDENT(int indent)</b><br />
5402 <b id="SCI_GETWRAPSTARTINDENT">SCI_GETWRAPSTARTINDENT</b><br />
5403 <code>SCI_SETWRAPSTARTINDENT</code> sets the size of indentation of sublines for
5404 wrapped lines in terms of the average character width in
5405 <a class="message" href="#StyleDefinition"><code>STYLE_DEFAULT</code></a>.
5406 There are no limits on indent sizes, but values less than 0 or large values may have
5407 undesirable effects.<br />
5408 The indention of sublines is independent of visual flags, but if
5409 <code>SC_WRAPVISUALFLAG_START</code> is set an indent of at least 1 is used.
5410 </p>
5412 <p><b id="SCI_SETLAYOUTCACHE">SCI_SETLAYOUTCACHE(int cacheMode)</b><br />
5413 <b id="SCI_GETLAYOUTCACHE">SCI_GETLAYOUTCACHE</b><br />
5414 You can set <code>cacheMode</code> to one of the symbols in the table:</p>
5416 <table cellpadding="1" cellspacing="2" border="0" summary="Line caching styles">
5417 <tbody>
5418 <tr>
5419 <th align="left">Symbol</th>
5421 <th>Value</th>
5423 <th align="left">Layout cached for these lines</th>
5424 </tr>
5425 </tbody>
5427 <tbody valign="top">
5428 <tr>
5429 <td align="left"><code>SC_CACHE_NONE</code></td>
5431 <td align="center">0</td>
5433 <td>No lines are cached.</td>
5434 </tr>
5436 <tr>
5437 <td align="left"><code>SC_CACHE_CARET</code></td>
5439 <td align="center">1</td>
5441 <td>The line containing the text caret. This is the default.</td>
5442 </tr>
5444 <tr>
5445 <td align="left"><code>SC_CACHE_PAGE</code></td>
5447 <td align="center">2</td>
5449 <td>Visible lines plus the line containing the caret.</td>
5450 </tr>
5452 <tr>
5453 <td align="left"><code>SC_CACHE_DOCUMENT</code></td>
5455 <td align="center">3</td>
5457 <td>All lines in the document.</td>
5458 </tr>
5459 </tbody>
5460 </table>
5462 <p><b id="SCI_SETPOSITIONCACHE">SCI_SETPOSITIONCACHE(int size)</b><br />
5463 <b id="SCI_GETPOSITIONCACHE">SCI_GETPOSITIONCACHE</b><br />
5464 The position cache stores position information for short runs of text
5465 so that their layout can be determined more quickly if the run recurs.
5466 The size in entries of this cache can be set with <code>SCI_SETPOSITIONCACHE</code>.</p>
5468 <p><b id="SCI_LINESSPLIT">SCI_LINESSPLIT(int pixelWidth)</b><br />
5469 Split a range of lines indicated by the target into lines that are at most pixelWidth wide.
5470 Splitting occurs on word boundaries wherever possible in a similar manner to line wrapping.
5471 When <code>pixelWidth</code> is 0 then the width of the window is used.
5472 </p>
5474 <p><b id="SCI_LINESJOIN">SCI_LINESJOIN</b><br />
5475 Join a range of lines indicated by the target into one line by
5476 removing line end characters.
5477 Where this would lead to no space between words, an extra space is inserted.
5478 </p>
5480 <p><b id="SCI_WRAPCOUNT">SCI_WRAPCOUNT(int docLine)</b><br />
5481 Document lines can occupy more than one display line if they wrap and this
5482 returns the number of display lines needed to wrap a document line.</p>
5484 <h2 id="Zooming">Zooming</h2>
5486 <p>Scintilla incorporates a "zoom factor" that lets you make all the text in the document
5487 larger or smaller in steps of one point. The displayed point size never goes below 2, whatever
5488 zoom factor you set. You can set zoom factors in the range -10 to +20 points.</p>
5489 <code><a class="message" href="#SCI_ZOOMIN">SCI_ZOOMIN</a><br />
5490 <a class="message" href="#SCI_ZOOMOUT">SCI_ZOOMOUT</a><br />
5491 <a class="message" href="#SCI_SETZOOM">SCI_SETZOOM(int zoomInPoints)</a><br />
5492 <a class="message" href="#SCI_GETZOOM">SCI_GETZOOM</a><br />
5493 </code>
5495 <p><b id="SCI_ZOOMIN">SCI_ZOOMIN</b><br />
5496 <b id="SCI_ZOOMOUT">SCI_ZOOMOUT</b><br />
5497 <code>SCI_ZOOMIN</code> increases the zoom factor by one point if the current zoom factor is
5498 less than 20 points. <code>SCI_ZOOMOUT</code> decreases the zoom factor by one point if the
5499 current zoom factor is greater than -10 points.</p>
5501 <p><b id="SCI_SETZOOM">SCI_SETZOOM(int zoomInPoints)</b><br />
5502 <b id="SCI_GETZOOM">SCI_GETZOOM</b><br />
5503 These messages let you set and get the zoom factor directly. There is no limit set on the
5504 factors you can set, so limiting yourself to -10 to +20 to match the incremental zoom functions
5505 is a good idea.</p>
5507 <h2 id="LongLines">Long lines</h2>
5509 <p>You can choose to mark lines that exceed a given length by drawing a vertical line or by
5510 colouring the background of characters that exceed the set length.</p>
5511 <code><a class="message" href="#SCI_SETEDGEMODE">SCI_SETEDGEMODE(int mode)</a><br />
5512 <a class="message" href="#SCI_GETEDGEMODE">SCI_GETEDGEMODE</a><br />
5513 <a class="message" href="#SCI_SETEDGECOLUMN">SCI_SETEDGECOLUMN(int column)</a><br />
5514 <a class="message" href="#SCI_GETEDGECOLUMN">SCI_GETEDGECOLUMN</a><br />
5515 <a class="message" href="#SCI_SETEDGECOLOUR">SCI_SETEDGECOLOUR(int colour)</a><br />
5516 <a class="message" href="#SCI_GETEDGECOLOUR">SCI_GETEDGECOLOUR</a><br />
5517 </code>
5519 <p><b id="SCI_SETEDGEMODE">SCI_SETEDGEMODE(int edgeMode)</b><br />
5520 <b id="SCI_GETEDGEMODE">SCI_GETEDGEMODE</b><br />
5521 These two messages set and get the mode used to display long lines. You can set one of the
5522 values in the table:</p>
5524 <table cellpadding="1" cellspacing="2" border="0" summary="Long line styles">
5525 <tbody>
5526 <tr>
5527 <th align="left">Symbol</th>
5529 <th>Value</th>
5531 <th align="left">Long line display mode</th>
5532 </tr>
5533 </tbody>
5535 <tbody valign="top">
5536 <tr>
5537 <td align="left"><code>EDGE_NONE</code></td>
5539 <td align="center">0</td>
5541 <td>Long lines are not marked. This is the default state.</td>
5542 </tr>
5544 <tr>
5545 <td align="left"><code>EDGE_LINE</code></td>
5547 <td align="center">1</td>
5549 <td>A vertical line is drawn at the column number set by <code>SCI_SETEDGECOLUMN</code>.
5550 This works well for monospaced fonts. The line is drawn at a position based on the width
5551 of a space character in <a class="message"
5552 href="#StyleDefinition"><code>STYLE_DEFAULT</code></a>, so it may not work very well if
5553 your styles use proportional fonts or if your style have varied font sizes or you use a
5554 mixture of bold, italic and normal text.</td>
5555 </tr>
5557 <tr>
5558 <td align="left"><code>EDGE_BACKGROUND</code></td>
5560 <td align="center">2</td>
5562 <td>The background colour of characters after the column limit is changed to the colour
5563 set by <code>SCI_SETEDGECOLOUR</code>. This is recommended for proportional fonts.</td>
5564 </tr>
5565 </tbody>
5566 </table>
5568 <p><b id="SCI_SETEDGECOLUMN">SCI_SETEDGECOLUMN(int column)</b><br />
5569 <b id="SCI_GETEDGECOLUMN">SCI_GETEDGECOLUMN</b><br />
5570 These messages set and get the column number at which to display the long line marker. When
5571 drawing lines, the column sets a position in units of the width of a space character in
5572 <code>STYLE_DEFAULT</code>. When setting the background colour, the column is a character count
5573 (allowing for tabs) into the line.</p>
5575 <p><b id="SCI_SETEDGECOLOUR">SCI_SETEDGECOLOUR(int <a class="jump"
5576 href="#colour">colour</a>)</b><br />
5577 <b id="SCI_GETEDGECOLOUR">SCI_GETEDGECOLOUR</b><br />
5578 These messages set and get the colour of the marker used to show that a line has exceeded the
5579 length set by <code>SCI_SETEDGECOLUMN</code>.</p>
5581 <h2 id="Lexer">Lexer</h2>
5583 <p>If you define the symbol <code>SCI_LEXER</code> when building Scintilla, (this is sometimes
5584 called the SciLexer version of Scintilla), lexing support for a wide range of programming
5585 languages is included and the messages in this section are supported. If you want to set
5586 styling and fold points for an unsupported language you can either do this in the container or
5587 better still, write your own lexer following the pattern of one of the existing ones.</p>
5589 <p>Scintilla also supports external lexers. These are DLLs (on Windows) or .so modules (on GTK+/Linux) that export three
5590 functions: <code>GetLexerCount</code>, <code>GetLexerName</code>, and
5591 <code>GetLexerFactory</code>. See <code>externalLexer.cxx</code> for more.</p>
5592 <code><a class="message" href="#SCI_SETLEXER">SCI_SETLEXER(int lexer)</a><br />
5593 <a class="message" href="#SCI_GETLEXER">SCI_GETLEXER</a><br />
5594 <a class="message" href="#SCI_SETLEXERLANGUAGE">SCI_SETLEXERLANGUAGE(&lt;unused&gt;, const char
5595 *name)</a><br />
5596 <a class="message" href="#SCI_GETLEXERLANGUAGE">SCI_GETLEXERLANGUAGE(&lt;unused&gt;, char
5597 *name)</a><br />
5598 <a class="message" href="#SCI_LOADLEXERLIBRARY">SCI_LOADLEXERLIBRARY(&lt;unused&gt;, const char
5599 *path)</a><br />
5600 <a class="message" href="#SCI_COLOURISE">SCI_COLOURISE(int start, int end)</a><br />
5601 <a class="message" href="#SCI_CHANGELEXERSTATE">SCI_CHANGELEXERSTATE(int start, int end)</a><br />
5602 <a class="message" href="#SCI_PROPERTYNAMES">SCI_PROPERTYNAMES(&lt;unused&gt;, char *names)</a><br />
5603 <a class="message" href="#SCI_PROPERTYTYPE">SCI_PROPERTYTYPE(const char *name)</a><br />
5604 <a class="message" href="#SCI_DESCRIBEPROPERTY">SCI_DESCRIBEPROPERTY(const char *name, char *description)</a><br />
5605 <a class="message" href="#SCI_SETPROPERTY">SCI_SETPROPERTY(const char *key, const char *value)</a><br />
5606 <a class="message" href="#SCI_GETPROPERTY">SCI_GETPROPERTY(const char *key, char *value)</a><br />
5607 <a class="message" href="#SCI_GETPROPERTYEXPANDED">SCI_GETPROPERTYEXPANDED(const char *key, char *value)</a><br />
5608 <a class="message" href="#SCI_GETPROPERTYINT">SCI_GETPROPERTYINT(const char *key, int default)</a><br />
5609 <a class="message" href="#SCI_DESCRIBEKEYWORDSETS">SCI_DESCRIBEKEYWORDSETS(&lt;unused&gt;, char *descriptions)</a><br />
5610 <a class="message" href="#SCI_SETKEYWORDS">SCI_SETKEYWORDS(int keyWordSet, const char
5611 *keyWordList)</a><br />
5612 <a class="message" href="#SCI_GETSTYLEBITSNEEDED">SCI_GETSTYLEBITSNEEDED</a>
5613 <br />
5614 </code>
5616 <p><b id="SCI_SETLEXER">SCI_SETLEXER(int lexer)</b><br />
5617 <b id="SCI_GETLEXER">SCI_GETLEXER</b><br />
5618 You can select the lexer to use with an integer code from the <code>SCLEX_*</code> enumeration
5619 in <code>Scintilla.h</code>. There are two codes in this sequence that do not use lexers:
5620 <code>SCLEX_NULL</code> to select no lexing action and <code>SCLEX_CONTAINER</code> which sends
5621 the <code><a class="message" href="#SCN_STYLENEEDED">SCN_STYLENEEDED</a></code> notification to
5622 the container whenever a range of text needs to be styled. You cannot use the
5623 <code>SCLEX_AUTOMATIC</code> value; this identifies additional external lexers that Scintilla
5624 assigns unused lexer numbers to.</p>
5626 <p><b id="SCI_SETLEXERLANGUAGE">SCI_SETLEXERLANGUAGE(&lt;unused&gt;, const char *name)</b><br />
5627 <b id="SCI_GETLEXERLANGUAGE">SCI_GETLEXERLANGUAGE(&lt;unused&gt;, char *name)</b><br />
5628 <code>SCI_SETLEXERLANGUAGE</code> lets you select a lexer by name, and is the only method if you are using an
5629 external lexer or if you have written a lexer module for a language of your own and do not wish
5630 to assign it an explicit lexer number. To select an existing lexer, set <code>name</code> to
5631 match the (case sensitive) name given to the module, for example "ada" or "python", not "Ada"
5632 or "Python". To locate the name for the built-in lexers, open the relevant
5633 <code>Lex*.cxx</code> file and search for <code>LexerModule</code>. The third argument in the
5634 <code>LexerModule</code> constructor is the name to use.</p>
5636 <p>To test if your lexer assignment worked, use <a class="message"
5637 href="#SCI_GETLEXER"><code>SCI_GETLEXER</code></a> before and after setting the new lexer to
5638 see if the lexer number changed.</p>
5640 <p><code>SCI_GETLEXERLANGUAGE</code> retrieves the name of the lexer.</p>
5642 <p><b id="SCI_LOADLEXERLIBRARY">SCI_LOADLEXERLIBRARY(&lt;unused&gt;, const char *path)</b><br />
5643 Load a lexer implemented in a shared library. This is a .so file on GTK+/Linux or a .DLL file on Windows.
5644 </p>
5646 <p><b id="SCI_COLOURISE">SCI_COLOURISE(int startPos, int endPos)</b><br />
5647 This requests the current lexer or the container (if the lexer is set to
5648 <code>SCLEX_CONTAINER</code>) to style the document between <code>startPos</code> and
5649 <code>endPos</code>. If <code>endPos</code> is -1, the document is styled from
5650 <code>startPos</code> to the end. If the <code>"fold"</code> property is set to
5651 <code>"1"</code> and your lexer or container supports folding, fold levels are also set. This
5652 message causes a redraw.</p>
5654 <p><b id="SCI_CHANGELEXERSTATE">SCI_CHANGELEXERSTATE(int startPos, int endPos)</b><br />
5655 Indicate that the internal state of a lexer has changed over a range and therefore
5656 there may be a need to redraw.</p>
5658 <p><b id="SCI_PROPERTYNAMES">SCI_PROPERTYNAMES(&lt;unused&gt;, char *names)</b><br />
5659 <b id="SCI_PROPERTYTYPE">SCI_PROPERTYTYPE(const char *name)</b><br />
5660 <b id="SCI_DESCRIBEPROPERTY">SCI_DESCRIBEPROPERTY(const char *name, char *description)</b><br />
5661 Information may be retrieved about the properties that can be set for the current lexer.
5662 This information is only available for newer lexers.
5663 <code>SCI_PROPERTYNAMES</code> returns a string with all of the valid properties separated by "\n".
5664 If the lexer does not support this call then an empty string is returned.
5665 Properties may be boolean (<code>SC_TYPE_BOOLEAN</code>), integer (<code>SC_TYPE_INTEGER</code>),
5666 or string (<code>SC_TYPE_STRING</code>) and this is found with <code>SCI_PROPERTYTYPE</code>.
5667 A description of a property in English is returned by <code>SCI_DESCRIBEPROPERTY</code>.</p>
5669 <p><b id="SCI_SETPROPERTY">SCI_SETPROPERTY(const char *key, const char *value)</b><br />
5670 You can communicate settings to lexers with keyword:value string pairs. There is no limit to
5671 the number of keyword pairs you can set, other than available memory. <code>key</code> is a
5672 case sensitive keyword, <code>value</code> is a string that is associated with the keyword. If
5673 there is already a value string associated with the keyword, it is replaced. If you pass a zero
5674 length string, the message does nothing. Both <code>key</code> and <code>value</code> are used
5675 without modification; extra spaces at the beginning or end of <code>key</code> are
5676 significant.</p>
5678 <p>The <code>value</code> string can refer to other keywords. For example,
5679 <code>SCI_SETPROPERTY("foldTimes10", "$(fold)0")</code> stores the string
5680 <code>"$(fold)0"</code>, but when this is accessed, the <code>$(fold)</code> is replaced by the
5681 value of the <code>"fold"</code> keyword (or by nothing if this keyword does not exist).</p>
5683 <p>Currently the "fold" property is defined for most of the lexers to set the fold structure if
5684 set to "1". <code>SCLEX_PYTHON</code> understands <code>"tab.timmy.whinge.level"</code> as a
5685 setting that determines how to indicate bad indentation. Most keywords have values that are
5686 interpreted as integers. Search the lexer sources for <code>GetPropertyInt</code> to see how
5687 properties are used.</p>
5689 <p>There is a convention for naming properties used by lexers so that the set of properties can be found by scripts.
5690 Property names should start with "lexer.&lt;lexer&gt;." or "fold.&lt;lexer&gt;." when they apply to one
5691 lexer or start with "lexer." or "fold." if they apply to multiple lexers.</p>
5693 <p>Applications may discover the set of properties used by searching the source code of lexers for lines that contain
5694 <code>GetProperty</code> and a double quoted string and extract the value of the double quoted string as the property name.
5695 The <code>scintilla/src/LexGen.py</code> script does this and can be used as an example.
5696 Documentation for the property may be located above the call as a multi-line comment starting with
5697 <br/><code>// property &lt;property-name&gt;</code></p>
5699 <p><b id="SCI_GETPROPERTY">SCI_GETPROPERTY(const char *key, char *value)</b><br />
5700 Lookup a keyword:value pair using the specified key; if found, copy the value to the user-supplied
5701 buffer and return the length (not including the terminating 0). If not found, copy an empty string
5702 to the buffer and return 0.</p>
5704 <p>Note that "keyword replacement" as described in <a class="message" href="#SCI_SETPROPERTY">
5705 <code>SCI_SETPROPERTY</code></a> will not be performed.</p>
5707 <p>If the value argument is 0 then the length that should be allocated to store the value is returned;
5708 again, the terminating 0 is not included.</p>
5710 <p><b id="SCI_GETPROPERTYEXPANDED">SCI_GETPROPERTYEXPANDED(const char *key, char *value)</b><br />
5711 Lookup a keyword:value pair using the specified key; if found, copy the value to the user-supplied
5712 buffer and return the length (not including the terminating 0). If not found, copy an empty string
5713 to the buffer and return 0.</p>
5715 <p>Note that "keyword replacement" as described in <a class="message" href="#SCI_SETPROPERTY">
5716 <code>SCI_SETPROPERTY</code></a> will be performed.</p>
5718 <p>If the value argument is 0 then the length that should be allocated to store the value (including any indicated keyword replacement)
5719 is returned; again, the terminating 0 is not included.</p>
5721 <p><b id="SCI_GETPROPERTYINT">SCI_GETPROPERTYINT(const char *key, int default)</b><br />
5722 Lookup a keyword:value pair using the specified key; if found, interpret the value as an integer and return it.
5723 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
5724 a number, then return 0.</p>
5726 <p>Note that "keyword replacement" as described in <a class="message" href="#SCI_SETPROPERTY">
5727 <code>SCI_SETPROPERTY</code></a> will be performed before any numeric interpretation.</p>
5729 <p><b id="SCI_SETKEYWORDS">SCI_SETKEYWORDS(int keyWordSet, const char *keyWordList)</b><br />
5730 You can set up to 9 lists of keywords for use by the current lexer. This was increased from 6
5731 at revision 1.50. <code>keyWordSet</code> can be 0 to 8 (actually 0 to <code>KEYWORDSET_MAX</code>)
5732 and selects which keyword list to replace. <code>keyWordList</code> is a list of keywords
5733 separated by spaces, tabs, <code>"\n"</code> or <code>"\r"</code> or any combination of these.
5734 It is expected that the keywords will be composed of standard ASCII printing characters,
5735 but there is nothing to stop you using any non-separator character codes from 1 to 255
5736 (except common sense).</p>
5738 <p>How these keywords are used is entirely up to the lexer. Some languages, such as HTML may
5739 contain embedded languages, VBScript and JavaScript are common for HTML. For HTML, key word set
5740 0 is for HTML, 1 is for JavaScript and 2 is for VBScript, 3 is for Python, 4 is for PHP and 5
5741 is for SGML and DTD keywords. Review the lexer code to see examples of keyword list. A fully
5742 conforming lexer sets the fourth argument of the <code>LexerModule</code> constructor to be a
5743 list of strings that describe the uses of the keyword lists.</p>
5745 <p>Alternatively, you might use set 0 for general keywords, set 1 for keywords that cause
5746 indentation and set 2 for keywords that cause unindentation. Yet again, you might have a simple
5747 lexer that colours keywords and you could change languages by changing the keywords in set 0.
5748 There is nothing to stop you building your own keyword lists into the lexer, but this means
5749 that the lexer must be rebuilt if more keywords are added.</p>
5751 <p><b id="SCI_DESCRIBEKEYWORDSETS">SCI_DESCRIBEKEYWORDSETS(&lt;unused&gt;, char *descriptions)</b><br />
5752 A description of all of the keyword sets separated by "\n" is returned by <code>SCI_DESCRIBEKEYWORDSETS</code>.</p>
5754 <p><b id="SCI_GETSTYLEBITSNEEDED">SCI_GETSTYLEBITSNEEDED</b><br />
5755 Retrieve the number of bits the current lexer needs for styling. This should normally be the argument
5756 to <a class="message" href="#SCI_SETSTYLEBITS">SCI_SETSTYLEBITS</a>.
5757 </p>
5759 <h2 id="LexerObjects">Lexer Objects</h2>
5761 <p>Lexers are programmed as objects that implement the ILexer interface and that interact
5762 with the document they are lexing through the IDocument interface.
5763 Previously lexers were defined by providing lexing and folding functions but creating an object
5764 to handle the interaction of a lexer with a document allows the lexer to store state information that
5765 can be used during lexing. For example a C++ lexer may store a set of preprocessor definitions
5766 or variable declarations and style these depending on their role.</p>
5768 <p>A set of helper classes allows older lexers defined by functions to be used in Scintilla.</p>
5769 <h4>ILexer</h4>
5771 <div class="highlighted">
5772 <span class="S5">class</span><span class="S0"> </span>ILexer<span class="S0"> </span><span class="S10">{</span><br />
5773 <span class="S5">public</span><span class="S10">:</span><br />
5774 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5775 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
5776 <span class="S0"> </span>Version<span class="S10">()</span><span class="S0"> </span>
5777 <span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
5778 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5779 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5780 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
5781 <span class="S0"> </span>Release<span class="S10">()</span><span class="S0"> </span>
5782 <span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5783 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span>
5784 <span class="S5">const</span><span class="S0"> </span>
5785 <span class="S5">char</span><span class="S0"> </span>
5786 <span class="S10">*</span><span class="S0"> </span>
5787 SCI_METHOD<span class="S0"> </span>PropertyNames<span class="S10">()</span>
5788 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5789 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5790 <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 />
5791 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5792 <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 />
5793 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5794 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
5795 <span class="S0"> </span>PropertySet<span class="S10">(</span><span class="S5">const</span>
5796 <span class="S0"> </span><span class="S5">char</span>
5797 <span class="S0"> </span><span class="S10">*</span>key<span class="S10">,</span>
5798 <span class="S0"> </span><span class="S5">const</span><span class="S0"> </span>
5799 <span class="S5">char</span><span class="S0"> </span><span class="S10">*</span>val<span class="S10">)</span>
5800 <span class="S0"> </span><span class="S10">=</span>
5801 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5802 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span>
5803 <span class="S5">const</span><span class="S0"> </span><span class="S5">char</span><span class="S0"> </span>
5804 <span class="S10">*</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>DescribeWordListSets<span class="S10">()</span>
5805 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
5806 <span class="S4">0</span><span class="S10">;</span><br />
5807 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5808 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
5809 <span class="S0"> </span>WordListSet<span class="S10">(</span><span class="S5">int</span>
5810 <span class="S0"> </span>n<span class="S10">,</span>
5811 <span class="S0"> </span><span class="S5">const</span><span class="S0"> </span>
5812 <span class="S5">char</span><span class="S0"> </span><span class="S10">*</span>wl<span class="S10">)</span>
5813 <span class="S0"> </span><span class="S10">=</span>
5814 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5815 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5816 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
5817 <span class="S0"> </span>Lex<span class="S10">(</span><span class="S5">unsigned</span>
5818 <span class="S0"> </span><span class="S5">int</span>
5819 <span class="S0"> </span>startPos<span class="S10">,</span>
5820 <span class="S0"> </span><span class="S5">int</span>
5821 <span class="S0"> </span>lengthDoc<span class="S10">,</span><span class="S0">
5822 </span><span class="S5">int</span><span class="S0"> </span>initStyle<span class="S10">,</span>
5823 <span class="S0"> </span>IDocument<span class="S0">
5824 </span><span class="S10">*</span>pAccess<span class="S10">)</span>
5825 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
5826 <span class="S4">0</span><span class="S10">;</span><br />
5827 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5828 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
5829 <span class="S0"> </span>Fold<span class="S10">(</span><span class="S5">unsigned</span>
5830 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>startPos<span class="S10">,</span>
5831 <span class="S0"> </span><span class="S5">int</span>
5832 <span class="S0"> </span>lengthDoc<span class="S10">,</span><span class="S0">
5833 </span><span class="S5">int</span><span class="S0"> </span>initStyle<span class="S10">,</span>
5834 <span class="S0"> </span>IDocument<span class="S0">
5835 </span><span class="S10">*</span>pAccess<span class="S10">)</span>
5836 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
5837 <span class="S4">0</span><span class="S10">;</span><br />
5838 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5839 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>
5840 <span class="S10">*</span><span class="S0"> </span>SCI_METHOD<span class="S0">
5841 </span>PrivateCall<span class="S10">(</span><span class="S5">int</span>
5842 <span class="S0"> </span>operation<span class="S10">,</span><span class="S0">
5843 </span><span class="S5">void</span><span class="S0"> </span>
5844 <span class="S10">*</span>pointer<span class="S10">)</span><span class="S0"> </span>
5845 <span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5846 <span class="S10">};</span><br />
5847 </div>
5850 The return values from PropertySet and WordListSet are used to indicate whether the change requires
5851 performing lexing or folding over any of the document. It is the position at which to restart lexing and folding or -1
5852 if the change does not require any extra work on the document.
5853 A simple approach is to return 0 if there is any possibility that a change requires lexing the document again while an
5854 optimisation could be to remember where a setting first affects the document and return that position.
5855 </p>
5857 <p><code>Release</code> is called to destroy the lexer object.</p>
5859 <p><code>PrivateCall</code> allows for direct communication between the
5860 application and a lexer. An example would be where an application
5861 maintains a single large data structure containing symbolic information
5862 about system headers (like Windows.h) and provides this to the lexer
5863 where it can be applied to each document. This avoids the costs of
5864 constructing the system header information for each document. This is
5865 invoked with the <code>SCI_PRIVATELEXERCALL</code> API.</p>
5867 <p><code>Fold</code> is called with the exact range that needs folding.
5868 Previously, lexers were called with a range that started one line before the range that
5869 needs to be folded as this allowed fixing up the last line from the previous folding.
5870 The new approach allows the lexer to decide whether to backtrack or to handle this
5871 more efficiently.</p>
5873 <h4>IDocument</h4>
5875 <div class="highlighted">
5876 <span class="S5">class</span><span class="S0"> </span>IDocument
5877 <span class="S0"> </span><span class="S10">{</span><br />
5878 <span class="S5">public</span><span class="S10">:</span><br />
5879 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5880 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
5881 <span class="S0"> </span>Version<span class="S10">()</span><span class="S0"> </span>
5882 <span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
5883 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5884 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5885 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
5886 <span class="S0"> </span>SetErrorStatus<span class="S10">(</span><span class="S5">int</span>
5887 <span class="S0"> </span>status<span class="S10">)</span>
5888 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
5889 <span class="S4">0</span><span class="S10">;</span><br />
5890 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5891 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
5892 <span class="S0"> </span>Length<span class="S10">()</span><span class="S0"> </span>
5893 <span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
5894 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5895 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5896 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
5897 <span class="S0"> </span>GetCharRange<span class="S10">(</span><span class="S5">char</span>
5898 <span class="S0"> </span><span class="S10">*</span>buffer<span class="S10">,</span>
5899 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>
5900 position<span class="S10">,</span><span class="S0"> </span>
5901 <span class="S5">int</span><span class="S0"> </span>lengthRetrieve<span class="S10">)</span>
5902 <span class="S0"> </span><span class="S5">const</span>
5903 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
5904 <span class="S4">0</span><span class="S10">;</span><br />
5905 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5906 <span class="S0"> </span><span class="S5">char</span><span class="S0"> </span>SCI_METHOD
5907 <span class="S0"> </span>StyleAt<span class="S10">(</span><span class="S5">int</span>
5908 <span class="S0"> </span>position<span class="S10">)</span><span class="S0"> </span>
5909 <span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
5910 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5911 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5912 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
5913 <span class="S0"> </span>LineFromPosition<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>position<span class="S10">)</span>
5914 <span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
5915 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5916 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span>
5917 <span class="S5">int</span><span class="S0"> </span>SCI_METHOD
5918 <span class="S0"> </span>LineStart<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>line<span class="S10">)</span>
5919 <span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
5920 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5921 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span>
5922 <span class="S5">int</span><span class="S0"> </span>SCI_METHOD
5923 <span class="S0"> </span>GetLevel<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>line<span class="S10">)</span>
5924 <span class="S0"> </span>
5925 <span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
5926 <span class="S4">0</span><span class="S10">;</span><br />
5927 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span>
5928 <span class="S5">int</span><span class="S0"> </span>SCI_METHOD
5929 <span class="S0"> </span>SetLevel<span class="S10">(</span><span class="S5">int</span>
5930 <span class="S0"> </span>line<span class="S10">,</span><span class="S0"> </span>
5931 <span class="S5">int</span><span class="S0"> </span>level<span class="S10">)</span>
5932 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
5933 <span class="S4">0</span><span class="S10">;</span><br />
5934 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5935 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
5936 <span class="S0"> </span>GetLineState<span class="S10">(</span><span class="S5">int</span>
5937 <span class="S0"> </span>line<span class="S10">)</span>
5938 <span class="S0"> </span><span class="S5">const</span><span class="S0"> </span>
5939 <span class="S10">=</span><span class="S0"> </span><span class="S4">0</span>
5940 <span class="S10">;</span><br />
5941 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5942 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
5943 <span class="S0"> </span>SetLineState<span class="S10">(</span><span class="S5">int</span>
5944 <span class="S0"> </span>line<span class="S10">,</span>
5945 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>state<span class="S10">)</span>
5946 <span class="S0"> </span><span class="S10">=</span>
5947 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5948 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5949 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
5950 <span class="S0"> </span>StartStyling<span class="S10">(</span><span class="S5">int</span>
5951 <span class="S0"> </span>position<span class="S10">,</span>
5952 <span class="S0"> </span><span class="S5">char</span><span class="S0"> </span>mask<span class="S10">)</span>
5953 <span class="S0"> </span><span class="S10">=</span>
5954 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5955 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">bool</span>
5956 <span class="S0"> </span>SCI_METHOD
5957 <span class="S0"> </span>SetStyleFor<span class="S10">(</span><span class="S5">int</span>
5958 <span class="S0"> </span>length<span class="S10">,</span>
5959 <span class="S0"> </span><span class="S5">char</span><span class="S0"> </span>style<span class="S10">)</span>
5960 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span>
5961 <span class="S10">;</span><br />
5962 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5963 <span class="S0"> </span><span class="S5">bool</span><span class="S0"> </span>SCI_METHOD
5964 <span class="S0"> </span>SetStyles<span class="S10">(</span><span class="S5">int</span>
5965 <span class="S0"> </span>length<span class="S10">,</span><span class="S0"> </span>
5966 <span class="S5">const</span><span class="S0"> </span><span class="S5">char</span>
5967 <span class="S0"> </span><span class="S10">*</span>styles<span class="S10">)</span>
5968 <span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
5969 <span class="S4">0</span><span class="S10">;</span><br />
5970 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">void</span>
5971 <span class="S0"> </span>SCI_METHOD
5972 <span class="S0"> </span>DecorationSetCurrentIndicator<span class="S10">(</span><span class="S5">int</span>
5973 <span class="S0"> </span>indicator<span class="S10">)</span>
5974 <span class="S0"> </span><span class="S10">=</span>
5975 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5976 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5977 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
5978 <span class="S0"> </span>DecorationFillRange<span class="S10">(</span><span class="S5">int</span>
5979 <span class="S0"> </span>position<span class="S10">,</span>
5980 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>value<span class="S10">,</span>
5981 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>fillLength<span class="S10">)</span>
5982 <span class="S0">
5983 </span><span class="S10">=</span><span class="S0"> </span>
5984 <span class="S4">0</span><span class="S10">;</span><br />
5985 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5986 <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
5987 <span class="S0"> </span>ChangeLexerState<span class="S10">(</span><span class="S5">int</span>
5988 <span class="S0"> </span>start<span class="S10">,</span>
5989 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>end<span class="S10">)</span>
5990 <span class="S0"> </span><span class="S10">=</span>
5991 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
5992 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span>
5993 <span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
5994 <span class="S0"> </span>CodePage<span class="S10">()</span><span class="S0">
5995 </span><span class="S5">const</span><span class="S0"> </span>
5996 <span class="S10">=</span><span class="S0"> </span><span class="S4">0</span>
5997 <span class="S10">;</span><br />
5998 <span class="S0">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">bool</span>
5999 <span class="S0"> </span>SCI_METHOD
6000 <span class="S0"> </span>IsDBCSLeadByte<span class="S10">(</span><span class="S5">char</span>
6001 <span class="S0"> </span>ch<span class="S10">)</span>
6002 <span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
6003 <span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
6004 <span class="S10">};</span><br />
6005 </div>
6007 <p>Scintilla tries to minimize the consequences of modifying text to
6008 only relex and redraw the line of the change where possible. Lexer
6009 objects contain their own private extra state which can affect later
6010 lines. For example, if the C++ lexer is greying out inactive code
6011 segments then changing the statement <code>#define BEOS 0</code> to <code>#define
6012 BEOS 1</code> may require restyling and redisplaying later parts of the
6013 document. The lexer can call <code>ChangeLexerState</code> to signal to
6014 the document that it should relex and display more.</p>
6016 <p><code>SetErrorStatus</code> is used to notify the document of
6017 exceptions. Exceptions should not be thrown over build boundaries as the
6018 two sides may be built with different compilers or incompatible
6019 exception options.</p>
6021 <p>The <code>ILexer</code> and <code>IDocument</code> interfaces may be
6022 expanded in the future with extended versions (<code>ILexer2</code>...).
6023 The <code>Version</code> method indicates which interface is
6024 implemented and thus which methods may be called.</p>
6026 <h2 id="Notifications">Notifications</h2>
6028 <p>Notifications are sent (fired) from the Scintilla control to its container when an event has
6029 occurred that may interest the container. Notifications are sent using the
6030 <code>WM_NOTIFY</code> message on Windows and the "notify" signal on GTK+. The container is
6031 passed a <code>SCNotification</code> structure containing information about the event.</p>
6032 <pre id="SCNotification">
6033 struct NotifyHeader { // This matches the Win32 NMHDR structure
6034 void *hwndFrom; // environment specific window handle/pointer
6035 uptr_t idFrom; // CtrlID of the window issuing the notification
6036 unsigned int code; // The SCN_* notification code
6039 struct SCNotification {
6040 struct Sci_NotifyHeader nmhdr;
6041 int position;
6042 /* SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_MARGINCLICK, */
6043 /* SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, SCN_CALLTIPCLICK, */
6044 /* SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK, */
6045 /* SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */
6046 /* SCN_USERLISTSELECTION, SCN_AUTOCSELECTION */
6048 int ch; /* SCN_CHARADDED, SCN_KEY */
6049 int modifiers;
6050 /* SCN_KEY, SCN_DOUBLECLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, */
6051 /* SCN_HOTSPOTRELEASECLICK, SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */
6053 int modificationType; /* SCN_MODIFIED */
6054 const char *text;
6055 /* SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION, SCN_URIDROPPED */
6057 int length; /* SCN_MODIFIED */
6058 int linesAdded; /* SCN_MODIFIED */
6059 int message; /* SCN_MACRORECORD */
6060 uptr_t wParam; /* SCN_MACRORECORD */
6061 sptr_t lParam; /* SCN_MACRORECORD */
6062 int line; /* SCN_MODIFIED */
6063 int foldLevelNow; /* SCN_MODIFIED */
6064 int foldLevelPrev; /* SCN_MODIFIED */
6065 int margin; /* SCN_MARGINCLICK */
6066 int listType; /* SCN_USERLISTSELECTION */
6067 int x; /* SCN_DWELLSTART, SCN_DWELLEND */
6068 int y; /* SCN_DWELLSTART, SCN_DWELLEND */
6069 int token; /* SCN_MODIFIED with SC_MOD_CONTAINER */
6070 int annotationLinesAdded; /* SCN_MODIFIED with SC_MOD_CHANGEANNOTATION */
6071 int updated; /* SCN_UPDATEUI */
6073 </pre>
6075 <p>The notification messages that your container can choose to handle and the messages
6076 associated with them are:</p>
6077 <code><a class="message" href="#SCN_STYLENEEDED">SCN_STYLENEEDED</a><br />
6078 <a class="message" href="#SCN_CHARADDED">SCN_CHARADDED</a><br />
6079 <a class="message" href="#SCN_SAVEPOINTREACHED">SCN_SAVEPOINTREACHED</a><br />
6080 <a class="message" href="#SCN_SAVEPOINTLEFT">SCN_SAVEPOINTLEFT</a><br />
6081 <a class="message" href="#SCN_MODIFYATTEMPTRO">SCN_MODIFYATTEMPTRO</a><br />
6082 <a class="message" href="#SCN_KEY">SCN_KEY</a><br />
6083 <a class="message" href="#SCN_DOUBLECLICK">SCN_DOUBLECLICK</a><br />
6084 <a class="message" href="#SCN_UPDATEUI">SCN_UPDATEUI</a><br />
6085 <a class="message" href="#SCN_MODIFIED">SCN_MODIFIED</a><br />
6086 <a class="message" href="#SCN_MACRORECORD">SCN_MACRORECORD</a><br />
6087 <a class="message" href="#SCN_MARGINCLICK">SCN_MARGINCLICK</a><br />
6088 <a class="message" href="#SCN_NEEDSHOWN">SCN_NEEDSHOWN</a><br />
6089 <a class="message" href="#SCN_PAINTED">SCN_PAINTED</a><br />
6090 <a class="message" href="#SCN_USERLISTSELECTION">SCN_USERLISTSELECTION</a><br />
6091 <a class="message" href="#SCN_URIDROPPED">SCN_URIDROPPED</a><br />
6092 <a class="message" href="#SCN_DWELLSTART">SCN_DWELLSTART</a><br />
6093 <a class="message" href="#SCN_DWELLEND">SCN_DWELLEND</a><br />
6094 <a class="message" href="#SCN_ZOOM">SCN_ZOOM</a><br />
6095 <a class="message" href="#SCN_HOTSPOTCLICK">SCN_HOTSPOTCLICK</a><br />
6096 <a class="message" href="#SCN_HOTSPOTDOUBLECLICK">SCN_HOTSPOTDOUBLECLICK</a><br />
6097 <a class="message" href="#SCN_HOTSPOTRELEASECLICK">SCN_HOTSPOTRELEASECLICK</a><br />
6098 <a class="message" href="#SCN_INDICATORCLICK">SCN_INDICATORCLICK</a><br />
6099 <a class="message" href="#SCN_INDICATORRELEASE">SCN_INDICATORRELEASE</a><br />
6100 <a class="message" href="#SCN_CALLTIPCLICK">SCN_CALLTIPCLICK</a><br />
6101 <a class="message" href="#SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</a><br />
6102 <a class="message" href="#SCN_AUTOCCANCELLED">SCN_AUTOCCANCELLED</a><br />
6103 <a class="message" href="#SCN_AUTOCCHARDELETED">SCN_AUTOCCHARDELETED</a><br />
6104 </code>
6106 <p>The following <code>SCI_*</code> messages are associated with these notifications:</p>
6107 <code><a class="message" href="#SCI_SETMODEVENTMASK">SCI_SETMODEVENTMASK(int eventMask)</a><br />
6108 <a class="message" href="#SCI_GETMODEVENTMASK">SCI_GETMODEVENTMASK</a><br />
6109 <a class="message" href="#SCI_SETMOUSEDWELLTIME">SCI_SETMOUSEDWELLTIME(int milliseconds)</a><br />
6110 <a class="message" href="#SCI_GETMOUSEDWELLTIME">SCI_GETMOUSEDWELLTIME</a><br />
6111 <a class="message" href="#SCI_SETIDENTIFIER">SCI_SETIDENTIFIER(int identifier)</a><br />
6112 <a class="message" href="#SCI_GETIDENTIFIER">SCI_GETIDENTIFIER</a><br />
6113 </code>
6115 <p>The following additional notifications are sent using the <code>WM_COMMAND</code> message on
6116 Windows and the "Command" signal on GTK+. This emulates the Windows Edit control. Only the lower
6117 16 bits of the control's ID is passed in these notifications.</p>
6118 <code><a class="message" href="#SCEN_CHANGE">SCEN_CHANGE</a><br />
6119 <a class="message" href="#SCEN_SETFOCUS">SCEN_SETFOCUS</a><br />
6120 <a class="message" href="#SCEN_KILLFOCUS">SCEN_KILLFOCUS</a><br />
6121 </code>
6123 <p><b id="SCI_SETIDENTIFIER">SCI_SETIDENTIFIER(int identifier)</b><br />
6124 <b id="SCI_GETIDENTIFIER">SCI_GETIDENTIFIER</b><br />
6125 These two messages set and get the identifier of the Scintilla instance which is included in notifications as the
6126 <code>idFrom</code> field.
6127 When an application creates multiple Scintilla widgets, this allows the source of each notification to be found.
6128 On Windows, this value is initialised in the <code>CreateWindow</code> call and stored as the
6129 <code>GWLP_ID</code> attribute of the window.
6130 The value should be small, preferrably less than 16 bits,
6131 rather than a pointer as some of the functions will only transmit 16 or 32 bits.
6132 </p>
6134 <p><b id="SCN_STYLENEEDED">SCN_STYLENEEDED</b><br />
6135 If you used <code><a class="message"
6136 href="#SCI_SETLEXER">SCI_SETLEXER</a>(SCLEX_CONTAINER)</code> to make the container act as the
6137 lexer, you will receive this notification when Scintilla is about to display or print text that
6138 requires styling. You are required to style the text from the line that contains the position
6139 returned by <a class="message" href="#SCI_GETENDSTYLED"><code>SCI_GETENDSTYLED</code></a> up to
6140 the position passed in <code>SCNotification.position</code>. Symbolically, you need code of the
6141 form:</p>
6142 <pre>
6143 startPos = <a class="message" href="#SCI_GETENDSTYLED">SCI_GETENDSTYLED</a>()
6144 lineNumber = <a class="message"
6145 href="#SCI_LINEFROMPOSITION">SCI_LINEFROMPOSITION</a>(startPos);
6146 startPos = <a class="message"
6147 href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE</a>(lineNumber);
6148 MyStyleRoutine(startPos, SCNotification.position);
6149 </pre>
6151 <p><b id="SCN_CHARADDED">SCN_CHARADDED</b><br />
6152 This is sent when the user types an ordinary text character (as opposed to a command
6153 character) that is entered into the text. The container can use this to decide to display a <a
6154 class="jump" href="#CallTips">call tip</a> or an <a class="jump" href="#Autocompletion">auto
6155 completion list</a>. The character is in <code>SCNotification.ch</code>.
6156 This notification is sent before the character has been styled so processing that depends on
6157 styling should instead be performed in the SCN_UPDATEUI notification.</p>
6159 <p><b id="SCN_SAVEPOINTREACHED">SCN_SAVEPOINTREACHED</b><br />
6160 <b id="SCN_SAVEPOINTLEFT">SCN_SAVEPOINTLEFT</b><br />
6161 Sent to the container when the save point is entered or left, allowing the container to
6162 display a "document dirty" indicator and change its menus.<br />
6163 See also: <a class="message" href="#SCI_SETSAVEPOINT"><code>SCI_SETSAVEPOINT</code></a>, <a
6164 class="message" href="#SCI_GETMODIFY"><code>SCI_GETMODIFY</code></a></p>
6166 <p><b id="SCN_MODIFYATTEMPTRO">SCN_MODIFYATTEMPTRO</b><br />
6167 When in read-only mode, this notification is sent to the container if the user tries to change
6168 the text. This can be used to check the document out of a version control system. You can set
6169 the read-only state of a document with <code><a class="message"
6170 href="#SCI_SETREADONLY">SCI_SETREADONLY</a></code>.</p>
6172 <p><b id="SCN_KEY">SCN_KEY</b><br />
6173 Reports all keys pressed but not consumed by Scintilla. Used on GTK+ because of
6174 some problems with keyboard focus and is not sent by the Windows version. <code>SCNotification.ch</code> holds the key code and
6175 <code>SCNotification.modifiers</code> holds the modifiers. This notification is sent if the
6176 modifiers include <code>SCMOD_ALT</code> or <code>SCMOD_CTRL</code> and the key code is less
6177 than 256.</p>
6179 <p><b id="SCN_DOUBLECLICK">SCN_DOUBLECLICK</b><br />
6180 The mouse button was double clicked in editor. The <code>position</code> field is set to the text position of the
6181 double click, the <code>line</code> field is set to the line of the double click, and
6182 the <code>modifiers</code> field is set to the key modifiers
6183 held down in a similar manner to <a class="message" href="#SCN_KEY">SCN_KEY</a>.</p>
6185 <p><b id="SCN_UPDATEUI">SCN_UPDATEUI</b><br />
6186 Either the text or styling of the document has changed or the selection range or scroll position has changed.
6187 Now would be a good time to update any container UI elements that depend on document or view state.
6188 The <code>updated</code> field is set to the bit set of things changed since the previous notification.</p>
6189 <table cellpadding="1" cellspacing="2" border="0" summary="Modify notification type flags">
6190 <tbody>
6191 <tr>
6192 <th align="left">Symbol</th>
6194 <th>Value</th>
6196 <th align="left">Meaning</th>
6198 </tr>
6199 </tbody>
6201 <tbody valign="top">
6202 <tr>
6203 <td align="left"><code>SC_UPDATE_CONTENT</code></td>
6205 <td align="center">0x01</td>
6207 <td>Contents, styling or markers have been changed.</td>
6209 </tr>
6211 <tr>
6212 <td align="left"><code>SC_UPDATE_SELECTION</code></td>
6214 <td align="center">0x02</td>
6216 <td>Selection has been changed.</td>
6218 </tr>
6220 <tr>
6221 <td align="left"><code>SC_UPDATE_V_SCROLL</code></td>
6223 <td align="center">0x04</td>
6225 <td>Scrolled vertically.</td>
6227 </tr>
6229 <tr>
6230 <td align="left"><code>SC_UPDATE_H_SCROLL</code></td>
6232 <td align="center">0x08</td>
6234 <td>Scrolled horizontally.</td>
6236 </tr>
6237 </tbody>
6238 </table>
6240 <p><b id="SCN_MODIFIED">SCN_MODIFIED</b><br />
6241 This notification is sent when the text or styling of the document changes or is about to
6242 change. You can set a mask for the notifications that are sent to the container with <a
6243 class="message" href="#SCI_SETMODEVENTMASK"><code>SCI_SETMODEVENTMASK</code></a>. The
6244 notification structure contains information about what changed, how the change occurred and
6245 whether this changed the number of lines in the document. No modifications may be performed
6246 while in a <code>SCN_MODIFIED</code> event. The <code>SCNotification</code> fields used
6247 are:</p>
6249 <table cellpadding="1" cellspacing="2" border="0" summary="Modify notification types">
6250 <tbody>
6251 <tr>
6252 <th align="left">Field</th>
6254 <th align="left">Usage</th>
6255 </tr>
6256 </tbody>
6258 <tbody valign="top">
6259 <tr>
6260 <td align="left"><code>modificationType</code></td>
6262 <td align="left">A set of flags that identify the change(s) made. See the next
6263 table.</td>
6264 </tr>
6266 <tr>
6267 <td align="left"><code>position</code></td>
6269 <td align="left">Start position of a text or styling change. Set to 0 if not used.</td>
6270 </tr>
6272 <tr>
6273 <td align="left"><code>length</code></td>
6275 <td align="left">Length of the change in cells or characters when the text or styling
6276 changes. Set to 0 if not used.</td>
6277 </tr>
6279 <tr>
6280 <td align="left"><code>linesAdded</code></td>
6282 <td align="left">Number of added lines. If negative, the number of deleted lines. Set to
6283 0 if not used or no lines added or deleted.</td>
6284 </tr>
6286 <tr>
6287 <td align="left"><code>text</code></td>
6289 <td align="left">Valid for text changes, not for style changes. If we are collecting undo
6290 information this holds a pointer to the text that is handed to the Undo system, otherwise
6291 it is zero. For user performed SC_MOD_BEFOREDELETE the text field is 0 and
6292 for user performed SC_MOD_BEFOREINSERT the text field points to an array of cells,
6293 not bytes and the length is the number of cells.</td>
6294 </tr>
6296 <tr>
6297 <td align="left"><code>line</code></td>
6299 <td align="left">The line number at which a fold level or marker change occurred. This is
6300 0 if unused and may be -1 if more than one line changed.</td>
6301 </tr>
6303 <tr>
6304 <td align="left"><code>foldLevelNow</code></td>
6306 <td align="left">The new fold level applied to the line or 0 if this field is
6307 unused.</td>
6308 </tr>
6310 <tr>
6311 <td align="left"><code>foldLevelPrev</code></td>
6313 <td align="left">The previous folding level of the line or 0 if this field is
6314 unused.</td>
6315 </tr>
6316 </tbody>
6317 </table>
6319 <p>The <code>SCNotification.modificationType</code> field has bits set to tell you what has
6320 been done. The <code>SC_MOD_*</code> bits correspond to actions. The
6321 <code>SC_PERFORMED_*</code> bits tell you if the action was done by the user, or the result of
6322 Undo or Redo of a previous action.</p>
6324 <table cellpadding="1" cellspacing="2" border="0" summary="Modify notification type flags">
6325 <tbody>
6326 <tr>
6327 <th align="left">Symbol</th>
6329 <th>Value</th>
6331 <th align="left">Meaning</th>
6333 <th align="left">SCNotification fields</th>
6334 </tr>
6335 </tbody>
6337 <tbody valign="top">
6338 <tr>
6339 <td align="left"><code>SC_MOD_INSERTTEXT</code></td>
6341 <td align="center">0x01</td>
6343 <td>Text has been inserted into the document.</td>
6345 <td><code>position, length, text, linesAdded</code></td>
6346 </tr>
6348 <tr>
6349 <td align="left"><code>SC_MOD_DELETETEXT</code></td>
6351 <td align="center">0x02</td>
6353 <td>Text has been removed from the document.</td>
6355 <td><code>position, length, text, linesAdded</code></td>
6356 </tr>
6358 <tr>
6359 <td align="left"><code>SC_MOD_CHANGESTYLE</code></td>
6361 <td align="center">0x04</td>
6363 <td>A style change has occurred.</td>
6365 <td><code>position, length</code></td>
6366 </tr>
6368 <tr>
6369 <td align="left"><code>SC_MOD_CHANGEFOLD</code></td>
6371 <td align="center">0x08</td>
6373 <td>A folding change has occurred.</td>
6375 <td><code>line, foldLevelNow, foldLevelPrev</code></td>
6376 </tr>
6378 <tr>
6379 <td align="left"><code>SC_PERFORMED_USER</code></td>
6381 <td align="center">0x10</td>
6383 <td>Information: the operation was done by the user.</td>
6385 <td>None</td>
6386 </tr>
6388 <tr>
6389 <td align="left"><code>SC_PERFORMED_UNDO</code></td>
6391 <td align="center">0x20</td>
6393 <td>Information: this was the result of an Undo.</td>
6395 <td>None</td>
6396 </tr>
6398 <tr>
6399 <td align="left"><code>SC_PERFORMED_REDO</code></td>
6401 <td align="center">0x40</td>
6403 <td>Information: this was the result of a Redo.</td>
6405 <td>None</td>
6406 </tr>
6408 <tr>
6409 <td align="left"><code>SC_MULTISTEPUNDOREDO</code></td>
6411 <td align="center">0x80</td>
6413 <td>This is part of a multi-step Undo or Redo transaction.</td>
6415 <td>None</td>
6416 </tr>
6418 <tr>
6419 <td align="left"><code>SC_LASTSTEPINUNDOREDO</code></td>
6421 <td align="center">0x100</td>
6423 <td>This is the final step in an Undo or Redo transaction.</td>
6425 <td>None</td>
6426 </tr>
6428 <tr>
6429 <td align="left"><code>SC_MOD_CHANGEMARKER</code></td>
6431 <td align="center">0x200</td>
6433 <td>One or more markers has changed in a line.</td>
6435 <td><code>line</code></td>
6436 </tr>
6438 <tr>
6439 <td align="left"><code>SC_MOD_BEFOREINSERT</code></td>
6441 <td align="center">0x400</td>
6443 <td>Text is about to be inserted into the document.</td>
6445 <td><code>position, if performed by user then text in cells, length in cells</code></td>
6446 </tr>
6448 <tr>
6449 <td align="left"><code>SC_MOD_BEFOREDELETE</code></td>
6451 <td align="center">0x800</td>
6453 <td>Text is about to be deleted from the document.</td>
6455 <td><code>position, length</code></td>
6456 </tr>
6458 <tr>
6459 <td align="left"><code>SC_MOD_CHANGEINDICATOR</code></td>
6461 <td align="center">0x4000</td>
6463 <td>An indicator has been added or removed from a range of text.</td>
6465 <td><code>position, length</code></td>
6466 </tr>
6468 <tr>
6469 <td align="left"><code id="SC_MOD_CHANGELINESTATE">SC_MOD_CHANGELINESTATE</code></td>
6471 <td align="center">0x8000</td>
6473 <td>A line state has changed because <a class="message" href="#SCI_SETLINESTATE">SCI_SETLINESTATE</a>
6474 was called.</td>
6476 <td><code>line</code></td>
6477 </tr>
6479 <tr>
6480 <td align="left"><code id="SC_MOD_LEXERSTATE">SC_MOD_LEXERSTATE</code></td>
6482 <td align="center">0x80000</td>
6484 <td>The internal state of a lexer has changed over a range.</td>
6486 <td><code>position, length</code></td>
6487 </tr>
6489 <tr>
6490 <td align="left"><code id="SC_MOD_CHANGEMARGIN">SC_MOD_CHANGEMARGIN</code></td>
6492 <td align="center">0x10000</td>
6494 <td>A text margin has changed.</td>
6496 <td><code>line</code></td>
6497 </tr>
6499 <tr>
6500 <td align="left"><code id="SC_MOD_CHANGEANNOTATION">SC_MOD_CHANGEANNOTATION</code></td>
6502 <td align="center">0x20000</td>
6504 <td>An annotation has changed.</td>
6506 <td><code>line</code></td>
6507 </tr>
6509 <tr>
6510 <td align="left"><code>SC_MULTILINEUNDOREDO</code></td>
6512 <td align="center">0x1000</td>
6514 <td>This is part of an Undo or Redo with multi-line changes.</td>
6516 <td>None</td>
6517 </tr>
6519 <tr>
6520 <td align="left"><code>SC_STARTACTION</code></td>
6522 <td align="center">0x2000</td>
6524 <td>This is set on a SC_PERFORMED_USER action when it is the
6525 first or only step in an undo transaction. This can be used to integrate the Scintilla
6526 undo stack with an undo stack in the container application by adding a Scintilla
6527 action to the container's stack for the currently opened container transaction or
6528 to open a new container transaction if there is no open container transaction.
6529 </td>
6531 <td>None</td>
6532 </tr>
6534 <tr>
6535 <td align="left"><code id="SC_MOD_CONTAINER">SC_MOD_CONTAINER</code></td>
6537 <td align="center">0x40000</td>
6539 <td>This is set on for actions that the container stored into the undo stack with
6540 <a class="message" href="#SCI_ADDUNDOACTION"><code>SCI_ADDUNDOACTION</code></a>.
6541 </td>
6543 <td>token</td>
6544 </tr>
6546 <tr>
6547 <td align="left"><code>SC_MODEVENTMASKALL</code></td>
6549 <td align="center">0x7FFFF</td>
6551 <td>This is a mask for all valid flags. This is the default mask state set by <a
6552 class="message" href="#SCI_SETMODEVENTMASK"><code>SCI_SETMODEVENTMASK</code></a>.</td>
6554 <td>None</td>
6555 </tr>
6556 </tbody>
6557 </table>
6559 <p><b id="SCEN_CHANGE">SCEN_CHANGE</b><br />
6560 <code>SCEN_CHANGE</code> (768) is fired when the text (not the style) of the document changes.
6561 This notification is sent using the <code>WM_COMMAND</code> message on Windows and the
6562 "Command" signal on GTK+ as this is the behavior of the standard Edit control
6563 (<code>SCEN_CHANGE</code> has the same value as the Windows Edit control
6564 <code>EN_CHANGE</code>). No other information is sent. If you need more detailed information
6565 use <a class="message" href="#SCN_MODIFIED"><code>SCN_MODIFIED</code></a>. You can filter the
6566 types of changes you are notified about with <a class="message"
6567 href="#SCI_SETMODEVENTMASK"><code>SCI_SETMODEVENTMASK</code></a>.</p>
6569 <p><b id="SCI_SETMODEVENTMASK">SCI_SETMODEVENTMASK(int eventMask)</b><br />
6570 <b id="SCI_GETMODEVENTMASK">SCI_GETMODEVENTMASK</b><br />
6571 These messages set and get an event mask that determines which document change events are
6572 notified to the container with <a class="message"
6573 href="#SCN_MODIFIED"><code>SCN_MODIFIED</code></a> and <a class="message"
6574 href="#SCEN_CHANGE"><code>SCEN_CHANGE</code></a>. For example, a container may decide to see
6575 only notifications about changes to text and not styling changes by calling
6576 <code>SCI_SETMODEVENTMASK(SC_MOD_INSERTTEXT|SC_MOD_DELETETEXT)</code>.</p>
6578 <p>The possible notification types are the same as the <code>modificationType</code> bit flags
6579 used by <code>SCN_MODIFIED</code>: <code>SC_MOD_INSERTTEXT</code>,
6580 <code>SC_MOD_DELETETEXT</code>, <code>SC_MOD_CHANGESTYLE</code>,
6581 <code>SC_MOD_CHANGEFOLD</code>, <code>SC_PERFORMED_USER</code>, <code>SC_PERFORMED_UNDO</code>,
6582 <code>SC_PERFORMED_REDO</code>, <code>SC_MULTISTEPUNDOREDO</code>,
6583 <code>SC_LASTSTEPINUNDOREDO</code>, <code>SC_MOD_CHANGEMARKER</code>,
6584 <code>SC_MOD_BEFOREINSERT</code>, <code>SC_MOD_BEFOREDELETE</code>,
6585 <code>SC_MULTILINEUNDOREDO</code>, and <code>SC_MODEVENTMASKALL</code>.</p>
6587 <p><b id="SCEN_SETFOCUS">SCEN_SETFOCUS</b><br />
6588 <b id="SCEN_KILLFOCUS">SCEN_KILLFOCUS</b><br />
6589 <code>SCEN_SETFOCUS</code> (512) is fired when Scintilla receives focus and
6590 <code>SCEN_KILLFOCUS</code> (256) when it loses focus. These notifications are sent using the
6591 <code>WM_COMMAND</code> message on Windows and the "Command" signal on GTK+ as this is the
6592 behavior of the standard Edit control. Unfortunately, these codes do not match the Windows Edit
6593 notification codes <code>EN_SETFOCUS</code> (256) and <code>EN_KILLFOCUS</code> (512). It is
6594 now too late to change the Scintilla codes as clients depend on the current values.</p>
6596 <p><b id="SCN_MACRORECORD">SCN_MACRORECORD</b><br />
6597 The <code><a class="message" href="#SCI_STARTRECORD">SCI_STARTRECORD</a></code> and <a
6598 class="message" href="#SCI_STOPRECORD"><code>SCI_STOPRECORD</code></a> messages enable and
6599 disable macro recording. When enabled, each time a recordable change occurs, the
6600 <code>SCN_MACRORECORD</code> notification is sent to the container. It is up to the container
6601 to record the action. To see the complete list of <code>SCI_*</code> messages that are
6602 recordable, search the Scintilla source <code>Editor.cxx</code> for
6603 <code>Editor::NotifyMacroRecord</code>. The fields of <code>SCNotification</code> set in this
6604 notification are:</p>
6606 <table cellpadding="1" cellspacing="2" border="0" summary="Macro record notification data">
6607 <tbody>
6608 <tr>
6609 <th align="left">Field</th>
6611 <th align="left">Usage</th>
6612 </tr>
6613 </tbody>
6615 <tbody valign="top">
6616 <tr>
6617 <td align="left"><code>message</code></td>
6619 <td align="left">The <code>SCI_*</code> message that caused the notification.</td>
6620 </tr>
6622 <tr>
6623 <td align="left"><code>wParam</code></td>
6625 <td align="left">The value of <code>wParam</code> in the <code>SCI_*</code> message.</td>
6626 </tr>
6628 <tr>
6629 <td align="left"><code>lParam</code></td>
6631 <td align="left">The value of <code>lParam</code> in the <code>SCI_*</code> message.</td>
6632 </tr>
6633 </tbody>
6634 </table>
6636 <p><b id="SCN_MARGINCLICK">SCN_MARGINCLICK</b><br />
6637 This notification tells the container that the mouse was clicked inside a <a class="jump"
6638 href="#Margins">margin</a> that was marked as sensitive (see <a class="message"
6639 href="#SCI_SETMARGINSENSITIVEN"><code>SCI_SETMARGINSENSITIVEN</code></a>). This can be used to
6640 perform folding or to place breakpoints. The following <code>SCNotification</code> fields are
6641 used:</p>
6643 <table cellpadding="1" cellspacing="2" border="0" summary="Margin click notification">
6644 <tbody>
6645 <tr>
6646 <th align="left">Field</th>
6648 <th align="left">Usage</th>
6649 </tr>
6650 </tbody>
6652 <tbody valign="top">
6653 <tr>
6654 <td align="left"><code>modifiers</code></td>
6656 <td align="left">The appropriate combination of <code>SCI_SHIFT</code>,
6657 <code>SCI_CTRL</code> and <code>SCI_ALT</code> to indicate the keys that were held down
6658 at the time of the margin click.</td>
6659 </tr>
6661 <tr>
6662 <td align="left"><code>position</code></td>
6664 <td align="left">The position of the start of the line in the document that corresponds
6665 to the margin click.</td>
6666 </tr>
6668 <tr>
6669 <td align="left"><code>margin</code></td>
6671 <td align="left">The margin number that was clicked.</td>
6672 </tr>
6673 </tbody>
6674 </table>
6676 <p><b id="SCN_NEEDSHOWN">SCN_NEEDSHOWN</b><br />
6677 Scintilla has determined that a range of lines that is currently invisible should be made
6678 visible. An example of where this may be needed is if the end of line of a contracted fold
6679 point is deleted. This message is sent to the container in case it wants to make the line
6680 visible in some unusual way such as making the whole document visible. Most containers will
6681 just ensure each line in the range is visible by calling <a class="message"
6682 href="#SCI_ENSUREVISIBLE"><code>SCI_ENSUREVISIBLE</code></a>. The <code>position</code> and
6683 <code>length</code> fields of <code>SCNotification</code> indicate the range of the document
6684 that should be made visible. The container code will be similar to the following code
6685 skeleton:</p>
6686 <pre>
6687 firstLine = SCI_LINEFROMPOSITION(scn.position)
6688 lastLine = SCI_LINEFROMPOSITION(scn.position+scn.length-1)
6689 for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next
6690 </pre>
6692 <p><b id="SCN_PAINTED">SCN_PAINTED</b><br />
6693 Painting has just been done. Useful when you want to update some other widgets based on a
6694 change in Scintilla, but want to have the paint occur first to appear more responsive. There is
6695 no other information in <code>SCNotification</code>.</p>
6697 <p><b id="SCN_USERLISTSELECTION">SCN_USERLISTSELECTION</b><br />
6698 The user has selected an item in a <a class="jump" href="#UserLists">user list</a>. The
6699 <code>SCNotification</code> fields used are:</p>
6701 <table cellpadding="1" cellspacing="2" border="0" summary="User list notification">
6702 <tbody>
6703 <tr>
6704 <th align="left">Field</th>
6706 <th align="left">Usage</th>
6707 </tr>
6708 </tbody>
6710 <tbody valign="top">
6711 <tr>
6712 <td align="left"><code>listType</code></td>
6714 <td align="left">This is set to the <code>listType</code> parameter from the <a
6715 class="message" href="#SCI_USERLISTSHOW"><code>SCI_USERLISTSHOW</code></a> message that
6716 initiated the list.</td>
6717 </tr>
6719 <tr>
6720 <td align="left"><code>text</code></td>
6722 <td align="left">The text of the selection.</td>
6723 </tr>
6725 <tr>
6726 <td align="left"><code>position</code></td>
6728 <td align="left">The position the list was displayed at.</td>
6729 </tr>
6730 </tbody>
6731 </table>
6732 <br />
6735 <p><b id="SCN_URIDROPPED">SCN_URIDROPPED</b><br />
6736 Only on the GTK+ version. Indicates that the user has dragged a URI such as a file name or Web
6737 address onto Scintilla. The container could interpret this as a request to open the file. The
6738 <code>text</code> field of <code>SCNotification</code> points at the URI text.</p>
6740 <p><b id="SCN_DWELLSTART">SCN_DWELLSTART</b><br />
6741 <b id="SCN_DWELLEND">SCN_DWELLEND</b><br />
6742 <code>SCN_DWELLSTART</code> is generated when the user keeps the mouse in one position for the
6743 dwell period (see <code><a class="message"
6744 href="#SCI_SETMOUSEDWELLTIME">SCI_SETMOUSEDWELLTIME</a></code>). <code>SCN_DWELLEND</code> is
6745 generated after a <code>SCN_DWELLSTART</code> and the mouse is moved or other activity such as
6746 key press indicates the dwell is over. Both notifications set the same fields in
6747 <code>SCNotification</code>:</p>
6749 <table cellpadding="1" cellspacing="2" border="0" summary="Mouse dwell notification">
6750 <tbody>
6751 <tr>
6752 <th align="left">Field</th>
6754 <th align="left">Usage</th>
6755 </tr>
6756 </tbody>
6758 <tbody valign="top">
6759 <tr>
6760 <td align="left"><code>position</code></td>
6762 <td align="left">This is the nearest position in the document to the position where the
6763 mouse pointer was lingering.</td>
6764 </tr>
6766 <tr>
6767 <td align="left"><code>x, y</code></td>
6769 <td align="left">Where the pointer lingered. The <code>position</code> field is set to
6770 <code><a class="message"
6771 href="#SCI_POSITIONFROMPOINTCLOSE">SCI_POSITIONFROMPOINTCLOSE</a>(x, y)</code>.</td>
6772 </tr>
6773 </tbody>
6774 </table>
6775 <br />
6777 <p><b id="SCI_SETMOUSEDWELLTIME">SCI_SETMOUSEDWELLTIME(int milliseconds)</b><br />
6778 <b id="SCI_GETMOUSEDWELLTIME">SCI_GETMOUSEDWELLTIME</b><br />
6779 These two messages set and get the time the mouse must sit still, in milliseconds, to generate
6780 a <code><a class="message" href="#SCN_DWELLSTART">SCN_DWELLSTART</a></code> notification. If
6781 set to <code>SC_TIME_FOREVER</code>, the default, no dwell events are generated.</p>
6783 <p><b id="SCN_ZOOM">SCN_ZOOM</b><br />
6784 This notification is generated when the user zooms the display using the keyboard or the
6785 <code><a class="message" href="#SCI_SETZOOM">SCI_SETZOOM</a></code> method is called. This
6786 notification can be used to recalculate positions, such as the width of the line number margin
6787 to maintain sizes in terms of characters rather than pixels. <code>SCNotification</code> has no
6788 additional information.</p>
6791 <b id="SCN_HOTSPOTCLICK">SCN_HOTSPOTCLICK</b><br />
6792 <b id="SCN_HOTSPOTDOUBLECLICK">SCN_HOTSPOTDOUBLECLICK</b><br />
6793 <b id="SCN_HOTSPOTRELEASECLICK">SCN_HOTSPOTRELEASECLICK</b><br />
6794 These notifications are generated when the user clicks or double clicks on
6795 text that is in a style with the hotspot attribute set.
6796 This notification can be used to link to variable definitions or web pages.
6797 The <code>position</code> field is set the text position of the click or
6798 double click and the <code>modifiers</code> field set to the key modifiers
6799 held down in a similar manner to <a class="message" href="#SCN_KEY">SCN_KEY</a>.
6800 Only the state of the Ctrl key is reported for <code>SCN_HOTSPOTRELEASECLICK</code>.</p>
6803 <b id="SCN_INDICATORCLICK">SCN_INDICATORCLICK</b><br />
6804 <b id="SCN_INDICATORRELEASE">SCN_INDICATORRELEASE</b><br />
6805 These notifications are generated when the user clicks or releases the mouse on
6806 text that has an indicator.
6807 The <code>position</code> field is set the text position of the click or
6808 double click and the <code>modifiers</code> field set to the key modifiers
6809 held down in a similar manner to <a class="message" href="#SCN_KEY">SCN_KEY</a>.</p>
6811 <p><b id="SCN_CALLTIPCLICK">SCN_CALLTIPCLICK</b><br />
6812 This notification is generated when the user clicks on a calltip.
6813 This notification can be used to display the next function prototype when a
6814 function name is overloaded with different arguments.
6815 The <code>position</code> field is set to 1 if the click is in an up arrow,
6816 2 if in a down arrow, and 0 if elsewhere.</p>
6818 <p><b id="SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</b><br />
6819 The user has selected an item in an <a class="jump" href="#Autocompletion">autocompletion list</a>. The
6820 notification is sent before the selection is inserted. Automatic insertion can be cancelled by sending a
6821 <code><a class="message" href="#SCI_AUTOCCANCEL">SCI_AUTOCCANCEL</a></code> message
6822 before returning from the notification. The <code>SCNotification</code> fields used are:</p>
6824 <table cellpadding="1" cellspacing="2" border="0" summary="Autocompletion list notification">
6825 <tbody>
6826 <tr>
6827 <th align="left">Field</th>
6829 <th align="left">Usage</th>
6830 </tr>
6831 </tbody>
6833 <tbody valign="top">
6834 <tr>
6835 <td align="left"><code>position</code></td>
6837 <td align="left">The start position of the word being completed.</td>
6838 </tr>
6839 <tr>
6840 <td align="left"><code>text</code></td>
6842 <td align="left">The text of the selection.</td>
6843 </tr>
6844 </tbody>
6845 </table>
6847 <p><b id="SCN_AUTOCCANCELLED">SCN_AUTOCCANCELLED</b><br />
6848 The user has cancelled an <a class="jump" href="#Autocompletion">autocompletion list</a>.
6849 There is no other information in SCNotification.</p>
6851 <p><b id="SCN_AUTOCCHARDELETED">SCN_AUTOCCHARDELETED</b><br />
6852 The user deleted a character while autocompletion list was active.
6853 There is no other information in SCNotification.</p>
6855 <h2 id="Images">Images</h2>
6857 <p>Two formats are supported for images used in margin markers and autocompletion lists, RGBA and XPM.</p>
6859 <h3 id="RGBA">RGBA</h3>
6861 <p>The RGBA format allows translucency with an <a class="jump" href="#alpha">alpha</a>
6862 value for each pixel. It is simpler than
6863 <code>XPM</code> and more capable.</p>
6865 <p>The data is a sequence of 4 byte pixel values starting with the pixels for the top line, with the
6866 leftmost pixel first, then continuing with the pixels for subsequent lines. There is no gap between
6867 lines for alignment reasons.</p>
6869 <p>Each pixel consists of, in order, a red byte, a green byte, a blue byte and an alpha byte.
6870 The colour bytes are not premultiplied by the alpha value. That is, a fully red pixel that is
6871 25% opaque will be [FF, 00, 00, 3F]</p>
6873 <p>Since the RGBA pixel data does not include any size information the
6874 width and height must previously been set with the
6875 <a class="message" href="#SCI_RGBAIMAGESETWIDTH"><code>SCI_RGBAIMAGESETWIDTH</code></a> and
6876 <a class="message" href="#SCI_RGBAIMAGESETHEIGHT"><code>SCI_RGBAIMAGESETHEIGHT</code></a> messages.</p>
6878 <p>GUI platforms often include functions for reading image file formats like PNG into memory
6879 in the RGBA form or a similar form.
6880 If there is no suitable platform support, the <a href="http://lodev.org/lodepng/">LodePNG and picoPNG</a> libraries are small libraries
6881 for loading and decoding PNG files available under a BSD-style license.</p>
6883 <p>RGBA format is supported on Windows, GTK+ and OS X Cocoa.
6884 It is not supported on OS X Carbon.</p>
6886 <h3 id="XPM">XPM</h3>
6888 <p>The XPM format is
6889 <a class="jump" href="http://en.wikipedia.org/wiki/X_PixMap">described here</a>.
6890 Scintilla is only able to handle XPM pixmaps that use one character per pixel with no named colours.
6891 There may be a completely transparent colour named "None".</p>
6892 <p>There are two forms of data structure used for XPM images, the first "lines form" format is well suited
6893 to embedding an image inside C source code and the "text form" is suited to reading from a file.
6894 In the lines form, an array of strings is used with the first string indicating the dimensions and number of colours
6895 used. This is followed by a string for each colour and that section is followed by the image with one string per line.
6896 The text form contains the same data as one null terminated block formatted as C source code starting
6897 with a "/* XPM */" comment to mark the format.</p>
6898 <p>Either format may be used with Scintilla APIs with the bytes at the location pointed to examined
6899 to determine which format: if the bytes start with "/* XPM */" then it is treated as text form,
6900 otherwise it is treated as lines form.</p>
6902 <p>XPM format is supported on on all platforms.</p>
6904 <h2 id="GTK">GTK+</h2>
6905 <p>On GTK+, the following functions create a Scintilla widget, communicate with it and allow
6906 resources to be released after all Scintilla widgets have been destroyed.</p>
6907 <code><a class="message" href="#scintilla_new">GtkWidget *scintilla_new()</a><br />
6908 <a class="message" href="#scintilla_set_id">void scintilla_set_id(ScintillaObject *sci, uptr_t id)</a><br />
6909 <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 />
6910 <a class="message" href="#scintilla_release_resources">void scintilla_release_resources()</a><br />
6911 </code>
6913 <p><b id="scintilla_new">GtkWidget *scintilla_new()</b><br />
6914 Create a new Scintilla widget. The returned pointer can be added to a container and displayed in the same way as other
6915 widgets.</p>
6917 <p><b id="scintilla_set_id">void scintilla_set_id(ScintillaObject *sci, uptr_t id)</b><br />
6918 Set the control ID which will be used in the idFrom field of the NotifyHeader structure of all
6919 notifications for this instance.
6920 This is equivalent to <a class="message" href="#SCI_SETIDENTIFIER">SCI_SETIDENTIFIER</a>.</p>
6922 <p><b id="scintilla_send_message">sptr_t scintilla_send_message(ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam)</b><br />
6923 The main entry point allows sending any of the messages described in this document.</p>
6925 <p><b id="scintilla_release_resources">void scintilla_release_resources()</b><br />
6926 Call this to free any remaining resources after all the Scintilla widgets have been destroyed.</p>
6928 <h2 id="DeprecatedMessages">Deprecated messages and notifications</h2>
6930 <p>The following messages are currently supported to emulate existing Windows controls, but
6931 they will be removed in future versions of Scintilla. If you use these messages you should
6932 replace them with the Scintilla equivalent.</p>
6933 <pre>
6934 WM_GETTEXT(int length, char *text)
6935 WM_SETTEXT(&lt;unused&gt;, const char *text)
6936 EM_GETLINE(int line, char *text)
6937 EM_REPLACESEL(&lt;unused&gt;, const char *text)
6938 EM_SETREADONLY
6939 EM_GETTEXTRANGE(&lt;unused&gt;, TEXTRANGE *tr)
6940 WM_CUT
6941 WM_COPY
6942 WM_PASTE
6943 WM_CLEAR
6944 WM_UNDO
6945 EM_CANUNDO
6946 EM_EMPTYUNDOBUFFER
6947 WM_GETTEXTLENGTH
6948 EM_GETFIRSTVISIBLELINE
6949 EM_GETLINECOUNT
6950 EM_GETMODIFY
6951 EM_SETMODIFY(bool isModified)
6952 EM_GETRECT(RECT *rect)
6953 EM_GETSEL(int *start, int *end)
6954 EM_EXGETSEL(&lt;unused&gt;, CHARRANGE *cr)
6955 EM_SETSEL(int start, int end)
6956 EM_EXSETSEL(&lt;unused&gt;, CHARRANGE *cr)
6957 EM_GETSELTEXT(&lt;unused&gt;, char *text)
6958 EM_LINEFROMCHAR(int position)
6959 EM_EXLINEFROMCHAR(int position)
6960 EM_LINEINDEX(int line)
6961 EM_LINELENGTH(int position)
6962 EM_SCROLL(int line)
6963 EM_LINESCROLL(int column, int line)
6964 EM_SCROLLCARET()
6965 EM_CANPASTE
6966 EM_CHARFROMPOS(&lt;unused&gt;, POINT *location)
6967 EM_POSFROMCHAR(int position, POINT *location)
6968 EM_SELECTIONTYPE
6969 EM_HIDESELECTION(bool hide)
6970 EM_FINDTEXT(int flags, FINDTEXTEX *ft)
6971 EM_FINDTEXTEX(int flags, FINDTEXTEX *ft)
6972 EM_GETMARGINS
6973 EM_SETMARGINS(EC_LEFTMARGIN or EC_RIGHTMARGIN or EC_USEFONTINFO, int val)
6974 EM_FORMATRANGE
6975 </pre>
6977 <p>The following are features that are only included if you define
6978 <code>INCLUDE_DEPRECATED_FEATURES</code> in <code>Scintilla.h</code>. To ensure future
6979 compatibility you should change them as indicated.</p>
6981 <p><b id="SC_CP_DBCS">SC_CP_DBCS</b> Deprecated<br />
6982 This was used to set a DBCS (Double Byte Character Set) mode on GTK+.
6983 An explicit DBCS code page should be used when calling <a class="message" href="#SCI_SETCODEPAGE">SCI_SETCODEPAGE</a></p>
6985 <p><b id="SCI_SETUSEPALETTE">SCI_SETUSEPALETTE(bool allowPaletteUse)</b> Deprecated<br />
6986 <b id="SCI_GETUSEPALETTE">SCI_GETUSEPALETTE</b> Deprecated<br />
6987 Scintilla no longer supports palette mode. The last version to support palettes was 2.29.
6988 Any calls to these methods should be removed.</p>
6990 <h2 id="EditMessagesNeverSupportedByScintilla">Edit messages never supported by Scintilla</h2>
6991 <pre>
6992 EM_GETWORDBREAKPROC EM_GETWORDBREAKPROCEX
6993 EM_SETWORDBREAKPROC EM_SETWORDBREAKPROCEX
6994 EM_GETWORDWRAPMODE EM_SETWORDWRAPMODE
6995 EM_LIMITTEXT EM_EXLIMITTEXT
6996 EM_SETRECT EM_SETRECTNP
6997 EM_FMTLINES
6998 EM_GETHANDLE EM_SETHANDLE
6999 EM_GETPASSWORDCHAR EM_SETPASSWORDCHAR
7000 EM_SETTABSTOPS
7001 EM_FINDWORDBREAK
7002 EM_GETCHARFORMAT EM_SETCHARFORMAT
7003 EM_GETOLEINTERFACE EM_SETOLEINTERFACE
7004 EM_SETOLECALLBACK
7005 EM_GETPARAFORMAT EM_SETPARAFORMAT
7006 EM_PASTESPECIAL
7007 EM_REQUESTRESIZE
7008 EM_GETBKGNDCOLOR EM_SETBKGNDCOLOR
7009 EM_STREAMIN EM_STREAMOUT
7010 EM_GETIMECOLOR EM_SETIMECOLOR
7011 EM_GETIMEOPTIONS EM_SETIMEOPTIONS
7012 EM_GETOPTIONS EM_SETOPTIONS
7013 EM_GETPUNCTUATION EM_SETPUNCTUATION
7014 EM_GETTHUMB
7015 EM_GETEVENTMASK
7016 EM_SETEVENTMASK
7017 EM_DISPLAYBAND
7018 EM_SETTARGETDEVICE
7019 </pre>
7021 <p>Scintilla tries to be a superset of the standard windows Edit and RichEdit controls wherever
7022 that makes sense. As it is not intended for use in a word processor, some edit messages can not
7023 be sensibly handled. Unsupported messages have no effect.</p>
7025 <h2 id="BuildingScintilla">Building Scintilla</h2>
7027 <p>To build Scintilla or SciTE, see the README file present in both the Scintilla and SciTE
7028 directories. For Windows, GCC 3.2, Borland C++ or Microsoft Visual Studio .NET can be used
7029 for building. There is a make file for building Scintilla but not SciTE with Visual C++ 6 at
7030 scintilla/win32/scintilla_vc6.mak. For GTK+, GCC 3.1 should be used. GTK+ 1.2x and 2.0x are
7031 supported. The version of GTK+ installed should be detected automatically.
7032 When both GTK+ 1 and GTK+ 2 are present, building for GTK+ 1.x requires defining GTK1
7033 on the command line.</p>
7035 <h3>Static linking</h3>
7037 <p>On Windows, Scintilla is normally used as a dynamic library as a .DLL file. If you want to
7038 link Scintilla directly into your application .EXE or .DLL file, then the
7039 <code>STATIC_BUILD</code> preprocessor symbol should be defined and
7040 <code>Scintilla_RegisterClasses</code> called. <code>STATIC_BUILD</code> prevents compiling the
7041 <code>DllMain</code> function which will conflict with any <code>DllMain</code> defined in your
7042 code. <code>Scintilla_RegisterClasses</code> takes the <code>HINSTANCE</code> of your
7043 application and ensures that the "Scintilla" window class is registered.</p>
7045 <h3>Ensuring lexers are linked into Scintilla</h3>
7047 <p>Depending on the compiler and linker used, the lexers may be stripped out. This is most
7048 often caused when building a static library. To ensure the lexers are linked in, the
7049 <code>Scintilla_LinkLexers()</code> function may be called.</p>
7051 <h3>Changing set of lexers</h3>
7053 <p>To change the set of lexers in Scintilla, add and remove lexer source files
7054 (<code>Lex*.cxx</code>) from the <code>scintilla/src directory</code> and run the
7055 <code>src/LexGen.py</code> script from the <code>src</code> directory to update the make files
7056 and <code>KeyWords.cxx</code>. <code>LexGen.py</code> requires Python 2.1 or later. If you do
7057 not have access to Python, you can hand edit <code>KeyWords.cxx</code> in a simple-minded way,
7058 following the patterns of other lexers. The important thing is to include
7059 <code>LINK_LEXER(lmMyLexer);</code> to correspond with the <code>LexerModule
7060 lmMyLexer(...);</code> in your lexer source code.</p>
7062 <h3>Building with an alternative Regular Expression implementation</h3>
7064 <p id="AlternativeRegEx">A simple interface provides support for switching the Regular Expressions engine at
7065 compile time. You must implement <code>RegexSearchBase</code> for your chosen engine,
7066 look at the built-in implementation <code>BuiltinRegex</code> to see how this is done.
7067 You then need to implement the factory method <code>CreateRegexSearch</code>
7068 to create an instance of your class. You must disable the built-in implementation by defining
7069 <code>SCI_OWNREGEX</code>.</p>
7071 </body>
7072 </html>