Clipper bugfix and iterator interface #626
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #610
Adds a hard-to-misuse iterator wrapper around the list clipper interface. Retains the step/display_start/display_end API for consistency with C++ and it is slightly more flexible which might be important in a few circumstances (where you want to draw the entire start..end chunk in a single call)
Main part missing currently is I haven't backported the upstream bugfix preventing "clipper.end(); clipper.step()` from segfaulting because of a null pointer (with the changes mentioned in #610 it will crash via assert() instead)
However this now only crashes if the user calls end and step explicitly - previously it was crashing if user just called
.end()
(because the drop token was incorrectly callingstep()
) - sort of undecided if it's worth backporting the change given this is a lesser used feature, and it's in an error path. Might be better to add a temporary internal check for double-end and panic - we can them remove it in future imgui release