/
ScintillaDoc.html
8167 lines (6606 loc) · 450 KB
/
ScintillaDoc.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator"
content="HTML Tidy for Windows (vers 1st August 2002), see www.w3.org" />
<meta name="generator" content="SciTE" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Scintilla Documentation</title>
<style type="text/css">
<!--
/*<![CDATA[*/
CODE { font-weight: bold; font-family: Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace; }
A:visited { color: blue; }
A:hover { text-decoration: underline ! important; }
A.message { text-decoration: none; font-weight: bold; font-family: Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace; }
A.seealso { text-decoration: none; font-weight: bold; font-family: Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace; }
A.toc { text-decoration: none; }
A.jump { text-decoration: none; }
LI.message { text-decoration: none; font-weight: bold; font-family: Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace; }
H2 { background: #E0EAFF; }
table {
border: 0px;
border-collapse: collapse;
}
table.categories {
border: 0px;
border-collapse: collapse;
}
table.categories td {
padding: 4px 12px;
}
table.standard {
border-collapse: collapse;
}
table.standard th {
background: #404040;
color: #FFFFFF;
padding: 1px 5px 1px 5px;
}
table.standard tr:nth-child(odd) {background: #D7D7D7}
table.standard tr:nth-child(even) {background: #F0F0F0}
table.standard td {
padding: 1px 5px 1px 5px;
}
.S0 {
color: #808080;
}
.S2 {
font-family: 'Comic Sans MS';
color: #007F00;
font-size: 9pt;
}
.S3 {
font-family: 'Comic Sans MS';
color: #3F703F;
font-size: 9pt;
}
.S4 {
color: #007F7F;
}
.S5 {
font-weight: bold;
color: #00007F;
}
.S9 {
color: #7F7F00;
}
.S10 {
font-weight: bold;
color: #000000;
}
.S17 {
font-family: 'Comic Sans MS';
color: #3060A0;
font-size: 9pt;
}
DIV.highlighted {
background: #F7FCF7;
border: 1px solid #C0D7C0;
margin: 0.3em 3em;
padding: 0.3em 0.6em;
font-family: 'Verdana';
color: #000000;
font-size: 10pt;
}
.provisional {
background: #FFB000;
}
.parameter {
font-style:italic;
}
/*]]>*/
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table bgcolor="#000000" width="100%" cellspacing="0" cellpadding="0" border="0"
summary="Banner">
<tr>
<td><img src="SciTEIco.png" border="3" height="64" width="64" alt="Scintilla icon" /></td>
<td><a href="index.html"
style="color:white;text-decoration:none;font-size:200%">Scintilla</a></td>
</tr>
</table>
<h1>Scintilla Documentation</h1>
<p>Last edited 7 December 2016 NH</p>
<p>There is <a class="jump" href="Design.html">an overview of the internal design of
Scintilla</a>.<br />
<a class="jump" href="ScintillaUsage.html">Some notes on using Scintilla</a>.<br />
<a class="jump" href="Steps.html">How to use the Scintilla Edit Control on Windows</a>.<br />
<a class="jump" href="http://www.scintilla.org/dmapp.zip">A simple sample using Scintilla from
C++ on Windows</a>.<br />
<a class="jump" href="http://www.scintilla.org/SciTry.vb">A simple sample using Scintilla from
Visual Basic</a>.<br />
<a class="jump" href="http://www.scintilla.org/bait.zip">Bait is a tiny sample using Scintilla
on GTK+</a>.<br />
<a class="jump" href="Lexer.txt">A detailed description of how to write a lexer, including a
discussion of folding</a>.<br />
<a class="jump" href="http://sphere.sourceforge.net/flik/docs/scintilla-container_lexer.html">
How to implement a lexer in the container</a>.<br />
<a class="jump" href="http://sphere.sourceforge.net/flik/docs/scintilla-folding.html">
How to implement folding</a>.<br />
<a class="jump" href="https://bitbucket.org/StarFire/scintilla-doc/downloads/Scintilla-var'aq-Tutorial.pdf">
Beginner's Guide to lexing and folding</a>.<br />
The <a class="jump" href="SciCoding.html">coding style</a> used in Scintilla and SciTE is
worth following if you want to contribute code to Scintilla but is not compulsory.</p>
<h2>Introduction</h2>
<p>The Windows version of Scintilla is a Windows Control. As such, its primary programming
interface is through Windows messages. Early versions of Scintilla emulated much of the API
defined by the standard Windows Edit and RichEdit controls but those APIs are now deprecated in
favour of Scintilla's own, more consistent API. In addition to messages performing the actions
of a normal Edit control, Scintilla allows control of syntax styling, folding, markers, autocompletion
and call tips.</p>
<p>The GTK+ version also uses messages in a similar way to the Windows version. This is
different to normal GTK+ practice but made it easier to implement rapidly.</p>
<p>Scintilla also builds with Cocoa on OS X and with Qt, and follows the conventions of
those platforms.</p>
<p>Scintilla does not properly support right-to-left languages like Arabic and Hebrew.
While text in these languages may appear correct, it is not possible to interact with this text
as is normal with other editing components.</p>
<p>This documentation describes the individual messages and notifications used by Scintilla. It
does not describe how to link them together to form a useful editor. For now, the best way to
work out how to develop using Scintilla is to see how SciTE uses it. SciTE exercises most of
Scintilla's facilities.</p>
<p>In the descriptions that follow, the messages are described as function calls with zero, one
or two arguments. These two arguments are the standard <code>wParam</code> and
<code>lParam</code> familiar to Windows programmers. These parameters are integers that
are large enough to hold pointers, and the return value is also an integer large enough to contain a
pointer.
Although the commands only use the
arguments described, because all messages have two arguments whether Scintilla uses them or
not, it is strongly recommended that any unused arguments are set to 0. This allows future
enhancement of messages without the risk of breaking existing code. Common argument types
are:</p>
<table class="standard" summary="Common argument types">
<tbody valign="top">
<tr>
<th align="left"><code>bool</code></th>
<td>Arguments expect the values 0 for <code>false</code> and 1 for
<code>true</code>.</td>
</tr>
<tr>
<th align="left"><code>int</code></th>
<td>Arguments are 32-bit or 64-bit signed integers depending on the platform.
Equivalent to <code>intptr_t</code>.</td>
</tr>
<tr>
<th align="left"><code>const char *</code></th>
<td>Arguments point at text that is being passed to Scintilla but not modified. The text
may be zero terminated or another argument may specify the character count, the
description will make this clear.</td>
</tr>
<tr>
<th align="left"><code>char *</code></th>
<td>Arguments point at text buffers that Scintilla will fill with text. In some cases,
another argument will tell Scintilla the buffer size. In others, you must make sure that
the buffer is big enough to hold the requested text. If a NULL pointer (0) is passed
then, for SCI_* calls, the length that should be allocated, not including any terminating
NUL, is returned. Some calls (marked "NUL-terminated") add a NUL character to the result but other calls do
not: to generically handle both types, allocate one more byte than indicated and set it to NUL.</td>
</tr>
<tr>
<th align="left" id="colour"><code>colour</code></th>
<td>Colours are set using the RGB format (Red, Green, Blue). The intensity of each colour
is set in the range 0 to 255. If you have three such intensities, they are combined as:
red | (green << 8) | (blue << 16). If you set all intensities to 255, the
colour is white. If you set all intensities to 0, the colour is black. When you set a
colour, you are making a request. What you will get depends on the capabilities of the
system and the current screen mode.</td>
</tr>
<tr>
<th align="left" id="alpha"><code>alpha</code></th>
<td>Translucency is set using an alpha value.
Alpha ranges from 0 (SC_ALPHA_TRANSPARENT) which is completely transparent to
255 (SC_ALPHA_OPAQUE) which is opaque. The value 256 (SC_ALPHA_NOALPHA)
is opaque and uses code that is not alpha-aware and may be faster. Not all platforms support
translucency and only some Scintilla features implement translucency.
The default alpha value for most features is SC_ALPHA_NOALPHA.</td>
</tr>
<tr>
<th align="left"><code><unused></code></th>
<td>This is an unused argument. Setting it to 0 will ensure compatibility with future
enhancements.</td>
</tr>
</tbody>
</table>
<h2 id="MessageCategories">Contents</h2>
<table class="categories" summary="Message categories">
<tbody>
<tr>
<td>○ <a class="toc" href="#TextRetrievalAndModification">Text retrieval and
modification</a></td>
<td>○ <a class="toc" href="#Searching">Searching and replacing</a></td>
<td>○ <a class="toc" href="#Overtype">Overtype</a></td>
</tr>
<tr>
<td>○ <a class="toc" href="#CutCopyAndPaste">Cut, copy and paste</a></td>
<td>○ <a class="toc" href="#ErrorHandling">Error handling</a></td>
<td>○ <a class="toc" href="#UndoAndRedo">Undo and Redo</a></td>
</tr>
<tr>
<td>○ <a class="toc" href="#SelectionAndInformation">Selection and information</a></td>
<td>○ <a class="toc" href="#MultipleSelectionAndVirtualSpace">Multiple Selection and Virtual Space</a></td>
<td>○ <a class="toc" href="#ScrollingAndAutomaticScrolling">Scrolling and automatic
scrolling</a></td>
</tr>
<tr>
<td>○ <a class="toc" href="#WhiteSpace">White space</a></td>
<td>○ <a class="toc" href="#Cursor">Cursor</a></td>
<td>○ <a class="toc" href="#MouseCapture">Mouse capture</a></td>
</tr>
<tr>
<td>○ <a class="toc" href="#LineEndings">Line endings</a></td>
<td>○ <a class="toc" href="#Words">Words</a></td>
<td>○ <a class="toc" href="#Styling">Styling</a></td>
</tr>
<tr>
<td>○ <a class="toc" href="#StyleDefinition">Style definition</a></td>
<td>○ <a class="toc" href="#CaretAndSelectionStyles">Caret, selection, and hotspot styles</a></td>
<td>○ <a class="toc" href="#CharacterRepresentations">Character representations</a></td>
</tr>
<tr>
<td>○ <a class="toc" href="#Margins">Margins</a></td>
<td>○ <a class="toc" href="#Annotations">Annotations</a></td>
<td>○ <a class="toc" href="#OtherSettings">Other settings</a></td>
</tr>
<tr>
<td>○ <a class="toc" href="#BraceHighlighting">Brace highlighting</a></td>
<td>○ <a class="toc" href="#TabsAndIndentationGuides">Tabs and Indentation
Guides</a></td>
<td>○ <a class="toc" href="#Markers">Markers</a></td>
</tr>
<tr>
<td>○ <a class="toc" href="#Indicators">Indicators</a></td>
<td>○ <a class="toc" href="#Autocompletion">Autocompletion</a></td>
<td>○ <a class="toc" href="#UserLists">User lists</a></td>
</tr>
<tr>
<td>○ <a class="toc" href="#CallTips">Call tips</a></td>
<td>○ <a class="toc" href="#KeyboardCommands">Keyboard commands</a></td>
<td>○ <a class="toc" href="#KeyBindings">Key bindings</a></td>
</tr>
<tr>
<td>○ <a class="toc" href="#PopupEditMenu">Popup edit menu</a></td>
<td>○ <a class="toc" href="#MacroRecording">Macro recording</a></td>
<td>○ <a class="toc" href="#Printing">Printing</a></td>
</tr>
<tr>
<td>○ <a class="toc" href="#DirectAccess">Direct access</a></td>
<td>○ <a class="toc" href="#MultipleViews">Multiple views</a></td>
<td>○ <a class="toc" href="#BackgroundLoadSave">Background loading and saving</a></td>
</tr>
<tr>
<td>○ <a class="toc" href="#Folding">Folding</a></td>
<td>○ <a class="toc" href="#LineWrapping">Line wrapping</a></td>
<td>○ <a class="toc" href="#Zooming">Zooming</a></td>
</tr>
<tr>
<td>○ <a class="toc" href="#LongLines">Long lines</a></td>
<td>○ <a class="toc" href="#Lexer">Lexer</a></td>
<td>○ <a class="toc" href="#LexerObjects">Lexer objects</a></td>
</tr>
<tr>
<td>○ <a class="toc" href="#Notifications">Notifications</a></td>
<td>○ <a class="toc" href="#Accessibility">Accessibility</a></td>
<td>○ <a class="toc" href="#Images">Images</a></td>
</tr>
<tr>
<td>○ <a class="toc" href="#GTK">GTK+</a></td>
<td>○ <a class="toc" href="#ProvisionalMessages"><span class="provisional">Provisional messages</span></a></td>
<td>○ <a class="toc" href="#DeprecatedMessages">Deprecated messages</a></td>
</tr>
<tr>
<td>○ <a class="toc" href="#EditMessagesNeverSupportedByScintilla">Edit messages never
supported by Scintilla</a></td>
<td>○ <a class="toc" href="#RemovedFeatures">Removed features</a></td>
<td>○ <a class="toc" href="#BuildingScintilla">Building Scintilla</a></td>
</tr>
</tbody>
</table>
<p>Messages with names of the form <code>SCI_SETxxxxx</code> often have a companion
<code>SCI_GETxxxxx</code>. To save tedious repetition, if the <code>SCI_GETxxxxx</code> message
returns the value set by the <code>SCI_SETxxxxx</code> message, the <code>SET</code> routine is
described and the <code>GET</code> routine is left to your imagination.</p>
<h2 id="TextRetrievalAndModification">Text retrieval and modification</h2>
<p>Each byte in a Scintilla document is associated with a byte of styling
information. The combination of a character byte and a style byte is called a cell. Style bytes
are interpreted an index into an array of styles.</p>
<p>In this document, 'character' normally refers to a byte even when multi-byte characters are used.
Lengths measure the numbers of bytes, not the amount of characters in those bytes.</p>
<p>Positions within the Scintilla document refer to a character or the gap before that
character. The first character in a document is 0, the second 1 and so on. If a document
contains <code>nLen</code> characters, the last character is numbered <code>nLen</code>-1.
The caret exists between character positions and can be located from before the first character (0)
to after the last character (<code>nLen</code>).</p>
<p>There are places where the caret can not go where two character bytes make up one character.
This occurs when a DBCS character from a language like Japanese is included in the document or
when line ends are marked with the CP/M standard of a carriage return followed by a line feed.
The <code>INVALID_POSITION</code> constant (-1) represents an invalid position within the
document.</p>
<p>All lines of text in Scintilla are the same height, and this height is calculated from the
largest font in any current style. This restriction is for performance; if lines differed in
height then calculations involving positioning of text would require the text to be styled
first.</p>
<code><a class="message" href="#SCI_GETTEXT">SCI_GETTEXT(int length, char *text) → int</a><br />
<a class="message" href="#SCI_SETTEXT">SCI_SETTEXT(<unused>, const char *text)</a><br />
<a class="message" href="#SCI_SETSAVEPOINT">SCI_SETSAVEPOINT</a><br />
<a class="message" href="#SCI_GETLINE">SCI_GETLINE(int line, char *text) → int</a><br />
<a class="message" href="#SCI_REPLACESEL">SCI_REPLACESEL(<unused>, const char
*text)</a><br />
<a class="message" href="#SCI_SETREADONLY">SCI_SETREADONLY(bool readOnly)</a><br />
<a class="message" href="#SCI_GETREADONLY">SCI_GETREADONLY → bool</a><br />
<a class="message" href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE(<unused>, Sci_TextRange *tr) → int</a><br />
<a class="message" href="#SCI_ALLOCATE">SCI_ALLOCATE(int bytes)</a><br />
<a class="message" href="#SCI_ADDTEXT">SCI_ADDTEXT(int length, const char *text)</a><br />
<a class="message" href="#SCI_ADDSTYLEDTEXT">SCI_ADDSTYLEDTEXT(int length, cell *c)</a><br />
<a class="message" href="#SCI_APPENDTEXT">SCI_APPENDTEXT(int length, const char *text)</a><br />
<a class="message" href="#SCI_INSERTTEXT">SCI_INSERTTEXT(int pos, const char *text)</a><br />
<a class="message" href="#SCI_CHANGEINSERTION">SCI_CHANGEINSERTION(int length, const char *text)</a><br />
<a class="message" href="#SCI_CLEARALL">SCI_CLEARALL</a><br />
<a class="message" href="#SCI_DELETERANGE">SCI_DELETERANGE(int start, int lengthDelete)</a><br />
<a class="message" href="#SCI_CLEARDOCUMENTSTYLE">SCI_CLEARDOCUMENTSTYLE</a><br />
<a class="message" href="#SCI_GETCHARAT">SCI_GETCHARAT(int pos) → int</a><br />
<a class="message" href="#SCI_GETSTYLEAT">SCI_GETSTYLEAT(int pos) → int</a><br />
<a class="message" href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT(<unused>, Sci_TextRange *tr) → int</a><br />
<a class="message" href="#SCI_RELEASEALLEXTENDEDSTYLES">SCI_RELEASEALLEXTENDEDSTYLES</a><br />
<a class="message" href="#SCI_ALLOCATEEXTENDEDSTYLES">SCI_ALLOCATEEXTENDEDSTYLES(int numberStyles) → int</a><br />
<a class="message" href="#SCI_TARGETASUTF8">SCI_TARGETASUTF8(<unused>, char *s) → int</a><br />
<a class="message" href="#SCI_ENCODEDFROMUTF8">SCI_ENCODEDFROMUTF8(const char *utf8, char *encoded) → int</a><br />
<a class="message" href="#SCI_SETLENGTHFORENCODE">SCI_SETLENGTHFORENCODE(int bytes)</a><br />
</code>
<p><b id="SCI_GETTEXT">SCI_GETTEXT(int length, char *text NUL-terminated) → int</b><br />
This returns <code class="parameter">length</code>-1 characters of text from the start of the document plus one
terminating 0 character. To collect all the text in a document, use <code>SCI_GETLENGTH</code>
to get the number of characters in the document (<code>nLen</code>), allocate a character
buffer of length <code>nLen+1</code> bytes, then call <code>SCI_GETTEXT(nLen+1, char
*text)</code>. If the text argument is 0 then the length that should be allocated to store the
entire document is returned.
If you then save the text, you should use <code>SCI_SETSAVEPOINT</code> to mark
the text as unmodified.</p>
<p>See also: <code><a class="seealso" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>,
<a class="seealso" href="#SCI_GETCURLINE">SCI_GETCURLINE</a>,
<a class="seealso" href="#SCI_GETLINE">SCI_GETLINE</a>,
<a class="seealso "href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>,
<a class="seealso" href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a></code></p>
<p><b id="SCI_SETTEXT">SCI_SETTEXT(<unused>, const char *text)</b><br />
This replaces all the text in the document with the zero terminated text string you pass
in.</p>
<p><b id="SCI_SETSAVEPOINT">SCI_SETSAVEPOINT</b><br />
This message tells Scintilla that the current state of the document is unmodified. This is
usually done when the file is saved or loaded, hence the name "save point". As Scintilla
performs undo and redo operations, it notifies the container that it has entered or left the
save point with <code><a class="message"
href="#SCN_SAVEPOINTREACHED">SCN_SAVEPOINTREACHED</a></code> and <code><a class="message"
href="#SCN_SAVEPOINTLEFT">SCN_SAVEPOINTLEFT</a></code> <a class="jump"
href="#Notifications">notification messages</a>, allowing the container to know if the file
should be considered dirty or not.</p>
<p>See also: <code><a class="message" href="#SCI_EMPTYUNDOBUFFER">SCI_EMPTYUNDOBUFFER</a>, <a
class="message" href="#SCI_GETMODIFY">SCI_GETMODIFY</a></code></p>
<p><b id="SCI_GETLINE">SCI_GETLINE(int line, char *text) → int</b><br />
This fills the buffer defined by text with the contents of the nominated line (lines start at
0). The buffer is not terminated by a 0 character. It is up to you to make sure that the buffer
is long enough for the text, use <a class="message"
href="#SCI_LINELENGTH"><code>SCI_LINELENGTH(int line)</code></a>. The returned value is the
number of characters copied to the buffer. The returned text includes any end of line
characters. If you ask for a line number outside the range of lines in the document, 0
characters are copied. If the text argument is 0 then the length that should be allocated
to store the entire line is returned.</p>
<p>See also: <code><a class="seealso" href="#SCI_GETCURLINE">SCI_GETCURLINE</a>,
<a class="seealso" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>,
<a class="seealso" href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a>,
<a class="seealso" href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>,
<a class="seealso" href="#SCI_GETTEXT">SCI_GETTEXT</a></code></p>
<p><b id="SCI_REPLACESEL">SCI_REPLACESEL(<unused>, const char *text)</b><br />
The currently selected text between the <a class="jump" href="#SelectionAndInformation">anchor
and the current position</a> is replaced by the 0 terminated text string. If the anchor and
current position are the same, the text is inserted at the caret position. The caret is
positioned after the inserted text and the caret is scrolled into view.</p>
<p><b id="SCI_SETREADONLY">SCI_SETREADONLY(bool readOnly)</b><br />
<b id="SCI_GETREADONLY">SCI_GETREADONLY → bool</b><br />
These messages set and get the read-only flag for the document. If you mark a document as read
only, attempts to modify the text cause the <a class="message"
href="#SCN_MODIFYATTEMPTRO"><code>SCN_MODIFYATTEMPTRO</code></a> notification.</p>
<p><b id="SCI_GETTEXTRANGE">SCI_GETTEXTRANGE(<unused>, <a class="jump" href="#Sci_TextRange">Sci_TextRange</a> *tr) → int</b><br />
This collects the text between the positions <code>cpMin</code> and <code>cpMax</code> and
copies it to <code>lpstrText</code> (see <code>struct Sci_TextRange</code> in
<code>Scintilla.h</code>). If <code>cpMax</code> is -1, text is returned to the end of the
document. The text is 0 terminated, so you must supply a buffer that is at least 1 character
longer than the number of characters you wish to read. The return value is the length of the
returned text not including the terminating 0.</p>
<p>See also: <code><a class="seealso" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>,
<a class="seealso" href="#SCI_GETLINE">SCI_GETLINE</a>,
<a class="seealso" href="#SCI_GETCURLINE">SCI_GETCURLINE</a>,
<a class="seealso" href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>,
<a class="seealso" href="#SCI_GETTEXT">SCI_GETTEXT</a></code></p>
<p><b id="SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT(<unused>, <a class="jump" href="#Sci_TextRange">Sci_TextRange</a> *tr) → int</b><br />
This collects styled text into a buffer using two bytes for each cell, with the character at
the lower address of each pair and the style byte at the upper address. Characters between the
positions <code>cpMin</code> and <code>cpMax</code> are copied to <code>lpstrText</code> (see
<code>struct Sci_TextRange</code> in <code>Scintilla.h</code>). Two 0 bytes are added to the end of
the text, so the buffer that <code>lpstrText</code> points at must be at least
<code>2*(cpMax-cpMin)+2</code> bytes long. No check is made for sensible values of
<code>cpMin</code> or <code>cpMax</code>. Positions outside the document return character codes
and style bytes of 0.</p>
<p>See also: <code><a class="seealso" href="#SCI_GETSELTEXT">SCI_GETSELTEXT</a>,
<a class="seealso" href="#SCI_GETLINE">SCI_GETLINE</a>,
<a class="seealso" href="#SCI_GETCURLINE">SCI_GETCURLINE</a>,
<a class="seealso" href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a>,
<a class="seealso" href="#SCI_GETTEXT">SCI_GETTEXT</a></code></p>
<p><b id="SCI_ALLOCATE">SCI_ALLOCATE(int bytes)</b><br />
Allocate a document buffer large enough to store a given number of bytes.
The document will not be made smaller than its current contents.</p>
<p><b id="SCI_ADDTEXT">SCI_ADDTEXT(int length, const char *text)</b><br />
This inserts the first <code class="parameter">length</code> characters from the string
<code class="parameter">text</code>
at the current position. This will include any 0's in the string that you might have expected
to stop the insert operation. The current position is set at the end of the inserted text,
but it is not scrolled into view.</p>
<p><b id="SCI_ADDSTYLEDTEXT">SCI_ADDSTYLEDTEXT(int length, cell *c)</b><br />
This behaves just like <code>SCI_ADDTEXT</code>, but inserts styled text.</p>
<p><b id="SCI_APPENDTEXT">SCI_APPENDTEXT(int length, const char *text)</b><br />
This adds the first <code class="parameter">length</code> characters from the string
<code class="parameter">text</code> to the end
of the document. This will include any 0's in the string that you might have expected to stop
the operation. The current selection is not changed and the new text is not scrolled into
view.</p>
<p><b id="SCI_INSERTTEXT">SCI_INSERTTEXT(int pos, const char *text)</b><br />
This inserts the zero terminated <code class="parameter">text</code> string at position <code class="parameter">pos</code> or at
the current position if <code class="parameter">pos</code> is -1. If the current position is after the insertion point
then it is moved along with its surrounding text but no scrolling is performed.</p>
<p><b id="SCI_CHANGEINSERTION">SCI_CHANGEINSERTION(int length, const char *text)</b><br />
This may only be called from a <a class="message" href="#SC_MOD_INSERTCHECK">SC_MOD_INSERTCHECK</a>
notification handler and will change the text being inserted to that provided.</p>
<p><b id="SCI_CLEARALL">SCI_CLEARALL</b><br />
Unless the document is read-only, this deletes all the text.</p>
<p><b id="SCI_DELETERANGE">SCI_DELETERANGE(int start, int lengthDelete)</b><br />
Deletes a range of text in the document.</p>
<p><b id="SCI_CLEARDOCUMENTSTYLE">SCI_CLEARDOCUMENTSTYLE</b><br />
When wanting to completely restyle the document, for example after choosing a lexer, the
<code>SCI_CLEARDOCUMENTSTYLE</code> can be used to clear all styling information and reset the
folding state.</p>
<p><b id="SCI_GETCHARAT">SCI_GETCHARAT(int pos) → int</b><br />
This returns the character at <code class="parameter">pos</code> in the document or 0 if <code class="parameter">pos</code> is
negative or past the end of the document.</p>
<p><b id="SCI_GETSTYLEAT">SCI_GETSTYLEAT(int pos) → int</b><br />
This returns the style at <code class="parameter">pos</code> in the document, or 0 if <code class="parameter">pos</code> is
negative or past the end of the document.</p>
<p><b id="SCI_RELEASEALLEXTENDEDSTYLES">SCI_RELEASEALLEXTENDEDSTYLES</b><br />
<b id="SCI_ALLOCATEEXTENDEDSTYLES">SCI_ALLOCATEEXTENDEDSTYLES(int numberStyles) → int</b><br />
Extended styles are used for features like textual margins and annotations as well as internally by Scintilla.
They are outside the range 0..255 used for the styles bytes associated with document bytes.
These functions manage the use of extended styles to ensures that components cooperate in defining styles.
<code>SCI_RELEASEALLEXTENDEDSTYLES</code> releases any extended styles allocated by the container.
<code>SCI_ALLOCATEEXTENDEDSTYLES</code> allocates a range of style numbers after the byte style values and returns
the number of the first allocated style.
Ranges for margin and annotation styles should be allocated before calling
<a class="seealso" href="#SCI_MARGINSETSTYLEOFFSET">SCI_MARGINSETSTYLEOFFSET</a> or
<a class="seealso" href="#SCI_ANNOTATIONSETSTYLEOFFSET">SCI_ANNOTATIONSETSTYLEOFFSET</a>.</p>
<p><b id="Sci_TextRange">Sci_TextRange</b> and <b id="Sci_CharacterRange">Sci_CharacterRange</b><br />
These structures are defined to be exactly the same shape as the Win32 <code>TEXTRANGE</code>
and <code>CHARRANGE</code>, so that older code that treats Scintilla as a RichEdit will
work.</p>
<p>In a future release the type <code>Sci_PositionCR</code> will be redefined to be 64-bits when Scintilla is
built for 64-bits on all platforms.</p>
<pre>
typedef long Sci_PositionCR;
struct Sci_CharacterRange {
Sci_PositionCR cpMin;
Sci_PositionCR cpMax;
};
struct Sci_TextRange {
struct Sci_CharacterRange chrg;
char *lpstrText;
};
</pre>
<h3 id="EncodedAccess">Specific to GTK+, Cocoa and Windows only: Access to encoded text</h3>
<p><b id="SCI_TARGETASUTF8">SCI_TARGETASUTF8(<unused>, char *s) → int</b><br />
This method retrieves the value of the target encoded as UTF-8 which is the default
encoding of GTK+ so is useful for retrieving text for use in other parts of the user interface,
such as find and replace dialogs. The length of the encoded text in bytes is returned.
Cocoa uses UTF-16 which is easily converted from UTF-8 so this method can be used to perform the
more complex work of transcoding from the various encodings supported.
</p>
<p><b id="SCI_ENCODEDFROMUTF8">SCI_ENCODEDFROMUTF8(const char *utf8, char *encoded) → int</b><br />
<b id="SCI_SETLENGTHFORENCODE">SCI_SETLENGTHFORENCODE(int bytes)</b><br />
<code>SCI_ENCODEDFROMUTF8</code> converts a UTF-8 string into the document's
encoding which is useful for taking the results of a find dialog, for example, and receiving
a string of bytes that can be searched for in the document. Since the text can contain nul bytes,
the <code>SCI_SETLENGTHFORENCODE</code> method can be used to set the
length that will be converted. If set to -1, the length is determined by finding a nul byte.
The length of the converted string is returned.
</p>
<h2 id="Searching">Searching</h2>
<p>
There are methods to search for text and for regular expressions.
Most applications should use
<a class="seealso" href="#SCI_SEARCHINTARGET">SCI_SEARCHINTARGET</a>
as the basis for their search implementations.
Other calls augment this or were implemented before <code>SCI_SEARCHINTARGET</code>.
</p>
<p>
The base regular expression support
is limited and should only be used for simple cases and initial development.
The C++ runtime <regex> library may be used by setting the <code>SCFIND_CXX11REGEX</code> search flag.
When using an older C++ compiler that does not support C++11, this may be turned off by
compiling Scintilla with <code>NO_CXX11_REGEX</code> defined.
A different regular expression
library can be <a class="jump" href="#AlternativeRegEx">integrated into Scintilla</a>
or can be called from the container using direct access to the buffer contents through
<a class="seealso" href="#SCI_GETCHARACTERPOINTER">SCI_GETCHARACTERPOINTER</a>.
</p>
<h3 id="SearchAndReplaceUsingTheTarget">Search and replace using the target</h3>
<p>Searching can be performed within the target range with <code>SCI_SEARCHINTARGET</code>,
which uses a counted string to allow searching for null characters. It returns the
position of the start of the matching text range or -1 for failure, in which case the target is not moved. The flags used by
<code>SCI_SEARCHINTARGET</code> such as <code>SCFIND_MATCHCASE</code>,
<code>SCFIND_WHOLEWORD</code>, <code>SCFIND_WORDSTART</code>, and <code>SCFIND_REGEXP</code>
can be set with <code>SCI_SETSEARCHFLAGS</code>.</p>
<code><a class="message" href="#SCI_SETTARGETSTART">SCI_SETTARGETSTART(int start)</a><br />
<a class="message" href="#SCI_GETTARGETSTART">SCI_GETTARGETSTART → position</a><br />
<a class="message" href="#SCI_SETTARGETEND">SCI_SETTARGETEND(int end)</a><br />
<a class="message" href="#SCI_GETTARGETEND">SCI_GETTARGETEND → position</a><br />
<a class="message" href="#SCI_SETTARGETRANGE">SCI_SETTARGETRANGE(int start, int end)</a><br />
<a class="message" href="#SCI_TARGETFROMSELECTION">SCI_TARGETFROMSELECTION</a><br />
<a class="message" href="#SCI_TARGETWHOLEDOCUMENT">SCI_TARGETWHOLEDOCUMENT</a><br />
<a class="message" href="#SCI_SETSEARCHFLAGS">SCI_SETSEARCHFLAGS(int searchFlags)</a><br />
<a class="message" href="#SCI_GETSEARCHFLAGS">SCI_GETSEARCHFLAGS → int</a><br />
<a class="message" href="#SCI_SEARCHINTARGET">SCI_SEARCHINTARGET(int length, const char *text) → int</a><br />
<a class="message" href="#SCI_GETTARGETTEXT">SCI_GETTARGETTEXT(<unused>, char *text) → int</a><br />
<a class="message" href="#SCI_REPLACETARGET">SCI_REPLACETARGET(int length, const char *text) → int</a><br />
<a class="message" href="#SCI_REPLACETARGETRE">SCI_REPLACETARGETRE(int length, const char *text) → int</a><br />
<a class="message" href="#SCI_GETTAG">SCI_GETTAG(int tagNumber, char *tagValue) → int</a><br />
</code>
<p><b id="SCI_SETTARGETSTART">SCI_SETTARGETSTART(int start)</b><br />
<b id="SCI_GETTARGETSTART">SCI_GETTARGETSTART → position</b><br />
<b id="SCI_SETTARGETEND">SCI_SETTARGETEND(int end)</b><br />
<b id="SCI_GETTARGETEND">SCI_GETTARGETEND → position</b><br />
<b id="SCI_SETTARGETRANGE">SCI_SETTARGETRANGE(int start, int end)</b><br />
These functions set and return the start and end of the target. When searching
you can set start greater than end to find the last matching text in the
target rather than the first matching text. The target is also set by a successful
<code>SCI_SEARCHINTARGET</code>.</p>
<p><b id="SCI_TARGETFROMSELECTION">SCI_TARGETFROMSELECTION</b><br />
Set the target start and end to the start and end positions of the selection.</p>
<p><b id="SCI_TARGETWHOLEDOCUMENT">SCI_TARGETWHOLEDOCUMENT</b><br />
Set the target start to the start of the document and target end to the end of the document.</p>
<p><b id="SCI_SETSEARCHFLAGS">SCI_SETSEARCHFLAGS(int searchFlags)</b><br />
<b id="SCI_GETSEARCHFLAGS">SCI_GETSEARCHFLAGS → int</b><br />
These get and set the <a class="jump" href="#searchFlags"><code class="parameter">searchFlags</code></a> used by
<code>SCI_SEARCHINTARGET</code>. There are several option flags including a simple regular
expression search.</p>
<p><b id="SCI_SEARCHINTARGET">SCI_SEARCHINTARGET(int length, const char *text) → int</b><br />
This searches for the first occurrence of a text string in the target defined by
<code>SCI_SETTARGETSTART</code> and <code>SCI_SETTARGETEND</code>. The text string is not zero
terminated; the size is set by <code class="parameter">length</code>. The search is modified by the search flags
set by <code>SCI_SETSEARCHFLAGS</code>. If the search succeeds, the target is set to the found
text and the return value is the position of the start of the matching text. If the search
fails, the result is -1.</p>
<p><b id="SCI_GETTARGETTEXT">SCI_GETTARGETTEXT(<unused>, char *text) → int</b><br />
Retrieve the value in the target.</p>
<p><b id="SCI_REPLACETARGET">SCI_REPLACETARGET(int length, const char *text) → int</b><br />
If <code class="parameter">length</code> is -1, <code class="parameter">text</code> is a zero terminated string, otherwise
<code class="parameter">length</code> sets the number of character to replace the target with.
After replacement, the target range refers to the replacement text.
The return value
is the length of the replacement string.<br />
Note that the recommended way to delete text in the document is to set the target to the text to be removed,
and to perform a replace target with an empty string.</p>
<p><b id="SCI_REPLACETARGETRE">SCI_REPLACETARGETRE(int length, const char *text) → int</b><br />
This replaces the target using regular expressions. If <code class="parameter">length</code> is -1,
<code class="parameter">text</code> is a zero terminated string, otherwise <code class="parameter">length</code> is the number of
characters to use. The replacement string is formed from the text string with any sequences of
<code>\1</code> through <code>\9</code> replaced by tagged matches from the most recent regular
expression search. <code>\0</code> is replaced with all the matched text from the most recent search.
After replacement, the target range refers to the replacement text.
The return value is the length of the replacement string.</p>
<p><b id="SCI_GETTAG">SCI_GETTAG(int tagNumber, char *tagValue NUL-terminated) → int</b><br />
Discover what text was matched by tagged expressions in a regular expression search.
This is useful if the application wants to interpret the replacement string itself.</p>
<p>See also: <a class="message" href="#SCI_FINDTEXT"><code>SCI_FINDTEXT</code></a></p>
<p><b id="searchFlags"><code class="parameter">searchFlags</code></b><br />
Several of the search routines use flag options, which include a simple regular expression
search. Combine the flag options by adding them:</p>
<table class="standard" summary="Search flags">
<tbody>
<tr>
<td><code>SCFIND_MATCHCASE</code></td>
<td>A match only occurs with text that matches the case of the search string.</td>
</tr>
<tr>
<td><code>SCFIND_WHOLEWORD</code></td>
<td>A match only occurs if the characters before and after are not word characters as defined
by <a class="message" href="#SCI_SETWORDCHARS"><code>SCI_SETWORDCHARS</code></a>.</td>
</tr>
<tr>
<td><code>SCFIND_WORDSTART</code></td>
<td>A match only occurs if the character before is not a word character as defined
by <a class="message" href="#SCI_SETWORDCHARS"><code>SCI_SETWORDCHARS</code></a>.</td>
</tr>
<tr>
<td><code>SCFIND_REGEXP</code></td>
<td>The search string should be interpreted as a regular expression.
Uses Scintilla's base implementation unless combined with <code>SCFIND_CXX11REGEX</code>.</td>
</tr>
<tr>
<td><code>SCFIND_POSIX</code></td>
<td>Treat regular expression in a more POSIX compatible manner
by interpreting bare ( and ) for tagged sections rather than \( and \).
Has no effect when <code>SCFIND_CXX11REGEX</code> is set.</td>
</tr>
<tr>
<td><code>SCFIND_CXX11REGEX</code></td>
<td>This flag may be set to use C++11 <regex> instead of Scintilla's basic regular expressions.
If the regular expression is invalid then -1 is returned and status is set to
<code>SC_STATUS_WARN_REGEX</code>.
The ECMAScript flag is set on the regex object and UTF-8 documents will exhibit Unicode-compliant
behaviour. For MSVC, where wchar_t is 16-bits, the reular expression ".." will match a single
astral-plane character. There may be other differences between compilers.
Must also have <code>SCFIND_REGEXP</code> set.</td>
</tr>
</tbody>
</table>
<p>In a regular expression, using Scintilla's base implementation,
special characters interpreted are:</p>
<table class="standard" summary="Regular expression synopsis">
<tbody>
<tr>
<td><code>.</code></td>
<td>Matches any character</td>
</tr>
<tr>
<td><code>\(</code></td>
<td>This marks the start of a region for tagging a match.</td>
</tr>
<tr>
<td><code>\)</code></td>
<td>This marks the end of a tagged region.</td>
</tr>
<tr>
<td><code>\n</code></td>
<td>Where <code>n</code> is 1 through 9 refers to the first through ninth tagged region
when replacing. For example, if the search string was <code>Fred\([1-9]\)XXX</code> and
the replace string was <code>Sam\1YYY</code>, when applied to <code>Fred2XXX</code> this
would generate <code>Sam2YYY</code>.
<code>\0</code> refers to all of the matching text.</td>
</tr>
<tr>
<td><code>\<</code></td>
<td>This matches the start of a word using Scintilla's definitions of words.</td>
</tr>
<tr>
<td><code>\></code></td>
<td>This matches the end of a word using Scintilla's definition of words.</td>
</tr>
<tr>
<td><code>\x</code></td>
<td>This allows you to use a character x that would otherwise have a special meaning. For
example, \[ would be interpreted as [ and not as the start of a character set.</td>
</tr>
<tr>
<td><code>[...]</code></td>
<td>This indicates a set of characters, for example, [abc] means any of the characters a,
b or c. You can also use ranges, for example [a-z] for any lower case character.</td>
</tr>
<tr>
<td><code>[^...]</code></td>
<td>The complement of the characters in the set. For example, [^A-Za-z] means any
character except an alphabetic character.</td>
</tr>
<tr>
<td><code>^</code></td>
<td>This matches the start of a line (unless used inside a set, see above).</td>
</tr>
<tr>
<td><code>$</code></td>
<td>This matches the end of a line.</td>
</tr>
<tr>
<td><code>*</code></td>
<td>This matches 0 or more times. For example, <code>Sa*m</code> matches <code>Sm</code>,
<code>Sam</code>, <code>Saam</code>, <code>Saaam</code> and so on.</td>
</tr>
<tr>
<td><code>+</code></td>
<td>This matches 1 or more times. For example, <code>Sa+m</code> matches
<code>Sam</code>, <code>Saam</code>, <code>Saaam</code> and so on.</td>
</tr>
</tbody>
</table>
<p>Regular expressions will only match ranges within a single line, never matching over multiple lines.</p>
<p>When using <code>SCFIND_CXX11REGEX</code> more features are available,
generally similar to regular expression support in JavaScript.
See the documentation of your C++ runtime for details on what is supported.</p>
<code><a class="message" href="#SCI_FINDTEXT">SCI_FINDTEXT(int searchFlags, Sci_TextToFind *ft) → position</a><br />
<a class="message" href="#SCI_SEARCHANCHOR">SCI_SEARCHANCHOR</a><br />
<a class="message" href="#SCI_SEARCHNEXT">SCI_SEARCHNEXT(int searchFlags, const char *text) → int</a><br />
<a class="message" href="#SCI_SEARCHPREV">SCI_SEARCHPREV(int searchFlags, const char *text) → int</a><br />
</code>
<p><b id="SCI_FINDTEXT">SCI_FINDTEXT(int searchFlags, <a class="jump" href="#Sci_TextToFind">Sci_TextToFind</a> *ft) → position</b><br />
This message searches for text in the document. It does not use or move the current selection.
The <a class="jump" href="#searchFlags"><code class="parameter">searchFlags</code></a> argument controls the
search type, which includes regular expression searches.</p>
<p>You can
search backwards to find the previous occurrence of a search string by setting the end of the
search range before the start.</p>
<p>The <code>Sci_TextToFind</code> structure is defined in <code>Scintilla.h</code>; set
<code>chrg.cpMin</code> and <code>chrg.cpMax</code> with the range of positions in the document
to search. You can search backwards by
setting <code>chrg.cpMax</code> less than <code>chrg.cpMin</code>.
Set the <code>lpstrText</code> member of <code>Sci_TextToFind</code> to point at a zero terminated
text string holding the search pattern. If your language makes the use of <code>Sci_TextToFind</code>
difficult, you should consider using <code>SCI_SEARCHINTARGET</code> instead.</p>
<p>The return value is -1 if the search fails or the position of the start of the found text if
it succeeds. The <code>chrgText.cpMin</code> and <code>chrgText.cpMax</code> members of
<code>Sci_TextToFind</code> are filled in with the start and end positions of the found text.</p>
<p>See also: <code><a class="message"
href="#SCI_SEARCHINTARGET">SCI_SEARCHINTARGET</a></code></p>
<p><b id="Sci_TextToFind">Sci_TextToFind</b><br />
This structure is defined to have exactly the same shape as the Win32 structure
<code>FINDTEXTEX</code> for old code that treated Scintilla as a RichEdit control.</p>
<pre>
struct Sci_TextToFind {
struct <a class="jump" href="#Sci_CharacterRange">Sci_CharacterRange</a> chrg; // range to search
const char *lpstrText; // the search pattern (zero terminated)
struct Sci_CharacterRange chrgText; // returned as position of matching text
};
</pre>
<p><b id="SCI_SEARCHANCHOR">SCI_SEARCHANCHOR</b><br />
<b id="SCI_SEARCHNEXT">SCI_SEARCHNEXT(int searchFlags, const char *text) → int</b><br />
<b id="SCI_SEARCHPREV">SCI_SEARCHPREV(int searchFlags, const char *text) → int</b><br />
These messages provide relocatable search support. This allows multiple incremental
interactive searches to be macro recorded while still setting the selection to found text so
the find/select operation is self-contained. These three messages send <a class="message"
href="#SCN_MACRORECORD"><code>SCN_MACRORECORD</code></a> <a class="jump"
href="#Notifications">notifications</a> if macro recording is enabled.</p>
<p><code>SCI_SEARCHANCHOR</code> sets the search start point used by
<code>SCI_SEARCHNEXT</code> and <code>SCI_SEARCHPREV</code> to the start of the current
selection, that is, the end of the selection that is nearer to the start of the document. You
should always call this before calling either of <code>SCI_SEARCHNEXT</code> or
<code>SCI_SEARCHPREV</code>.</p>
<p><code>SCI_SEARCHNEXT</code> and <code>SCI_SEARCHPREV</code> search for the next and previous
occurrence of the zero terminated search string pointed at by text. The search is modified by
the <a class="jump" href="#searchFlags"><code class="parameter">searchFlags</code></a>. </p>
<p>The return value is -1 if nothing is found, otherwise the return value is the start position
of the matching text. The selection is updated to show the matched text, but is not scrolled
into view.</p>
<p>See also: <a class="message" href="#SCI_SEARCHINTARGET"><code>SCI_SEARCHINTARGET</code></a>,
<a class="message" href="#SCI_FINDTEXT"><code>SCI_FINDTEXT</code></a></p>
<h2 id="Overtype">Overtype</h2>
<code><a class="message" href="#SCI_SETOVERTYPE">SCI_SETOVERTYPE(bool overType)</a><br />
<a class="message" href="#SCI_GETOVERTYPE">SCI_GETOVERTYPE → bool</a><br />
</code>
<p><b id="SCI_SETOVERTYPE">SCI_SETOVERTYPE(bool overType)</b><br />
<b id="SCI_GETOVERTYPE">SCI_GETOVERTYPE → bool</b><br />
When overtype is enabled, each typed character replaces the character to the right of the text
caret. When overtype is disabled, characters are inserted at the caret.
<code>SCI_GETOVERTYPE</code> returns <code>true</code> (1) if overtyping is active, otherwise
<code>false</code> (0) will be returned. Use <code>SCI_SETOVERTYPE</code> to set the overtype
mode.</p>
<h2 id="CutCopyAndPaste">Cut, copy and paste</h2>
<code><a class="message" href="#SCI_CUT">SCI_CUT</a><br />
<a class="message" href="#SCI_COPY">SCI_COPY</a><br />
<a class="message" href="#SCI_PASTE">SCI_PASTE</a><br />
<a class="message" href="#SCI_CLEAR">SCI_CLEAR</a><br />
<a class="message" href="#SCI_CANPASTE">SCI_CANPASTE → bool</a><br />
<a class="message" href="#SCI_COPYRANGE">SCI_COPYRANGE(int start, int end)</a><br />
<a class="message" href="#SCI_COPYTEXT">SCI_COPYTEXT(int length, const char *text)</a><br />
<a class="message" href="#SCI_COPYALLOWLINE">SCI_COPYALLOWLINE</a><br />