Fix arrow line calculation when disasm line is has multiple newlines. (#3217)

This commit is contained in:
Giovanni 2023-08-03 20:36:34 +08:00 committed by GitHub
parent 3bcafe9625
commit 3e74b9ad67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4143,11 +4143,20 @@ QList<DisassemblyLine> CutterCore::disassembleLines(RVA offset, int lines)
QList<DisassemblyLine> r;
for (const auto &t : CutterPVector<RzAnalysisDisasmText>(vec.get())) {
DisassemblyLine line;
line.offset = t->offset;
line.text = ansiEscapeToHtml(t->text);
line.arrow = t->arrow;
r << line;
QString text = t->text;
QStringList tokens = text.split('\n');
// text might contain multiple lines
// so we split them and keep only one
// arrow/jump to addr.
for (const auto &tok : tokens) {
DisassemblyLine line;
line.offset = t->offset;
line.text = ansiEscapeToHtml(tok);
line.arrow = t->arrow;
r << line;
// only the first one.
t->arrow = RVA_INVALID;
}
}
return r;
}