[ui] Use the same key algorithm for Hash_Find

Using label + key_offset in both imui_state_getkey and the call to
Hash_Find greatly simplifies the logic of using the correct key. Fixes
an ever-growing set of buttons when using separators (hmm, I think this
means pruning isn't working correctly).
This commit is contained in:
Bill Currie 2023-07-02 15:14:21 +09:00
parent 68e155448d
commit 3aceccf4aa

View file

@ -123,10 +123,8 @@ imui_get_state (imui_ctx_t *ctx, const char *label)
key_offset = (key += 3) - label;
}
label_len = key - label;
} else {
key = label;
}
imui_state_t *state = Hash_Find (ctx->tab, key);
imui_state_t *state = Hash_Find (ctx->tab, label + key_offset);
if (state) {
state->frame_count = ctx->frame_count;
return state;