GUI: fixed copy multiple lines
This commit is contained in:
parent
1ebcb070ae
commit
9a5e2f94ea
|
@ -1589,7 +1589,7 @@ void Disassembly::prepareDataCount(const QList<dsint> & wRVAs, QList<Instruction
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Disassembly::prepareDataRange(dsint startRva, dsint endRva, const std::function<void(int, const Instruction_t &)> & disassembled)
|
void Disassembly::prepareDataRange(dsint startRva, dsint endRva, const std::function<bool(int, const Instruction_t &)> & disassembled)
|
||||||
{
|
{
|
||||||
dsint wAddrPrev = startRva;
|
dsint wAddrPrev = startRva;
|
||||||
dsint wAddr = wAddrPrev;
|
dsint wAddr = wAddrPrev;
|
||||||
|
@ -1604,7 +1604,8 @@ void Disassembly::prepareDataRange(dsint startRva, dsint endRva, const std::func
|
||||||
wAddr = getNextInstructionRVA(wAddr, 1);
|
wAddr = getNextInstructionRVA(wAddr, 1);
|
||||||
if(wAddr == wAddrPrev)
|
if(wAddr == wAddrPrev)
|
||||||
break;
|
break;
|
||||||
disassembled(i++, wInst);
|
if(!disassembled(i++, wInst))
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ public:
|
||||||
|
|
||||||
QString getAddrText(dsint cur_addr, char label[MAX_LABEL_SIZE], bool getLabel = true);
|
QString getAddrText(dsint cur_addr, char label[MAX_LABEL_SIZE], bool getLabel = true);
|
||||||
void prepareDataCount(const QList<dsint> & wRVAs, QList<Instruction_t>* instBuffer);
|
void prepareDataCount(const QList<dsint> & wRVAs, QList<Instruction_t>* instBuffer);
|
||||||
void prepareDataRange(dsint startRva, dsint endRva, const std::function<void(int, const Instruction_t &)> & disassembled);
|
void prepareDataRange(dsint startRva, dsint endRva, const std::function<bool(int, const Instruction_t &)> & disassembled);
|
||||||
|
|
||||||
//misc
|
//misc
|
||||||
void setCodeFoldingManager(CodeFoldingHelper* CodeFoldingManager);
|
void setCodeFoldingManager(CodeFoldingHelper* CodeFoldingManager);
|
||||||
|
|
|
@ -31,6 +31,8 @@ Bridge::~Bridge()
|
||||||
|
|
||||||
void Bridge::CopyToClipboard(const QString & text)
|
void Bridge::CopyToClipboard(const QString & text)
|
||||||
{
|
{
|
||||||
|
if(!text.length())
|
||||||
|
return;
|
||||||
QClipboard* clipboard = QApplication::clipboard();
|
QClipboard* clipboard = QApplication::clipboard();
|
||||||
clipboard->setText(text);
|
clipboard->setText(text);
|
||||||
GuiAddStatusBarMessage(tr("The data has been copied to clipboard.\n").toUtf8().constData());
|
GuiAddStatusBarMessage(tr("The data has been copied to clipboard.\n").toUtf8().constData());
|
||||||
|
|
|
@ -1572,6 +1572,7 @@ void CPUDisassembly::pushSelectionInto(bool copyBytes, QTextStream & stream)
|
||||||
if(copyBytes)
|
if(copyBytes)
|
||||||
stream << " | " + bytes.leftJustified(bytesLen, QChar(' '), true);
|
stream << " | " + bytes.leftJustified(bytesLen, QChar(' '), true);
|
||||||
stream << " | " + disassembly.leftJustified(disassemblyLen, QChar(' '), true) + " |" + fullComment;
|
stream << " | " + disassembly.leftJustified(disassemblyLen, QChar(' '), true) + " |" + fullComment;
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1600,7 +1601,10 @@ void CPUDisassembly::copyAddressSlot()
|
||||||
QString clipboard = "";
|
QString clipboard = "";
|
||||||
prepareDataRange(getSelectionStart(), getSelectionEnd(), [&](int i, const Instruction_t & inst)
|
prepareDataRange(getSelectionStart(), getSelectionEnd(), [&](int i, const Instruction_t & inst)
|
||||||
{
|
{
|
||||||
clipboard += ToPtrString(rvaToVa(inst.rva)) + "\r\n";
|
if(i)
|
||||||
|
clipboard += "\r\n";
|
||||||
|
clipboard += ToPtrString(rvaToVa(inst.rva));
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
Bridge::CopyToClipboard(clipboard);
|
Bridge::CopyToClipboard(clipboard);
|
||||||
}
|
}
|
||||||
|
@ -1610,12 +1614,18 @@ void CPUDisassembly::copyRvaSlot()
|
||||||
QString clipboard = "";
|
QString clipboard = "";
|
||||||
prepareDataRange(getSelectionStart(), getSelectionEnd(), [&](int i, const Instruction_t & inst)
|
prepareDataRange(getSelectionStart(), getSelectionEnd(), [&](int i, const Instruction_t & inst)
|
||||||
{
|
{
|
||||||
|
if(i)
|
||||||
|
clipboard += "\r\n";
|
||||||
duint addr = rvaToVa(inst.rva);
|
duint addr = rvaToVa(inst.rva);
|
||||||
duint base = DbgFunctions()->ModBaseFromAddr(addr);
|
duint base = DbgFunctions()->ModBaseFromAddr(addr);
|
||||||
if(base)
|
if(base)
|
||||||
clipboard += ToHexString(addr - base) + "\r\n";
|
clipboard += ToHexString(addr - base);
|
||||||
else
|
else
|
||||||
|
{
|
||||||
SimpleWarningBox(this, tr("Error!"), tr("Selection not in a module..."));
|
SimpleWarningBox(this, tr("Error!"), tr("Selection not in a module..."));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
Bridge::CopyToClipboard(clipboard);
|
Bridge::CopyToClipboard(clipboard);
|
||||||
}
|
}
|
||||||
|
@ -1629,6 +1639,7 @@ void CPUDisassembly::copyDisassemblySlot()
|
||||||
clipboard += "\r\n";
|
clipboard += "\r\n";
|
||||||
for(const auto & token : inst.tokens.tokens)
|
for(const auto & token : inst.tokens.tokens)
|
||||||
clipboard += token.text;
|
clipboard += token.text;
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
Bridge::CopyToClipboard(clipboard);
|
Bridge::CopyToClipboard(clipboard);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue