mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-31 08:37:26 +00:00
parent
66dcaea5bb
commit
95a7d5f210
@ -325,14 +325,6 @@ void DisassemblyWidget::highlightCurrentLine()
|
||||
QColor highlightWordCurrentLineColor = ConfigColor("gui.background");
|
||||
highlightWordCurrentLineColor.setAlpha(128);
|
||||
|
||||
// Highlight the current line
|
||||
QTextEdit::ExtraSelection selection;
|
||||
selection.format.setBackground(highlightColor);
|
||||
selection.format.setProperty(QTextFormat::FullWidthSelection, true);
|
||||
selection.cursor = mDisasTextEdit->textCursor();
|
||||
selection.cursor.clearSelection();
|
||||
extraSelections.append(selection);
|
||||
|
||||
// Highlight the current word
|
||||
QTextCursor cursor = mDisasTextEdit->textCursor();
|
||||
cursor.select(QTextCursor::WordUnderCursor);
|
||||
@ -343,10 +335,31 @@ void DisassemblyWidget::highlightCurrentLine()
|
||||
cursor.movePosition(QTextCursor::EndOfLine);
|
||||
int lineEndPos = cursor.position();
|
||||
|
||||
// Highlight the current line
|
||||
QTextEdit::ExtraSelection highlightSelection;
|
||||
highlightSelection.cursor = cursor;
|
||||
highlightSelection.cursor.movePosition(QTextCursor::Start);
|
||||
while (true) {
|
||||
RVA lineOffset = readDisassemblyOffset(highlightSelection.cursor);
|
||||
if (lineOffset == seekable->getOffset()) {
|
||||
highlightSelection.format.setBackground(highlightColor);
|
||||
highlightSelection.format.setProperty(QTextFormat::FullWidthSelection, true);
|
||||
highlightSelection.cursor.clearSelection();
|
||||
extraSelections.append(highlightSelection);
|
||||
} else if (lineOffset != RVA_INVALID && lineOffset > seekable->getOffset()) {
|
||||
break;
|
||||
}
|
||||
highlightSelection.cursor.movePosition(QTextCursor::EndOfLine);
|
||||
if (highlightSelection.cursor.atEnd()) {
|
||||
break;
|
||||
}
|
||||
|
||||
highlightSelection.cursor.movePosition(QTextCursor::Down);
|
||||
}
|
||||
|
||||
// Highlight all the words in the document same as the current one
|
||||
QTextDocument *document = mDisasTextEdit->document();
|
||||
|
||||
QTextEdit::ExtraSelection highlightSelection;
|
||||
highlightSelection.cursor = cursor;
|
||||
highlightSelection.cursor.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user