From da8e583f93679b0b96c1dd23106a00625d807388 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Mon, 5 May 2025 05:32:26 -0700 Subject: [PATCH] hook up fancy-cell edit button to double-click action, ensure double-click starts edits in listers for editable cells --- src/raddbg/raddbg_core.c | 7 ++++++- src/raddbg/raddbg_widgets.c | 14 +++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/raddbg/raddbg_core.c b/src/raddbg/raddbg_core.c index 5dd3ded3..8508ad0a 100644 --- a/src/raddbg/raddbg_core.c +++ b/src/raddbg/raddbg_core.c @@ -5057,12 +5057,16 @@ rd_view_ui(Rng2F32 rect) ui_kill_action(); } - // rjf: this watch window is a lister? -> move cursor & accept + // rjf: this watch window is a lister? -> move cursor & edit or accept if(rd_cfg_child_from_string(view, str8_lit("lister")) != &rd_nil_cfg || rd_cfg_child_from_string(view, str8_lit("autocomplete")) != &rd_nil_cfg) { ewv->next_cursor = ewv->next_mark = cell_pt; rd_cmd(RD_CmdKind_Accept); + if(cell_info.flags & RD_WatchCellFlag_CanEdit) + { + rd_cmd(RD_CmdKind_Edit); + } } // rjf: has a command name? -> push command @@ -5117,6 +5121,7 @@ rd_view_ui(Rng2F32 rect) else if(!(sig.f & UI_SignalFlag_KeyboardPressed) && cell_info.flags & RD_WatchCellFlag_CanEdit) { ewv->next_cursor = ewv->next_mark = cell_pt; + rd_cmd(RD_CmdKind_Accept); rd_cmd(RD_CmdKind_Edit); } diff --git a/src/raddbg/raddbg_widgets.c b/src/raddbg/raddbg_widgets.c index c44c4f99..ca5d8721 100644 --- a/src/raddbg/raddbg_widgets.c +++ b/src/raddbg/raddbg_widgets.c @@ -3415,6 +3415,7 @@ rd_cell(RD_CellParams *params, String8 string) ////////////////////////////// //- rjf: build edit-button, if line edit is embedded, and has no string // + B32 edit_started = 0; if(!is_focus_active && !is_focus_active_disabled && build_lhs_name_desc && build_line_edit && value_name_fstrs.total_size == 0) { UI_TagF(".") @@ -3427,7 +3428,6 @@ rd_cell(RD_CellParams *params, String8 string) UI_Padding(ui_pct(1, 0)) UI_PrefHeight(ui_em(2.f, 1.f)) UI_CornerRadius(ui_top_font_size()*0.5f) - UI_HoverCursor(OS_Cursor_HandPoint) RD_Font(RD_FontSlot_Icons) UI_TextAlignment(UI_TextAlign_Center) { @@ -3440,6 +3440,10 @@ rd_cell(RD_CellParams *params, String8 string) UI_BoxFlag_Clickable, "%S##edit", rd_icon_kind_text_table[RD_IconKind_Pencil]); UI_Signal sig = ui_signal_from_box(edit_start_box); + if(ui_pressed(sig)) + { + edit_started = 1; + } } ui_spacer(ui_em(1.f, 1.f)); } @@ -3719,6 +3723,14 @@ rd_cell(RD_CellParams *params, String8 string) scratch_end(scratch); } + ////////////////////////////// + //- rjf: click-driven "start editing" + // + if(edit_started) + { + sig.f |= UI_SignalFlag_DoubleClicked; + } + ////////////////////////////// //- rjf: compute editable fancy strings //