diff --git a/lib/libimhex/source/helpers/logger.cpp b/lib/libimhex/source/helpers/logger.cpp index 23e348c23..40f809b81 100644 --- a/lib/libimhex/source/helpers/logger.cpp +++ b/lib/libimhex/source/helpers/logger.cpp @@ -145,7 +145,7 @@ namespace hex::log { } void assertionHandler(bool expr, const char* exprString, const char* file, int line) { - if (!expr) { + if (!expr) [[unlikely]] { log::error("Assertion failed: {} at {}:{}", exprString, file, line); #if defined (DEBUG) diff --git a/lib/libimhex/source/ui/view.cpp b/lib/libimhex/source/ui/view.cpp index aa0a803d5..add68ccff 100644 --- a/lib/libimhex/source/ui/view.cpp +++ b/lib/libimhex/source/ui/view.cpp @@ -71,7 +71,7 @@ namespace hex { } std::string View::toWindowName(const UnlocalizedString &unlocalizedName) { - return Lang(unlocalizedName) + "###" + unlocalizedName.get(); + return fmt::format("{}###{}", Lang(unlocalizedName), unlocalizedName.get()); } } \ No newline at end of file diff --git a/plugins/builtin/source/content/ui_items.cpp b/plugins/builtin/source/content/ui_items.cpp index 907730dab..73434c91e 100644 --- a/plugins/builtin/source/content/ui_items.cpp +++ b/plugins/builtin/source/content/ui_items.cpp @@ -416,6 +416,7 @@ namespace hex::plugin::builtin { // Toolbar items ContentRegistry::Interface::addToolbarItem([] { + // TODO: Optimize this std::set menuItems; for (const auto &[priority, menuItem] : ContentRegistry::Interface::impl::getMenuItems()) { diff --git a/plugins/builtin/source/content/window_decoration.cpp b/plugins/builtin/source/content/window_decoration.cpp index 400171fac..057eb710b 100644 --- a/plugins/builtin/source/content/window_decoration.cpp +++ b/plugins/builtin/source/content/window_decoration.cpp @@ -279,18 +279,17 @@ namespace hex::plugin::builtin { toolbarIndex ] = menuItem; - createNestedMenu(unlocalizedNames, icon.glyph.c_str(), *shortcut, callback, enabledCallback, selectedCallack); + createNestedMenu(unlocalizedNames | std::views::drop(1), icon.glyph.c_str(), *shortcut, callback, enabledCallback, selectedCallack); } } void defineMenu(const UnlocalizedString &menuName) { ImGui::GetStyle().TouchExtraPadding = scaled(ImVec2(0, 2)); if (ImGui::BeginMenu(Lang(menuName))) { + populateMenu(menuName); ImGui::EndMenu(); } ImGui::GetStyle().TouchExtraPadding = ImVec2(0, 0); - - populateMenu(menuName); } void drawMenu() { diff --git a/plugins/ui/source/ui/hex_editor.cpp b/plugins/ui/source/ui/hex_editor.cpp index efc83886d..d7fe8a677 100644 --- a/plugins/ui/source/ui/hex_editor.cpp +++ b/plugins/ui/source/ui/hex_editor.cpp @@ -24,9 +24,11 @@ namespace hex::ui { hex::unused(address, upperCase); if (size == 1) { - const u8 c = data[0]; - if (std::isprint(c) != 0) - ImGui::Text("%c", c); + const char c = char(data[0]); + if (std::isprint(c) != 0) { + const std::array string = { c, 0x00 }; + ImGui::TextUnformatted(string.data()); + } else ImGui::TextDisabled("."); } else {