move watch window to using exclusively view ui rule input eval, rather than looking at the expression string itself

This commit is contained in:
Ryan Fleury
2025-02-11 14:14:55 -08:00
parent fa7143a3e4
commit 50e4f6a22a
5 changed files with 13 additions and 30 deletions
@@ -476,26 +476,24 @@ ev_keyed_expr_push_tags(Arena *arena, EV_View *view, EV_Block *block, EV_Key key
//~ rjf: Block Building
internal EV_BlockTree
ev_block_tree_from_string(Arena *arena, EV_View *view, String8 filter, String8 string)
ev_block_tree_from_eval(Arena *arena, EV_View *view, String8 filter, E_Eval eval)
{
ProfBeginFunction();
EV_BlockTree tree = {&ev_nil_block};
{
Temp scratch = scratch_begin(&arena, 1);
//- rjf: produce root expression
//- rjf: generate root expression
EV_Key root_key = ev_key_root();
EV_Key root_row_key = ev_key_make(ev_hash_from_key(root_key), 1);
E_TokenArray root_tokens = e_token_array_from_text(scratch.arena, string);
E_Parse root_parse = e_parse_expr_from_text_tokens(arena, string, &root_tokens);
E_Expr *root_expr = root_parse.last_expr;
E_Expr *root_expr = e_expr_copy(arena, eval.expr);
ev_keyed_expr_push_tags(arena, view, &ev_nil_block, root_row_key, root_expr);
//- rjf: generate root block
tree.root = push_array(arena, EV_Block, 1);
MemoryCopyStruct(tree.root, &ev_nil_block);
tree.root->key = root_key;
tree.root->string = string;
tree.root->string = str8_zero();
tree.root->expr = root_expr;
tree.root->row_count = 1;
tree.total_row_count += 1;
@@ -337,7 +337,7 @@ internal void ev_keyed_expr_push_tags(Arena *arena, EV_View *view, EV_Block *blo
////////////////////////////////
//~ rjf: Block Building
internal EV_BlockTree ev_block_tree_from_string(Arena *arena, EV_View *view, String8 filter, String8 string);
internal EV_BlockTree ev_block_tree_from_eval(Arena *arena, EV_View *view, String8 filter, E_Eval eval);
internal U64 ev_depth_from_block(EV_Block *block);
////////////////////////////////
+6 -15
View File
@@ -2990,7 +2990,7 @@ rd_view_ui(Rng2F32 rect)
}
// rjf: unpack view's target expression & hash
String8 expr_string = rd_view_expr_string();
String8 expr_string = rd_expr_from_cfg(view);
E_Eval eval = e_eval_from_string(scratch.arena, expr_string);
Rng1U64 range = r1u64(0, 1024);
U128 key = rd_key_from_eval_space_range(eval.space, range, 0);
@@ -3112,15 +3112,6 @@ rd_view_eval_view(void)
return view_state->ev_view;
}
internal String8
rd_view_expr_string(void)
{
RD_Cfg *view = rd_cfg_from_id(rd_regs()->view);
RD_Cfg *expr = rd_cfg_child_from_string(view, str8_lit("expression"));
String8 expr_string = expr->first->string;
return expr_string;
}
internal String8
rd_view_filter(void)
{
@@ -6217,7 +6208,7 @@ rd_window_frame(void)
RD_RegsScope(.view = view->id)
{
rd_cfg_new_replace(expr, ws->hover_eval_string);
EV_BlockTree predicted_block_tree = ev_block_tree_from_string(scratch.arena, rd_view_eval_view(), str8_zero(), ws->hover_eval_string);
EV_BlockTree predicted_block_tree = ev_block_tree_from_eval(scratch.arena, rd_view_eval_view(), str8_zero(), hover_eval);
F32 row_height_px = floor_f32(ui_top_font_size()*2.5f);
U64 max_row_count = (U64)floor_f32(ui_top_font_size()*10.f / row_height_px);
if(ws->hover_eval_focused)
@@ -15138,7 +15129,7 @@ Z(getting_started)
// rjf: get source path
RD_Cfg *src_view = rd_cfg_from_id(rd_regs()->view);
String8 src_view_expr = rd_view_expr_string();
String8 src_view_expr = rd_expr_from_cfg(src_view);
String8 src_file_path = rd_file_path_from_eval_string(scratch.arena, src_view_expr);
String8List src_file_parts = str8_split_path(scratch.arena, src_file_path);
@@ -15305,7 +15296,7 @@ Z(getting_started)
if(rd_cfg_is_project_filtered(tab)) { continue; }
RD_RegsScope(.view = tab->id)
{
String8 tab_expr = rd_view_expr_string();
String8 tab_expr = rd_expr_from_cfg(tab);
String8 tab_file_path = rd_file_path_from_eval_string(scratch.arena, tab_expr);
if((str8_match(tab->string, str8_lit("text"), 0) || str8_match(tab->string, str8_lit("pending"), 0)) &&
path_match_normalized(tab_file_path, file_path))
@@ -15377,7 +15368,7 @@ Z(getting_started)
RD_RegsScope(.view = tab->id)
{
B32 tab_is_selected = (tab == panel->selected_tab);
String8 expr_string = rd_view_expr_string();
String8 expr_string = rd_expr_from_cfg(tab);
if(str8_match(tab->string, str8_lit("disasm"), 0) && expr_string.size == 0 && panel_area > best_panel_area)
{
panel_w_disasm = panel;
@@ -17020,7 +17011,7 @@ Z(getting_started)
}
RD_RegsScope(.view = tab->id)
{
String8 eval_string = rd_view_expr_string();
String8 eval_string = rd_expr_from_cfg(tab);
String8 file_path = rd_file_path_from_eval_string(scratch.arena, eval_string);
if(file_path.size != 0)
{
-1
View File
@@ -1077,7 +1077,6 @@ internal void rd_view_ui(Rng2F32 rect);
internal Arena *rd_view_arena(void);
internal UI_ScrollPt2 rd_view_scroll_pos(void);
internal EV_View *rd_view_eval_view(void);
internal String8 rd_view_expr_string(void);
internal String8 rd_view_filter(void);
internal RD_Cfg *rd_view_cfg_from_string(String8 string);
internal E_Value rd_view_cfg_value_from_string(String8 string);
+2 -7
View File
@@ -1586,11 +1586,6 @@ RD_VIEW_UI_FUNCTION_DEF(watch)
F32 row_string_max_size_px = dim_2f32(rect).x;
EV_StringFlags string_flags = EV_StringFlag_ReadOnlyDisplayRules;
String8 filter = rd_view_filter();
String8 expr = rd_view_expr_string();
if(expr.size == 0)
{
expr = str8_lit("query:watches");
}
//////////////////////////////
//- rjf: decide if root should be implicit
@@ -1642,7 +1637,7 @@ RD_VIEW_UI_FUNCTION_DEF(watch)
MemoryZeroStruct(&block_tree);
MemoryZeroStruct(&block_ranges);
ev_key_set_expansion(eval_view, ev_key_root(), ev_key_make(ev_hash_from_key(ev_key_root()), 1), 1);
block_tree = ev_block_tree_from_string(scratch.arena, eval_view, filter, expr);
block_tree = ev_block_tree_from_eval(scratch.arena, eval_view, filter, eval);
block_ranges = ev_block_range_list_from_tree(scratch.arena, &block_tree);
if(implicit_root && block_ranges.first != 0)
{
@@ -4181,7 +4176,7 @@ RD_VIEW_UI_FUNCTION_DEF(text)
// rjf: override file picking
case RD_CmdKind_PickFile:
{
String8 src = rd_file_path_from_eval_string(scratch.arena, rd_view_expr_string());
String8 src = rd_regs()->file_path;
String8 dst = cmd->regs->file_path;
if(src.size != 0 && dst.size != 0)
{