From b4ac46f7192ff6dcb50176cc24ed128ce520ebdc Mon Sep 17 00:00:00 2001 From: Sergei Rebrov Date: Tue, 6 Jun 2023 09:22:10 +0300 Subject: [PATCH] impr: Set currently selected address in selection popup (#1125) Set the Begin field to the current selected address --- plugins/builtin/source/content/views/view_hex_editor.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/builtin/source/content/views/view_hex_editor.cpp b/plugins/builtin/source/content/views/view_hex_editor.cpp index 85762629d..a092f16f2 100644 --- a/plugins/builtin/source/content/views/view_hex_editor.cpp +++ b/plugins/builtin/source/content/views/view_hex_editor.cpp @@ -105,6 +105,8 @@ namespace hex::plugin::builtin { class PopupSelect : public ViewHexEditor::Popup { public: + + PopupSelect(u64 address, size_t size): m_region({address, size}) {} void draw(ViewHexEditor *editor) override { ImGui::TextUnformatted("hex.builtin.view.hex_editor.menu.file.select"_lang); @@ -1017,7 +1019,8 @@ namespace hex::plugin::builtin { ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.hex_editor.menu.file.select" }, 1650, CTRLCMD + SHIFT + Keys::A, [this] { - this->openPopup(); + auto selection = ImHexApi::HexEditor::getSelection(); + this->openPopup(selection->getStartAddress(), selection->getSize()); }, ImHexApi::Provider::isValid); @@ -1193,4 +1196,4 @@ namespace hex::plugin::builtin { [] { return ImHexApi::HexEditor::isSelectionValid() && ImHexApi::Provider::isValid(); }); } -} \ No newline at end of file +}