@@ -51,6 +51,9 @@ TDelphiAIDevIDENTAEditViewNotifier = class(TInterfacedObject, IOTANotifier, IN
51
51
procedure BeforeSave ;
52
52
procedure Modified ;
53
53
procedure Destroyed ;
54
+
55
+ // TDelphiAIDevIDENTAEditViewNotifier
56
+ procedure ClearLinesNotUsed ;
54
57
end ;
55
58
56
59
implementation
@@ -96,8 +99,8 @@ procedure TDelphiAIDevIDENTAEditViewNotifier.EditorIdle(const View: IOTAEditView
96
99
begin
97
100
TUtilsOTA.GetCursorPosition(LRow, LColumn);
98
101
99
- // if LVars.LineIni > 0 then
100
- if not LVars.Release then
102
+ if LVars.LineIni > 0 then
103
+ // if LVars.Release then
101
104
if (LRow <> LVars.Row) or (LColumn <> LVars.Column) then
102
105
begin
103
106
// LVars.LineIni := 0;
@@ -117,13 +120,38 @@ procedure TDelphiAIDevIDENTAEditViewNotifier.Modified;
117
120
118
121
end ;
119
122
123
+ procedure TDelphiAIDevIDENTAEditViewNotifier.ClearLinesNotUsed ;
124
+ var
125
+ LView: IOTAEditView;
126
+ LColCurrent: Integer;
127
+ LLineCurrent: Integer;
128
+ begin
129
+ LVars.Release := False;
130
+
131
+ if LVars.Module = nil then
132
+ Exit;
133
+
134
+ TUtils.AddLog(sLineBreak + LVars.Module .FileName + sLineBreak + TUtilsOTA.GetCurrentModule.FileName);
135
+
136
+ // if LVars.Module.FileName <> TUtilsOTA.GetCurrentModule.FileName then
137
+ // Exit;
138
+
139
+ LView := TUtilsOTA.GetIOTAEditView(LVars.Module );
140
+ LColCurrent := LView.CursorPos.Col;
141
+ LLineCurrent := LView.CursorPos.Line;
142
+ try
143
+ LView.Buffer.EditPosition.Move(LVars.LineIni, 2 );
144
+ LView.Buffer.EditPosition.Delete(Pred(LVars.Contents.Count));
145
+ finally
146
+ LView.Buffer.EditPosition.Move(LLineCurrent, LColCurrent);
147
+ end ;
148
+ end ;
149
+
120
150
procedure TDelphiAIDevIDENTAEditViewNotifier.PaintLine (const View : IOTAEditView; LineNumber: Integer;
121
151
const LineText: PAnsiChar; const TextWidth: Word; const LineAttributes: TOTAAttributeArray;
122
152
const Canvas: TCanvas; const TextRect: TRect; const LineRect: TRect; const CellSize: TSize);
123
153
var
124
154
LLineText: string;
125
- LColCurrent: Integer;
126
- LLineCurrent: Integer;
127
155
begin
128
156
if LineNumber < 1 then
129
157
Exit;
@@ -133,27 +161,35 @@ procedure TDelphiAIDevIDENTAEditViewNotifier.PaintLine(const View: IOTAEditView;
133
161
if not LLineText.Trim.IsEmpty then
134
162
Exit;
135
163
136
- // if LineNumber <> View.CursorPos.Line then
137
- // Exit;
138
164
139
- // verificar o nome da tab da unit aberta
165
+ // if LineNumber <> View.CursorPos.Line then Exit;
166
+
140
167
if LVars.Release then
141
168
begin
169
+ try
170
+ Self.ClearLinesNotUsed;
171
+ finally
172
+ LVars.Clear;
173
+ end ;
174
+
175
+ { TUtils.AddLog(sLineBreak + LVars.Module.FileName + sLineBreak + TUtilsOTA.GetCurrentModule.FileName);
142
176
LVars.Release := False;
143
177
144
- // **
145
- LColCurrent := View .CursorPos.Col;
146
- LLineCurrent := View .CursorPos.Line;
147
- // **
148
178
try
149
- View .Buffer.EditPosition.Move(LVars.LineIni, 2 );
150
- View .Buffer.EditPosition.Delete(Pred(LVars.Contents.Count));
179
+ if LVars.Module.FileName = TUtilsOTA.GetCurrentModule.FileName then
180
+ begin
181
+ LColCurrent := View.CursorPos.Col;
182
+ LLineCurrent := View.CursorPos.Line;
183
+ try
184
+ View.Buffer.EditPosition.Move(LVars.LineIni, 2);
185
+ View.Buffer.EditPosition.Delete(Pred(LVars.Contents.Count));
186
+ finally
187
+ View.Buffer.EditPosition.Move(LLineCurrent, LColCurrent);
188
+ end;
189
+ end
151
190
finally
152
191
LVars.Clear;
153
- // **
154
- View .Buffer.EditPosition.Move(LLineCurrent, LColCurrent);
155
- // **
156
- end ;
192
+ end;}
157
193
end ;
158
194
159
195
if (LineNumber >= LVars.LineIni)and (LineNumber < LVars.LineEnd) then
0 commit comments