watch-expr-at-mouse command

This commit is contained in:
Ryan Fleury
2024-06-28 09:14:58 -07:00
parent d1c0bf5fe2
commit f2a7103461
9 changed files with 26 additions and 7 deletions
+1
View File
@@ -315,6 +315,7 @@ DF_CoreCmdTable:// | | |
//- rjf: watch expressions
{ToggleWatchExpression 0 Null Nil 0 0 0 0 0 0 Binoculars "toggle_watch_expr" "Toggle Watch Expression" "Adds or removes an expression to an opened watch view." "" }
{ToggleWatchExpressionAtCursor 0 Null Nil 0 0 0 0 0 0 Binoculars "toggle_watch_expr_at_cursor" "Toggle Watch Expression At Cursor" "Adds or removes the expression that the cursor or selection is currently over to an opened watch view." "" }
{ToggleWatchExpressionAtMouse 0 Null Nil 0 0 0 0 0 0 Binoculars "toggle_watch_expr_at_mouse" "Toggle Watch Expression At Mouse" "Adds or removes the expression that the mouse is currently over to an opened watch view." "" }
//- rjf: memory view parameterization
{SetColumns 0 Index Nil 0 0 0 0 1 1 Thumbnails "set_columns" "Set Columns" "Sets the number of columns for a memory view." "" }
+2 -1
View File
@@ -209,7 +209,7 @@ DF_CoreCmdKind_Null,
DF_CoreCmdKind_Null,
};
DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[220] =
DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[221] =
{
{ str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
{ str8_lit_comp("exit"), str8_lit_comp("Exits the debugger."), str8_lit_comp("quit,close,abort"), str8_lit_comp("Exit"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_X},
@@ -364,6 +364,7 @@ DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[220] =
{ str8_lit_comp("goto_name_at_cursor"), str8_lit_comp("Searches for the text at the cursor as a file, a symbol in debug info, and more, then jumps to it if possible."), str8_lit_comp(""), str8_lit_comp("Go To Name At Cursor"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
{ str8_lit_comp("toggle_watch_expr"), str8_lit_comp("Adds or removes an expression to an opened watch view."), str8_lit_comp(""), str8_lit_comp("Toggle Watch Expression"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Binoculars},
{ str8_lit_comp("toggle_watch_expr_at_cursor"), str8_lit_comp("Adds or removes the expression that the cursor or selection is currently over to an opened watch view."), str8_lit_comp(""), str8_lit_comp("Toggle Watch Expression At Cursor"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Binoculars},
{ str8_lit_comp("toggle_watch_expr_at_mouse"), str8_lit_comp("Adds or removes the expression that the mouse is currently over to an opened watch view."), str8_lit_comp(""), str8_lit_comp("Toggle Watch Expression At Mouse"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Binoculars},
{ str8_lit_comp("set_columns"), str8_lit_comp("Sets the number of columns for a memory view."), str8_lit_comp(""), str8_lit_comp("Set Columns"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Index, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*1)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_Thumbnails},
{ str8_lit_comp("toggle_address_visibility"), str8_lit_comp("Toggles the visibility of addresses in a disassembly view."), str8_lit_comp(""), str8_lit_comp("Toggle Address Visibility"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Thumbnails},
{ str8_lit_comp("toggle_code_bytes_visibility"), str8_lit_comp("Toggles the visibility of machine code bytes in a disassembly view."), str8_lit_comp(""), str8_lit_comp("Toggle Code Bytes Visibility"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Thumbnails},
+1
View File
@@ -200,6 +200,7 @@ DF_CoreCmdKind_GoToName,
DF_CoreCmdKind_GoToNameAtCursor,
DF_CoreCmdKind_ToggleWatchExpression,
DF_CoreCmdKind_ToggleWatchExpressionAtCursor,
DF_CoreCmdKind_ToggleWatchExpressionAtMouse,
DF_CoreCmdKind_SetColumns,
DF_CoreCmdKind_ToggleAddressVisibility,
DF_CoreCmdKind_ToggleCodeBytesVisibility,
+1
View File
@@ -155,6 +155,7 @@ DF_DefaultBindingTable:
//- rjf: watch expressions
{ "toggle_watch_expr_at_cursor" W 0 0 alt }
{ "toggle_watch_expr_at_mouse" D ctrl 0 0 }
{ "toggle_watch_pin_at_cursor" F9 ctrl 0 0 }
//- rjf: breakpoints
+14
View File
@@ -450,6 +450,10 @@ df_code_view_cmds(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_CodeViewStat
arena_clear(cv->find_text_arena);
cv->find_text_bwd = push_str8_copy(cv->find_text_arena, cmd->params.string);
}break;
case DF_CoreCmdKind_ToggleWatchExpressionAtMouse:
{
cv->watch_expr_at_mouse = 1;
}break;
}
}
}
@@ -974,6 +978,16 @@ df_code_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_CodeViewSta
df_push_cmd__root(&params, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_GoToName));
}
//- rjf: watch expr at mouse
if(cv->watch_expr_at_mouse)
{
cv->watch_expr_at_mouse = 0;
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
params.string = txt_string_from_info_data_txt_rng(text_info, text_data, sig.mouse_expr_rng);
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_String);
df_push_cmd__root(&params, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_ToggleWatchExpression));
}
//- rjf: selected text on single line, no query? -> set search text
if(!txt_pt_match(view->cursor, view->mark) && view->cursor.line == view->mark.line && search_query.size == 0)
{
+1
View File
@@ -388,6 +388,7 @@ struct DF_CodeViewState
S64 goto_line_num;
B32 center_cursor;
B32 contain_cursor;
B32 watch_expr_at_mouse;
Arena *find_text_arena;
String8 find_text_fwd;
String8 find_text_bwd;
+2 -1
View File
@@ -4,7 +4,7 @@
//- GENERATED CODE
C_LINKAGE_BEGIN
DF_StringBindingPair df_g_default_binding_table[105] =
DF_StringBindingPair df_g_default_binding_table[106] =
{
{str8_lit_comp("kill_all"), {OS_Key_F5, 0 |OS_EventFlag_Shift }},
{str8_lit_comp("step_into_inst"), {OS_Key_F11, 0 |OS_EventFlag_Alt}},
@@ -104,6 +104,7 @@ DF_StringBindingPair df_g_default_binding_table[105] =
{str8_lit_comp("goto_name"), {OS_Key_J, 0 |OS_EventFlag_Ctrl }},
{str8_lit_comp("goto_name_at_cursor"), {OS_Key_F12, 0 }},
{str8_lit_comp("toggle_watch_expr_at_cursor"), {OS_Key_W, 0 |OS_EventFlag_Alt}},
{str8_lit_comp("toggle_watch_expr_at_mouse"), {OS_Key_D, 0 |OS_EventFlag_Ctrl }},
{str8_lit_comp("toggle_watch_pin_at_cursor"), {OS_Key_F9, 0 |OS_EventFlag_Ctrl }},
{str8_lit_comp("toggle_breakpoint_cursor"), {OS_Key_F9, 0 }},
{str8_lit_comp("add_target"), {OS_Key_T, 0 |OS_EventFlag_Ctrl }},
+1 -1
View File
@@ -314,7 +314,7 @@ DF_VIEW_UI_FUNCTION_DEF(disasm);
DF_VIEW_UI_FUNCTION_DEF(bitmap);
DF_VIEW_UI_FUNCTION_DEF(geo);
C_LINKAGE_BEGIN
extern DF_StringBindingPair df_g_default_binding_table[105];
extern DF_StringBindingPair df_g_default_binding_table[106];
extern String8 df_g_binding_version_remap_old_name_table[5];
extern String8 df_g_binding_version_remap_new_name_table[5];
extern DF_ViewSpecInfo df_g_gfx_view_kind_spec_info_table[31];
+3 -4
View File
@@ -112,10 +112,6 @@
// [ ] lock icon
// [ ] "rotation arrow" icon next to executables
//
// [ ] I LOVE ALT-W to add watch under cursor, but I would prefer to have it
// add what's under the MOUSE cursor instead of the keyboard cursor. Can
// we get a command for that so I can bind ALT-W to that instead?
//
// [ ] For theme editing, when you hove the mouse over a theme color entry and
// it highlights that entry, it might help to temporarily change that
// color to white (or the inverse of the background color, or whatever) so
@@ -410,6 +406,9 @@
// sometimes both source code and menu/tab/watch font size, sometimes
// just menu/tab/watch font size not source size.
// [x] colors: fill out rest of theme presets for new theme setup
// [x] I LOVE ALT-W to add watch under cursor, but I would prefer to have it
// add what's under the MOUSE cursor instead of the keyboard cursor. Can
// we get a command for that so I can bind ALT-W to that instead?
#ifndef RADDBG_H
#define RADDBG_H