auto-fill ctrl+f query from selection; fix single-cell copy/paste in watch views; tweaks/fixes

This commit is contained in:
Ryan Fleury
2024-06-25 08:04:00 -07:00
parent 0d581694e6
commit 7a185f9560
7 changed files with 93 additions and 88 deletions
-3
View File
@@ -384,8 +384,6 @@ struct DF_CoreViewRuleSpec
//////////////////////////////// ////////////////////////////////
//~ rjf: Entity Types //~ rjf: Entity Types
typedef U32 DF_EntitySubKind;
typedef U32 DF_EntityFlags; typedef U32 DF_EntityFlags;
enum enum
{ {
@@ -433,7 +431,6 @@ struct DF_Entity
// rjf: metadata // rjf: metadata
DF_EntityKind kind; DF_EntityKind kind;
DF_EntitySubKind subkind;
DF_EntityFlags flags; DF_EntityFlags flags;
DF_EntityID id; DF_EntityID id;
U64 generation; U64 generation;
+9 -17
View File
@@ -3572,8 +3572,9 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
//////////////////////////// ////////////////////////////
//- rjf: developer menu //- rjf: developer menu
// //
if(ws->dev_menu_is_open) if(ws->dev_menu_is_open) UI_Font(df_font_from_slot(DF_FontSlot_Code))
UI_Font(df_font_from_slot(DF_FontSlot_Code)) {
ui_set_next_flags(UI_BoxFlag_ViewScrollY|UI_BoxFlag_AllowOverflowY|UI_BoxFlag_ViewClamp);
UI_PaneF(r2f32p(30, 30, 30+ui_top_font_size()*100, ui_top_font_size()*150), "###dev_ctx_menu") UI_PaneF(r2f32p(30, 30, 30+ui_top_font_size()*100, ui_top_font_size()*150), "###dev_ctx_menu")
{ {
//- rjf: toggles //- rjf: toggles
@@ -3630,41 +3631,32 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
} }
} }
//- rjf: draw entity file tree //- rjf: draw entity tree
#if 0
DF_EntityRec rec = {0}; DF_EntityRec rec = {0};
S32 indent = 0; S32 indent = 0;
UI_PrefWidth(ui_text_dim(10, 1)) ui_labelf("Entity File Tree:"); UI_PrefWidth(ui_text_dim(10, 1)) ui_labelf("Entity Tree:");
for(DF_Entity *e = df_entity_root(); !df_entity_is_nil(e); e = rec.next) for(DF_Entity *e = df_entity_root(); !df_entity_is_nil(e); e = rec.next)
{
switch(e->kind)
{
default:{}break;
case DF_EntityKind_File:
case DF_EntityKind_OverrideFileLink:
{ {
ui_set_next_pref_width(ui_children_sum(1)); ui_set_next_pref_width(ui_children_sum(1));
ui_set_next_pref_height(ui_children_sum(1)); ui_set_next_pref_height(ui_children_sum(1));
UI_Row UI_Row
{ {
ui_spacer(ui_em(2.f*indent, 1.f)); ui_spacer(ui_em(2.f*indent, 1.f));
if(e->kind == DF_EntityKind_File)
{
ui_label(e->name);
}
if(e->kind == DF_EntityKind_OverrideFileLink) if(e->kind == DF_EntityKind_OverrideFileLink)
{ {
DF_Entity *dst = df_entity_from_handle(e->entity_handle); DF_Entity *dst = df_entity_from_handle(e->entity_handle);
ui_labelf("[link] %S -> %S", e->name, dst->name); ui_labelf("[link] %S -> %S", e->name, dst->name);
} }
else
{
ui_labelf("%S: %S", df_g_entity_kind_display_string_table[e->kind], e->name);
} }
}break;
} }
rec = df_entity_rec_df_pre(e, df_entity_root()); rec = df_entity_rec_df_pre(e, df_entity_root());
indent += rec.push_count; indent += rec.push_count;
indent -= rec.pop_count; indent -= rec.pop_count;
} }
#endif }
} }
} }
+14
View File
@@ -1264,12 +1264,19 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
String8 cell_string = df_string_from_eval_viz_row_column_kind(scratch.arena, eval_view, parse_ctx.type_graph, parse_ctx.rdi, row, (DF_WatchViewColumnKind)x, 0); String8 cell_string = df_string_from_eval_viz_row_column_kind(scratch.arena, eval_view, parse_ctx.type_graph, parse_ctx.rdi, row, (DF_WatchViewColumnKind)x, 0);
cell_string = str8_skip_chop_whitespace(cell_string); cell_string = str8_skip_chop_whitespace(cell_string);
U64 comma_pos = str8_find_needle(cell_string, 0, str8_lit(","), 0); U64 comma_pos = str8_find_needle(cell_string, 0, str8_lit(","), 0);
if(selection_tbl.min.x != selection_tbl.max.x || selection_tbl.min.y != selection_tbl.max.y)
{
str8_list_pushf(scratch.arena, &strs, "%s%S%s%s", str8_list_pushf(scratch.arena, &strs, "%s%S%s%s",
comma_pos < cell_string.size ? "\"" : "", comma_pos < cell_string.size ? "\"" : "",
cell_string, cell_string,
comma_pos < cell_string.size ? "\"" : "", comma_pos < cell_string.size ? "\"" : "",
x+1 <= selection_tbl.max.x ? "," : ""); x+1 <= selection_tbl.max.x ? "," : "");
} }
else
{
str8_list_push(scratch.arena, &strs, cell_string);
}
}
if(y+1 <= selection_tbl.max.y) if(y+1 <= selection_tbl.max.y)
{ {
str8_list_push(scratch.arena, &strs, str8_lit("\n")); str8_list_push(scratch.arena, &strs, str8_lit("\n"));
@@ -6298,6 +6305,13 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
os_set_clipboard_text(text); os_set_clipboard_text(text);
} }
//- rjf: selected text on single line, no query? -> set search text
if(!txt_pt_match(tv->cursor, tv->mark) && tv->cursor.line == tv->mark.line && search_query.size == 0)
{
String8 text = txt_string_from_info_data_txt_rng(&text_info, data, txt_rng(tv->cursor, tv->mark));
df_set_search_string(text);
}
//- rjf: toggle cursor watch //- rjf: toggle cursor watch
if(sig.toggle_cursor_watch) if(sig.toggle_cursor_watch)
{ {
+1 -1
View File
@@ -36,7 +36,7 @@
// [ ] "Browse..." buttons should adopt a more relevant starting search path, // [ ] "Browse..." buttons should adopt a more relevant starting search path,
// if possible // if possible
// //
// [ ] highlighted text & ctrl+f -> auto-fill search query // [x] highlighted text & ctrl+f -> auto-fill search query
// [ ] double click on procedure in procedures tab to jump to source // [ ] double click on procedure in procedures tab to jump to source
// [ ] double-click any part of frame in callstack view -> snap to function // [ ] double-click any part of frame in callstack view -> snap to function
+4 -2
View File
@@ -908,11 +908,13 @@ ui_pane_beginf(Rng2F32 rect, char *fmt, ...)
return box; return box;
} }
internal void internal UI_Signal
ui_pane_end(void) ui_pane_end(void)
{ {
ui_pop_pref_width(); ui_pop_pref_width();
ui_pop_parent(); UI_Box *box = ui_pop_parent();
UI_Signal sig = ui_signal_from_box(box);
return sig;
} }
//////////////////////////////// ////////////////////////////////
+1 -1
View File
@@ -130,7 +130,7 @@ internal void ui_named_column_end(void);
internal UI_Box *ui_pane_begin(Rng2F32 rect, String8 string); internal UI_Box *ui_pane_begin(Rng2F32 rect, String8 string);
internal UI_Box *ui_pane_beginf(Rng2F32 rect, char *fmt, ...); internal UI_Box *ui_pane_beginf(Rng2F32 rect, char *fmt, ...);
internal void ui_pane_end(void); internal UI_Signal ui_pane_end(void);
//////////////////////////////// ////////////////////////////////
//~ rjf: Tables //~ rjf: Tables
+1 -1
View File
@@ -1417,7 +1417,7 @@ ui_end_build(void)
String8 box_display_string = ui_box_display_string(b); String8 box_display_string = ui_box_display_string(b);
Vec2F32 text_pos = ui_box_text_position(b); Vec2F32 text_pos = ui_box_text_position(b);
Vec2F32 drawn_text_dim = b->display_string_runs.dim; Vec2F32 drawn_text_dim = b->display_string_runs.dim;
B32 text_is_truncated = (drawn_text_dim.x + text_pos.x > rect.x1); B32 text_is_truncated = (drawn_text_dim.x + text_pos.x >= rect.x1);
B32 mouse_is_hovering = contains_2f32(r2f32p(text_pos.x, B32 mouse_is_hovering = contains_2f32(r2f32p(text_pos.x,
rect.y0, rect.y0,
Min(text_pos.x+drawn_text_dim.x, rect.x1), Min(text_pos.x+drawn_text_dim.x, rect.x1),