mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-06 05:48:40 +00:00
fix watch window snap-to-cursor rules; fix eval path for command parameter filling
This commit is contained in:
@@ -852,7 +852,6 @@ internal String8
|
|||||||
df_cmd_params_apply_spec_query(Arena *arena, DF_CmdParams *params, DF_CmdSpec *spec, String8 query)
|
df_cmd_params_apply_spec_query(Arena *arena, DF_CmdParams *params, DF_CmdSpec *spec, String8 query)
|
||||||
{
|
{
|
||||||
String8 error = {0};
|
String8 error = {0};
|
||||||
B32 prefer_imm = 0;
|
|
||||||
switch(spec->info.query.slot)
|
switch(spec->info.query.slot)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
@@ -883,15 +882,15 @@ df_cmd_params_apply_spec_query(Arena *arena, DF_CmdParams *params, DF_CmdSpec *s
|
|||||||
error = str8_lit("Couldn't interpret as a line number.");
|
error = str8_lit("Couldn't interpret as a line number.");
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
case DF_CmdParamSlot_VirtualAddr: prefer_imm = 0; goto use_numeric_eval;
|
case DF_CmdParamSlot_VirtualAddr: goto use_numeric_eval;
|
||||||
case DF_CmdParamSlot_VirtualOff: prefer_imm = 0; goto use_numeric_eval;
|
case DF_CmdParamSlot_VirtualOff: goto use_numeric_eval;
|
||||||
case DF_CmdParamSlot_Index: prefer_imm = 1; goto use_numeric_eval;
|
case DF_CmdParamSlot_Index: goto use_numeric_eval;
|
||||||
case DF_CmdParamSlot_ID: prefer_imm = 1; goto use_numeric_eval;
|
case DF_CmdParamSlot_ID: goto use_numeric_eval;
|
||||||
use_numeric_eval:
|
use_numeric_eval:
|
||||||
{
|
{
|
||||||
Temp scratch = scratch_begin(&arena, 1);
|
Temp scratch = scratch_begin(&arena, 1);
|
||||||
E_Eval eval = e_eval_from_string(scratch.arena, query);
|
E_Eval eval = e_eval_from_string(scratch.arena, query);
|
||||||
if(eval.msgs.max_kind != E_MsgKind_Null)
|
if(eval.msgs.max_kind == E_MsgKind_Null)
|
||||||
{
|
{
|
||||||
E_TypeKind eval_type_kind = e_type_kind_from_key(e_type_unwrap(eval.type_key));
|
E_TypeKind eval_type_kind = e_type_kind_from_key(e_type_unwrap(eval.type_key));
|
||||||
if(eval_type_kind == E_TypeKind_Ptr ||
|
if(eval_type_kind == E_TypeKind_Ptr ||
|
||||||
@@ -938,7 +937,7 @@ df_cmd_params_apply_spec_query(Arena *arena, DF_CmdParams *params, DF_CmdSpec *s
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
error = push_str8f(scratch.arena, "Couldn't evaluate \"%S\" as an address", query);
|
error = push_str8f(scratch.arena, "Couldn't evaluate \"%S\" as an address.", query);
|
||||||
}
|
}
|
||||||
scratch_end(scratch);
|
scratch_end(scratch);
|
||||||
}break;
|
}break;
|
||||||
|
|||||||
+44
-33
@@ -1584,6 +1584,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
|||||||
{
|
{
|
||||||
UI_EventList *events = ui_events();
|
UI_EventList *events = ui_events();
|
||||||
B32 state_dirty = 1;
|
B32 state_dirty = 1;
|
||||||
|
B32 snap_to_cursor = 0;
|
||||||
B32 cursor_dirty__tbl = 0;
|
B32 cursor_dirty__tbl = 0;
|
||||||
B32 take_autocomplete = 0;
|
B32 take_autocomplete = 0;
|
||||||
for(UI_EventNode *event_n = events->first, *next = 0;; event_n = next)
|
for(UI_EventNode *event_n = events->first, *next = 0;; event_n = next)
|
||||||
@@ -1610,6 +1611,10 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
|||||||
for(DF_EntityNode *n = watches.first; n != 0; n = n->next)
|
for(DF_EntityNode *n = watches.first; n != 0; n = n->next)
|
||||||
{
|
{
|
||||||
DF_Entity *watch = n->entity;
|
DF_Entity *watch = n->entity;
|
||||||
|
if(watch->flags & DF_EntityFlag_MarkedForDeletion)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
DF_ExpandKey parent_key = df_parent_expand_key_from_entity(watch);
|
DF_ExpandKey parent_key = df_parent_expand_key_from_entity(watch);
|
||||||
DF_ExpandKey key = df_expand_key_from_entity(watch);
|
DF_ExpandKey key = df_expand_key_from_entity(watch);
|
||||||
DF_Entity *view_rule = df_entity_child_from_kind(watch, DF_EntityKind_ViewRule);
|
DF_Entity *view_rule = df_entity_child_from_kind(watch, DF_EntityKind_ViewRule);
|
||||||
@@ -1868,6 +1873,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
|||||||
if(state_dirty)
|
if(state_dirty)
|
||||||
{
|
{
|
||||||
state_dirty = 0;
|
state_dirty = 0;
|
||||||
|
snap_to_cursor = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
@@ -1925,6 +1931,43 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
|||||||
Max(cursor_tbl.x, mark_tbl.x), Max(cursor_tbl.y, mark_tbl.y));
|
Max(cursor_tbl.x, mark_tbl.x), Max(cursor_tbl.y, mark_tbl.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////
|
||||||
|
//- rjf: [table] snap to cursor
|
||||||
|
//
|
||||||
|
if(snap_to_cursor)
|
||||||
|
{
|
||||||
|
Rng1S64 item_range = r1s64(0, 1 + blocks.total_visual_row_count);
|
||||||
|
Rng1S64 scroll_row_idx_range = r1s64(item_range.min, ClampBot(item_range.min, item_range.max-1));
|
||||||
|
S64 cursor_item_idx = cursor_tbl.y-1;
|
||||||
|
if(item_range.min <= cursor_item_idx && cursor_item_idx <= item_range.max)
|
||||||
|
{
|
||||||
|
UI_ScrollPt *scroll_pt = &view->scroll_pos.y;
|
||||||
|
|
||||||
|
//- rjf: compute visible row range
|
||||||
|
Rng1S64 visible_row_range = r1s64(scroll_pt->idx + 0 - !!(scroll_pt->off < 0),
|
||||||
|
scroll_pt->idx + 0 + num_possible_visible_rows + 1);
|
||||||
|
|
||||||
|
//- rjf: compute cursor row range from cursor item
|
||||||
|
Rng1S64 cursor_visibility_row_range = {0};
|
||||||
|
if(row_blocks.count == 0)
|
||||||
|
{
|
||||||
|
cursor_visibility_row_range = r1s64(cursor_item_idx-1, cursor_item_idx+3);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cursor_visibility_row_range.min = (S64)ui_scroll_list_row_from_item(&row_blocks, (U64)cursor_item_idx);
|
||||||
|
cursor_visibility_row_range.max = cursor_visibility_row_range.min + 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- rjf: compute deltas & apply
|
||||||
|
S64 min_delta = Min(0, cursor_visibility_row_range.min-visible_row_range.min);
|
||||||
|
S64 max_delta = Max(0, cursor_visibility_row_range.max-visible_row_range.max);
|
||||||
|
S64 new_idx = scroll_pt->idx+min_delta+max_delta;
|
||||||
|
new_idx = clamp_1s64(scroll_row_idx_range, new_idx);
|
||||||
|
ui_scroll_pt_target_idx(scroll_pt, new_idx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- rjf: apply cursor/mark rugpull change
|
//- rjf: apply cursor/mark rugpull change
|
||||||
//
|
//
|
||||||
@@ -2304,7 +2347,6 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
|||||||
{
|
{
|
||||||
B32 cursor_tbl_min_is_empty_selection[Axis2_COUNT] = {0, 1};
|
B32 cursor_tbl_min_is_empty_selection[Axis2_COUNT] = {0, 1};
|
||||||
Rng2S64 cursor_tbl_range = r2s64(v2s64(0, 0), v2s64(3, blocks.total_semantic_row_count));
|
Rng2S64 cursor_tbl_range = r2s64(v2s64(0, 0), v2s64(3, blocks.total_semantic_row_count));
|
||||||
Rng1S64 item_range = r1s64(0, 1 + blocks.total_visual_row_count);
|
|
||||||
Vec2S32 delta = evt->delta_2s32;
|
Vec2S32 delta = evt->delta_2s32;
|
||||||
if(evt->flags & UI_EventFlag_PickSelectSide && !MemoryMatchStruct(&selection_tbl.min, &selection_tbl.max))
|
if(evt->flags & UI_EventFlag_PickSelectSide && !MemoryMatchStruct(&selection_tbl.min, &selection_tbl.max))
|
||||||
{
|
{
|
||||||
@@ -2369,38 +2411,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
|||||||
{
|
{
|
||||||
taken = 1;
|
taken = 1;
|
||||||
cursor_dirty__tbl = 1;
|
cursor_dirty__tbl = 1;
|
||||||
{
|
snap_to_cursor = 1;
|
||||||
Rng1S64 scroll_row_idx_range = r1s64(item_range.min, ClampBot(item_range.min, item_range.max-1));
|
|
||||||
S64 cursor_item_idx = cursor_tbl.y-1;
|
|
||||||
if(item_range.min <= cursor_item_idx && cursor_item_idx <= item_range.max)
|
|
||||||
{
|
|
||||||
UI_ScrollPt *scroll_pt = &view->scroll_pos.y;
|
|
||||||
|
|
||||||
//- rjf: compute visible row range
|
|
||||||
Rng1S64 visible_row_range = r1s64(scroll_pt->idx + 0 - !!(scroll_pt->off < 0),
|
|
||||||
scroll_pt->idx + 0 + num_possible_visible_rows + 1);
|
|
||||||
|
|
||||||
//- rjf: compute cursor row range from cursor item
|
|
||||||
Rng1S64 cursor_visibility_row_range = {0};
|
|
||||||
if(row_blocks.count == 0)
|
|
||||||
{
|
|
||||||
cursor_visibility_row_range = r1s64(cursor_item_idx-1, cursor_item_idx+3);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cursor_visibility_row_range.min = (S64)ui_scroll_list_row_from_item(&row_blocks, (U64)cursor_item_idx);
|
|
||||||
cursor_visibility_row_range.max = cursor_visibility_row_range.min + 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- rjf: compute deltas & apply
|
|
||||||
S64 min_delta = Min(0, cursor_visibility_row_range.min-visible_row_range.min);
|
|
||||||
S64 max_delta = Max(0, cursor_visibility_row_range.max-visible_row_range.max);
|
|
||||||
S64 new_idx = scroll_pt->idx+min_delta+max_delta;
|
|
||||||
new_idx = clamp_1s64(scroll_row_idx_range, new_idx);
|
|
||||||
ui_scroll_pt_target_idx(scroll_pt, new_idx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user