From 696d8d1d54b925e5b009e4720029ed5583013177 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Thu, 29 Dec 2022 15:08:36 +0100 Subject: [PATCH] feat: Allow pasting of bytes with prefixes and comma separators Closes #581 --- plugins/builtin/source/content/views/view_hex_editor.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/builtin/source/content/views/view_hex_editor.cpp b/plugins/builtin/source/content/views/view_hex_editor.cpp index 4b270270b..5fca798c3 100644 --- a/plugins/builtin/source/content/views/view_hex_editor.cpp +++ b/plugins/builtin/source/content/views/view_hex_editor.cpp @@ -630,6 +630,11 @@ namespace hex::plugin::builtin { if (clipboard.empty()) return; + // Remove common hex prefixes and commas + hex::replaceStrings(clipboard, "0x", ""); + hex::replaceStrings(clipboard, "0X", ""); + hex::replaceStrings(clipboard, ",", ""); + // Check for non-hex characters bool isValidHexString = std::find_if(clipboard.begin(), clipboard.end(), [](char c) { return !std::isxdigit(c) && !std::isspace(c);