Skip to content

Commit 18b576e

Browse files
committed
bk/before-changing-copilot-name
1 parent 985de7b commit 18b576e

File tree

4 files changed

+34
-28
lines changed

4 files changed

+34
-28
lines changed

Package/DelphiCopilot.dproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
<DCC_RemoteDebug>false</DCC_RemoteDebug>
108108
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
109109
<VerInfo_Locale>1033</VerInfo_Locale>
110+
<Debugger_HostApplication>C:\Program Files (x86)\Embarcadero\Studio\20.0\bin\bds.exe</Debugger_HostApplication>
110111
</PropertyGroup>
111112
<PropertyGroup Condition="'$(Cfg_2)'!=''">
112113
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>

Src/Chat/DelphiCopilot.Chat.View.dfm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ object DelphiCopilotChatView: TDelphiCopilotChatView
138138
Left = 0
139139
Top = 3
140140
Width = 56
141-
Height = 13
141+
Height = 20
142142
Cursor = crHandPoint
143143
Hint = 'AI being used'
144144
Margins.Left = 0
@@ -149,6 +149,7 @@ object DelphiCopilotChatView: TDelphiCopilotChatView
149149
Caption = 'lbCurrentAI'
150150
PopupMenu = pMenuCurrentAI
151151
OnClick = lbCurrentAIClick
152+
ExplicitHeight = 13
152153
end
153154
object btnSend: TButton
154155
AlignWithMargins = True

Src/Utils/DelphiCopilot.Utils.OTA.pas

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,15 @@ class function TUtilsOTA.EditorAsString(AIOTAModule: IOTAModule): string;
212212
LRead: Integer;
213213
LPosition: Integer;
214214
LStrBuffer: AnsiString;
215+
LOTASourceEditor: IOTASourceEditor;
215216
begin
216217
Result := '';
217-
LIOTAEditReader := Self.GetIOTASourceEditor(AIOTAModule).CreateReader;
218+
219+
LOTASourceEditor := Self.GetIOTASourceEditor(AIOTAModule);
220+
if LOTASourceEditor = nil then
221+
TUtils.ShowMsgSynchronize('Unable to get SourceEditor.');
222+
223+
LIOTAEditReader := LOTASourceEditor.CreateReader;
218224
try
219225
LPosition := 0;
220226
repeat

Src/Utils/DelphiCopilot.Utils.pas

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -264,47 +264,45 @@ class function TUtils.ConfReturnAI(const AValue: string): string;
264264

265265
class function TUtils.ProcessTextForEditor(const AText: string): string;
266266
var
267-
AdjustRet: Boolean;
268-
Strings: TStrings;
267+
LAdjustRet: Boolean;
268+
LStrings: TStrings;
269269
I: Integer;
270-
SpcCount: Integer;
271-
c: Char;
272-
s: string;
270+
LCount: Integer;
271+
LChar: Char;
272+
LStrLine: string;
273273
begin
274-
AdjustRet := CopyReverse(AText, 1, 2) = #13#10;
275-
Strings := TStringList.Create;
274+
LAdjustRet := CopyReverse(AText, 1, 2) = #13#10;
275+
LStrings := TStringList.Create;
276276
try
277-
Strings.Text := AText;
277+
LStrings.Text := AText;
278278
//SpcCount := 0;
279-
for I := 0 to Pred(Strings.Count) do
279+
for I := 0 to Pred(LStrings.Count) do
280280
begin
281-
s := Strings[I];
282-
if Length(s) > 2 then
281+
LStrLine := LStrings[I];
282+
if Length(LStrLine) > 2 then
283283
begin
284-
if s[2] = ' ' then
284+
if LStrLine[2] = ' ' then
285285
begin
286-
c := s[1];
287-
s[1] := ' ';
288-
SpcCount := 0;
289-
while (SpcCount < Length(s)) and (s[SpcCount + 2] = ' ') do
290-
Inc(SpcCount);
291-
s[SpcCount + 1] := c;
292-
293-
Strings[I] := s;
286+
LChar := LStrLine[1];
287+
LStrLine[1] := ' ';
288+
LCount := 0;
289+
while (LCount < Length(LStrLine)) and (LStrLine[LCount + 2] = ' ') do
290+
Inc(LCount);
291+
LStrLine[LCount + 1] := LChar;
292+
293+
LStrings[I] := LStrLine;
294294
end
295295
else
296-
begin
297-
Strings[I] := s;
298-
end;
296+
LStrings[I] := LStrLine;
299297
end;
300298
end;
301-
Result := Strings.Text;
299+
Result := LStrings.Text;
302300
Delete(Result, Pred(Result.Length), 2);
303301
finally
304-
Strings.Free;
302+
LStrings.Free;
305303
end;
306304

307-
if AdjustRet then
305+
if LAdjustRet then
308306
Result := Result + #13#10;
309307
end;
310308

0 commit comments

Comments
 (0)