1
0
mirror of synced 2025-01-18 17:14:13 +01:00

fix: misuse of clipper (#445)

clipper.Step() should be called in a loop until it returns false.
You don't need to call End() after it.

Co-authored-by: Dmitry Polshakov <dmitry.polshakov@dsr-corporation.com>
This commit is contained in:
Polshakov Dmitry 2022-02-18 15:32:36 +03:00 committed by GitHub
parent 39cc845df3
commit 07ae00aa20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -295,7 +295,6 @@ struct MemoryEditor
const int line_total_count = (int)((mem_size + Cols - 1) / Cols);
clipper.Begin(line_total_count, s.LineHeight);
clipper.Step();
const size_t visible_start_addr = clipper.DisplayStart * Cols;
const size_t visible_end_addr = clipper.DisplayEnd * Cols;
const size_t visible_count = visible_end_addr - visible_start_addr;
@ -377,6 +376,8 @@ struct MemoryEditor
const char* format_byte_space = OptUpperCaseHex ? "%02X " : "%02x ";
bool tooltipShown = false;
while (clipper.Step())
{
for (int line_i = clipper.DisplayStart; line_i < clipper.DisplayEnd; line_i++) // display only visible lines
{
size_t addr = (size_t)(line_i * Cols);
@ -688,8 +689,8 @@ struct MemoryEditor
}
}
}
clipper.Step();
clipper.End();
}
ImGui::PopStyleVar(2);
ImGui::EndChild();