preserve whole chain of parent irtrees, do not simply apply only to autohook overrides; straighten out some event consumption weirdness in interaction between autocompletion floating view & query floating view; ensure we mark the cfg space as dirty when modifying strings

This commit is contained in:
Ryan Fleury
2025-05-13 13:44:14 -07:00
parent 97c58e3747
commit 8b8c88f310
4 changed files with 110 additions and 97 deletions
+7 -4
View File
@@ -1602,11 +1602,14 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, E_I
if(qualifier.size == 0 && !string_mapped && str8_match(string, str8_lit("$"), 0) && parent != 0 && (parent->root != &e_irnode_nil || parent->msgs.first != 0)) if(qualifier.size == 0 && !string_mapped && str8_match(string, str8_lit("$"), 0) && parent != 0 && (parent->root != &e_irnode_nil || parent->msgs.first != 0))
{ {
E_IRTreeAndType *parent_irtree = parent; E_IRTreeAndType *parent_irtree = parent;
if(disallow_autohooks)
{ {
for(E_IRTreeAndType *prev = parent_irtree->prev; prev != 0; prev = prev->prev) for(E_IRTreeAndType *prev = parent_irtree; prev != 0; prev = prev->prev)
{ {
parent_irtree = prev; parent_irtree = prev;
if(prev->root != &e_irnode_nil)
{
break;
}
} }
} }
E_OpList oplist = e_oplist_from_irtree(arena, parent_irtree->root); E_OpList oplist = e_oplist_from_irtree(arena, parent_irtree->root);
@@ -2331,10 +2334,10 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, E_I
} }
//- rjf: equip previous task's irtree //- rjf: equip previous task's irtree
if(t->overridden != 0) if(parent != 0)
{ {
result.prev = push_array(arena, E_IRTreeAndType, 1); result.prev = push_array(arena, E_IRTreeAndType, 1);
result.prev[0] = *t->overridden; result.prev[0] = *parent;
} }
//- rjf: find any auto hooks according to this generation's type //- rjf: find any auto hooks according to this generation's type
+2 -2
View File
@@ -417,8 +417,8 @@ RD_NameSchemaInfo rd_name_schema_info_table[24] =
{str8_lit_comp("watch"), str8_lit_comp("@inherit(tab) x:\n{\n @override @display_name('Tab Row Height') @description(\"Controls the tab's row height, in multiples of the font size.\")\n 'row_height': @range[1.75f, 5.f] f32,\n 'label': code_string,\n @description(\"The root expression which is evaluated to produce the watch window.\")\n 'expression': expr_string,\n @no_expand 'watches': query,\n}\n")}, {str8_lit_comp("watch"), str8_lit_comp("@inherit(tab) x:\n{\n @override @display_name('Tab Row Height') @description(\"Controls the tab's row height, in multiples of the font size.\")\n 'row_height': @range[1.75f, 5.f] f32,\n 'label': code_string,\n @description(\"The root expression which is evaluated to produce the watch window.\")\n 'expression': expr_string,\n @no_expand 'watches': query,\n}\n")},
{str8_lit_comp("text"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"An expression to describe data which should be viewed as text or code.\")\n 'expression': expr_string,\n @description(\"The language that the text should be interpreted as being within. Used for syntax highlighting and other parsing features.\")\n 'lang': code_string,\n @default(1) @description(\"Controls whether or not line numbers are shown.\")\n 'show_line_numbers':bool,\n @no_callee_helper @default(0) @display_name('Scroll To Bottom On Change') @description(\"Scrolls to the bottom if the text is changed.\")\n 'scroll_to_bottom_on_change':bool,\n @no_callee_helper @no_revert @default(0) @display_name('Transient') @description(\"Controls whether or not this tab will be automatically replaced by the debugger when it snaps to new source code locations.\")\n 'auto': bool,\n}\n")}, {str8_lit_comp("text"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"An expression to describe data which should be viewed as text or code.\")\n 'expression': expr_string,\n @description(\"The language that the text should be interpreted as being within. Used for syntax highlighting and other parsing features.\")\n 'lang': code_string,\n @default(1) @description(\"Controls whether or not line numbers are shown.\")\n 'show_line_numbers':bool,\n @no_callee_helper @default(0) @display_name('Scroll To Bottom On Change') @description(\"Scrolls to the bottom if the text is changed.\")\n 'scroll_to_bottom_on_change':bool,\n @no_callee_helper @no_revert @default(0) @display_name('Transient') @description(\"Controls whether or not this tab will be automatically replaced by the debugger when it snaps to new source code locations.\")\n 'auto': bool,\n}\n")},
{str8_lit_comp("disasm"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"An expression to describe the base address or offset of the disassembly.\")\n 'expression': expr_string,\n 'arch': code_string,\n 'syntax': code_string,\n 'size': expr_string,\n @no_callee_helper @default(1) @description(\"Controls whether or not addresses are shown in the disassembly text.\")\n 'show_addresses': bool,\n @no_callee_helper @default(0) @description(\"Controls whether or not code bytes are shown in the disassembly text.\")\n 'show_code_bytes': bool,\n @no_callee_helper @default(1) @description(\"Controls whether or not source lines, corresponding to disassembly instruction ranges, are shown in the disassembly text.\")\n 'show_source_lines': bool,\n @no_callee_helper @default(1) @description(\"Controls whether or not disassembly text is decorated with symbol names.\")\n 'show_symbol_names': bool,\n @no_callee_helper @default(1) @description(\"Controls whether or not line numbers are shown.\")\n 'show_line_numbers': bool,\n}\n")}, {str8_lit_comp("disasm"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"An expression to describe the base address or offset of the disassembly.\")\n 'expression': expr_string,\n 'arch': code_string,\n 'syntax': code_string,\n 'size': expr_string,\n @no_callee_helper @default(1) @description(\"Controls whether or not addresses are shown in the disassembly text.\")\n 'show_addresses': bool,\n @no_callee_helper @default(0) @description(\"Controls whether or not code bytes are shown in the disassembly text.\")\n 'show_code_bytes': bool,\n @no_callee_helper @default(1) @description(\"Controls whether or not source lines, corresponding to disassembly instruction ranges, are shown in the disassembly text.\")\n 'show_source_lines': bool,\n @no_callee_helper @default(1) @description(\"Controls whether or not disassembly text is decorated with symbol names.\")\n 'show_symbol_names': bool,\n @no_callee_helper @default(1) @description(\"Controls whether or not line numbers are shown.\")\n 'show_line_numbers': bool,\n}\n")},
{str8_lit_comp("memory"), str8_lit_comp("@inherit(tab) x:\n{\n @display_name(\"Base Address\") @description(\"An expression to describe the base address or offset of the memory view.\")\n 'expression': expr_string,\n @display_name(\"Address Range Size\") @description(\"The number of bytes of the viewed memory range.\")\n 'size': expr_string,\n @display_name(\"Cursor Address\") @description(\"The address of the cursor.\")\n 'cursor': expr_string,\n @display_name(\"Cursor Size\") @description(\"The size, in bytes, of the cursor.\")\n 'cursor_size': @range[1, 16] u64,\n @default(16) @description(\"The number of columns to build before building new rows.\")\n 'num_columns': @range[1, 64] u64,\n}\n")}, {str8_lit_comp("memory"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"An expression which refers to the data which should be viewed as memory.\")\n 'expression': expr_string,\n @display_name(\"Address Range Size\") @description(\"The number of bytes of the viewed memory range.\")\n 'size': expr_string,\n @display_name(\"Cursor Address\") @description(\"The address of the cursor.\")\n 'cursor': expr_string,\n @display_name(\"Cursor Size\") @description(\"The size, in bytes, of the cursor.\")\n 'cursor_size': @range[1, 16] u64,\n @default(16) @description(\"The number of columns to build before building new rows.\")\n 'num_columns': @range[1, 64] u64,\n}\n")},
{str8_lit_comp("bitmap"), str8_lit_comp("@inherit(tab) x:\n{\n @display_name(\"Base Pointer\") @description(\"An expression to describe the base address or offset of the bitmap data.\")\n 'expression': expr_string,\n @description(\"An expression describing the width of the bitmap, in pixels.\") @order(0) 'w': u64,\n @description(\"An expression describing the height of the bitmap, in pixels.\") @order(1) 'h': u64,\n @display_name(\"Bitmap Format\") @description(\"The pixel format that the bitmap data should be interpreted as being within.\")\n 'fmt': code_string,\n}\n")}, {str8_lit_comp("bitmap"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"An expression which refers to the data which should be viewed as a bitmap.\")\n 'expression': expr_string,\n @description(\"An expression describing the width of the bitmap, in pixels.\") @order(0) 'w': u64,\n @description(\"An expression describing the height of the bitmap, in pixels.\") @order(1) 'h': u64,\n @display_name(\"Bitmap Format\") @description(\"The pixel format that the bitmap data should be interpreted as being within.\")\n 'fmt': code_string,\n}\n")},
{str8_lit_comp("color"), str8_lit_comp("@inherit(tab) x:\n{\n @display_name(\"Value\") @description(\"An expression to describe the value or location of the color.\")\n 'expression': expr_string,\n}\n")}, {str8_lit_comp("color"), str8_lit_comp("@inherit(tab) x:\n{\n @display_name(\"Value\") @description(\"An expression to describe the value or location of the color.\")\n 'expression': expr_string,\n}\n")},
{str8_lit_comp("geo3d"), str8_lit_comp("@inherit(tab) x:\n{\n @display_name(\"Expression\") @description(\"An expression to describe the base address of the index buffer.\")\n 'expression': expr_string,\n 'count': expr_string,\n 'vtx': expr_string,\n 'vtx_size': expr_string,\n 'yaw': @range[0, 1] f32,\n 'pitch': @range[-0.5, 0] f32,\n 'zoom': @range[0, 100] f32,\n}\n")}, {str8_lit_comp("geo3d"), str8_lit_comp("@inherit(tab) x:\n{\n @display_name(\"Expression\") @description(\"An expression to describe the base address of the index buffer.\")\n 'expression': expr_string,\n 'count': expr_string,\n 'vtx': expr_string,\n 'vtx_size': expr_string,\n 'yaw': @range[0, 1] f32,\n 'pitch': @range[-0.5, 0] f32,\n 'zoom': @range[0, 100] f32,\n}\n")},
{str8_lit_comp("getting_started"), str8_lit_comp("@inherit(tab) x:\n{\n}\n")}, {str8_lit_comp("getting_started"), str8_lit_comp("@inherit(tab) x:\n{\n}\n")},
+2 -2
View File
@@ -503,7 +503,7 @@ RD_VocabTable:
``` ```
@inherit(tab) x: @inherit(tab) x:
{ {
@display_name("Base Address") @description("An expression to describe the base address or offset of the memory view.") @description("An expression which refers to the data which should be viewed as memory.")
'expression': expr_string, 'expression': expr_string,
@display_name("Address Range Size") @description("The number of bytes of the viewed memory range.") @display_name("Address Range Size") @description("The number of bytes of the viewed memory range.")
'size': expr_string, 'size': expr_string,
@@ -521,7 +521,7 @@ RD_VocabTable:
``` ```
@inherit(tab) x: @inherit(tab) x:
{ {
@display_name("Base Pointer") @description("An expression to describe the base address or offset of the bitmap data.") @description("An expression which refers to the data which should be viewed as a bitmap.")
'expression': expr_string, 'expression': expr_string,
@description("An expression describing the width of the bitmap, in pixels.") @order(0) 'w': u64, @description("An expression describing the width of the bitmap, in pixels.") @order(0) 'w': u64,
@description("An expression describing the height of the bitmap, in pixels.") @order(1) 'h': u64, @description("An expression describing the height of the bitmap, in pixels.") @order(1) 'h': u64,
+19 -9
View File
@@ -483,6 +483,7 @@ rd_cfg_equip_string(RD_Cfg *cfg, String8 string)
{ {
rd_name_release(cfg->string); rd_name_release(cfg->string);
cfg->string = rd_name_alloc(string); cfg->string = rd_name_alloc(string);
rd_state->cfg_change_gen += 1;
} }
internal void internal void
@@ -1847,10 +1848,15 @@ rd_eval_space_read(void *u, E_Space space, void *out, Rng1U64 range)
if(child_key.size != 0) if(child_key.size != 0)
{ {
MD_NodePtrList schemas = rd_schemas_from_name(root_cfg->string); MD_NodePtrList schemas = rd_schemas_from_name(root_cfg->string);
MD_Node *expr_child_schema = &md_nil_node;
MD_Node *child_schema = &md_nil_node; MD_Node *child_schema = &md_nil_node;
for(MD_NodePtrNode *n = schemas.first; n != 0 && child_schema == &md_nil_node; n = n->next) for(MD_NodePtrNode *n = schemas.first; n != 0 && child_schema == &md_nil_node; n = n->next)
{ {
child_schema = md_child_from_string(n->v, child_key, 0); child_schema = md_child_from_string(n->v, child_key, 0);
if(child_schema != &md_nil_node)
{
expr_child_schema = md_child_from_string(n->v, str8_lit("expression"), 0);
}
} }
String8 child_type_name = child_schema->first->string; String8 child_type_name = child_schema->first->string;
if(str8_match(child_type_name, str8_lit("path"), 0) || if(str8_match(child_type_name, str8_lit("path"), 0) ||
@@ -1885,6 +1891,13 @@ rd_eval_space_read(void *u, E_Space space, void *out, Rng1U64 range)
} }
} }
} }
E_Key parent_key = {0};
if(expr_child_schema != &md_nil_node && child_schema != expr_child_schema)
{
parent_key = e_key_from_string(rd_cfg_child_from_string(root_cfg, expr_child_schema->string)->first->string);
}
E_ParentKey(parent_key)
{
if(str8_match(child_type_name, str8_lit("bool"), 0)) if(str8_match(child_type_name, str8_lit("bool"), 0))
{ {
B32 value = !!e_value_from_stringf("(bool)(%S)", value_string).u64; B32 value = !!e_value_from_stringf("(bool)(%S)", value_string).u64;
@@ -1907,6 +1920,7 @@ rd_eval_space_read(void *u, E_Space space, void *out, Rng1U64 range)
} }
} }
} }
}
// rjf: if no child key? -> just read from this cfg's child string - first 8 bytes -> offset of string (just 8), then string's content // rjf: if no child key? -> just read from this cfg's child string - first 8 bytes -> offset of string (just 8), then string's content
if(child_key.size == 0) if(child_key.size == 0)
@@ -3677,6 +3691,7 @@ rd_view_ui(Rng2F32 rect)
{ {
B32 success = 0; B32 success = 0;
success = rd_commit_eval_value_string(cell->eval, new_string); success = rd_commit_eval_value_string(cell->eval, new_string);
state_dirty = 1;
if(!success) if(!success)
{ {
log_user_error(str8_lit("Could not commit value successfully.")); log_user_error(str8_lit("Could not commit value successfully."));
@@ -7394,15 +7409,9 @@ rd_window_frame(void)
{ {
UI_TagF("inactive") UI_Transparency(1-open_t) UI_Rect(content_rect) ui_build_box_from_key(UI_BoxFlag_DrawBackground|UI_BoxFlag_Floating, ui_key_zero()); UI_TagF("inactive") UI_Transparency(1-open_t) UI_Rect(content_rect) ui_build_box_from_key(UI_BoxFlag_DrawBackground|UI_BoxFlag_Floating, ui_key_zero());
} }
}
}
////////////////////////////
//- rjf: @window_ui_part do special handling of floating view interactions
//
{
//- rjf: autocompletion view early-closing rules //- rjf: autocompletion view early-closing rules
if(autocomp_floating_view_task) if(t == autocomp_floating_view_task)
{ {
B32 has_autocomplete_hint = ui_autocomplete_string().size != 0; B32 has_autocomplete_hint = ui_autocomplete_string().size != 0;
B32 has_accept_operation = 0; B32 has_accept_operation = 0;
@@ -7421,7 +7430,7 @@ rd_window_frame(void)
} }
//- rjf: hover eval focus rules //- rjf: hover eval focus rules
if(hover_eval_floating_view_task) if(t == hover_eval_floating_view_task)
{ {
UI_Signal sig = hover_eval_floating_view_task->signal; UI_Signal sig = hover_eval_floating_view_task->signal;
if(ui_pressed(sig) || hover_eval_floating_view_task->pressed) if(ui_pressed(sig) || hover_eval_floating_view_task->pressed)
@@ -7446,7 +7455,7 @@ rd_window_frame(void)
} }
//- rjf: query interactions //- rjf: query interactions
if(query_floating_view_task) if(t == query_floating_view_task)
{ {
RD_Cfg *view = query_floating_view_task->view; RD_Cfg *view = query_floating_view_task->view;
RD_ViewState *vs = rd_view_state_from_cfg(query_floating_view_task->view); RD_ViewState *vs = rd_view_state_from_cfg(query_floating_view_task->view);
@@ -7480,6 +7489,7 @@ rd_window_frame(void)
} }
} }
} }
}
//////////////////////////// ////////////////////////////
//- rjf: @window_ui_part top bar //- rjf: @window_ui_part top bar