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
91
91
Abort;
92
92
end ;
93
93
94
+ // Pegar o nome da tab da unit aberta
95
+ FVars.Module := TUtilsOTA.GetCurrentModule;
94
96
FVars.Contents.Text := TUtils.ConfReturnAI(FAI.Response.Text);
95
97
96
98
LRow := LIOTAEditPosition.Row;
Original file line number Diff line number Diff line change @@ -4,11 +4,14 @@ interface
4
4
5
5
uses
6
6
System.SysUtils,
7
- System.Classes;
7
+ System.Classes,
8
+ ToolsAPI;
8
9
9
10
type
10
11
TDelphiAIDevCodeCompletionVars = class
11
12
private
13
+ FRelease: Boolean;
14
+ FModule: IOTAModule;
12
15
FLineIni: Integer;
13
16
FLineEnd: Integer;
14
17
FRow: Integer;
@@ -19,6 +22,8 @@ TDelphiAIDevCodeCompletionVars = class
19
22
class function GetInstance : TDelphiAIDevCodeCompletionVars;
20
23
destructor Destroy; override;
21
24
procedure Clear ;
25
+ property Release: Boolean read FRelease write FRelease;
26
+ property Module : IOTAModule read FModule write FModule;
22
27
property LineIni: Integer read FLineIni write FLineIni;
23
28
property LineEnd: Integer read FLineEnd write FLineEnd;
24
29
property Row: Integer read FRow write FRow;
@@ -53,6 +58,8 @@ destructor TDelphiAIDevCodeCompletionVars.Destroy;
53
58
54
59
procedure TDelphiAIDevCodeCompletionVars.Clear ;
55
60
begin
61
+ FRelease := False;
62
+ FModule := nil ;
56
63
FLineIni := 0 ;
57
64
FLineEnd := 0 ;
58
65
FRow := 0 ;
Original file line number Diff line number Diff line change @@ -96,11 +96,13 @@ procedure TDelphiAIDevIDENTAEditViewNotifier.EditorIdle(const View: IOTAEditView
96
96
begin
97
97
TUtilsOTA.GetCursorPosition(LRow, LColumn);
98
98
99
- if LVars.LineIni > 0 then
99
+ // if LVars.LineIni > 0 then
100
+ if not LVars.Release then
100
101
if (LRow <> LVars.Row) or (LColumn <> LVars.Column) then
101
102
begin
102
- LVars.LineIni := 0 ;
103
- LVars.Clear;
103
+ // LVars.LineIni := 0;
104
+ // LVars.Clear;
105
+ LVars.Release := True;
104
106
TUtils.AddLog(' EditorIdle' );
105
107
end ;
106
108
end ;
@@ -120,6 +122,8 @@ procedure TDelphiAIDevIDENTAEditViewNotifier.PaintLine(const View: IOTAEditView;
120
122
const Canvas: TCanvas; const TextRect: TRect; const LineRect: TRect; const CellSize: TSize);
121
123
var
122
124
LLineText: string;
125
+ LColCurrent: Integer;
126
+ LLineCurrent: Integer;
123
127
begin
124
128
if LineNumber < 1 then
125
129
Exit;
@@ -132,6 +136,26 @@ procedure TDelphiAIDevIDENTAEditViewNotifier.PaintLine(const View: IOTAEditView;
132
136
// if LineNumber <> View.CursorPos.Line then
133
137
// Exit;
134
138
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
+
135
159
if (LineNumber >= LVars.LineIni)and (LineNumber < LVars.LineEnd) then
136
160
begin
137
161
Canvas.Brush.Style := bsClear;
You can’t perform that action at this time.
0 commit comments