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()
{
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();
}