mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-05 21:38:40 +00:00
fix txt cache scope lookup binary search
This commit is contained in:
@@ -1279,6 +1279,11 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
|||||||
{
|
{
|
||||||
pop_color = ui_color_from_name(str8_lit("background"));
|
pop_color = ui_color_from_name(str8_lit("background"));
|
||||||
}
|
}
|
||||||
|
Vec4F32 highlight_color = {0};
|
||||||
|
UI_TagF("focus")
|
||||||
|
{
|
||||||
|
highlight_color = ui_color_from_name(str8_lit("border"));
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- rjf: build top-level container
|
//- rjf: build top-level container
|
||||||
@@ -2122,6 +2127,14 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
|||||||
cursor_scope_node = txt_scope_node_from_info_pt(params->text_info, rd_regs()->cursor);
|
cursor_scope_node = txt_scope_node_from_info_pt(params->text_info, rd_regs()->cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////////
|
||||||
|
//- rjf: equip cursor scope rendering info
|
||||||
|
//
|
||||||
|
if(cursor_scope_node != &txt_scope_node_nil)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- rjf: produce fancy strings for each line
|
//- rjf: produce fancy strings for each line
|
||||||
//
|
//
|
||||||
@@ -2187,7 +2200,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
|||||||
if(params->text_info->tokens.v[scope_n->token_idx_range.min].range.min == token->range.min ||
|
if(params->text_info->tokens.v[scope_n->token_idx_range.min].range.min == token->range.min ||
|
||||||
params->text_info->tokens.v[scope_n->token_idx_range.max].range.min == token->range.min)
|
params->text_info->tokens.v[scope_n->token_idx_range.max].range.min == token->range.min)
|
||||||
{
|
{
|
||||||
token_color = pop_color;
|
token_color = highlight_color;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,6 +159,7 @@ internal UI_Signal rd_icon_buttonf(RD_IconKind kind, FuzzyMatchRangeList *matche
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: UI Widgets: Text View
|
//~ rjf: UI Widgets: Text View
|
||||||
|
|
||||||
|
internal UI_BOX_CUSTOM_DRAW(rd_code_slice_text_draw_extensions);
|
||||||
internal UI_BOX_CUSTOM_DRAW(rd_thread_box_draw_extensions);
|
internal UI_BOX_CUSTOM_DRAW(rd_thread_box_draw_extensions);
|
||||||
internal UI_BOX_CUSTOM_DRAW(rd_bp_box_draw_extensions);
|
internal UI_BOX_CUSTOM_DRAW(rd_bp_box_draw_extensions);
|
||||||
internal RD_CodeSliceSignal rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *preferred_column, String8 string);
|
internal RD_CodeSliceSignal rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *preferred_column, String8 string);
|
||||||
|
|||||||
@@ -2101,26 +2101,41 @@ internal TXT_ScopeNode *
|
|||||||
txt_scope_node_from_info_off(TXT_TextInfo *info, U64 off)
|
txt_scope_node_from_info_off(TXT_TextInfo *info, U64 off)
|
||||||
{
|
{
|
||||||
TXT_ScopeNode *result = &txt_scope_node_nil;
|
TXT_ScopeNode *result = &txt_scope_node_nil;
|
||||||
|
if(info->scope_pts.count != 0)
|
||||||
{
|
{
|
||||||
U64 first = 0;
|
U64 first = 0;
|
||||||
U64 opl = info->scope_pts.count;
|
U64 opl = info->scope_pts.count;
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
U64 mid = first + (opl - first) / 2;
|
U64 mid = (first + opl) / 2;
|
||||||
if(mid >= info->scope_pts.count) { break; }
|
|
||||||
U64 mid_off = info->tokens.v[info->scope_pts.v[mid].token_idx].range.min;
|
U64 mid_off = info->tokens.v[info->scope_pts.v[mid].token_idx].range.min;
|
||||||
if(off == mid_off || (first == mid && opl == mid+1))
|
if(mid_off < off)
|
||||||
{
|
{
|
||||||
result = &info->scope_nodes.v[info->scope_pts.v[mid].scope_idx];
|
first = mid;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
else if(off < mid_off)
|
else if(off < mid_off)
|
||||||
{
|
{
|
||||||
opl = mid;
|
opl = mid;
|
||||||
}
|
}
|
||||||
else if(mid_off < off)
|
else
|
||||||
{
|
{
|
||||||
first = mid;
|
first = mid;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(opl - first <= 1)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TXT_ScopeNode *closest_node = &info->scope_nodes.v[info->scope_pts.v[first].scope_idx];
|
||||||
|
for(TXT_ScopeNode *scope_n = closest_node;
|
||||||
|
scope_n != &txt_scope_node_nil;
|
||||||
|
scope_n = txt_scope_node_from_info_num(info, scope_n->parent_num))
|
||||||
|
{
|
||||||
|
if(off < info->tokens.v[scope_n->token_idx_range.max].range.max)
|
||||||
|
{
|
||||||
|
result = scope_n;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user