diff --git a/components/codetools/basiccodetools.pas b/components/codetools/basiccodetools.pas index 43966fda31..3fd58562c0 100644 --- a/components/codetools/basiccodetools.pas +++ b/components/codetools/basiccodetools.pas @@ -4422,8 +4422,8 @@ function IdentifierPos(Search, Identifier: PChar): PtrInt; var i: Integer; begin - if (Search=nil) or (Search^=#0) then exit(-1); if Identifier=nil then exit(-1); + if (Search=nil) or (Search^=#0) then exit(0); Result:=0; while (IsIdentChar[Identifier[Result]]) do begin if UpChars[Search^]=UpChars[Identifier[Result]] then begin diff --git a/components/codetools/identcompletiontool.pas b/components/codetools/identcompletiontool.pas index 07b5d7de35..1fea0c635d 100644 --- a/components/codetools/identcompletiontool.pas +++ b/components/codetools/identcompletiontool.pas @@ -637,7 +637,9 @@ begin if FExtendedFilter then i:=IdentifierPos(PChar(Pointer(Prefix)),PChar(Pointer(CurItem.Identifier))) else if ComparePrefixIdent(PChar(Pointer(Prefix)),PChar(Pointer(CurItem.Identifier))) then - i:=0; + i:=0 + else + i:=-1; if i=0 then begin {$IFDEF ShowFilteredIdents} DebugLn(['::: FILTERED ITEM ',FFilteredList.Count,' ',CurItem.Identifier]);