mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2026-01-04 23:31:06 +01:00
IDE: fixed clicking on message during compile, bug #17691
git-svn-id: trunk@31268 -
This commit is contained in:
parent
36e0a4b59f
commit
93a6c5de7b
@ -66,6 +66,7 @@ type
|
||||
FItems: TFPList; // list of TFPCMsgItem
|
||||
fSortedForID: TAVLTree; // tree of TFPCMsgItem sorted for ID
|
||||
fItemById: array of TFPCMsgItem;
|
||||
fNodeMgr: TAVLTreeNodeMemManager;
|
||||
function GetItems(Index: integer): TFPCMsgItem;
|
||||
procedure CreateArray;
|
||||
public
|
||||
@ -222,27 +223,41 @@ var
|
||||
MaxID: Integer;
|
||||
i: Integer;
|
||||
Item: TFPCMsgItem;
|
||||
MinID: Integer;
|
||||
begin
|
||||
SetLength(fItemById,0);
|
||||
if fSortedForID.Count=0 then
|
||||
exit;
|
||||
MaxID:=TFPCMsgItem(fSortedForID.FindHighest.Data).ID;
|
||||
debugln(['TFPCMsgFile.CreateArray AAA1']);
|
||||
Item:=TFPCMsgItem(fSortedForID.FindLowest.Data);
|
||||
MinID:=Item.ID;
|
||||
if MinID<0 then begin
|
||||
debugln(['TFPCMsgFile.CreateArray WARNING: MinID ',MinID,' too low: ',Item.Msg]);
|
||||
exit;
|
||||
end;
|
||||
Item:=TFPCMsgItem(fSortedForID.FindHighest.Data);
|
||||
MaxID:=Item.ID;
|
||||
if MaxID>100000 then begin
|
||||
debugln(['TFPCMsgFile.CreateArray WARNING: MaxID ',MaxID,' too high']);
|
||||
debugln(['TFPCMsgFile.CreateArray WARNING: MaxID ',MaxID,' too high: ',Item.Msg]);
|
||||
exit;
|
||||
end;
|
||||
SetLength(fItemById,MaxID+1);
|
||||
for i:=0 to length(fItemById)-1 do fItemById[i]:=nil;
|
||||
for i:=0 to FItems.Count-1 do begin
|
||||
Item:=TFPCMsgItem(FItems[i]);
|
||||
debugln(['TFPCMsgFile.CreateArray ',Item.ID,' ',Item.Msg]);
|
||||
fItemById[Item.ID]:=Item;
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TFPCMsgFile.Create;
|
||||
begin
|
||||
debugln(['TFPCMsgFile.Create START']);
|
||||
inherited Create;
|
||||
FItems:=TFPList.Create;
|
||||
fSortedForID:=TAVLTree.Create(@CompareFPCMsgId);
|
||||
fNodeMgr:=TAVLTreeNodeMemManager.Create;
|
||||
fSortedForID.SetNodeManager(fNodeMgr);
|
||||
end;
|
||||
|
||||
destructor TFPCMsgFile.Destroy;
|
||||
@ -250,6 +265,7 @@ begin
|
||||
Clear;
|
||||
FreeAndNil(FItems);
|
||||
FreeAndNil(fSortedForID);
|
||||
FreeAndNil(fNodeMgr);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
@ -257,9 +273,13 @@ procedure TFPCMsgFile.LoadFromFile(const Filename: string);
|
||||
var
|
||||
sl: TStringList;
|
||||
begin
|
||||
debugln(['TFPCMsgFile.LoadFromFile AAA1']);
|
||||
exit;
|
||||
sl:=TStringList.Create;
|
||||
try
|
||||
debugln(['TFPCMsgFile.LoadFromFile AAA2']);
|
||||
sl.LoadFromFile(UTF8ToSys(Filename));
|
||||
debugln(['TFPCMsgFile.LoadFromFile AAA3']);
|
||||
LoadFromList(sl);
|
||||
finally
|
||||
sl.Free;
|
||||
@ -373,6 +393,7 @@ var
|
||||
s: string;
|
||||
Item: TFPCMsgItem;
|
||||
begin
|
||||
debugln(['TFPCMsgFile.LoadFromList START']);
|
||||
Clear;
|
||||
Line:=0;
|
||||
Item:=nil;
|
||||
@ -393,6 +414,7 @@ begin
|
||||
end else begin
|
||||
Item:=ReadItem(Line,s);
|
||||
if Item<>nil then begin
|
||||
debugln(['TFPCMsgFile.LoadFromList ',Item.ID,' ',Item.Msg]);
|
||||
Item.Index:=FItems.Count;
|
||||
FItems.Add(Item);
|
||||
fSortedForID.Add(Item);
|
||||
@ -400,6 +422,7 @@ begin
|
||||
end;
|
||||
inc(Line);
|
||||
end;
|
||||
debugln(['TFPCMsgFile.LoadFromList BBB1']);
|
||||
CreateArray;
|
||||
end;
|
||||
|
||||
|
||||
18
ide/main.pp
18
ide/main.pp
@ -13468,8 +13468,8 @@ end;
|
||||
function GetFPCMessage(ALine: TLazMessageLine; var FileName: String; var CaretPos: TPoint; var ErrType: TFPCErrorType): Boolean;
|
||||
begin
|
||||
Result := Assigned(ALine.Parts);
|
||||
if Result and (Aline.Filename = '') then
|
||||
Aline.UpdateSourcePosition;
|
||||
if Result and (ALine.Filename = '') then
|
||||
ALine.UpdateSourcePosition;
|
||||
FileName:=ALine.Filename;
|
||||
CaretPos.x:=ALine.Column;
|
||||
CaretPos.y:=ALine.LineNumber;
|
||||
@ -13480,7 +13480,8 @@ end;
|
||||
|
||||
function TMainIDE.DoJumpToCompilerMessage(Index:integer;
|
||||
FocusEditor: boolean): boolean;
|
||||
var MaxMessages: integer;
|
||||
var
|
||||
MaxMessages: integer;
|
||||
Filename, SearchedFilename: string;
|
||||
LogCaretXY: TPoint;
|
||||
TopLine: integer;
|
||||
@ -13491,6 +13492,7 @@ var MaxMessages: integer;
|
||||
NewFilename: String;
|
||||
AnUnitInfo: TUnitInfo;
|
||||
AnEditorInfo: TUnitEditorInfo;
|
||||
MsgLine: TLazMessageLine;
|
||||
begin
|
||||
Result:=false;
|
||||
|
||||
@ -13501,7 +13503,8 @@ begin
|
||||
Index:=0;
|
||||
while (Index<MaxMessages) do begin
|
||||
// ParseFPCMessage doesn't support multilingual messages, by GetFPCMessage
|
||||
if GetFPCMessage(MessagesView.VisibleItems[Index],Filename,LogCaretXY,MsgType) then
|
||||
MsgLine:=MessagesView.VisibleItems[Index];
|
||||
if GetFPCMessage(MsgLine,Filename,LogCaretXY,MsgType) then
|
||||
begin
|
||||
if MsgType in [etError,etFatal,etPanic] then break;
|
||||
end;
|
||||
@ -13515,9 +13518,10 @@ begin
|
||||
if MessagesView.ExecuteMsgLinePlugin(imqfoJump) then exit;
|
||||
|
||||
// default: jump to source position
|
||||
if GetFPCMessage(MessagesView.VisibleItems[Index],Filename,LogCaretXY,MsgType)
|
||||
then begin
|
||||
CurDir:=MessagesView.VisibleItems[Index].Directory;
|
||||
MsgLine:=MessagesView.VisibleItems[Index];
|
||||
if GetFPCMessage(MsgLine,Filename,LogCaretXY,MsgType) then begin
|
||||
//debugln(['TMainIDE.DoJumpToCompilerMessage Index=',Index,' MsgFile=',MsgLine.Filename,' MsgY=',MsgLine.LineNumber,' File=',Filename,' XY=',dbgs(LogCaretXY),' ',MsgLine.Parts.Text]);
|
||||
CurDir:=MsgLine.Directory;
|
||||
if (not FilenameIsAbsolute(Filename)) and (CurDir<>'') then begin
|
||||
// the directory was just hidden, re-append it
|
||||
NewFilename:=AppendPathDelim(CurDir)+Filename;
|
||||
|
||||
@ -456,7 +456,7 @@ begin
|
||||
if NewMsg.Parts=nil then
|
||||
NewMsg.Parts:=TStringList.Create;
|
||||
NewMsg.Parts.Assign(Parts);
|
||||
NewMsg.Filename:=Parts.Values['Filename'];
|
||||
NewMsg.UpdateSourcePosition;
|
||||
end;
|
||||
//DebugLn('TMessagesView.Add FItems.Count=',dbgs(FItems.Count),' OriginalIndex=',dbgs(OriginalIndex));
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user