diff --git a/components/codetools/basiccodetools.pas b/components/codetools/basiccodetools.pas index b1ea4f71a1..8c21fee7e6 100644 --- a/components/codetools/basiccodetools.pas +++ b/components/codetools/basiccodetools.pas @@ -340,6 +340,7 @@ function ReadTilPascalBracketClose(const Source: string; function GetAtomLength(p: PChar; NestedComments: boolean): integer; function GetAtomString(p: PChar; NestedComments: boolean): string; function FindStartOfAtom(const Source: string; Position: integer): integer; +function FindEndOfAtom(const Source: string; Position: integer): integer; //----------------------------------------------------------------------------- @@ -2233,9 +2234,10 @@ begin else inc(p); c2:=p^; - // test for double char operators :=, +=, -=, /=, *=, <>, <=, >=, ** + // test for double char operators :=, +=, -=, /=, *=, <>, <=, >=, **, .., >< if ((c2='=') and (IsEqualOperatorStartChar[c1])) or ((c1='<') and (c2='>')) + or ((c1='>') and (c2='<')) or ((c1='.') and (c2='.')) or ((c1='*') and (c2='*')) then @@ -2345,6 +2347,9 @@ begin '$': // hex number dec(Result); + '&': + // &keyword + dec(Result); end; break; end; @@ -2455,7 +2460,7 @@ begin else if Result>1 then begin c2:=Source[Result-1]; - // test for double char operators :=, +=, -=, /=, *=, <>, <=, >=, **, >< + // test for double char operators :=, +=, -=, /=, *=, <>, <=, >=, **, ><, .. if ((c2='=') and (IsEqualOperatorStartChar[c])) or ((c='<') and (c2='>')) or ((c='>') and (c2='<')) @@ -2469,6 +2474,23 @@ begin end; end; +function FindEndOfAtom(const Source: string; Position: integer): integer; +var + p: PChar; +begin + Result:=FindStartOfAtom(Source,Position); + if (Result>=1) and (Result<=length(Source)) then begin + p:=@Source[Result]; + case p^ of + #0..#31,' ': exit; + '{': exit; + '/': if p[1]='/' then exit; + '(': if p[1]='*' then exit; + end; + inc(Result,GetAtomLength(p,false)); + end; +end; + function LineEndCount(const Txt: string; out LengthOfLastLine: integer): integer; begin diff --git a/components/codetools/definetemplates.pas b/components/codetools/definetemplates.pas index e2a0743dd3..9629340d5a 100644 --- a/components/codetools/definetemplates.pas +++ b/components/codetools/definetemplates.pas @@ -7265,15 +7265,22 @@ function TFPCTargetConfigCache.FindRealCompilerInPath(aTargetCPU: string; function Search(const ShortFileName: string): string; begin - if ShortFileName='' then Result:=''; - // try in PATH + // fpc.exe first searches in -XP + // Maybe: extact -XP from extra options + + // then fpc.exe searches in its own directory + if Compiler<>'' then begin + Result:=ExtractFilePath(Compiler); + if FilenameIsAbsolute(Result) then begin + Result+=ShortFileName; + if FileExistsCached(Result) then + exit; + end; + end; + // finally fpc.exe searches in PATH Result:=SearchFileInPath(ShortFileName,GetCurrentDirUTF8, GetEnvironmentVariableUTF8('PATH'),PathSeparator,ctsfcDefault); if (Result<>'') or (Compiler='') then exit; - // try in directory of compiler - Result:=ExtractFilePath(Compiler)+ShortFileName; - if not FileExistsCached(Result) then - Result:=''; end; var diff --git a/components/codetools/ide/codyctrls.pas b/components/codetools/ide/codyctrls.pas index 290a185ddf..ddfab1cf2a 100644 --- a/components/codetools/ide/codyctrls.pas +++ b/components/codetools/ide/codyctrls.pas @@ -41,16 +41,16 @@ type procedure FreeNodeData; end; +procedure FreeTVNodeData(TV: TCustomTreeView); + implementation -{ TCodyTreeView } - -procedure TCodyTreeView.FreeNodeData; +procedure FreeTVNodeData(TV: TCustomTreeView); var Node: TTreeNode; begin - BeginUpdate; - Node:=Items.GetFirstNode; + TV.BeginUpdate; + Node:=TV.Items.GetFirstNode; while Node<>nil do begin if Node.Data<>nil then begin TObject(Node.Data).Free; @@ -58,7 +58,14 @@ begin end; Node:=Node.GetNext; end; - EndUpdate; + TV.EndUpdate; +end; + +{ TCodyTreeView } + +procedure TCodyTreeView.FreeNodeData; +begin + FreeTVNodeData(Self); end; end.