Commit b976a34e authored by hjk's avatar hjk
Browse files

bineditor: allow copying also if selection is "backwards"

parent ad0eff18
...@@ -1290,9 +1290,11 @@ void BinEditor::zoomOut(int range) ...@@ -1290,9 +1290,11 @@ void BinEditor::zoomOut(int range)
void BinEditor::copy(bool raw) void BinEditor::copy(bool raw)
{ {
const int selStart = selectionStart(); int selStart = selectionStart();
const int selEnd = selectionEnd(); int selEnd = selectionEnd();
if (selStart < selEnd) { if (selStart >= selEnd)
qSwap(selStart, selEnd);
const int selectionLength = selEnd - selStart; const int selectionLength = selEnd - selStart;
if (selectionLength >> 22) { if (selectionLength >> 22) {
QMessageBox::warning(this, tr("Copying Failed"), QMessageBox::warning(this, tr("Copying Failed"),
...@@ -1313,7 +1315,6 @@ void BinEditor::copy(bool raw) ...@@ -1313,7 +1315,6 @@ void BinEditor::copy(bool raw)
} }
hexString.chop(1); hexString.chop(1);
QApplication::clipboard()->setText(hexString); QApplication::clipboard()->setText(hexString);
}
} }
void BinEditor::highlightSearchResults(const QByteArray &pattern, QTextDocument::FindFlags findFlags) void BinEditor::highlightSearchResults(const QByteArray &pattern, QTextDocument::FindFlags findFlags)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment