mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-10 14:08:14 +02:00
SourceEditor, PascalScriptMacro: Add property LinesCount. Issue #37778 Patch by Domingo Galmés
git-svn-id: trunk@63893 -
This commit is contained in:
parent
cb166633f6
commit
7b179bcf72
@ -72,6 +72,8 @@ const
|
||||
//PropReadId_TextBetweenPointsEx = 15x;
|
||||
//PropWriteId_TextBetweenPointsEx = 15x;
|
||||
FunctionId_SetTextBetweenPoints = 157;
|
||||
PropReadId_LinesCount = 158;
|
||||
PropWriteId_LinesCount = 159;
|
||||
|
||||
FunctionId_CopyToClipboard = 160;
|
||||
FunctionId_CutToClipboard = 161;
|
||||
@ -721,6 +723,16 @@ begin
|
||||
PropWriteId_Lines: begin //
|
||||
assert(false, 'read only');
|
||||
end;
|
||||
PropReadId_LinesCount: begin //
|
||||
CheckMinParamCount(1, 'TSynEdit.LinesCount (r)');
|
||||
Result := GetSynEditFromStack(-2, Obj);
|
||||
if not Result then
|
||||
exit;
|
||||
Stack.SetInt(-1, Obj.Lines.Count);
|
||||
end;
|
||||
PropWriteId_LinesCount: begin //
|
||||
assert(false, 'read only');
|
||||
end;
|
||||
PropReadId_LineAtCaret: begin //
|
||||
CheckMinParamCount(1, 'TSynEdit.LineAtCaret (r)');
|
||||
Result := GetSynEditFromStack(-2, Obj);
|
||||
@ -917,6 +929,7 @@ procedure TSynEdit_SelMode_R(Self: TSynEdit; var M: TSynSelectionMode); begin
|
||||
|
||||
// Text
|
||||
procedure TSynEdit_Lines_R(Self: TSynEdit; var S: string; I: Longint); begin S := Self.Lines[I]; end;
|
||||
procedure TSynEdit_LinesCount_R(Self: TSynEdit; var C: integer); begin C := Self.Lines.Count; end;
|
||||
procedure TSynEdit_LineAtCaret_R(Self: TSynEdit; var S: string); begin S := Self.Lines[Self.CaretY-1]; end;
|
||||
|
||||
procedure TSynEdit_TextBetweenPoints_W(Self: TSynEdit; M: String; P1, P2: TPoint);
|
||||
@ -1103,6 +1116,7 @@ begin
|
||||
|
||||
// Text
|
||||
RegisterProperty('Lines', 'String Integer', iptR);
|
||||
RegisterProperty('LinesCount', 'Integer', iptR);
|
||||
RegisterProperty('LineAtCaret', 'String', iptR); // LineText
|
||||
RegisterMethod('procedure InsertTextAtCaret(aText: String; aCaretMode : TSynCaretAdjustMode);'); // = scamEnd
|
||||
RegisterProperty('TextBetweenPoints', 'String TPoint TPoint', iptRW);
|
||||
@ -1160,6 +1174,7 @@ begin
|
||||
RegisterMethodName('SEARCHREPLACEEX', @ExecBasicHandler, Pointer(FunctionId_SearchReplaceEx), nil);
|
||||
|
||||
RegisterPropertyNameHelper('LINES', @ExecBasicHandler, Pointer(PropReadId_Lines), nil, Pointer(PropWriteId_Lines), nil);
|
||||
RegisterPropertyNameHelper('LINESCOUNT', @ExecBasicHandler, Pointer(PropReadId_LinesCount), nil, Pointer(PropWriteId_LinesCount), nil);
|
||||
RegisterPropertyNameHelper('LINEATCARET', @ExecBasicHandler, Pointer(PropReadId_LineAtCaret), nil, Pointer(PropWriteId_LineAtCaret), nil);
|
||||
RegisterMethodName('INSERTTEXTATCARET', @ExecBasicHandler, Pointer(FunctionId_InsertTextAtCaret), nil);
|
||||
|
||||
@ -1208,6 +1223,7 @@ begin
|
||||
RegisterMethod(@TEmsSynWrapper.EMS_SearchReplaceEx, 'SEARCHREPLACEEX');
|
||||
|
||||
RegisterPropertyHelper(@TSynEdit_Lines_R, nil, 'LINES');
|
||||
RegisterPropertyHelper(@TSynEdit_LinesCount_R, nil, 'LINESCOUNT');
|
||||
RegisterPropertyHelper(@TSynEdit_LineAtCaret_R, nil, 'LINEATCARET');
|
||||
RegisterMethod(@TEmsSynWrapper.EMS_InsertTextAtCaret, 'INSERTTEXTATCARET');
|
||||
|
||||
|
@ -64,6 +64,7 @@ Dimitrios Chr. Ioannidis
|
||||
Diogo Piçarra
|
||||
Dirk Schiphorst
|
||||
Dmitry Boyarintsev
|
||||
Domingo Galmés
|
||||
Dominique Louis
|
||||
Don Siders
|
||||
Ere Maijala
|
||||
|
Loading…
Reference in New Issue
Block a user