diff --git a/lib/libimhex/source/helpers/utils.cpp b/lib/libimhex/source/helpers/utils.cpp index b8a71e9e5..b8edbc445 100644 --- a/lib/libimhex/source/helpers/utils.cpp +++ b/lib/libimhex/source/helpers/utils.cpp @@ -685,7 +685,7 @@ namespace hex { return string; // If the string is longer than the max length, find the last space before the max length - auto it = string.begin() + maxLength / 2; + auto it = string.begin() + maxLength; while (it != string.begin() && !std::isspace(*it)) --it; // If there's no space before the max length, just cut the string diff --git a/plugins/builtin/source/content/views/view_pattern_editor.cpp b/plugins/builtin/source/content/views/view_pattern_editor.cpp index ff4ed5fc0..5533e8e78 100644 --- a/plugins/builtin/source/content/views/view_pattern_editor.cpp +++ b/plugins/builtin/source/content/views/view_pattern_editor.cpp @@ -1456,6 +1456,7 @@ namespace hex::plugin::builtin { void ViewPatternEditor::drawPatternTooltip(pl::ptrn::Pattern *pattern) { ImGui::PushID(pattern); { + const bool shiftHeld = ImGui::GetIO().KeyShift; ImGui::ColorButton(pattern->getVariableName().c_str(), ImColor(pattern->getColor())); ImGui::SameLine(0, 10); ImGuiExt::TextFormattedColored(TextEditor::GetPalette()[u32(TextEditor::PaletteIndex::KnownIdentifier)], "{} ", pattern->getFormattedName()); @@ -1464,9 +1465,9 @@ namespace hex::plugin::builtin { ImGui::SameLine(); ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); ImGui::SameLine(); - ImGuiExt::TextFormatted("{} ", hex::limitStringLength(pattern->getFormattedValue(), 64)); + ImGuiExt::TextFormatted("{: <{}} ", hex::limitStringLength(pattern->getFormattedValue(), 64), shiftHeld ? 40 : 0); - if (ImGui::GetIO().KeyShift) { + if (shiftHeld) { ImGui::Indent(); if (ImGui::BeginTable("##extra_info", 2, ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_NoClip)) { ImGui::TableNextRow(); @@ -1498,7 +1499,7 @@ namespace hex::plugin::builtin { } ImGui::Indent(); - ImGui::PushTextWrapPos(300_scaled); + ImGui::PushTextWrapPos(500_scaled); ImGuiExt::TextFormattedWrapped("{}", path); ImGui::PopTextWrapPos(); ImGui::Unindent();