fix: Hex editor search buttons not working (#439)

* fix: reset focus only once after window opening

* refactor: extract search functions

* fix: restore focus after search/goto

Co-authored-by: Dmitry Polshakov <dmitry.polshakov@dsr-corporation.com>
This commit is contained in:
Polshakov Dmitry
2022-02-13 22:13:59 +03:00
committed by GitHub
parent 24f3b8dd3d
commit 8be39488ec
2 changed files with 102 additions and 71 deletions

View File

@@ -45,6 +45,7 @@ namespace hex::plugin::builtin {
std::vector<char> m_searchHexBuffer;
SearchFunction m_searchFunction = nullptr;
std::vector<std::pair<u64, u64>> *m_lastSearchBuffer;
bool m_searchRequested = false;
i64 m_lastSearchIndex = 0;
std::vector<std::pair<u64, u64>> m_lastStringSearch;
@@ -52,6 +53,7 @@ namespace hex::plugin::builtin {
u64 m_gotoAddressAbsolute = 0;
i64 m_gotoAddressRelative = 0;
bool m_gotoRequested = false;
char m_baseAddressBuffer[0x20] = { 0 };
u64 m_resizeSize = 0;
@@ -71,6 +73,12 @@ namespace hex::plugin::builtin {
bool m_advancedDecodingEnabled = false;
void drawSearchPopup();
void drawSearchInput(std::vector<char> *currBuffer, ImGuiInputTextFlags flags);
void performSearch(char *buffer);
void performSearchNext();
void performSearchPrevious();
static int inputCallback(ImGuiInputTextCallbackData *data);
void drawGotoPopup();
void drawEditPopup();