File tree Expand file tree Collapse file tree 3 files changed +37
-4
lines changed
Expand file tree Collapse file tree 3 files changed +37
-4
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,8 @@ procedure TDelphiAIDevCodeCompletionSearch.Process(const AContext: IOTAKeyContex
9191 Abort;
9292 end ;
9393
94+ // Pegar o nome da tab da unit aberta
95+ FVars.Module := TUtilsOTA.GetCurrentModule;
9496 FVars.Contents.Text := TUtils.ConfReturnAI(FAI.Response.Text);
9597
9698 LRow := LIOTAEditPosition.Row;
Original file line number Diff line number Diff line change @@ -4,11 +4,14 @@ interface
44
55uses
66 System.SysUtils,
7- System.Classes;
7+ System.Classes,
8+ ToolsAPI;
89
910type
1011 TDelphiAIDevCodeCompletionVars = class
1112 private
13+ FRelease: Boolean;
14+ FModule: IOTAModule;
1215 FLineIni: Integer;
1316 FLineEnd: Integer;
1417 FRow: Integer;
@@ -19,6 +22,8 @@ TDelphiAIDevCodeCompletionVars = class
1922 class function GetInstance : TDelphiAIDevCodeCompletionVars;
2023 destructor Destroy; override;
2124 procedure Clear ;
25+ property Release: Boolean read FRelease write FRelease;
26+ property Module : IOTAModule read FModule write FModule;
2227 property LineIni: Integer read FLineIni write FLineIni;
2328 property LineEnd: Integer read FLineEnd write FLineEnd;
2429 property Row: Integer read FRow write FRow;
@@ -53,6 +58,8 @@ destructor TDelphiAIDevCodeCompletionVars.Destroy;
5358
5459procedure TDelphiAIDevCodeCompletionVars.Clear ;
5560begin
61+ FRelease := False;
62+ FModule := nil ;
5663 FLineIni := 0 ;
5764 FLineEnd := 0 ;
5865 FRow := 0 ;
Original file line number Diff line number Diff line change @@ -96,11 +96,13 @@ procedure TDelphiAIDevIDENTAEditViewNotifier.EditorIdle(const View: IOTAEditView
9696begin
9797 TUtilsOTA.GetCursorPosition(LRow, LColumn);
9898
99- if LVars.LineIni > 0 then
99+ // if LVars.LineIni > 0 then
100+ if not LVars.Release then
100101 if (LRow <> LVars.Row) or (LColumn <> LVars.Column) then
101102 begin
102- LVars.LineIni := 0 ;
103- LVars.Clear;
103+ // LVars.LineIni := 0;
104+ // LVars.Clear;
105+ LVars.Release := True;
104106 TUtils.AddLog(' EditorIdle' );
105107 end ;
106108end ;
@@ -120,6 +122,8 @@ procedure TDelphiAIDevIDENTAEditViewNotifier.PaintLine(const View: IOTAEditView;
120122 const Canvas: TCanvas; const TextRect: TRect; const LineRect: TRect; const CellSize: TSize);
121123var
122124 LLineText: string;
125+ LColCurrent: Integer;
126+ LLineCurrent: Integer;
123127begin
124128 if LineNumber < 1 then
125129 Exit;
@@ -132,6 +136,26 @@ procedure TDelphiAIDevIDENTAEditViewNotifier.PaintLine(const View: IOTAEditView;
132136 // if LineNumber <> View.CursorPos.Line then
133137 // Exit;
134138
139+ // verificar o nome da tab da unit aberta
140+ if LVars.Release then
141+ begin
142+ LVars.Release := False;
143+
144+ // **
145+ LColCurrent := View .CursorPos.Col;
146+ LLineCurrent := View .CursorPos.Line;
147+ // **
148+ try
149+ View .Buffer.EditPosition.Move(LVars.LineIni, 2 );
150+ View .Buffer.EditPosition.Delete(Pred(LVars.Contents.Count));
151+ finally
152+ LVars.Clear;
153+ // **
154+ View .Buffer.EditPosition.Move(LLineCurrent, LColCurrent);
155+ // **
156+ end ;
157+ end ;
158+
135159 if (LineNumber >= LVars.LineIni)and (LineNumber < LVars.LineEnd) then
136160 begin
137161 Canvas.Brush.Style := bsClear;
You can’t perform that action at this time.
0 commit comments