File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,12 @@ vector<uint8_t> &HexEditor::getCurrentData() {
101101}
102102
103103string HexEditor::getCurrentDataAsString (unsigned long start, unsigned long len) {
104- std::string str (this ->current_data .begin () + start, this ->current_data .begin () + start + len);
104+ string str;
105+ std::for_each (this ->current_data .begin () + start, this ->current_data .begin () + start + len, [&str](uint8_t const & elem) {
106+ if (elem != 0 ) {
107+ str.push_back ((char )elem);
108+ }
109+ });
105110 return str;
106111}
107112
Original file line number Diff line number Diff line change @@ -555,7 +555,7 @@ void Fhex::keyPressEvent(QKeyEvent *event) {
555555 if (event->type () == QKeyEvent::KeyPress) {
556556 if ((event->key () == Qt::Key_Space) && QApplication::keyboardModifiers ().testFlag (Qt::ControlModifier)) {
557557 pair<qint64,qint64> offsets = this ->qhex ->selectedOffsets ();
558- QApplication::clipboard ()->setText (QString::fromWCharArray ( this ->hexEditor ->getCurrentDataAsWString (offsets.first , offsets.second - offsets.first ).c_str () ));
558+ QApplication::clipboard ()->setText (this ->hexEditor ->getCurrentDataAsString (offsets.first , offsets.second - offsets.first ).c_str ());
559559 this ->statusBar .setText (" Text copied" );
560560 } else if (event->key () == Qt::Key_F5) {
561561 this ->loadFile (this ->hexEditor ->getCurrentPath ().c_str ());
You can’t perform that action at this time.
0 commit comments