From 9ae0ee9a46d154402b32c981e262279a34df684b Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Mon, 19 May 2025 19:21:06 -0700 Subject: [PATCH] correctly use tab width px in new code slice fstrs measuring path --- src/draw/draw.c | 4 ++-- src/draw/draw.h | 2 +- src/raddbg/raddbg_core.c | 2 +- src/raddbg/raddbg_widgets.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/draw/draw.c b/src/draw/draw.c index e26a55b6..db34c9b0 100644 --- a/src/draw/draw.c +++ b/src/draw/draw.c @@ -187,10 +187,10 @@ dr_fruns_from_fstrs(Arena *arena, F32 tab_size_px, DR_FStrList *strs) } internal Vec2F32 -dr_dim_from_fstrs(DR_FStrList *fstrs) +dr_dim_from_fstrs(F32 tab_size_px, DR_FStrList *fstrs) { Temp scratch = scratch_begin(0, 0); - DR_FRunList fruns = dr_fruns_from_fstrs(scratch.arena, 0, fstrs); + DR_FRunList fruns = dr_fruns_from_fstrs(scratch.arena, tab_size_px, fstrs); Vec2F32 dim = fruns.dim; scratch_end(scratch); return dim; diff --git a/src/draw/draw.h b/src/draw/draw.h index d98f1081..f338e0fd 100644 --- a/src/draw/draw.h +++ b/src/draw/draw.h @@ -125,7 +125,7 @@ internal DR_FStrList dr_fstrs_copy(Arena *arena, DR_FStrList *src); internal String8 dr_string_from_fstrs(Arena *arena, DR_FStrList *list); internal FuzzyMatchRangeList dr_fuzzy_match_find_from_fstrs(Arena *arena, DR_FStrList *fstrs, String8 needle); internal DR_FRunList dr_fruns_from_fstrs(Arena *arena, F32 tab_size_px, DR_FStrList *strs); -internal Vec2F32 dr_dim_from_fstrs(DR_FStrList *fstrs); +internal Vec2F32 dr_dim_from_fstrs(F32 tab_size_px, DR_FStrList *fstrs); //////////////////////////////// //~ rjf: Top-Level API diff --git a/src/raddbg/raddbg_core.c b/src/raddbg/raddbg_core.c index e1fb2b4b..0da5f4b0 100644 --- a/src/raddbg/raddbg_core.c +++ b/src/raddbg/raddbg_core.c @@ -8920,7 +8920,7 @@ rd_window_frame(void) TabTask *t = push_array(scratch.arena, TabTask, 1); t->tab = tab; t->fstrs = rd_title_fstrs_from_cfg(scratch.arena, tab); - F32 tab_width_target = dr_dim_from_fstrs(&t->fstrs).x + tab_close_width_px + ui_top_font_size()*1.f; + F32 tab_width_target = dr_dim_from_fstrs(ui_top_tab_size(), &t->fstrs).x + tab_close_width_px + ui_top_font_size()*1.f; tab_width_target = Min(max_tab_width_px, tab_width_target); t->tab_width = floor_f32(ui_anim(ui_key_from_stringf(ui_key_zero(), "tab_width_%p", tab), tab_width_target, .initial = reset ? tab_width_target : 0, .rate = rd_state->menu_animation_rate)); SLLQueuePush(first_tab_task, last_tab_task, t); diff --git a/src/raddbg/raddbg_widgets.c b/src/raddbg/raddbg_widgets.c index 5cd62bbc..98faec79 100644 --- a/src/raddbg/raddbg_widgets.c +++ b/src/raddbg/raddbg_widgets.c @@ -1954,7 +1954,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe line_num += 1, line_idx += 1) { DR_FStrList line_fstrs = lines_fstrs[line_idx]; - F32 line_text_dim = dr_dim_from_fstrs(&line_fstrs).x + params->line_num_width_px + params->catchall_margin_width_px + params->priority_margin_width_px; + F32 line_text_dim = dr_dim_from_fstrs(params->tab_size, &line_fstrs).x + params->line_num_width_px + params->catchall_margin_width_px + params->priority_margin_width_px; line_extras_off[line_idx] = Max(line_text_dim, params->font_size*30); } }