From 3e74b9ad6769d00cc67d6c1817e591eea96a7e47 Mon Sep 17 00:00:00 2001 From: Giovanni <561184+wargio@users.noreply.github.com> Date: Thu, 3 Aug 2023 20:36:34 +0800 Subject: [PATCH] Fix arrow line calculation when disasm line is has multiple newlines. (#3217) --- src/core/Cutter.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/core/Cutter.cpp b/src/core/Cutter.cpp index f9b0c3e4..1c7803f1 100644 --- a/src/core/Cutter.cpp +++ b/src/core/Cutter.cpp @@ -4143,11 +4143,20 @@ QList CutterCore::disassembleLines(RVA offset, int lines) QList r; for (const auto &t : CutterPVector(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; }