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; QList<DisassemblyLine> r;
for (const auto &t : CutterPVector<RzAnalysisDisasmText>(vec.get())) { for (const auto &t : CutterPVector<RzAnalysisDisasmText>(vec.get())) {
DisassemblyLine line; QString text = t->text;
line.offset = t->offset; QStringList tokens = text.split('\n');
line.text = ansiEscapeToHtml(t->text); // text might contain multiple lines
line.arrow = t->arrow; // so we split them and keep only one
r << line; // 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; return r;
} }