more tweaks with new double-margin; do not try to display non-printable ascii characters in watch

This commit is contained in:
Ryan Fleury
2024-05-29 12:25:03 -07:00
parent c426818364
commit 89c8f84498
2 changed files with 12 additions and 10 deletions
+12 -4
View File
@@ -4473,6 +4473,7 @@ df_string_from_ascii_value(Arena *arena, U8 val)
case '\'':{result = str8_lit("\\'");}break; case '\'':{result = str8_lit("\\'");}break;
case '\\':{result = str8_lit("\\\\");}break; case '\\':{result = str8_lit("\\\\");}break;
default: default:
if(32 <= val && val < 255)
{ {
result = push_str8f(arena, "%c", val); result = push_str8f(arena, "%c", val);
}break; }break;
@@ -4511,14 +4512,21 @@ df_string_from_simple_typed_eval(Arena *arena, TG_Graph *graph, RDI_Parsed *rdi,
case TG_Kind_UChar32: case TG_Kind_UChar32:
{ {
String8 char_str = df_string_from_ascii_value(arena, eval.imm_s64); String8 char_str = df_string_from_ascii_value(arena, eval.imm_s64);
if(flags & DF_EvalVizStringFlag_ReadOnlyDisplayRules) if(char_str.size != 0)
{ {
String8 imm_string = str8_from_s64(arena, eval.imm_s64, radix, 0, digit_group_separator); if(flags & DF_EvalVizStringFlag_ReadOnlyDisplayRules)
result = push_str8f(arena, "'%S' (%S)", char_str, imm_string); {
String8 imm_string = str8_from_s64(arena, eval.imm_s64, radix, 0, digit_group_separator);
result = push_str8f(arena, "'%S' (%S)", char_str, imm_string);
}
else
{
result = push_str8f(arena, "'%S'", char_str);
}
} }
else else
{ {
result = push_str8f(arena, "'%S'", char_str); result = str8_from_s64(arena, eval.imm_s64, radix, 0, digit_group_separator);
} }
}break; }break;
-6
View File
@@ -10709,8 +10709,6 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
line_num += 1, line_idx += 1) line_num += 1, line_idx += 1)
{ {
DF_EntityList line_ips = params->line_ips[line_idx]; DF_EntityList line_ips = params->line_ips[line_idx];
DF_EntityList line_bps = params->line_bps[line_idx];
DF_EntityList line_pins = params->line_pins[line_idx];
ui_set_next_hover_cursor(OS_Cursor_HandPoint); ui_set_next_hover_cursor(OS_Cursor_HandPoint);
ui_set_next_background_color(v4f32(0, 0, 0, 0)); ui_set_next_background_color(v4f32(0, 0, 0, 0));
UI_Box *line_margin_box = ui_build_box_from_stringf(UI_BoxFlag_Clickable*!!(params->flags & DF_CodeSliceFlag_Clickable)|UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawActiveEffects, "line_margin_%I64x", line_num); UI_Box *line_margin_box = ui_build_box_from_stringf(UI_BoxFlag_Clickable*!!(params->flags & DF_CodeSliceFlag_Clickable)|UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawActiveEffects, "line_margin_%I64x", line_num);
@@ -10771,7 +10769,6 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
UI_Key thread_box_key = ui_key_from_stringf(top_container_box->key, "###ip_%p", thread); UI_Key thread_box_key = ui_key_from_stringf(top_container_box->key, "###ip_%p", thread);
UI_Box *thread_box = ui_build_box_from_key(UI_BoxFlag_DisableTextTrunc| UI_Box *thread_box = ui_build_box_from_key(UI_BoxFlag_DisableTextTrunc|
UI_BoxFlag_Clickable*!!(params->flags & DF_CodeSliceFlag_Clickable)| UI_BoxFlag_Clickable*!!(params->flags & DF_CodeSliceFlag_Clickable)|
UI_BoxFlag_AnimatePosX|
UI_BoxFlag_DrawText, UI_BoxFlag_DrawText,
thread_box_key); thread_box_key);
ui_box_equip_display_string(thread_box, df_g_icon_kind_text_table[DF_IconKind_RightArrow]); ui_box_equip_display_string(thread_box, df_g_icon_kind_text_table[DF_IconKind_RightArrow]);
@@ -10937,7 +10934,6 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
UI_Key thread_box_key = ui_key_from_stringf(top_container_box->key, "###ip_%p", thread); UI_Key thread_box_key = ui_key_from_stringf(top_container_box->key, "###ip_%p", thread);
UI_Box *thread_box = ui_build_box_from_key(UI_BoxFlag_DisableTextTrunc| UI_Box *thread_box = ui_build_box_from_key(UI_BoxFlag_DisableTextTrunc|
UI_BoxFlag_Clickable*!!(params->flags & DF_CodeSliceFlag_Clickable)| UI_BoxFlag_Clickable*!!(params->flags & DF_CodeSliceFlag_Clickable)|
UI_BoxFlag_AnimatePosX|
UI_BoxFlag_DrawText, UI_BoxFlag_DrawText,
thread_box_key); thread_box_key);
ui_box_equip_display_string(thread_box, df_g_icon_kind_text_table[DF_IconKind_RightArrow]); ui_box_equip_display_string(thread_box, df_g_icon_kind_text_table[DF_IconKind_RightArrow]);
@@ -11062,7 +11058,6 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
UI_BoxFlag_DrawActiveEffects| UI_BoxFlag_DrawActiveEffects|
UI_BoxFlag_DrawHotEffects| UI_BoxFlag_DrawHotEffects|
UI_BoxFlag_DrawBorder| UI_BoxFlag_DrawBorder|
UI_BoxFlag_AnimatePosX|
UI_BoxFlag_Clickable*!!(params->flags & DF_CodeSliceFlag_Clickable)| UI_BoxFlag_Clickable*!!(params->flags & DF_CodeSliceFlag_Clickable)|
UI_BoxFlag_DisableTextTrunc, UI_BoxFlag_DisableTextTrunc,
"%S##bp_%p", "%S##bp_%p",
@@ -11131,7 +11126,6 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
UI_BoxFlag_DrawHotEffects| UI_BoxFlag_DrawHotEffects|
UI_BoxFlag_DrawBorder| UI_BoxFlag_DrawBorder|
UI_BoxFlag_Clickable*!!(params->flags & DF_CodeSliceFlag_Clickable)| UI_BoxFlag_Clickable*!!(params->flags & DF_CodeSliceFlag_Clickable)|
UI_BoxFlag_AnimatePosX|
UI_BoxFlag_DisableTextTrunc, UI_BoxFlag_DisableTextTrunc,
"%S##watch_%p", "%S##watch_%p",
df_g_icon_kind_text_table[DF_IconKind_Pin], df_g_icon_kind_text_table[DF_IconKind_Pin],