From e219b8daba4b67aeac426f70aa0a99b02f4dbbb2 Mon Sep 17 00:00:00 2001 From: Adam Zambrzycki Date: Sat, 27 Oct 2018 18:36:14 +0200 Subject: [PATCH] Fix sticking out highlighting on graph (#881) --- src/widgets/DisassemblerGraphView.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/widgets/DisassemblerGraphView.cpp b/src/widgets/DisassemblerGraphView.cpp index 3a964200..56d51199 100644 --- a/src/widgets/DisassemblerGraphView.cpp +++ b/src/widgets/DisassemblerGraphView.cpp @@ -501,7 +501,16 @@ void DisassemblerGraphView::drawBlock(QPainter &p, GraphView::GraphBlock &block) } int widthBefore = mFontMetrics->width(instr.plainText.left(pos)); - p.fillRect(QRect(block.x + charWidth * 3 + widthBefore, y, tokenWidth, + if (widthBefore + charWidth * 7 > block.width) { + continue; + } + + int highlightWidth = tokenWidth; + if (widthBefore + tokenWidth >= block.width) { + highlightWidth = block.width - widthBefore - charWidth * 5; + } + + p.fillRect(QRect(block.x + charWidth * 3 + widthBefore, y, highlightWidth, charHeight), disassemblySelectionColor.lighter(250)); }