Highlight cursor line, not always first of offset in DiassemblyWidget

This commit is contained in:
Florian Märkl 2017-12-02 14:27:15 +01:00
parent de010d4c6c
commit 65ec19ddbf

View File

@ -327,9 +327,17 @@ RVA DisassemblyWidget::readDisassemblyOffset(QTextCursor tc)
void DisassemblyWidget::updateCursorPosition() void DisassemblyWidget::updateCursorPosition()
{ {
connectCursorPositionChanged(true);
RVA offset = Core()->getOffset(); 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)) if (offset < topOffset || (offset > bottomOffset && bottomOffset != RVA_INVALID))
{ {
mDisasTextEdit->moveCursor(QTextCursor::Start); mDisasTextEdit->moveCursor(QTextCursor::Start);
@ -345,10 +353,10 @@ void DisassemblyWidget::updateCursorPosition()
while (true) while (true)
{ {
mDisasTextEdit->setTextCursor(cursor); RVA lineOffset = readDisassemblyOffset(cursor);
RVA lineOffset = readCurrentDisassemblyOffset();
if (lineOffset == offset) if (lineOffset == offset)
{ {
mDisasTextEdit->setTextCursor(cursor);
highlightCurrentLine(); highlightCurrentLine();
break; break;
} }
@ -394,6 +402,7 @@ void DisassemblyWidget::cursorPositionChanged()
{ {
RVA offset = readCurrentDisassemblyOffset(); RVA offset = readCurrentDisassemblyOffset();
Core()->seek(offset); Core()->seek(offset);
highlightCurrentLine();
} }