mirror of https://github.com/WerWolv/ImHex
fix: Gaps in-between hex editor highlighting on specific scalings
This commit is contained in:
parent
63e777c84c
commit
62732de227
|
|
@ -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));
|
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));
|
byteCellSize = ImVec2(std::ceil(byteCellSize.x), std::ceil(byteCellSize.y));
|
||||||
|
|
||||||
|
std::optional<float> prevEndPosX;
|
||||||
for (u64 x = 0; x < columnCount; x++) {
|
for (u64 x = 0; x < columnCount; x++) {
|
||||||
const u64 byteAddress = y * bytesPerRow + x * bytesPerCell + m_provider->getBaseAddress() + m_provider->getCurrentPageAddress();
|
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)) {
|
if (x < std::ceil(float(validBytes) / bytesPerCell)) {
|
||||||
auto cellStartPos = getCellPosition();
|
auto cellStartPos = getCellPosition();
|
||||||
|
|
||||||
auto [foregroundColor, backgroundColor] = cellColors[x];
|
auto [foregroundColor, backgroundColor] = cellColors[x];
|
||||||
|
|
||||||
auto adjustedCellSize = byteCellSize;
|
auto adjustedCellSize = byteCellSize;
|
||||||
|
|
@ -809,6 +811,13 @@ namespace hex::ui {
|
||||||
|
|
||||||
backgroundColor = applySelectionColor(byteAddress, backgroundColor);
|
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
|
// Draw highlights and selection
|
||||||
if (backgroundColor.has_value()) {
|
if (backgroundColor.has_value()) {
|
||||||
this->drawBackgroundHighlight(cellStartPos, adjustedCellSize, backgroundColor.value());
|
this->drawBackgroundHighlight(cellStartPos, adjustedCellSize, backgroundColor.value());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue