preserve dbgi fuzzy searching results based on key alone, rather than throwing away all results if params change (although still re-querying if params change); also fix not clearing the autocompletion string gathered for a UI build across frames

This commit is contained in:
Ryan Fleury
2025-05-06 09:31:16 -07:00
parent e5a2f6da11
commit 2b1e286aad
2 changed files with 5 additions and 5 deletions
+4 -5
View File
@@ -704,12 +704,11 @@ di_search_items_from_key_params_query(DI_Scope *scope, U128 key, DI_SearchParams
B32 params_stale = 1;
B32 query_stale = 1;
B32 results_stale = 1;
if(params_hash == node->buckets[node->bucket_read_gen%ArrayCount(node->buckets)].params_hash &&
node->bucket_read_gen != 0)
if(node->bucket_read_gen != 0)
{
di_scope_touch_search_node__stripe_mutex_r_guarded(scope, node);
items = node->items;
params_stale = 0;
params_stale = (params_hash != node->buckets[node->bucket_read_gen%ArrayCount(node->buckets)].params_hash);
query_stale = !str8_match(query, node->buckets[node->bucket_read_gen%ArrayCount(node->buckets)].query, 0);
results_stale = (node->bucket_read_gen < node->bucket_write_gen);
}
@@ -718,8 +717,8 @@ di_search_items_from_key_params_query(DI_Scope *scope, U128 key, DI_SearchParams
*stale_out = (params_stale || query_stale || results_stale);
}
// rjf: if query stale -> request again
if(query_stale && node->bucket_read_gen <= node->bucket_write_gen && node->bucket_write_gen < node->bucket_read_gen + ArrayCount(node->buckets)-1)
// rjf: if query or params stale -> request again
if((query_stale || params_stale) && node->bucket_read_gen <= node->bucket_write_gen && node->bucket_write_gen < node->bucket_read_gen + ArrayCount(node->buckets)-1)
{
node->bucket_write_gen += 1;
if(node->bucket_write_gen >= node->bucket_items_gen + ArrayCount(node->buckets))
+1
View File
@@ -833,6 +833,7 @@ ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, U
ui_state->tags_key_stack_top = ui_state->tags_key_stack_free = 0;
ui_state->tags_cache_slots_count = 512;
ui_state->tags_cache_slots = push_array(ui_build_arena(), UI_TagsCacheSlot, ui_state->tags_cache_slots_count);
ui_state->autocomplete_string = str8_zero();
}
//- rjf: prune unused animation nodes