extend autocompletion lister parameter detection, based on cursor position; feed through view rule parameters; correctly support cursor position with multi-arguments, regardless of which argument the cursor is on

This commit is contained in:
Ryan Fleury
2024-05-13 16:19:32 -07:00
parent 7c0f92ab3d
commit 90fc289ef0
3 changed files with 123 additions and 41 deletions
+6 -5
View File
@@ -1269,7 +1269,8 @@ df_eval_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_EvalW
if(expr_editing_active && !edit_end && txt_pt_match(ewv->input_cursor, ewv->input_mark))
{
String8 input = str8(ewv->input_buffer, ewv->input_size);
df_set_autocomp_lister_query(ws, sig.box->key, ctrl_ctx, DF_AutoCompListerFlag_Locals, input, ewv->input_cursor.column-1);
DF_AutoCompListerParams params = {DF_AutoCompListerFlag_Locals};
df_set_autocomp_lister_query(ws, sig.box->key, ctrl_ctx, &params, input, ewv->input_cursor.column-1);
}
}
@@ -1481,12 +1482,12 @@ df_eval_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_EvalW
if(rule_editing_active && !edit_end && txt_pt_match(ewv->input_cursor, ewv->input_mark))
{
String8 input = str8(ewv->input_buffer, ewv->input_size);
DF_AutoCompListerFlags flags = df_view_rule_autocomp_lister_flags_from_input_cursor(input, ewv->input_cursor.column-1);
if(flags == 0)
DF_AutoCompListerParams params = df_view_rule_autocomp_lister_params_from_input_cursor(scratch.arena, input, ewv->input_cursor.column-1);
if(params.flags == 0)
{
flags = DF_AutoCompListerFlag_ViewRules;
params.flags = DF_AutoCompListerFlag_ViewRules;
}
df_set_autocomp_lister_query(ws, sig.box->key, ctrl_ctx, flags, input, ewv->input_cursor.column-1);
df_set_autocomp_lister_query(ws, sig.box->key, ctrl_ctx, &params, input, ewv->input_cursor.column-1);
}
}
}