forked from jrsoftware/issrc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScintEdit.pas
3029 lines (2685 loc) · 102 KB
/
ScintEdit.pas
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
unit ScintEdit;
{
Inno Setup
Copyright (C) 1997-2024 Jordan Russell
Portions by Martijn Laan
For conditions of distribution and use, see LICENSE.TXT.
TScintEdit component: a VCL wrapper for Scintilla
}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Generics.Collections, ScintInt;
const
StyleNumbers = 32; { The syntax highlighting can use up to 32 styles }
StyleNumberBits = 5; { 5 bits are needed to store 32 values }
StyleNumberMask = StyleNumbers-1; { To get the 5 bits from a byte it needs to be AND-ed with $1F = 31 }
StyleNumberUnusedBits = 8-StyleNumberBits; { 3 bits of a byte are unused }
type
TScintChangeHistory = (schDisabled, schMarkers, schIndicators);
TScintCommand = type NativeInt;
TScintEditAutoCompleteSelectionEvent = TNotifyEvent;
TScintEditCallTipArrowClick = procedure(Sender: TObject; const Up: Boolean) of object;
TScintEditChangeInfo = record
Inserting: Boolean;
StartPos, Length, LinesDelta: Integer;
end;
TScintEditChangeEvent = procedure(Sender: TObject;
const Info: TScintEditChangeInfo) of object;
TScintEditCharAddedEvent = procedure(Sender: TObject; Ch: AnsiChar) of object;
TScintEditDropFilesEvent = procedure(Sender: TObject; X, Y: Integer;
AFiles: TStrings) of object;
TScintHintInfo = Controls.THintInfo;
TScintEditHintShowEvent = procedure(Sender: TObject;
var Info: TScintHintInfo) of object;
TScintEditMarginClickEvent = procedure(Sender: TObject; MarginNumber: Integer;
Line: Integer) of object;
TScintEditUpdate = (suContent, suSelection, suVScroll, suHScroll);
TScintEditUpdates = set of TScintEditUpdate;
TScintEditUpdateUIEvent = procedure(Sender: TObject; Updated: TScintEditUpdates) of object;
TScintFindOption = (sfoMatchCase, sfoWholeWord, sfoRegEx);
TScintFindOptions = set of TScintFindOption;
TScintFoldFlag = (sffLineBeforeExpanded, sffLineBeforeContracted,
sffLineAfterExpanded, sffLineAfterContracted, sffLevelNumbers, sffLineState);
TScintFoldFlags = set of TScintFoldFlag;
TScintIndentationGuides = (sigNone, sigReal, sigLookForward, sigLookBoth);
TScintKeyCode = type Word;
TScintKeyDefinition = type Cardinal;
TScintReplaceMode = (srmNormal, srmMinimal, srmRegEx);
TScintStyleByteIndicatorNumber = 0..1; { Could be increased to 0..StyleNumberUnusedBits-1 }
TScintStyleByteIndicatorNumbers = set of TScintStyleByteIndicatorNumber;
TScintIndicatorNumber = INDICATOR_CONTAINER..INDICATOR_MAX;
TScintLineEndings = (sleCRLF, sleCR, sleLF);
TScintLineState = type Integer;
TScintMarkerNumber = 0..31;
TScintMarkerNumbers = set of TScintMarkerNumber;
TScintRange = record
StartPos, EndPos: Integer;
constructor Create(const AStartPos, AEndPos: Integer);
function Empty: Boolean;
function Overlaps(const ARange: TScintRange): Boolean;
function Within(const ARange: TScintRange): Boolean;
end;
TScintRangeList = class(TList<TScintRange>)
function Overlaps(const ARange: TScintRange;
var AOverlappingRange: TScintRange): Boolean;
end;
TScintCaretAndAnchor = record
CaretPos, AnchorPos: Integer;
constructor Create(const ACaretPos, AAnchorPos: Integer);
function Range: TScintRange;
end;
TScintCaretAndAnchorList = class(TList<TScintCaretAndAnchor>);
TScintRawCharSet = set of AnsiChar;
TScintRawString = type RawByteString;
TScintRectangle = record
Left, Top, Right, Bottom: Integer;
end;
TScintSelectionMode = (ssmStream, ssmRectangular, ssmLines, ssmThinRectangular);
TScintStyleNumber = 0..StyleNumbers-1;
TScintVirtualSpaceOption = (svsRectangularSelection, svsUserAccessible,
svsNoWrapLineStart);
TScintVirtualSpaceOptions = set of TScintVirtualSpaceOption;
PScintRangeToFormat = ^TScintRangeToFormat;
TScintRangeToFormat = record
hdc, hdcTarget: UINT_PTR;
rc, rcPage: TScintRectangle;
chrg: TScintRange;
end;
TScintEditStrings = class;
TScintCustomStyler = class;
EScintEditError = class(Exception);
TScintEdit = class(TWinControl)
private
FAcceptDroppedFiles: Boolean;
FAutoCompleteFontName: String;
FAutoCompleteFontSize: Integer;
FAutoCompleteStyle: Integer;
FChangeHistory: TScintChangeHistory;
FCodePage: Integer;
FDirectPtr: Pointer;
FDirectStatusFunction: SciFnDirectStatus;
FEffectiveCodePage: Integer;
FEffectiveCodePageDBCS: Boolean;
FFillSelectionToEdge: Boolean;
FFoldLevelNumbersOrLineState: Boolean;
FForceModified: Boolean;
FIndentationGuides: TScintIndentationGuides;
FLeadBytes: TScintRawCharSet;
FLineNumbers: Boolean;
FLines: TScintEditStrings;
FOnAutoCompleteSelection: TScintEditAutoCompleteSelectionEvent;
FOnCallTipArrowClick: TScintEditCallTipArrowClick;
FOnChange: TScintEditChangeEvent;
FOnCharAdded: TScintEditCharAddedEvent;
FOnDropFiles: TScintEditDropFilesEvent;
FOnHintShow: TScintEditHintShowEvent;
FOnMarginClick: TScintEditMarginClickEvent;
FOnMarginRightClick: TScintEditMarginClickEvent;
FOnModifiedChange: TNotifyEvent;
FOnUpdateUI: TScintEditUpdateUIEvent;
FOnZoom: TNotifyEvent;
FReportCaretPositionToStyler: Boolean;
FStyler: TScintCustomStyler;
FTabWidth: Integer;
FUseStyleAttributes: Boolean;
FUseTabCharacter: Boolean;
FVirtualSpaceOptions: TScintVirtualSpaceOptions;
FWordChars: AnsiString;
FWordCharsAsSet: TSysCharSet;
FWordWrap: Boolean;
procedure ApplyOptions;
procedure ForwardMessage(const Message: TMessage);
function GetAutoCompleteActive: Boolean;
function GetCallTipActive: Boolean;
function GetCaretColumn: Integer;
function GetCaretColumnExpandedForTabs: Integer;
function GetCaretLine: Integer;
function GetCaretLineText: String;
function GetCaretPosition: Integer;
function GetCaretPositionInLine: Integer;
function GetCaretVirtualSpace: Integer;
function GetInsertMode: Boolean;
function GetLineEndings: TScintLineEndings;
function GetLineEndingString: TScintRawString;
function GetLineHeight: Integer;
function GetLinesInWindow: Integer;
function GetMainSelText: String;
function GetModified: Boolean;
function GetRawCaretLineText: TScintRawString;
function GetRawMainSelText: TScintRawString;
function GetRawSelText: TScintRawString;
function GetRawText: TScintRawString;
function GetReadOnly: Boolean;
class function GetReplaceTargetMessage(const ReplaceMode: TScintReplaceMode): Cardinal;
class function GetSearchFlags(const Options: TScintFindOptions): Integer;
function GetSelection: TScintRange;
function GetSelectionAnchorPosition(Selection: Integer): Integer;
function GetSelectionAnchorVirtualSpace(Selection: Integer): Integer;
function GetSelectionCaretPosition(Selection: Integer): Integer;
function GetSelectionCaretVirtualSpace(Selection: Integer): Integer;
function GetSelectionCount: Integer;
function GetSelectionMode: TScintSelectionMode;
function GetSelText: String;
function GetTopLine: Integer;
function GetZoom: Integer;
procedure SetAcceptDroppedFiles(const Value: Boolean);
procedure SetAutoCompleteFontName(const Value: String);
procedure SetAutoCompleteFontSize(const Value: Integer);
procedure SetCodePage(const Value: Integer);
procedure SetCaretColumn(const Value: Integer);
procedure SetCaretLine(const Value: Integer);
procedure SetCaretPosition(const Value: Integer);
procedure SetCaretPositionWithSelectFromAnchor(const Value: Integer);
procedure SetCaretVirtualSpace(const Value: Integer);
procedure SetChangeHistory(const Value: TScintChangeHistory);
procedure SetFillSelectionToEdge(const Value: Boolean);
procedure SetFoldFlags(const Value: TScintFoldFlags);
procedure SetIndentationGuides(const Value: TScintIndentationGuides);
procedure SetLineNumbers(const Value: Boolean);
procedure SetMainSelection(const Value: Integer);
procedure SetMainSelText(const Value: String);
procedure SetRawMainSelText(const Value: TScintRawString);
procedure SetRawSelText(const Value: TScintRawString);
procedure SetRawText(const Value: TScintRawString);
procedure SetReadOnly(const Value: Boolean);
procedure SetSelection(const Value: TScintRange);
procedure SetSelectionAnchorPosition(Selection: Integer; const Value: Integer);
procedure SetSelectionAnchorVirtualSpace(Selection: Integer;
const Value: Integer);
procedure SetSelectionCaretPosition(Selection: Integer; const Value: Integer);
procedure SetSelectionCaretVirtualSpace(Selection: Integer;
const Value: Integer);
procedure SetSelectionMode(const Value: TScintSelectionMode);
procedure SetSelText(const Value: String);
procedure SetStyler(const Value: TScintCustomStyler);
procedure SetTabWidth(const Value: Integer);
procedure SetTopLine(const Value: Integer);
procedure SetUseStyleAttributes(const Value: Boolean);
procedure SetUseTabCharacter(const Value: Boolean);
procedure SetVirtualSpaceOptions(const Value: TScintVirtualSpaceOptions);
procedure SetWordWrap(const Value: Boolean);
procedure SetZoom(const Value: Integer);
procedure UpdateCodePage;
procedure UpdateLineNumbersWidth;
procedure CMColorChanged(var Message: TMessage); message CM_COLORCHANGED;
procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED;
procedure CMHintShow(var Message: TCMHintShow); message CM_HINTSHOW;
procedure CMSysColorChange(var Message: TMessage); message CM_SYSCOLORCHANGE;
procedure CNNotify(var Message: TWMNotify); message CN_NOTIFY;
procedure WMDestroy(var Message: TWMDestroy); message WM_DESTROY;
procedure WMDropFiles(var Message: TWMDropFiles); message WM_DROPFILES;
procedure WMEraseBkgnd(var Message: TMessage); message WM_ERASEBKGND;
procedure WMGetDlgCode(var Message: TWMGetDlgCode); message WM_GETDLGCODE;
procedure WMMouseWheel(var Message: TMessage); message WM_MOUSEWHEEL;
protected
procedure Change(const AInserting: Boolean; const AStartPos, ALength,
ALinesDelta: Integer); virtual;
procedure CheckPosRange(const StartPos, EndPos: Integer);
procedure CreateParams(var Params: TCreateParams); override;
procedure CreateWnd; override;
class function GetErrorException(const S: String): EScintEditError;
class procedure Error(const S: String); overload;
class procedure ErrorFmt(const S: String; const Args: array of const);
function GetMainSelection: Integer;
function GetTarget: TScintRange;
procedure InitRawString(var S: TScintRawString; const Len: Integer);
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure Notify(const N: TSCNotification); virtual;
procedure SetTarget(const StartPos, EndPos: Integer);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure AddMarker(const Line: Integer; const Marker: TScintMarkerNumber);
procedure AddSelection(const CaretPos, AnchorPos: Integer);
procedure AssignCmdKey(const Key: AnsiChar; const Shift: TShiftState;
const Command: TScintCommand); overload;
procedure AssignCmdKey(const KeyCode: TScintKeyCode; const Shift: TShiftState;
const Command: TScintCommand); overload;
procedure BeginUndoAction;
function Call(Msg: Cardinal; WParam: Longint; LParam: Longint): Longint; overload;
function Call(Msg: Cardinal; WParam: Longint; LParam: Longint; out WarnStatus: Integer): Longint; overload;
function Call(Msg: Cardinal; WParam: Longint; const LParamStr: TScintRawString): Longint; overload;
function Call(Msg: Cardinal; WParam: Longint; const LParamStr: TScintRawString; out WarnStatus: Integer): Longint; overload;
procedure CancelAutoComplete;
procedure CancelAutoCompleteAndCallTip;
procedure CancelCallTip;
function CanRedo: Boolean;
function CanUndo: Boolean;
procedure ChooseCaretX;
procedure ClearAll;
procedure ClearCmdKey(const Key: AnsiChar; const Shift: TShiftState); overload;
procedure ClearCmdKey(const KeyCode: TScintKeyCode; const Shift: TShiftState); overload;
procedure ClearIndicators(const IndicatorNumber: TScintIndicatorNumber);
procedure ClearSelection;
procedure ClearUndo(const ClearChangeHistory: Boolean = True);
function ConvertRawStringToString(const S: TScintRawString): String;
function ConvertPCharToRawString(const Text: PChar;
const TextLen: Integer): TScintRawString;
function ConvertStringToRawString(const S: String): TScintRawString;
procedure CopyToClipboard;
procedure CutToClipboard;
procedure DeleteAllMarkersOnLine(const Line: Integer);
procedure DeleteMarker(const Line: Integer; const Marker: TScintMarkerNumber);
procedure DPIChanged(const Message: TMessage);
procedure EndUndoAction;
procedure EnsureLineVisible(const Line: Integer);
function FindRawText(const StartPos, EndPos: Integer; const S: TScintRawString;
const Options: TScintFindOptions; out MatchRange: TScintRange): Boolean;
function FindText(const StartPos, EndPos: Integer; const S: String;
const Options: TScintFindOptions; out MatchRange: TScintRange): Boolean;
procedure FoldLine(const Line: Integer; const Fold: Boolean);
function FormatRange(const Draw: Boolean;
const RangeToFormat: PScintRangeToFormat): Integer;
procedure ForceModifiedState;
function GetByteAtPosition(const Pos: Integer): AnsiChar;
function GetCharacterCount(const StartPos, EndPos: Integer): Integer;
function GetColumnFromPosition(const Pos: Integer): Integer;
function GetDefaultWordChars: AnsiString;
function GetDocLineFromVisibleLine(const VisibleLine: Integer): Integer;
function GetIndicatorAtPosition(const IndicatorNumber: TScintIndicatorNumber;
const Pos: Integer): Boolean;
function GetLineEndPosition(const Line: Integer): Integer;
function GetLineFromPosition(const Pos: Integer): Integer;
function GetLineIndentation(const Line: Integer): Integer;
function GetLineIndentPosition(const Line: Integer): Integer;
function GetMarkers(const Line: Integer): TScintMarkerNumbers;
function GetPointFromPosition(const Pos: Integer): TPoint;
function GetPositionAfter(const Pos: Integer): Integer;
function GetPositionBefore(const Pos: Integer): Integer;
function GetPositionFromLine(const Line: Integer): Integer;
function GetPositionFromLineColumn(const Line, Column: Integer): Integer;
function GetPositionFromLineExpandedColumn(const Line, ExpandedColumn: Integer): Integer;
function GetPositionFromPoint(const P: TPoint;
const CharPosition, CloseOnly: Boolean): Integer;
function GetPositionOfMatchingBrace(const Pos: Integer): Integer;
function GetPositionRelative(const Pos, CharacterCount: Integer): Integer;
function GetRawTextLength: Integer;
function GetRawTextRange(const StartPos, EndPos: Integer): TScintRawString;
procedure GetSelections(const RangeList: TScintRangeList); overload;
procedure GetSelections(const CaretAndAnchorList: TScintCaretAndAnchorList); overload;
procedure GetSelections(const CaretAndAnchorList, VirtualSpacesList: TScintCaretAndAnchorList); overload;
function GetStyleAtPosition(const Pos: Integer): TScintStyleNumber;
function GetTextRange(const StartPos, EndPos: Integer): String;
function GetVisibleLineFromDocLine(const DocLine: Integer): Integer;
function GetWordEndPosition(const Pos: Integer; const OnlyWordChars: Boolean): Integer;
function GetWordStartPosition(const Pos: Integer; const OnlyWordChars: Boolean): Integer;
function IsPositionInViewVertically(const Pos: Integer): Boolean;
class function KeyCodeAndShiftToKeyDefinition(const KeyCode: TScintKeyCode;
Shift: TShiftState): TScintKeyDefinition;
function MainSelTextEquals(const S: String;
const Options: TScintFindOptions): Boolean;
class function KeyToKeyCode(const Key: AnsiChar): TScintKeyCode;
procedure PasteFromClipboard;
function RawMainSelTextEquals(const S: TScintRawString;
const Options: TScintFindOptions): Boolean;
class function RawStringIsBlank(const S: TScintRawString): Boolean;
procedure Redo;
procedure RemoveAdditionalSelections;
function ReplaceMainSelText(const S: String;
const ReplaceMode: TScintReplaceMode = srmNormal): TScintRange;
function ReplaceRawMainSelText(const S: TScintRawString;
const ReplaceMode: TScintReplaceMode = srmNormal): TScintRange;
function ReplaceRawTextRange(const StartPos, EndPos: Integer;
const S: TScintRawString; const ReplaceMode: TScintReplaceMode = srmNormal): TScintRange;
function ReplaceTextRange(const StartPos, EndPos: Integer; const S: String;
const ReplaceMode: TScintReplaceMode = srmNormal): TScintRange;
procedure RestyleLine(const Line: Integer);
procedure ScrollCaretIntoView;
procedure SelectAll;
procedure SelectAllOccurrences(const Options: TScintFindOptions);
procedure SelectAndEnsureVisible(const Range: TScintRange);
procedure SelectNextOccurrence(const Options: TScintFindOptions);
function SelEmpty: Boolean;
function SelNotEmpty(out Sel: TScintRange): Boolean;
procedure SetAutoCompleteFillupChars(const FillupChars: AnsiString);
procedure SetAutoCompleteSeparators(const Separator, TypeSeparator: AnsiChar);
procedure SetAutoCompleteSelectedItem(const S: TScintRawString);
procedure SetAutoCompleteStopChars(const StopChars: AnsiString);
procedure SetBraceBadHighlighting(const Pos: Integer);
procedure SetBraceHighlighting(const Pos1, Pos2: Integer);
procedure SetCursorID(const CursorID: Integer);
procedure SetCallTipHighlight(HighlightStart, HighlightEnd: Integer);
procedure SetDefaultWordChars;
procedure SetEmptySelection;
procedure SetEmptySelections;
procedure SetIndicators(const StartPos, EndPos: Integer;
const IndicatorNumber: TScintIndicatorNumber; const Value: Boolean);
procedure SetLineIndentation(const Line, Indentation: Integer);
procedure SetSavePoint;
procedure SetSingleSelection(const CaretPos, AnchorPos: Integer);
procedure SettingChange(const Message: TMessage);
procedure SetWordChars(const S: AnsiString);
procedure ShowAutoComplete(const CharsEntered: Integer; const WordList: AnsiString);
procedure ShowCallTip(const Pos: Integer; const Definition: AnsiString);
procedure StyleNeeded(const EndPos: Integer);
procedure SysColorChange(const Message: TMessage);
function TestRegularExpression(const S: String): Boolean;
function TestRawRegularExpression(const S: TScintRawString): Boolean;
procedure Undo;
procedure UpdateStyleAttributes;
function WordAtCursor: String;
function WordAtCursorRange: TScintRange;
procedure ZoomIn;
procedure ZoomOut;
property AutoCompleteActive: Boolean read GetAutoCompleteActive;
property CallTipActive: Boolean read GetCallTipActive;
property CaretColumn: Integer read GetCaretColumn write SetCaretColumn;
property CaretColumnExpandedForTabs: Integer read GetCaretColumnExpandedForTabs;
property CaretLine: Integer read GetCaretLine write SetCaretLine;
property CaretLineText: String read GetCaretLineText;
property CaretPosition: Integer read GetCaretPosition write SetCaretPosition;
property CaretPositionInLine: Integer read GetCaretPositionInLine;
property CaretPositionWithSelectFromAnchor: Integer write SetCaretPositionWithSelectFromAnchor;
property CaretVirtualSpace: Integer read GetCaretVirtualSpace write SetCaretVirtualSpace;
property EffectiveCodePage: Integer read FEffectiveCodePage;
property FoldFlags: TScintFoldFlags write SetFoldFlags;
property InsertMode: Boolean read GetInsertMode;
property LineEndings: TScintLineEndings read GetLineEndings;
property LineEndingString: TScintRawString read GetLineEndingString;
property LineHeight: Integer read GetLineHeight;
property Lines: TScintEditStrings read FLines;
property LinesInWindow: Integer read GetLinesInWindow;
property MainSelection: Integer read GetMainSelection write SetMainSelection;
property MainSelText: String read GetMainSelText write SetMainSelText;
property Modified: Boolean read GetModified;
property RawCaretLineText: TScintRawString read GetRawCaretLineText;
property RawMainSelText: TScintRawString read GetRawMainSelText write SetRawMainSelText;
property RawSelText: TScintRawString read GetRawSelText write SetRawSelText;
property RawText: TScintRawString read GetRawText write SetRawText;
property RawTextLength: Integer read GetRawTextLength;
property ReadOnly: Boolean read GetReadOnly write SetReadOnly;
property Selection: TScintRange read GetSelection write SetSelection;
property SelectionAnchorPosition[Selection: Integer]: Integer read GetSelectionAnchorPosition write SetSelectionAnchorPosition;
property SelectionAnchorVirtualSpace[Selection: Integer]: Integer read GetSelectionAnchorVirtualSpace write SetSelectionAnchorVirtualSpace;
property SelectionCaretPosition[Selection: Integer]: Integer read GetSelectionCaretPosition write SetSelectionCaretPosition;
property SelectionCaretVirtualSpace[Selection: Integer]: Integer read GetSelectionCaretVirtualSpace write SetSelectionCaretVirtualSpace;
property SelectionCount: Integer read GetSelectionCount;
property SelectionMode: TScintSelectionMode read GetSelectionMode write SetSelectionMode;
property SelText: String read GetSelText write SetSelText;
property Styler: TScintCustomStyler read FStyler write SetStyler;
property TopLine: Integer read GetTopLine write SetTopLine;
property WordChars: AnsiString read FWordChars;
property WordCharsAsSet: TSysCharSet read FWordCharsAsSet;
published
property AcceptDroppedFiles: Boolean read FAcceptDroppedFiles write SetAcceptDroppedFiles
default False;
property AutoCompleteFontName: String read FAutoCompleteFontName
write SetAutoCompleteFontName;
property AutoCompleteFontSize: Integer read FAutoCompleteFontSize
write SetAutoCompleteFontSize default 0;
property ChangeHistory: TScintChangeHistory read FChangeHistory write SetChangeHistory default schDisabled;
property CodePage: Integer read FCodePage write SetCodePage default CP_UTF8;
property Color;
property FillSelectionToEdge: Boolean read FFillSelectionToEdge write SetFillSelectionToEdge
default False;
property Font;
property IndentationGuides: TScintIndentationGuides read FIndentationGuides
write SetIndentationGuides default sigNone;
property LineNumbers: Boolean read FLineNumbers write SetLineNumbers default False;
property ParentFont;
property PopupMenu;
property ReportCaretPositionToStyler: Boolean read FReportCaretPositionToStyler
write FReportCaretPositionToStyler;
property TabStop default True;
property TabWidth: Integer read FTabWidth write SetTabWidth default 8;
property UseStyleAttributes: Boolean read FUseStyleAttributes write SetUseStyleAttributes
default True;
property UseTabCharacter: Boolean read FUseTabCharacter write SetUseTabCharacter
default True;
property VirtualSpaceOptions: TScintVirtualSpaceOptions read FVirtualSpaceOptions
write SetVirtualSpaceOptions default [];
property WordWrap: Boolean read FWordWrap write SetWordWrap default False;
property Zoom: Integer read GetZoom write SetZoom default 0;
property OnAutoCompleteSelection: TScintEditAutoCompleteSelectionEvent read FOnAutoCompleteSelection write FOnAutoCompleteSelection;
property OnCallTipArrowClick: TScintEditCallTipArrowClick read FOnCallTipArrowClick write FOnCallTipArrowClick;
property OnChange: TScintEditChangeEvent read FOnChange write FOnChange;
property OnCharAdded: TScintEditCharAddedEvent read FOnCharAdded write FOnCharAdded;
property OnDropFiles: TScintEditDropFilesEvent read FOnDropFiles write FOnDropFiles;
property OnHintShow: TScintEditHintShowEvent read FOnHintShow write FOnHintShow;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMarginClick: TScintEditMarginClickEvent read FOnMarginClick write FOnMarginClick;
property OnMarginRightClick: TScintEditMarginClickEvent read FOnMarginRightClick write FOnMarginRightClick;
property OnModifiedChange: TNotifyEvent read FOnModifiedChange write FOnModifiedChange;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnUpdateUI: TScintEditUpdateUIEvent read FOnUpdateUI write FOnUpdateUI;
property OnZoom: TNotifyEvent read FOnZoom write FOnZoom;
end;
TScintEditStrings = class(TStrings)
private
FEdit: TScintEdit;
function GetLineEndingLength(const Index: Integer): Integer;
function GetRawLine(Index: Integer): TScintRawString;
function GetRawLineWithEnding(Index: Integer): TScintRawString;
function GetRawLineLength(Index: Integer): Integer;
function GetRawLineLengthWithEnding(Index: Integer): Integer;
function GetState(Index: Integer): TScintLineState;
procedure PutRawLine(Index: Integer; const S: TScintRawString);
protected
procedure CheckIndexRange(const Index: Integer);
procedure CheckIndexRangePlusOne(const Index: Integer);
function Get(Index: Integer): String; override;
function GetCount: Integer; override;
function GetTextStr: String; override;
procedure Put(Index: Integer; const S: String); override;
procedure SetTextStr(const Value: String); override;
public
procedure Clear; override;
procedure Delete(Index: Integer); override;
procedure Insert(Index: Integer; const S: String); override;
procedure InsertRawLine(Index: Integer; const S: TScintRawString);
procedure SetText(Text: PChar); override;
property RawLineLengths[Index: Integer]: Integer read GetRawLineLength;
property RawLineLengthsWithEnding[Index: Integer]: Integer read GetRawLineLengthWithEnding;
property RawLines[Index: Integer]: TScintRawString read GetRawLine write PutRawLine;
property RawLinesWithEnding[Index: Integer]: TScintRawString read GetRawLineWithEnding;
property State[Index: Integer]: TScintLineState read GetState;
end;
TScintStyleAttributes = record
FontName: String;
FontSize: Integer;
FontStyle: TFontStyles;
FontCharset: TFontCharset;
ForeColor: TColor;
BackColor: TColor;
end;
TScintCustomStyler = class(TComponent)
private
FCaretIndex: Integer;
FCurIndex: Integer;
FLineState: TScintLineState;
FStyleStartIndex: Integer;
FStyleStr: AnsiString;
FText: TScintRawString;
FTextLen: Integer;
function GetCurChar: AnsiChar;
function GetEndOfLine: Boolean;
protected
procedure ApplyStyleByteIndicators(const Indicators: TScintStyleByteIndicatorNumbers;
StartIndex, EndIndex: Integer);
procedure ApplyStyle(const Style: TScintStyleNumber;
StartIndex, EndIndex: Integer);
procedure CommitStyle(const Style: TScintStyleNumber);
function ConsumeAllRemaining: Boolean;
function ConsumeChar(const C: AnsiChar): Boolean;
function ConsumeCharIn(const Chars: TScintRawCharSet): Boolean;
function ConsumeChars(const Chars: TScintRawCharSet): Boolean;
function ConsumeCharsNot(const Chars: TScintRawCharSet): Boolean;
function ConsumeString(const Chars: TScintRawCharSet): TScintRawString;
function CurCharIn(const Chars: TScintRawCharSet): Boolean;
function CurCharIs(const C: AnsiChar): Boolean;
procedure GetFoldLevel(const LineState, PreviousLineState: TScintLineState;
var Level: Integer; var Header, EnableHeaderOnPrevious: Boolean); virtual; abstract;
procedure GetStyleAttributes(const Style: Integer;
var Attributes: TScintStyleAttributes); virtual; abstract;
function LineTextSpans(const S: TScintRawString): Boolean; virtual;
function NextCharIs(const C: AnsiChar): Boolean;
function PreviousCharIn(const Chars: TScintRawCharSet): Boolean;
procedure ResetCurIndexTo(Index: Integer);
procedure ReplaceText(StartIndex, EndIndex: Integer; const C: AnsiChar);
procedure StyleNeeded; virtual; abstract;
property CaretIndex: Integer read FCaretIndex;
property CurChar: AnsiChar read GetCurChar;
property CurIndex: Integer read FCurIndex;
property EndOfLine: Boolean read GetEndOfLine;
property LineState: TScintLineState read FLineState write FLineState;
property StyleStartIndex: Integer read FStyleStartIndex;
property Text: TScintRawString read FText;
property TextLength: Integer read FTextLen;
end;
TScintPixmap = class
private
class var ColorCodes: String;
class constructor Create;
type TPixmap = array of AnsiString;
var FPixmap: TPixmap;
function GetPixmap: Pointer;
public
procedure InitializeFromBitmap(const ABitmap: TBitmap; const TransparentColor: TColorRef);
property Pixmap: Pointer read GetPixmap;
end;
implementation
uses
ShellAPI, RTLConsts, UITypes, GraphUtil;
{ TScintEdit }
const
AUTOCSETSEPARATOR = #9;
constructor TScintEdit.Create(AOwner: TComponent);
begin
inherited;
FCodePage := CP_UTF8;
FLines := TScintEditStrings.Create;
FLines.FEdit := Self;
FTabWidth := 8;
FUseStyleAttributes := True;
FUseTabCharacter := True;
SetBounds(0, 0, 257, 193);
ParentColor := False;
TabStop := True;
end;
destructor TScintEdit.Destroy;
begin
SetStyler(nil);
FLines.Free;
FLines := nil;
inherited;
end;
procedure TScintEdit.AddMarker(const Line: Integer;
const Marker: TScintMarkerNumber);
begin
FLines.CheckIndexRange(Line);
Call(SCI_MARKERADD, Line, Marker);
end;
procedure TScintEdit.AddSelection(const CaretPos, AnchorPos: Integer);
{ Adds a new selection as the main selection retaining all other selections as
additional selections without scrolling the caret into view. The first
selection should be added with SetSingleSelection. }
begin
Call(SCI_ADDSELECTION, CaretPos, AnchorPos);
end;
procedure TScintEdit.ApplyOptions;
const
IndentationGuides: array [TScintIndentationGuides] of Integer = (SC_IV_NONE, SC_IV_REAL,
SC_IV_LOOKFORWARD, SC_IV_LOOKBOTH);
var
Flags: Integer;
begin
if not HandleAllocated then
Exit;
Call(SCI_SETSELEOLFILLED, Ord(FFillSelectionToEdge), 0);
Call(SCI_SETTABWIDTH, FTabWidth, 0);
Call(SCI_SETUSETABS, Ord(FUseTabCharacter), 0);
Flags := 0;
if svsRectangularSelection in VirtualSpaceOptions then
Flags := Flags or SCVS_RECTANGULARSELECTION;
if svsUserAccessible in VirtualSpaceOptions then
Flags := Flags or SCVS_USERACCESSIBLE;
if svsNoWrapLineStart in VirtualSpaceOptions then
Flags := Flags or SCVS_NOWRAPLINESTART;
Call(SCI_SETVIRTUALSPACEOPTIONS, Flags, 0);
Call(SCI_SETWRAPMODE, Ord(FWordWrap), 0);
Call(SCI_SETINDENTATIONGUIDES, IndentationGuides[FIndentationGuides], 0);
{ If FChangeHistory is not schDisabled then next call to ClearUndo will enable
change history and else we should disable it now }
if FChangeHistory = schDisabled then
Call(SCI_SETCHANGEHISTORY, SC_CHANGE_HISTORY_DISABLED, 0);
end;
procedure TScintEdit.AssignCmdKey(const Key: AnsiChar; const Shift: TShiftState;
const Command: TScintCommand);
begin
AssignCmdKey(KeyToKeyCode(Key), Shift, Command);
end;
procedure TScintEdit.AssignCmdKey(const KeyCode: TScintKeyCode;
const Shift: TShiftState; const Command: TScintCommand);
begin
Call(SCI_ASSIGNCMDKEY, KeyCodeAndShiftToKeyDefinition(KeyCode, Shift), Command);
end;
procedure TScintEdit.BeginUndoAction;
begin
Call(SCI_BEGINUNDOACTION, 0, 0);
end;
function TScintEdit.Call(Msg: Cardinal; WParam: Longint; LParam: Longint): Longint;
begin
var Dummy: Integer;
Result := Call(Msg, WParam, LParam, Dummy);
end;
function TScintEdit.Call(Msg: Cardinal; WParam: Longint; LParam: Longint;
out WarnStatus: Integer): Longint;
begin
HandleNeeded;
if FDirectPtr = nil then
Error('Call: FDirectPtr is nil');
if not Assigned(FDirectStatusFunction) then
Error('Call: FDirectStatusFunction is nil');
var ErrorStatus: Integer;
Result := FDirectStatusFunction(FDirectPtr, Msg, WParam, LParam, ErrorStatus);
if ErrorStatus <> 0 then begin
var Dummy: Integer;
FDirectStatusFunction(FDirectPtr, SCI_SETSTATUS, 0, 0, Dummy);
if ErrorStatus < SC_STATUS_WARN_START then
ErrorFmt('Error status %d returned after Call(%u, %d, %d) = %d',
[ErrorStatus, Msg, WParam, LParam, Result]);
end;
WarnStatus := ErrorStatus;
end;
function TScintEdit.Call(Msg: Cardinal; WParam: Longint;
const LParamStr: TScintRawString): Longint;
begin
var Dummy: Integer;
Result := Call(Msg, WParam, LParamStr, Dummy);
end;
function TScintEdit.Call(Msg: Cardinal; WParam: Longint;
const LParamStr: TScintRawString; out WarnStatus: Integer): Longint;
begin
Result := Call(Msg, WParam, LPARAM(PAnsiChar(LParamStr)), WarnStatus);
end;
procedure TScintEdit.CancelAutoComplete;
begin
Call(SCI_AUTOCCANCEL, 0, 0);
end;
procedure TScintEdit.CancelAutoCompleteAndCallTip;
begin
CancelAutoComplete;
CancelCallTip;
end;
procedure TScintEdit.CancelCallTip;
begin
Call(SCI_CALLTIPCANCEL, 0, 0);
end;
function TScintEdit.CanRedo: Boolean;
begin
Result := Call(SCI_CANREDO, 0, 0) <> 0;
end;
function TScintEdit.CanUndo: Boolean;
begin
Result := Call(SCI_CANUNDO, 0, 0) <> 0;
end;
procedure TScintEdit.Change(const AInserting: Boolean;
const AStartPos, ALength, ALinesDelta: Integer);
var
Info: TScintEditChangeInfo;
begin
inherited Changed;
if Assigned(FOnChange) then begin
Info.Inserting := AInserting;
Info.StartPos := AStartPos;
Info.Length := ALength;
Info.LinesDelta := ALinesDelta;
FOnChange(Self, Info);
end;
end;
procedure TScintEdit.CheckPosRange(const StartPos, EndPos: Integer);
begin
if (StartPos < 0) or (StartPos > EndPos) or (EndPos > GetRawTextLength) then
ErrorFmt('CheckPosRange: Invalid range (%d, %d)', [StartPos, EndPos]);
end;
procedure TScintEdit.ChooseCaretX;
begin
Call(SCI_CHOOSECARETX, 0, 0);
end;
procedure TScintEdit.ClearAll;
begin
Call(SCI_CLEARALL, 0, 0);
ChooseCaretX;
end;
procedure TScintEdit.ClearCmdKey(const Key: AnsiChar; const Shift: TShiftState);
begin
ClearCmdKey(KeyToKeyCode(Key), Shift);
end;
procedure TScintEdit.ClearCmdKey(const KeyCode: TScintKeyCode; const Shift: TShiftState);
begin
Call(SCI_CLEARCMDKEY, KeyCodeAndShiftToKeyDefinition(KeyCode, Shift), 0);
end;
procedure TScintEdit.ClearIndicators(
const IndicatorNumber: TScintIndicatorNumber);
begin
Call(SCI_SETINDICATORCURRENT, IndicatorNumber, 0);
Call(SCI_INDICATORCLEARRANGE, 0, RawTextLength);
end;
procedure TScintEdit.ClearSelection;
begin
Call(SCI_CLEAR, 0, 0);
end;
procedure TScintEdit.ClearUndo(const ClearChangeHistory: Boolean);
begin
{ SCI_EMPTYUNDOBUFFER resets the save point but doesn't send a
SCN_SAVEPOINTREACHED notification. Call SetSavePoint manually to get
that. SetSavePoint additionally resets FForceModified. }
SetSavePoint;
Call(SCI_EMPTYUNDOBUFFER, 0, 0);
if ClearChangeHistory and (FChangeHistory <> schDisabled) then begin
Call(SCI_SETCHANGEHISTORY, SC_CHANGE_HISTORY_DISABLED, 0);
var Flags := SC_CHANGE_HISTORY_ENABLED;
if FChangeHistory = schMarkers then
Flags := Flags or SC_CHANGE_HISTORY_MARKERS
else
Flags := Flags or SC_CHANGE_HISTORY_INDICATORS;
Call(SCI_SETCHANGEHISTORY, Flags, 0);
end;
end;
function TScintEdit.ConvertRawStringToString(const S: TScintRawString): String;
var
SrcLen, DestLen: Integer;
DestStr: UnicodeString;
begin
SrcLen := Length(S);
if SrcLen > 0 then begin
DestLen := MultiByteToWideChar(FCodePage, 0, PAnsiChar(S), SrcLen, nil, 0);
if DestLen <= 0 then
Error('MultiByteToWideChar failed');
SetString(DestStr, nil, DestLen);
if MultiByteToWideChar(FCodePage, 0, PAnsiChar(S), SrcLen, @DestStr[1],
Length(DestStr)) <> DestLen then
Error('Unexpected result from MultiByteToWideChar');
end;
Result := DestStr;
end;
function TScintEdit.ConvertPCharToRawString(const Text: PChar;
const TextLen: Integer): TScintRawString;
var
DestLen: Integer;
DestStr: TScintRawString;
begin
if TextLen > 0 then begin
DestLen := WideCharToMultiByte(FCodePage, 0, Text, TextLen, nil, 0, nil, nil);
if DestLen <= 0 then
Error('WideCharToMultiByte failed');
InitRawString(DestStr, DestLen);
if WideCharToMultiByte(FCodePage, 0, Text, TextLen, @DestStr[1], Length(DestStr),
nil, nil) <> DestLen then
Error('Unexpected result from WideCharToMultiByte');
end;
Result := DestStr;
end;
function TScintEdit.ConvertStringToRawString(const S: String): TScintRawString;
begin
Result := ConvertPCharToRawString(PChar(S), Length(S));
end;
procedure TScintEdit.CopyToClipboard;
begin
Call(SCI_COPY, 0, 0);
end;
procedure TScintEdit.CreateParams(var Params: TCreateParams);
begin
inherited;
CreateSubClass(Params, 'Scintilla');
//Params.ExStyle := Params.ExStyle or WS_EX_CLIENTEDGE;
Params.WindowClass.style := Params.WindowClass.style and
not (CS_HREDRAW or CS_VREDRAW);
end;
procedure TScintEdit.CreateWnd;
begin
if IsscintLibary = 0 then
Error('CreateWnd: IsscintLibary is 0');
inherited;
FDirectPtr := Pointer(SendMessage(Handle, SCI_GETDIRECTPOINTER, 0, 0));
if FDirectPtr = nil then
Error('CreateWnd: FDirectPtr is nil');
FDirectStatusFunction := SciFnDirectStatus(SendMessage(Handle, SCI_GETDIRECTSTATUSFUNCTION, 0, 0));
if not Assigned(FDirectStatusFunction) then
Error('CreateWnd: FDirectStatusFunction is nil');
UpdateCodePage;
Call(SCI_SETCOMMANDEVENTS, 0, 0);
Call(SCI_SETMODEVENTMASK, SC_MOD_INSERTTEXT or SC_MOD_DELETETEXT, 0);
Call(SCI_SETCARETPERIOD, GetCaretBlinkTime, 0);
Call(SCI_SETSCROLLWIDTHTRACKING, 1, 0);
{ The default popup menu conflicts with the VCL's PopupMenu }
Call(SCI_USEPOPUP, 0, 0);
SetDefaultWordChars;
ApplyOptions;
UpdateStyleAttributes;
if FAcceptDroppedFiles then
DragAcceptFiles(Handle, True);
end;
procedure TScintEdit.CutToClipboard;
begin
Call(SCI_CUT, 0, 0);
end;
procedure TScintEdit.DeleteAllMarkersOnLine(const Line: Integer);
begin
FLines.CheckIndexRange(Line);
Call(SCI_MARKERDELETE, Line, -1);
end;
procedure TScintEdit.DeleteMarker(const Line: Integer;
const Marker: TScintMarkerNumber);
begin
FLines.CheckIndexRange(Line);
Call(SCI_MARKERDELETE, Line, Marker);
end;
procedure TScintEdit.EndUndoAction;
begin
Call(SCI_ENDUNDOACTION, 0, 0);
end;
procedure TScintEdit.EnsureLineVisible(const Line: Integer);
begin
FLines.CheckIndexRange(Line);
Call(SCI_ENSUREVISIBLE, Line, 0);
end;
class function TScintEdit.GetErrorException(const S: String): EScintEditError;
{ Can be used when just calling Error would cause a compiler warning because it doesn't realize Error always raises }
begin
Result := EScintEditError.Create('TScintEdit error: ' + S);
end;
class procedure TScintEdit.Error(const S: String);
begin
raise GetErrorException(S);
end;
class procedure TScintEdit.ErrorFmt(const S: String; const Args: array of const);
begin
Error(Format(S, Args));
end;
function TScintEdit.FindRawText(const StartPos, EndPos: Integer;
const S: TScintRawString; const Options: TScintFindOptions;
out MatchRange: TScintRange): Boolean;
begin
SetTarget(StartPos, EndPos);
Call(SCI_SETSEARCHFLAGS, GetSearchFlags(Options), 0);
Result := Call(SCI_SEARCHINTARGET, Length(S), S) >= 0;
if Result then
MatchRange := GetTarget;
end;
function TScintEdit.FindText(const StartPos, EndPos: Integer; const S: String;
const Options: TScintFindOptions; out MatchRange: TScintRange): Boolean;
begin
Result := FindRawText(StartPos, EndPos, ConvertStringToRawString(S),
Options, MatchRange);
end;
procedure TScintEdit.FoldLine(const Line: Integer; const Fold: Boolean);
begin
FLines.CheckIndexRange(Line);
{ If the line is not part of a fold the following will return False }
var Folded := Call(SCI_GETFOLDEXPANDED, Line, 0) = 0;
if Fold <> Folded then begin
{ If the line is not part of a fold the following will do nothing
and else if the line is not the header Scintilla will lookup the
header for us }
Call(SCI_TOGGLEFOLD, Line, 0);
end;
end;
procedure TScintEdit.ForceModifiedState;
begin
if not FForceModified then begin
FForceModified := True;
if Assigned(FOnModifiedChange) then
FOnModifiedChange(Self);
end;
end;
function TScintEdit.FormatRange(const Draw: Boolean;
const RangeToFormat: PScintRangeToFormat): Integer;
begin
Result := Call(SCI_FORMATRANGE, Ord(Draw), LPARAM(RangeToFormat));
end;
procedure TScintEdit.ForwardMessage(const Message: TMessage);
begin
if HandleAllocated then
CallWindowProc(DefWndProc, Handle, Message.Msg, Message.WParam, Message.LParam);
end;
function TScintEdit.GetAutoCompleteActive: Boolean;
begin
Result := Call(SCI_AUTOCACTIVE, 0, 0) <> 0;
end;
function TScintEdit.GetByteAtPosition(const Pos: Integer): AnsiChar;
begin
Result := AnsiChar(Call(SCI_GETCHARAT, Pos, 0));
end;
function TScintEdit.GetCallTipActive: Boolean;
begin
Result := Call(SCI_CALLTIPACTIVE, 0, 0) <> 0;
end;
function TScintEdit.GetCaretColumn: Integer;
begin
Result := GetColumnFromPosition(GetCaretPosition);
end;
function TScintEdit.GetCaretColumnExpandedForTabs: Integer;
begin
Result := Call(SCI_GETCOLUMN, GetCaretPosition, 0);
Inc(Result, GetCaretVirtualSpace);
end;
function TScintEdit.GetCaretLine: Integer;
begin
Result := GetLineFromPosition(GetCaretPosition);
end;
function TScintEdit.GetCaretLineText: String;
begin
Result := ConvertRawStringToString(GetRawCaretLineText);