From 0f5d659ce25025a7cafb7ef685ab76688cd711b9 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Thu, 9 Nov 2023 14:42:29 +0100 Subject: [PATCH] impr: Fade out zero bytes in HTML formatted data --- plugins/builtin/source/content/data_formatters.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/plugins/builtin/source/content/data_formatters.cpp b/plugins/builtin/source/content/data_formatters.cpp index 106880768..a3a1a01f5 100644 --- a/plugins/builtin/source/content/data_formatters.cpp +++ b/plugins/builtin/source/content/data_formatters.cpp @@ -157,6 +157,7 @@ namespace hex::plugin::builtin { " .offsetcolumn { color:#0000A0 }\n" " .hexcolumn { color:#000000 }\n" " .textcolumn { color:#000000 }\n" + " .zerobyte { color:#808080 }\n" " \n\n" " \n" " Hex View  00 01 02 03 04 05 06 07  08 09 0A 0B 0C 0D 0E 0F"; @@ -185,7 +186,13 @@ namespace hex::plugin::builtin { result += ""; } - result += hex::format("{0:02X} ", byte); + std::string tagStart, tagEnd; + if (byte == 0x00) { + tagStart = ""; + tagEnd = ""; + } + + result += hex::format("{0}{2:02X}{1} ", tagStart, tagEnd, byte); asciiRow += std::isprint(byte) ? char(byte) : '.'; if ((address % 0x10) == 0x07) result += " "; @@ -193,8 +200,9 @@ namespace hex::plugin::builtin { address++; } - for (u32 i = 0; i < (0x10 - (address % 0x10)); i++) - result += "   "; + if (address % 0x10 != 0x00) + for (u32 i = 0; i < (0x10 - (address % 0x10)); i++) + result += "   "; result += asciiRow; result +=