mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 14:18:17 +02:00
Codetools, IDE: Improve handling of '&'. Issues #41113,#41114, patch by WooBean007.
This commit is contained in:
parent
b5a01af355
commit
b3179cedd0
@ -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
|
||||
|
11
ide/main.pp
11
ide/main.pp
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user