From 65ec19ddbfa77df6f52b36e42f5b429c4797e684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Sat, 2 Dec 2017 14:27:15 +0100 Subject: [PATCH] Highlight cursor line, not always first of offset in DiassemblyWidget --- src/widgets/DisassemblyWidget.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/widgets/DisassemblyWidget.cpp b/src/widgets/DisassemblyWidget.cpp index f3a41735..a9b39f7e 100644 --- a/src/widgets/DisassemblyWidget.cpp +++ b/src/widgets/DisassemblyWidget.cpp @@ -327,9 +327,17 @@ RVA DisassemblyWidget::readDisassemblyOffset(QTextCursor tc) void DisassemblyWidget::updateCursorPosition() { - connectCursorPositionChanged(true); RVA offset = Core()->getOffset(); + // already fine where it is? + RVA currentLineOffset = readCurrentDisassemblyOffset(); + if (currentLineOffset == offset) + { + return; + } + + connectCursorPositionChanged(true); + if (offset < topOffset || (offset > bottomOffset && bottomOffset != RVA_INVALID)) { mDisasTextEdit->moveCursor(QTextCursor::Start); @@ -345,10 +353,10 @@ void DisassemblyWidget::updateCursorPosition() while (true) { - mDisasTextEdit->setTextCursor(cursor); - RVA lineOffset = readCurrentDisassemblyOffset(); + RVA lineOffset = readDisassemblyOffset(cursor); if (lineOffset == offset) { + mDisasTextEdit->setTextCursor(cursor); highlightCurrentLine(); break; } @@ -394,6 +402,7 @@ void DisassemblyWidget::cursorPositionChanged() { RVA offset = readCurrentDisassemblyOffset(); Core()->seek(offset); + highlightCurrentLine(); }