From 62732de227d40f8177ee35e41cbe7da2f930ee79 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Fri, 12 Dec 2025 22:04:15 +0100 Subject: [PATCH] fix: Gaps in-between hex editor highlighting on specific scalings --- plugins/ui/source/ui/hex_editor.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/ui/source/ui/hex_editor.cpp b/plugins/ui/source/ui/hex_editor.cpp index b4c6fe9ed..b269007eb 100644 --- a/plugins/ui/source/ui/hex_editor.cpp +++ b/plugins/ui/source/ui/hex_editor.cpp @@ -782,6 +782,7 @@ namespace hex::ui { auto byteCellSize = (CharacterSize * ImVec2(maxCharsPerCell, 1)) + (ImVec2(2, 2) * ImGui::GetStyle().CellPadding) + scaled(ImVec2(1 + m_byteCellPadding, 0)); byteCellSize = ImVec2(std::ceil(byteCellSize.x), std::ceil(byteCellSize.y)); + std::optional prevEndPosX; for (u64 x = 0; x < columnCount; x++) { const u64 byteAddress = y * bytesPerRow + x * bytesPerCell + m_provider->getBaseAddress() + m_provider->getCurrentPageAddress(); @@ -794,6 +795,7 @@ namespace hex::ui { if (x < std::ceil(float(validBytes) / bytesPerCell)) { auto cellStartPos = getCellPosition(); + auto [foregroundColor, backgroundColor] = cellColors[x]; auto adjustedCellSize = byteCellSize; @@ -809,6 +811,13 @@ namespace hex::ui { backgroundColor = applySelectionColor(byteAddress, backgroundColor); + if (prevEndPosX.has_value()) { + adjustedCellSize.x += cellStartPos.x - prevEndPosX.value(); + cellStartPos.x = prevEndPosX.value(); + } + + prevEndPosX = cellStartPos.x + adjustedCellSize.x; + // Draw highlights and selection if (backgroundColor.has_value()) { this->drawBackgroundHighlight(cellStartPos, adjustedCellSize, backgroundColor.value());