@@ -27,10 +27,14 @@ function CnOtaGetTopMostEditView: IOTAEditView;
2727function CnOtaEditPosToLinePos (EditPos: TOTAEditPos; EditView: IOTAEditView = nil ): Integer;
2828function OTAEditPos (Col: SmallInt; Line: Longint): TOTAEditPos;
2929function CnOtaGetCurrLineText (var Text: string; var LineNo: Integer; var CharIndex: Integer; View : IOTAEditView = nil ): Boolean;
30- function GetCurrentLine (const AEditView: IOTAEditView): string;
30+ function GetCurrentLineOrBlock (const AEditView: IOTAEditView): string;
3131
3232implementation
3333
34+ uses
35+ DelphiAiDev.Utils,
36+ DelphiAiDev.Utils.OTA;
37+
3438function QuerySvcs (const Instance: IUnknown; const Intf: TGUID; out Inst): Boolean;
3539begin
3640 Result := (Instance <> nil ) and Supports(Instance, Intf, Inst);
@@ -98,7 +102,7 @@ function CnOtaGetCurrLineText(var Text: string; var LineNo: Integer; var CharInd
98102 OutStr: AnsiString;
99103begin
100104 Result := False;
101- // teste
105+
102106 if not Assigned(View )then
103107 View := CnOtaGetTopMostEditView;
104108 if not Assigned(View ) then
@@ -130,14 +134,11 @@ function CnOtaGetCurrLineText(var Text: string; var LineNo: Integer; var CharInd
130134 Result := True;
131135end ;
132136
133- function GetCurrentLine (const AEditView: IOTAEditView): string;
137+ function GetCurrentLineOrBlock (const AEditView: IOTAEditView): string;
134138var
135- TextLen: Integer;
136- StartPos: Integer;
137- EndPos: Integer;
138- LineNo: Integer;
139- CharIndex: Integer;
140- LineText: String;
139+ LLineText: string;
140+ LLineNo: Integer;
141+ LCharIndex: Integer;
141142begin
142143 Result := ' ' ;
143144// if IsEditControl(Screen.ActiveControl) and Assigned(AEditView) then
@@ -148,32 +149,11 @@ function GetCurrentLine(const AEditView: IOTAEditView): string;
148149 Exit;
149150
150151 if AEditView.Block.IsValid then
151- begin
152- // StartPos := CnOtaEditPosToLinePos(OTAEditPos(AEditView.Block.StartingColumn,
153- // AEditView.Block.StartingRow), AEditView);
154- // EndPos := CnOtaEditPosToLinePos(OTAEditPos(AEditView.Block.EndingColumn,
155- // AEditView.Block.EndingRow), AEditView);
156- // TextLen := AEditView.Block.Size;
157- //
158- // {$IFDEF UNICODE}
159- // CnOtaInsertTextIntoEditorAtPosW(AEditView.Block.Text, StartPos, AEditView.Buffer);
160- // {$ELSE}
161- // CnOtaInsertTextIntoEditorAtPos(ConvertEditorTextToText(AEditView.Block.Text), StartPos, AEditView.Buffer);
162- // {$ENDIF}
163- // AEditView.CursorPos := CnOtaLinePosToEditPos(StartPos + TextLen);
164- // AEditView.Block.BeginBlock;
165- // AEditView.CursorPos := CnOtaLinePosToEditPos(EndPos + TextLen);
166- // AEditView.Block.EndBlock;
167- //
168- // AEditView.Paint;
169- end
152+ Result := TUtilsOTA.GetBlockTextSelect
170153 else
171154 begin
172- CnOtaGetCurrLineText(LineText, LineNo, CharIndex);
173- Result := LineText;
174-
175- // Inc(LineNo);
176- // CnOtaInsertSingleLine(LineNo, LineText, AEditView);
155+ CnOtaGetCurrLineText(LLineText, LLineNo, LCharIndex);
156+ Result := LLineText;
177157 end ;
178158end ;
179159
0 commit comments