libui icon indicating copy to clipboard operation
libui copied to clipboard

Fix table row inserted/deleted documentation and windows implementation.

Open szanni opened this issue 4 years ago • 0 comments

As I failed to understand the documentation of both uiTableModelRowInserted() and uiTableModelRowDeleted() on when to insert to/delete from the underlying model and when to in/decrease the NumRows() counter - I decided to do some digging.

As it stands the current implementation does not seem to be so sure itself. The windows code is completely broken. The TODOs regarding API clarification and compatability with unix and darwin were never implemented. This patch set fixes all that.

  • Clarify the API: we now require rows to be inserted/deleted in the model before calling uiTableModelRowInserted() and uiTableModelRowDeleted()
  • Clarify the API: we now require the row count in NumRows() to reflect the new row count before calling uiTableModelRowInserted() and uiTableModelRowDeleted()
  • Fix double row insertion on windows (Fixes #416, and supersedes/closes #484)

Strictly API wise speaking only gtk seems to require data insertion into the model before calling uiTableModelRowInserted(). With this patch set no implementation actually relies on the value in NumRows(). But my reasoning is that both functions are past tense. The operation has already been performed and hence the state of the model should represent that. Otherwise I would consider the function names to be buggy.

Oh and I used the win32 provided macros instead of the SendMessageW((CastARoo*))((FUNCTIONS))

szanni avatar Sep 21 '20 01:09 szanni