diff --git a/components/codetools/basiccodetools.pas b/components/codetools/basiccodetools.pas index 4f9937e49f..b8da4372be 100644 --- a/components/codetools/basiccodetools.pas +++ b/components/codetools/basiccodetools.pas @@ -107,7 +107,7 @@ procedure GetIdentStartEndAtPosition(const Source:string; Position:integer; out IdentStart,IdentEnd:integer); function GetIdentStartPosition(const Source:string; Position:integer): integer; function GetIdentLen(Identifier: PChar): integer; -function GetIdentifier(Identifier: PChar): string; +function GetIdentifier(Identifier: PChar; const aSkipAmp: Boolean = True): string; function FindNextIdentifier(const Source: string; StartPos, MaxPos: integer): integer; function FindNextIdentifierSkipStrings(const Source: string; StartPos, MaxPos: integer): integer; @@ -4719,17 +4719,22 @@ begin +'Actual: '+dbgstr(Actual,1,d-1)+'|'+dbgstr(Actual,d,length(Actual)); end; -function GetIdentifier(Identifier: PChar): string; +function GetIdentifier(Identifier: PChar; const aSkipAmp: Boolean): string; var len: integer; begin if (Identifier=nil) then begin Result:=''; exit; end; - if (Identifier^='&') and (IsIdentChar[Identifier[1]]) then - inc(Identifier); - if IsIdentStartChar[Identifier^] then begin + if IsIdentStartChar[Identifier^] or ((Identifier^='&') and (IsIdentStartChar[Identifier[1]])) then begin len:=0; + if (Identifier^='&') then + begin + if aSkipAmp then + inc(Identifier) + else + inc(len); + end; while (IsIdentChar[Identifier[len]]) do inc(len); SetLength(Result,len); if len>0 then diff --git a/components/codetools/identcompletiontool.pas b/components/codetools/identcompletiontool.pas index 87e82ba18e..4031f17728 100644 --- a/components/codetools/identcompletiontool.pas +++ b/components/codetools/identcompletiontool.pas @@ -3765,7 +3765,7 @@ begin Node:=Node.FirstChild; while Node<>nil do begin - List.Add(EnumPrefix+GetIdentifier(@Tool.Src[Node.StartPos])); + List.Add(EnumPrefix+GetIdentifier(@Tool.Src[Node.StartPos], False)); Node:=Node.NextBrother; end; end;