mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 04:16:06 +02:00
SynEdit: Fix CodeTemplate completion when Attributes section is missing. Related to issue #40764.
(cherry picked from commit b4ccfdb8b6
)
This commit is contained in:
parent
17d5fce04b
commit
e7454ec7f9
@ -560,12 +560,13 @@ var
|
||||
raise Exception.Create('TCustomSynAutoComplete.ParseCompletionList: "'
|
||||
+ CodeTemplateAttributesEndMagic + '" not found.');
|
||||
Template.Attributes.Text := Copy(sValue, StartI, EndI-StartI);
|
||||
// Start of value
|
||||
StartI := EndI + Length(CodeTemplateAttributesEndMagic);
|
||||
while (StartI <= Length(sValue)) and (sValue[StartI] in [#10,#13]) do
|
||||
Inc(StartI);
|
||||
Template.Value := Copy(sValue, StartI, Length(sValue));
|
||||
end;
|
||||
StartI := EndI + Length(CodeTemplateAttributesEndMagic); // Start of value
|
||||
end
|
||||
else
|
||||
StartI := 1;
|
||||
while (StartI <= Length(sValue)) and (sValue[StartI] in [#10,#13]) do
|
||||
Inc(StartI);
|
||||
Template.Value := Copy(sValue, StartI, Length(sValue)); // Extract value
|
||||
fCodeTemplates.Add(Template);
|
||||
sKey := '';
|
||||
sValue := '';
|
||||
@ -617,20 +618,24 @@ begin
|
||||
TemplateStarted:=false;
|
||||
sValue := sValue + S;
|
||||
end;
|
||||
end else begin
|
||||
end
|
||||
else begin
|
||||
// the original style
|
||||
if (Len > 0) and (S[1] <> '=') then begin
|
||||
// save last entry
|
||||
if sKey <> '' then
|
||||
SaveEntry;
|
||||
// new completion entry
|
||||
sKey := S;
|
||||
TemplateStarted:=true;
|
||||
end else if (Len > 0) and (S[1] = '=') then begin
|
||||
if not TemplateStarted then
|
||||
sValue := sValue + LineEnding;
|
||||
TemplateStarted:=false;
|
||||
sValue := sValue + Copy(S, 2, Len);
|
||||
if Len > 0 then begin
|
||||
if S[1] <> '=' then begin
|
||||
// save last entry
|
||||
if sKey <> '' then
|
||||
SaveEntry;
|
||||
// new completion entry
|
||||
sKey := S;
|
||||
TemplateStarted:=true;
|
||||
end
|
||||
else begin
|
||||
if not TemplateStarted then
|
||||
sValue := sValue + LineEnding;
|
||||
TemplateStarted:=false;
|
||||
sValue := sValue + Copy(S, 2, Len);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user