mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-01 20:39:25 +01:00
codetools: fixed CleanPosIsInComment
git-svn-id: trunk@16545 -
This commit is contained in:
parent
e4e3f88979
commit
c2a3f47f4d
@ -1324,6 +1324,7 @@ begin
|
||||
if (fsfFindMainDeclaration in SearchSmartFlags)
|
||||
and CleanPosIsDeclarationIdentifier(CleanCursorPos,CursorNode)
|
||||
then begin
|
||||
//DebugLn(['TFindDeclarationTool.FindDeclaration CleanPosIsDeclarationIdentifier']);
|
||||
NewTool:=Self;
|
||||
NewNode:=CursorNode;
|
||||
CleanCursorPos:=GetIdentStartPosition(Src,CleanCursorPos);
|
||||
@ -1340,6 +1341,7 @@ begin
|
||||
and IsIncludeDirectiveAtPos(CleanCursorPos,CleanPosInFront,NewPos.Code)
|
||||
then begin
|
||||
// include directive
|
||||
//DebugLn(['TFindDeclarationTool.FindDeclaration IsIncludeDirectiveAtPos']);
|
||||
NewPos.X:=1;
|
||||
NewPos.Y:=1;
|
||||
NewTopLine:=1;
|
||||
@ -1357,6 +1359,7 @@ begin
|
||||
if (not IsDirtySrcValid)
|
||||
and (CursorNode.Desc=ctnUsesSection) then begin
|
||||
// in uses section
|
||||
//DebugLn(['TFindDeclarationTool.FindDeclaration IsUsesSection']);
|
||||
Result:=FindDeclarationInUsesSection(CursorNode,CleanCursorPos,
|
||||
NewPos,NewTopLine);
|
||||
NewNode:=nil;
|
||||
@ -2027,8 +2030,10 @@ begin
|
||||
SrcLink:=Scanner.Links[LinkIndex+1];
|
||||
if (SrcLink.Code=nil) or (SrcLink.Code=Scanner.Links[LinkIndex].Code) then
|
||||
exit;
|
||||
//DebugLn(['TFindDeclarationTool.IsIncludeDirectiveAtPos CleanPos=',CleanPos,' CleanCodePosInFront=',CleanCodePosInFront,' ',copy(Src,CleanCodePosInFront,10)]);
|
||||
if CleanPosIsInComment(CleanPos,CleanCodePosInFront,CommentStart,CommentEnd)
|
||||
and (CommentEnd=SrcLink.CleanedPos) then begin
|
||||
//DebugLn(['TFindDeclarationTool.IsIncludeDirectiveAtPos CommentStart=',CommentStart,' CommentEnd=',CommentEnd,' ',copy(Src,CommentStart,CommentEnd-CommentStart)]);
|
||||
IncludeCode:=TCodeBuffer(SrcLink.Code);
|
||||
Result:=true;
|
||||
exit;
|
||||
|
||||
@ -189,6 +189,7 @@ begin
|
||||
repeat
|
||||
ReadNextAtom;
|
||||
if CurPos.StartPos>CleanPos then begin
|
||||
//DebugLn(['TPascalReaderTool.CleanPosIsInComment ',GetATom,' StartPos=',CurPos.StartPos,' CleanPos=',CleanPos]);
|
||||
// CleanPos between two atoms -> parse space between for comments
|
||||
CommentStart:=CleanCodePosInFront;
|
||||
CommentEnd:=CurPos.StartPos;
|
||||
@ -252,6 +253,8 @@ begin
|
||||
break;
|
||||
end;
|
||||
end;
|
||||
// CleanPos not in a comment
|
||||
exit;
|
||||
end else if CurPos.EndPos>CleanPos then begin
|
||||
// CleanPos not in a comment
|
||||
exit;
|
||||
|
||||
@ -12355,6 +12355,7 @@ begin
|
||||
writeln('[TMainIDE.DoFindDeclarationAtCaret] ************');
|
||||
{$ENDIF}
|
||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.DoFindDeclarationAtCaret A');{$ENDIF}
|
||||
//DebugLn(['TMainIDE.DoFindDeclarationAtCaret LogCaretXY=',dbgs(LogCaretXY),' SynEdit.Log=',dbgs(ActiveSrcEdit.EditorComponent.LogicalCaretXY),' SynEdit.Caret=',dbgs(ActiveSrcEdit.EditorComponent.CaretXY)]);
|
||||
if CodeToolBoss.FindDeclaration(ActiveUnitInfo.Source,
|
||||
LogCaretXY.X,LogCaretXY.Y,
|
||||
NewSource,NewX,NewY,NewTopLine) then
|
||||
|
||||
@ -750,8 +750,7 @@ type
|
||||
read FOnAddJumpPoint write FOnAddJumpPoint;
|
||||
property OnCloseClicked: TOnCloseSrcEditor
|
||||
read FOnCloseClicked write FOnCloseClicked;
|
||||
property OnClickLink: TMouseEvent
|
||||
read FOnClickLink write FOnClickLink;
|
||||
property OnClickLink: TMouseEvent read FOnClickLink write FOnClickLink;
|
||||
property OnDeleteLastJumpPoint: TNotifyEvent
|
||||
read FOnDeleteLastJumpPoint write FOnDeleteLastJumpPoint;
|
||||
property OnEditorVisibleChanged: TNotifyEvent
|
||||
@ -2667,7 +2666,7 @@ end;
|
||||
procedure TSourceEditor.EditorClickLink(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
begin
|
||||
DebugLn(['TSourceEditor.EditorClickLink ']);
|
||||
DebugLn(['TSourceEditor.EditorClickLink ',X,',',Y]);
|
||||
if Assigned(OnClickLink) then
|
||||
OnClickLink(Sender, Button, Shift, X,Y);
|
||||
end;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user