mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-25 13:05:00 -07:00
fix editable expression strings, fix command evaluation, etc.
This commit is contained in:
@@ -3219,15 +3219,15 @@ rd_view_ui(Rng2F32 rect)
|
||||
if(cell_info.flags & RD_WatchCellFlag_CanEdit)
|
||||
{
|
||||
any_edits_started = 1;
|
||||
String8 string = cell->edit_string;
|
||||
if(string.size == 0)
|
||||
String8 string = {0};
|
||||
if(cell_info.flags & RD_WatchCellFlag_NoEval)
|
||||
{
|
||||
string = cell->eval.string;
|
||||
}
|
||||
else
|
||||
{
|
||||
string = dr_string_from_fstrs(scratch.arena, &cell_info.eval_fstrs);
|
||||
}
|
||||
if(string.size == 0)
|
||||
{
|
||||
string = dr_string_from_fstrs(scratch.arena, &cell_info.expr_fstrs);
|
||||
}
|
||||
string.size = Min(string.size, sizeof(ewv->dummy_text_edit_state.input_buffer));
|
||||
RD_WatchPt pt = {row->block->key, row->key, rd_id_from_watch_cell(cell)};
|
||||
U64 hash = ev_hash_from_key(pt.key);
|
||||
|
||||
@@ -638,7 +638,6 @@ E_TYPE_IREXT_FUNCTION_DEF(cfgs)
|
||||
|
||||
//- rjf: gather commands
|
||||
String8List cmds_list = {0};
|
||||
if(rd_cfg_child_from_string(rd_cfg_from_id(rd_regs()->view), str8_lit("lister")) == &rd_nil_cfg)
|
||||
{
|
||||
MD_NodePtrList schemas = rd_schemas_from_name(cfg_name);
|
||||
for(MD_NodePtrNode *n = schemas.first; n != 0; n = n->next)
|
||||
@@ -738,9 +737,12 @@ E_TYPE_EXPAND_INFO_FUNCTION_DEF(cfgs)
|
||||
}
|
||||
|
||||
//- rjf: fill
|
||||
accel->cmds = ext->cmds;
|
||||
if(rd_cfg_child_from_string(rd_cfg_from_id(rd_regs()->view), str8_lit("lister")) == &rd_nil_cfg)
|
||||
{
|
||||
accel->cmds = ext->cmds;
|
||||
accel->cmds_idx_range = r1u64(0, accel->cmds.count);
|
||||
}
|
||||
accel->cfgs = cfgs__filtered;
|
||||
accel->cmds_idx_range = r1u64(0, accel->cmds.count);
|
||||
accel->cfgs_idx_range = r1u64(accel->cmds_idx_range.max, accel->cmds_idx_range.max + accel->cfgs.count);
|
||||
info.expr_count = (accel->cmds.count + accel->cfgs.count);
|
||||
}
|
||||
|
||||
@@ -1129,7 +1129,7 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
||||
if(type->kind == E_TypeKind_Set)
|
||||
{
|
||||
String8 file_path = e_string_from_id(row->eval.value.u64);
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval, .edit_string = row->edit_string, .flags = RD_WatchCellFlag_Expr|RD_WatchCellFlag_NoEval|RD_WatchCellFlag_Indented|RD_WatchCellFlag_Button|RD_WatchCellFlag_IsNonCode, .pct = 1.f);
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval, .flags = RD_WatchCellFlag_Expr|RD_WatchCellFlag_NoEval|RD_WatchCellFlag_Indented|RD_WatchCellFlag_Button|RD_WatchCellFlag_IsNonCode, .pct = 1.f);
|
||||
if(str8_match(type->name, str8_lit("file"), 0))
|
||||
{
|
||||
info.can_expand = 0;
|
||||
@@ -1143,7 +1143,7 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
||||
RD_Cfg *w_cfg = style->first;
|
||||
F32 next_pct = 0;
|
||||
#define take_pct() (next_pct = (F32)f64_from_str8(w_cfg->string), w_cfg = w_cfg->next, next_pct)
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval, .edit_string = row->edit_string, .flags = RD_WatchCellFlag_Expr|RD_WatchCellFlag_NoEval|RD_WatchCellFlag_Indented, .default_pct = 0.35f, .pct = take_pct());
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval, .flags = RD_WatchCellFlag_Expr|RD_WatchCellFlag_NoEval|RD_WatchCellFlag_Indented, .default_pct = 0.35f, .pct = take_pct());
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval, .default_pct = 0.65f, .pct = take_pct());
|
||||
#undef take_pct
|
||||
}
|
||||
@@ -1156,7 +1156,6 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
||||
str8_match(row_type->name, str8_lit("unattached_process"), 0))
|
||||
{
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval,
|
||||
.edit_string = row->edit_string,
|
||||
.flags = RD_WatchCellFlag_Button|RD_WatchCellFlag_Indented,
|
||||
.pct = 1.f);
|
||||
}
|
||||
@@ -1172,7 +1171,7 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
||||
{
|
||||
extra_flags |= RD_WatchCellFlag_NoEval;
|
||||
}
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval, .edit_string = row->edit_string, .flags = extra_flags|RD_WatchCellFlag_Expr|RD_WatchCellFlag_Button|RD_WatchCellFlag_Indented, .pct = 1.f);
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval, .flags = extra_flags|RD_WatchCellFlag_Expr|RD_WatchCellFlag_Button|RD_WatchCellFlag_Indented, .pct = 1.f);
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
@@ -1181,7 +1180,7 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
||||
else if(is_top_level && evalled_cfg != &rd_nil_cfg)
|
||||
{
|
||||
RD_Cfg *cfg = evalled_cfg;
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval, .edit_string = row->edit_string, .flags = RD_WatchCellFlag_Expr|RD_WatchCellFlag_NoEval|RD_WatchCellFlag_Button|RD_WatchCellFlag_Indented, .pct = 1.f);
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval, .flags = RD_WatchCellFlag_Expr|RD_WatchCellFlag_NoEval|RD_WatchCellFlag_Button|RD_WatchCellFlag_Indented, .pct = 1.f);
|
||||
MD_NodePtrList schemas = rd_schemas_from_name(cfg->string);
|
||||
for(MD_NodePtrNode *n = schemas.first; n != 0; n = n->next)
|
||||
{
|
||||
@@ -1252,7 +1251,6 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
||||
{
|
||||
CTRL_Entity *entity = evalled_entity;
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval,
|
||||
.edit_string = row->edit_string,
|
||||
.flags = RD_WatchCellFlag_Expr|RD_WatchCellFlag_NoEval|RD_WatchCellFlag_Indented|RD_WatchCellFlag_Button,
|
||||
.pct = 1.f);
|
||||
if(entity->kind == CTRL_EntityKind_Machine ||
|
||||
@@ -1260,7 +1258,6 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
||||
entity->kind == CTRL_EntityKind_Thread)
|
||||
{
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, e_eval_wrapf(row->eval, "active"),
|
||||
.edit_string = row->edit_string,
|
||||
.px = floor_f32(ui_top_font_size()*5.f));
|
||||
}
|
||||
if(entity->kind == CTRL_EntityKind_Thread)
|
||||
@@ -1272,7 +1269,6 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
||||
}
|
||||
String8 cmd_name = rd_cmd_kind_info_table[cmd_kind].string;
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, e_eval_from_stringf("query:commands.%S", cmd_name),
|
||||
.edit_string = row->edit_string,
|
||||
.flags = RD_WatchCellFlag_ActivateWithSingleClick|RD_WatchCellFlag_Button,
|
||||
.px = floor_f32(ui_top_font_size()*3.f));
|
||||
}
|
||||
@@ -1283,7 +1279,7 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
||||
//
|
||||
else if(row->eval.space.kind == RD_EvalSpaceKind_MetaQuery)
|
||||
{
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval, .edit_string = row->edit_string, .flags = RD_WatchCellFlag_Expr|RD_WatchCellFlag_NoEval|RD_WatchCellFlag_Indented, .pct = 1.f);
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval, .flags = RD_WatchCellFlag_Expr|RD_WatchCellFlag_NoEval|RD_WatchCellFlag_Indented, .pct = 1.f);
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
@@ -1295,13 +1291,11 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
||||
if(type->kind == E_TypeKind_Set)
|
||||
{
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval,
|
||||
.edit_string = row->edit_string,
|
||||
.flags = RD_WatchCellFlag_Expr|RD_WatchCellFlag_NoEval|RD_WatchCellFlag_Indented, .pct = 1.f);
|
||||
}
|
||||
else
|
||||
{
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval,
|
||||
.edit_string = row->edit_string,
|
||||
.flags = RD_WatchCellFlag_Expr|RD_WatchCellFlag_NoEval|RD_WatchCellFlag_Indented|RD_WatchCellFlag_Button|RD_WatchCellFlag_ActivateWithSingleClick,
|
||||
.pct = 1.f);
|
||||
}
|
||||
@@ -1321,7 +1315,6 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
||||
else if(row->eval.expr == &e_expr_nil && info.group_cfg_name.size != 0 && info.group_cfg_child == &rd_nil_cfg)
|
||||
{
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval,
|
||||
.edit_string = row->edit_string,
|
||||
.flags = RD_WatchCellFlag_Expr|RD_WatchCellFlag_NoEval|RD_WatchCellFlag_Indented, .pct = 1.f);
|
||||
}
|
||||
|
||||
@@ -1335,7 +1328,6 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
||||
row->eval.space.kind == RD_EvalSpaceKind_MetaCtrlEntity))
|
||||
{
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval,
|
||||
.edit_string = row->edit_string,
|
||||
.flags = RD_WatchCellFlag_Expr|RD_WatchCellFlag_Indented, .pct = 1.f);
|
||||
}
|
||||
|
||||
@@ -1359,10 +1351,8 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
||||
F32 next_pct = 0;
|
||||
#define take_pct() (next_pct = (F32)f64_from_str8(w_cfg->string), w_cfg = w_cfg->next, next_pct)
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval,
|
||||
.edit_string = row->edit_string,
|
||||
.flags = RD_WatchCellFlag_Expr|RD_WatchCellFlag_NoEval|RD_WatchCellFlag_Indented, .default_pct = 0.35f, .pct = take_pct());
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval,
|
||||
.edit_string = row->edit_string,
|
||||
.default_pct = 0.65f, .pct = take_pct());
|
||||
#undef take_pct
|
||||
}
|
||||
@@ -1379,7 +1369,6 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
||||
F32 next_pct = 0;
|
||||
#define take_pct() (next_pct = (F32)f64_from_str8(w_cfg->string), w_cfg = w_cfg->next, next_pct)
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval,
|
||||
.edit_string = row->edit_string,
|
||||
.flags = RD_WatchCellFlag_Expr|RD_WatchCellFlag_NoEval|RD_WatchCellFlag_Indented,
|
||||
.default_pct = 0.75f,
|
||||
.pct = take_pct());
|
||||
@@ -1421,7 +1410,6 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
||||
F32 next_pct = 0;
|
||||
#define take_pct() (next_pct = (F32)f64_from_str8(w_cfg->string), w_cfg = w_cfg->next, next_pct)
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval,
|
||||
.edit_string = row->edit_string,
|
||||
.flags = RD_WatchCellFlag_Expr|RD_WatchCellFlag_NoEval|RD_WatchCellFlag_Indented,
|
||||
.default_pct = 0.35f,
|
||||
.pct = take_pct());
|
||||
@@ -1573,9 +1561,8 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla
|
||||
DR_FStrList expr_fstrs = {0};
|
||||
if(cell->flags & RD_WatchCellFlag_Expr)
|
||||
{
|
||||
// rjf: funnel-through this cell's string, if it has one
|
||||
B32 is_non_code = 0;
|
||||
String8 expr_string = cell->edit_string;
|
||||
String8 expr_string = {0};
|
||||
|
||||
// rjf: if this cell has a meta-display-name, then use that
|
||||
if(expr_string.size == 0)
|
||||
@@ -1620,10 +1607,10 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla
|
||||
// rjf: generate expression string based on our notable expression
|
||||
switch(notable_expr->kind)
|
||||
{
|
||||
// rjf: default case -> just walk the expression tree & generate a string
|
||||
// rjf: default case -> just take whatever string was directly passed via the evaluation
|
||||
default:
|
||||
{
|
||||
expr_string = e_string_from_expr(arena, notable_expr, str8_zero());
|
||||
expr_string = cell->eval.string;
|
||||
}break;
|
||||
|
||||
// rjf: array indices -> fast path to [index]
|
||||
|
||||
@@ -70,7 +70,6 @@ struct RD_WatchCell
|
||||
RD_WatchCellKind kind;
|
||||
RD_WatchCellFlags flags;
|
||||
U64 index;
|
||||
String8 edit_string;
|
||||
E_Eval eval;
|
||||
F32 default_pct;
|
||||
F32 pct;
|
||||
|
||||
Reference in New Issue
Block a user