Skip to content

Commit a640698

Browse files
nyorainocornut
authored andcommitted
Clipper: Fixed incorrect end-list positioning when using ImGuiListClipper with 1 item (bug in 1.79). (ocornut#3663)
1 parent ae63d56 commit a640698

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

docs/CHANGELOG.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ Other Changes:
8080
- Drag and Drop: Fix drag and drop to tie same-size drop targets by choosen the later one. Fixes dragging
8181
into a full-window-sized dockspace inside a zero-padded window. (#3519, #2717) [@Black-Cat]
8282
- Checkbox: Added CheckboxFlags() helper with int* type.
83+
- Clipper: Fixed incorrect end-list positioning when using ImGuiListClipper with 1 item (bug in 1.79). (#3663) [@nyorain]
8384
- InputText: Fixed updating cursor/selection position when a callback altered the buffer in a way
8485
where the byte count is unchanged but the decoded character count changes. (#3587) [@gqw]
8586
- InputText: Fixed swiching from single to multi-line while preserving same ID.

imgui.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2266,8 +2266,8 @@ bool ImGuiListClipper::Step()
22662266
if (table && table->IsInsideRow)
22672267
ImGui::TableEndRow(table);
22682268

2269-
// Reached end of list
2270-
if (DisplayEnd >= ItemsCount || GetSkipItemForListClipping())
2269+
// No items
2270+
if (ItemsCount == 0 || GetSkipItemForListClipping())
22712271
{
22722272
End();
22732273
return false;
@@ -2320,6 +2320,13 @@ bool ImGuiListClipper::Step()
23202320
StepNo = 2;
23212321
}
23222322

2323+
// Reached end of list
2324+
if (DisplayEnd >= ItemsCount)
2325+
{
2326+
End();
2327+
return false;
2328+
}
2329+
23232330
// Step 2: calculate the actual range of elements to display, and position the cursor before the first element
23242331
if (StepNo == 2)
23252332
{

0 commit comments

Comments
 (0)