mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-14 17:28:07 +00:00
fix mouse-hover-in-source-evaluation (off -> range) rules, to correctly enclose more expressions
This commit is contained in:
@@ -2600,7 +2600,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
|||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- rjf: hover eval
|
//- rjf: hover eval
|
||||||
//
|
//
|
||||||
if(!ui_dragging(text_container_sig) && text_container_sig.event_flags == 0 && mouse_expr.size != 0)
|
if(!ui_dragging(text_container_sig) && text_container_sig.event_flags == 0 && mouse_expr.size != 0) E_ParentKey(e_key_zero())
|
||||||
{
|
{
|
||||||
E_Eval eval = e_eval_from_string(mouse_expr);
|
E_Eval eval = e_eval_from_string(mouse_expr);
|
||||||
B32 eval_implicit_hover = (eval.irtree.mode != E_Mode_Null &&
|
B32 eval_implicit_hover = (eval.irtree.mode != E_Mode_Null &&
|
||||||
|
|||||||
+29
-1
@@ -2356,7 +2356,7 @@ txt_expr_off_range_from_line_off_range_string_tokens(U64 off, Rng1U64 line_range
|
|||||||
if(contains_1u64(token->range, off))
|
if(contains_1u64(token->range, off))
|
||||||
{
|
{
|
||||||
Rng1U64 token_range_clamped = intersect_1u64(line_range, token->range);
|
Rng1U64 token_range_clamped = intersect_1u64(line_range, token->range);
|
||||||
String8 token_string = str8_substr(line_text, r1u64(token_range_clamped.max - line_range.min, token_range_clamped.max - line_range.min));
|
String8 token_string = str8_substr(line_text, r1u64(token_range_clamped.min - line_range.min, token_range_clamped.max - line_range.min));
|
||||||
B32 token_ender = 0;
|
B32 token_ender = 0;
|
||||||
switch(token->kind)
|
switch(token->kind)
|
||||||
{
|
{
|
||||||
@@ -2366,6 +2366,7 @@ txt_expr_off_range_from_line_off_range_string_tokens(U64 off, Rng1U64 line_range
|
|||||||
token_ender = (str8_match(token_string, str8_lit("]"), 0));
|
token_ender = (str8_match(token_string, str8_lit("]"), 0));
|
||||||
}break;
|
}break;
|
||||||
case TXT_TokenKind_Identifier:
|
case TXT_TokenKind_Identifier:
|
||||||
|
case TXT_TokenKind_Numeric:
|
||||||
case TXT_TokenKind_Keyword:
|
case TXT_TokenKind_Keyword:
|
||||||
case TXT_TokenKind_Meta:
|
case TXT_TokenKind_Meta:
|
||||||
{
|
{
|
||||||
@@ -2380,6 +2381,26 @@ txt_expr_off_range_from_line_off_range_string_tokens(U64 off, Rng1U64 line_range
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rjf: walk forward from pt_token - consume closing braces
|
||||||
|
if(pt_token != 0)
|
||||||
|
{
|
||||||
|
for(TXT_Token *wf_token = pt_token+1;
|
||||||
|
wf_token < line_tokens_opl;
|
||||||
|
wf_token += 1)
|
||||||
|
{
|
||||||
|
Rng1U64 wf_token_range_clamped = intersect_1u64(line_range, wf_token->range);
|
||||||
|
String8 wf_token_string = str8_substr(line_text, r1u64(wf_token_range_clamped.min - line_range.min, wf_token_range_clamped.max - line_range.min));
|
||||||
|
if(wf_token->kind == TXT_TokenKind_Symbol && str8_match(wf_token_string, str8_lit("]"), 0))
|
||||||
|
{
|
||||||
|
pt_token = wf_token;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// rjf: found token containing `off`? -> mark that as our initial range
|
// rjf: found token containing `off`? -> mark that as our initial range
|
||||||
if(pt_token != 0)
|
if(pt_token != 0)
|
||||||
{
|
{
|
||||||
@@ -2420,6 +2441,7 @@ txt_expr_off_range_from_line_off_range_string_tokens(U64 off, Rng1U64 line_range
|
|||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
case TXT_TokenKind_Identifier:
|
case TXT_TokenKind_Identifier:
|
||||||
|
case TXT_TokenKind_Numeric:
|
||||||
{
|
{
|
||||||
include_wb_token = 1;
|
include_wb_token = 1;
|
||||||
}break;
|
}break;
|
||||||
@@ -2434,6 +2456,12 @@ txt_expr_off_range_from_line_off_range_string_tokens(U64 off, Rng1U64 line_range
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rjf: exclude standalone numerics
|
||||||
|
if(pt_token != 0 && pt_token->kind == TXT_TokenKind_Numeric && result.min == pt_token->range.min && result.max == pt_token->range.max)
|
||||||
|
{
|
||||||
|
MemoryZeroStruct(&result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
scratch_end(scratch);
|
scratch_end(scratch);
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Reference in New Issue
Block a user