From 45715114a1c5b5bc4bd636cfbe571997097d5255 Mon Sep 17 00:00:00 2001 From: Nav Date: Sun, 19 Mar 2023 01:33:53 +0000 Subject: [PATCH] Fixed excessive annotation margin bug in FocusedRegionGroupItem --- .../HexViewerWidget/FocusedRegionGroupItem.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/FocusedRegionGroupItem.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/FocusedRegionGroupItem.cpp index 1e055d9e..c0dc58ef 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/FocusedRegionGroupItem.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/FocusedRegionGroupItem.cpp @@ -176,11 +176,14 @@ namespace Bloom::Widgets const auto byteItemSize = (this->focusedMemoryRegion.addressRange.endAddress - this->focusedMemoryRegion.addressRange.startAddress + 1); const auto estimatedWidth = static_cast( - byteItemSize * (ByteItem::WIDTH + (ByteItem::RIGHT_MARGIN / 2)) + byteItemSize * (ByteItem::WIDTH + ByteItem::RIGHT_MARGIN) - ByteItem::RIGHT_MARGIN ); - const auto annotationMargin = static_cast( - estimatedWidth < minimumWidth ? minimumWidth - estimatedWidth : 0 + const auto annotationMargin = std::min( + static_cast( + estimatedWidth < minimumWidth ? minimumWidth - estimatedWidth : 0 + ), + std::max(maximumWidth - estimatedWidth, 0) ); return QMargins(