pass through eval msgs appropriately in eval cache evaluations; fix rules for reverting to overridden IR trees on usage of 'raw'; more fixes/improvements

This commit is contained in:
Ryan Fleury
2025-04-24 13:04:32 -07:00
parent a6c9a1bd2a
commit a9685e6b9d
11 changed files with 195 additions and 125 deletions
+3 -3
View File
@@ -683,9 +683,9 @@ E_TYPE_ACCESS_FUNCTION_DEF(cfgs)
{
String8 rhs_name = expr->first->next->string;
RD_CfgID id = 0;
if(str8_match(str8_prefix(rhs_name, 1), str8_lit("$"), 0) &&
try_u64_from_str8_c_rules(str8_skip(rhs_name, 1), &id))
if(str8_match(str8_prefix(rhs_name, 1), str8_lit("$"), 0))
{
id = u64_from_str8(str8_skip(rhs_name, 1), 16);
cfg = rd_cfg_from_id(id);
}
}break;
@@ -777,7 +777,7 @@ E_TYPE_EXPAND_RANGE_FUNCTION_DEF(cfgs)
for(U64 idx = 0; idx < read_count; idx += 1, dst_idx += 1)
{
RD_Cfg *cfg = accel->cfgs.v[idx + read_range.min - cfgs_idx_range.min];
evals_out[dst_idx] = e_eval_wrapf(eval, "$.$%I64d", cfg->id);
evals_out[dst_idx] = e_eval_from_stringf("$%I64x", cfg->id);
}
}
}
+29
View File
@@ -1509,6 +1509,35 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla
{
if(0){}
//- rjf: errors
else if(cell->eval.msgs.max_kind > E_MsgKind_Null && !(cell->flags & RD_WatchCellFlag_NoEval))
{
RD_Font(RD_FontSlot_Main)
{
DR_FStrParams params = {rd_font_from_slot(RD_FontSlot_Main), rd_raster_flags_from_slot(RD_FontSlot_Main), ui_color_from_name(str8_lit("text")), ui_top_font_size()};
DR_FStrList fstrs = {0};
UI_TagF("weak")
{
dr_fstrs_push_new(arena, &fstrs, &params,
rd_icon_kind_text_table[RD_IconKind_WarningBig],
.font = rd_font_from_slot(RD_FontSlot_Icons),
.raster_flags = rd_raster_flags_from_slot(RD_FontSlot_Icons),
.color = ui_color_from_name(str8_lit("text")));
dr_fstrs_push_new(arena, &fstrs, &params, str8_lit(" "));
for(E_Msg *msg = cell->eval.msgs.first; msg != 0; msg = msg->next)
{
DR_FStrList msg_fstrs = rd_fstrs_from_rich_string(arena, msg->text);
dr_fstrs_concat_in_place(&fstrs, &msg_fstrs);
if(msg->next)
{
dr_fstrs_push_new(arena, &fstrs, &params, str8_lit(" "));
}
}
}
result.expr_fstrs = fstrs;
}
}
//- rjf: cfg evaluation -> button for cfg
else if(result.cfg != &rd_nil_cfg)
{
+17 -8
View File
@@ -2595,12 +2595,12 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
S64 column = cursor->column;
Vec2F32 advance = fnt_dim_from_tag_size_string(line_box->font, line_box->font_size, 0, params->tab_size, str8_prefix(line_string, column-1));
F32 cursor_off_pixels = advance.x;
F32 cursor_thickness = ClampBot(4.f, line_box->font_size/6.f);
F32 cursor_thickness = ClampBot(1.f, floor_f32(line_box->font_size/10.f));
Rng2F32 cursor_rect =
{
ui_box_text_position(line_box).x+cursor_off_pixels-cursor_thickness/2.f,
ui_box_text_position(line_box).x+cursor_off_pixels,
line_box->rect.y0-params->font_size*0.125f,
ui_box_text_position(line_box).x+cursor_off_pixels+cursor_thickness/2.f,
ui_box_text_position(line_box).x+cursor_off_pixels+cursor_thickness,
line_box->rect.y1+params->font_size*0.125f,
};
Vec4F32 cursor_color = ui_color_from_name(str8_lit("cursor"));
@@ -2608,7 +2608,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
{
cursor_color.w *= 0.5f;
}
dr_rect(cursor_rect, cursor_color, 1.f, 0, 1.f);
dr_rect(cursor_rect, cursor_color, 1.f, 0, 0.f);
}
// rjf: extra rendering for lines with line-info that match the hovered
@@ -2849,10 +2849,10 @@ rd_do_txt_controls(TXT_TextInfo *info, String8 data, U64 line_count_per_page, Tx
////////////////////////////////
//~ rjf: UI Widgets: Fancy Labels
internal UI_Signal
rd_label(String8 string)
internal DR_FStrList
rd_fstrs_from_rich_string(Arena *arena, String8 string)
{
Temp scratch = scratch_begin(0, 0);
Temp scratch = scratch_begin(&arena, 1);
typedef U32 StringPartFlags;
enum
{
@@ -2907,8 +2907,17 @@ rd_label(String8 string)
fstr.params.color = rd_rgba_from_theme_color(RD_ThemeColor_CodeDefault);
}
}
dr_fstrs_push(scratch.arena, &fstrs, &fstr);
dr_fstrs_push(arena, &fstrs, &fstr);
}
scratch_end(scratch);
return fstrs;
}
internal UI_Signal
rd_label(String8 string)
{
Temp scratch = scratch_begin(0, 0);
DR_FStrList fstrs = rd_fstrs_from_rich_string(scratch.arena, string);
UI_Box *box = ui_build_box_from_key(UI_BoxFlag_DrawText, ui_key_zero());
ui_box_equip_display_fstrs(box, &fstrs);
UI_Signal sig = ui_signal_from_box(box);
+1
View File
@@ -160,6 +160,7 @@ internal B32 rd_do_txt_controls(TXT_TextInfo *info, String8 data, U64 line_count
////////////////////////////////
//~ rjf: UI Widgets: Fancy Labels
internal DR_FStrList rd_fstrs_from_rich_string(Arena *arena, String8 string);
internal UI_Signal rd_label(String8 string);
internal UI_Signal rd_error_label(String8 string);
internal B32 rd_help_label(String8 string);