fix: Gaps in-between hex editor highlighting on specific scalings

This commit is contained in:
WerWolv 2025-12-12 22:04:15 +01:00
parent 63e777c84c
commit 62732de227
1 changed files with 9 additions and 0 deletions

View File

@ -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<float> 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());