diff --git a/plugins/builtin/source/ui/hex_editor.cpp b/plugins/builtin/source/ui/hex_editor.cpp index 32d6f3d73..4dc05795c 100644 --- a/plugins/builtin/source/ui/hex_editor.cpp +++ b/plugins/builtin/source/ui/hex_editor.cpp @@ -263,6 +263,11 @@ namespace hex::plugin::builtin::ui { } void HexEditor::drawSelectionFrame(u32 x, u32 y, Region selection, u64 byteAddress, u16 bytesPerCell, const ImVec2 &cellPos, const ImVec2 &cellSize, const ImColor &backgroundColor) const { + auto drawList = ImGui::GetWindowDrawList(); + + // Draw background color + drawList->AddRectFilled(cellPos, cellPos + cellSize, backgroundColor); + if (!this->isSelectionValid()) return; if (!Region { byteAddress, 1 }.isWithin(selection)) @@ -270,11 +275,6 @@ namespace hex::plugin::builtin::ui { const color_t SelectionFrameColor = ImGui::GetColorU32(ImGuiCol_Text); - auto drawList = ImGui::GetWindowDrawList(); - - // Draw background color - drawList->AddRectFilled(cellPos, cellPos + cellSize, backgroundColor); - // Draw vertical line at the left of first byte and the start of the line if (x == 0 || byteAddress == selection.getStartAddress()) drawList->AddLine(cellPos, cellPos + ImVec2(0, cellSize.y), ImColor(SelectionFrameColor), 1_scaled);