From 8382f68601ef5f68a9c2a9cb5f786cfb7d1d6489 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Fri, 8 Jul 2022 09:21:49 +0200 Subject: [PATCH] fix: Data inspector string row not being editable correctly Fixes #575 --- plugins/builtin/source/content/data_inspector.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/builtin/source/content/data_inspector.cpp b/plugins/builtin/source/content/data_inspector.cpp index ddeb68557..69992d165 100644 --- a/plugins/builtin/source/content/data_inspector.cpp +++ b/plugins/builtin/source/content/data_inspector.cpp @@ -349,7 +349,7 @@ namespace hex::plugin::builtin { ContentRegistry::DataInspector::add("hex.builtin.inspector.string", 1, [](auto buffer, auto endian, auto style) { - hex::unused(endian, style); + hex::unused(buffer, endian, style); auto currSelection = ImHexApi::HexEditor::getSelection(); @@ -358,14 +358,15 @@ namespace hex::plugin::builtin { std::string value, copyValue; if (currSelection.has_value()) { - std::vector stringBuffer(std::min(MaxStringLength, currSelection->size), 0x00); + std::vector stringBuffer(std::min(currSelection->size, 0x1000), 0x00); ImHexApi::Provider::get()->read(currSelection->address, stringBuffer.data(), stringBuffer.size()); - value = hex::encodeByteString(stringBuffer); - copyValue = hex::encodeByteString(buffer); + value = copyValue = hex::encodeByteString(stringBuffer); - if (currSelection->size > MaxStringLength) + if (currSelection->size > MaxStringLength) { + value.resize(MaxStringLength); value += "..."; + } } else { value = ""; copyValue = "";