Skip to content

Commit

Permalink
solves #17
Browse files Browse the repository at this point in the history
  • Loading branch information
gcarmix committed Sep 11, 2023
1 parent 528ffc8 commit 8668e3f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion hexwalk/hexwalkmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ void HexWalkMain::loadFile(const QString &fileName)
void HexWalkMain::about()
{
QMessageBox::about(this, tr("About HexWalk"),
tr("HexWalk v1.4.1 is an HEX editor/viewer/analyzer.\r\n"
tr("HexWalk v1.4.2 is an HEX editor/viewer/analyzer.\r\n"
"It is open source and it is based on QT, qhexedit2, binwalk\r\n"
"Sources at https://github.com/gcarmix/HexWalk\r\n"));
}
Expand Down
20 changes: 18 additions & 2 deletions src/qhexedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -852,9 +852,25 @@ void QHexEdit::keyPressEvent(QKeyEvent *event)
/* Copy */
if (event->matches(QKeySequence::Copy))
{
QByteArray ba = _chunks->data(getSelectionBegin(), getSelectionEnd() - getSelectionBegin()).toHex();
QByteArray ba;
if(!_editAreaIsAscii)
{
ba = _chunks->data(getSelectionBegin(), getSelectionEnd() - getSelectionBegin()).toHex();
for (qint64 idx = 32; idx < ba.size(); idx +=33)
ba.insert(idx, "\n");
ba.insert(idx, "\n");
}
else
{
ba = _chunks->data(getSelectionBegin(), getSelectionEnd() - getSelectionBegin());
for (int i = 0; i < ba.length(); i++) {
if(ba.at(i) < 32 || ba.at(i) > 126)
{
ba[i] = '.';
}
}
}


QClipboard *clipboard = QApplication::clipboard();
clipboard->setText(ba);
}
Expand Down

0 comments on commit 8668e3f

Please sign in to comment.