Debugger: Watches, fix "not showing" the last array element / fixed page size calculation / ensure to trigger evaluation, when node is expanded.

This commit is contained in:
Martin 2022-06-13 15:43:42 +02:00
parent ee5cc5f780
commit 8c9d81c77f
3 changed files with 25 additions and 6 deletions

View File

@ -39,6 +39,7 @@ object WatchesDlg: TWatchesDlg
OnChange = tvWatchesChange
OnDragOver = tvWatchesDragOver
OnDragDrop = tvWatchesDragDrop
OnExpanded = tvWatchesExpanded
OnFocusChanged = tvWatchesFocusChanged
OnInitChildren = tvWatchesInitChildren
OnNodeDblClick = tvWatchesNodeDblClick
@ -164,13 +165,14 @@ object WatchesDlg: TWatchesDlg
Width = 200
Align = alTop
Caption = '...'
Color = clDefault
ParentColor = False
end
end
end
object mnuPopup: TPopupMenu
left = 100
top = 96
Left = 100
Top = 96
object popAdd: TMenuItem
Action = actAddWatch
end

View File

@ -133,6 +133,7 @@ type
procedure tvWatchesDragOver(Sender: TBaseVirtualTree; Source: TObject;
Shift: TShiftState; State: TDragState; const Pt: TPoint; Mode: TDropMode;
var Effect: LongWord; var Accept: Boolean);
procedure tvWatchesExpanded(Sender: TBaseVirtualTree; Node: PVirtualNode);
procedure tvWatchesFocusChanged(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex);
procedure tvWatchesInitChildren(Sender: TBaseVirtualTree;
@ -484,6 +485,20 @@ begin
( (Source is TCustomEdit) and (TCustomEdit(Source).SelText <> '') );
end;
procedure TWatchesDlg.tvWatchesExpanded(Sender: TBaseVirtualTree;
Node: PVirtualNode);
var
AWatch: TIdeWatch;
begin
Node := tvWatches.GetFirstChildNoInit(Node);
while Node <> nil do begin
AWatch := TIdeWatch(tvWatches.NodeItem[Node]);
if AWatch <> nil then
UpdateItem(Node, AWatch);
Node := tvWatches.GetNextSiblingNoInit(Node);
end;
end;
procedure TWatchesDlg.tvWatchesFocusChanged(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex);
begin
@ -1181,7 +1196,7 @@ begin
ExistingNode := tvWatches.GetNextSiblingNoInit(ExistingNode);
Offs := Nav.Index;
for i := 0 to ChildCount do begin
for i := 0 to ChildCount - 1 do begin
Idx := IntToStr(Offs + i);
NewWatch := AWatch.ChildrenByName[Idx];
@ -1193,8 +1208,8 @@ begin
if AWatch is TCurrentWatch then begin
NewWatch.DisplayFormat := wdfDefault;
NewWatch.Enabled := AWatch.Enabled;
if EnvironmentOptions.DebuggerAutoSetInstanceFromClass then
NewWatch.EvaluateFlags := [defClassAutoCast];
if (defClassAutoCast in AWatch.EvaluateFlags) then
NewWatch.EvaluateFlags := NewWatch.EvaluateFlags + [defClassAutoCast];
end;
if ExistingNode <> nil then begin
@ -1208,6 +1223,8 @@ begin
UpdateItem(nd, NewWatch);
end;
inc(ChildCount); // for the nav row
if AWatch is TCurrentWatch then begin
KeepCnt := Nav.PageSize;
KeepBelow := KeepCnt;

View File

@ -156,7 +156,7 @@ var
begin
Result := edArrayPageSize.Value;
idx := edArrayStart.Value;
if (idx >= FLowBound) and (idx < FHighBound) then
if (idx >= FLowBound) and (idx <= FHighBound) then
Result := Max(1, Min(Result, FHighBound + 1 - idx));
end;