Codetools, IDE: Improve handling of '&'. Issues #41113,#41114, patch by WooBean007.

This commit is contained in:
Juha 2024-09-08 12:52:43 +03:00
parent b5a01af355
commit b3179cedd0
2 changed files with 11 additions and 4 deletions

View File

@ -548,7 +548,7 @@ begin
if IsIdentStartChar[p^] then begin
if not WordIsKeyWordFuncList.DoIdentifier(p) then
exit(true);
end else if (p^='&') and (IsIdentChar[p[1]]) then begin
end else if (p^='&') and (IsIdentStartChar[p[1]]) then begin
exit(true);
end;
end;
@ -1774,7 +1774,7 @@ begin
'$':
// hex number
dec(CurPos.StartPos);
'&':
'&': // &-identifier
if IsIdentStartChar[Src[CurPos.StartPos]] then
dec(CurPos.StartPos);
else

View File

@ -10836,6 +10836,7 @@ var
ActiveSrcEdit: TSourceEditor;
ActiveUnitInfo: TUnitInfo;
LogCaretXY: TPoint;
CodePos:integer;
begin
ActiveSrcEdit:=nil;
if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[]) then exit(false);
@ -10846,9 +10847,15 @@ begin
{$ENDIF}
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.DoInitIdentCompletion A');{$ENDIF}
LogCaretXY:=ActiveSrcEdit.EditorComponent.LogicalCaretXY;
Result:=CodeToolBoss.GatherIdentifiers(ActiveUnitInfo.Source,
ActiveSrcEdit.CodeBuffer.LineColToPosition(LogCaretXY.Y,LogCaretXY.X,CodePos);
Result:=True;
if (CodePos>1) and (CodePos<=ActiveSrcEdit.CodeBuffer.SourceLength)
and (ActiveSrcEdit.CodeBuffer.Source[CodePos-1]='&')
and not IsIdentStartChar[ActiveSrcEdit.CodeBuffer.Source[CodePos]] then
Result:=False;
if Result then
Result:=CodeToolBoss.GatherIdentifiers(ActiveUnitInfo.Source,
LogCaretXY.X,LogCaretXY.Y);
if not Result then begin
if JumpToError then
DoJumpToCodeToolBossError