blank cell rendering fixes, autocompletion work, fix to value-string visualization, more fixes/tweaks

This commit is contained in:
Ryan Fleury
2025-05-01 08:18:14 -07:00
parent 91be06dea9
commit 791187b152
3 changed files with 54 additions and 14 deletions
@@ -1776,16 +1776,16 @@ ev_string_iter_next(Arena *arena, EV_StringIter *it, String8 *out_string)
// rjf: read string data // rjf: read string data
#define EV_STRING_ITER_STRING_BUFFER_CAPACITY 4096 #define EV_STRING_ITER_STRING_BUFFER_CAPACITY 4096
U64 string_memory_addr = ptr_data->value_eval.value.u64;
U64 string_buffer_size = EV_STRING_ITER_STRING_BUFFER_CAPACITY; U64 string_buffer_size = EV_STRING_ITER_STRING_BUFFER_CAPACITY;
U8 *string_buffer = push_array(scratch.arena, U8, string_buffer_size); U8 *string_buffer = push_array(scratch.arena, U8, string_buffer_size);
if(type_kind == E_TypeKind_Array && ptr_data->value_eval.irtree.mode == E_Mode_Value) if(type_kind == E_TypeKind_Array && eval.irtree.mode == E_Mode_Value)
{ {
StaticAssert(sizeof(ptr_data->value_eval.value.u512.u8) <= EV_STRING_ITER_STRING_BUFFER_CAPACITY, ev_string_iter_value_string_buffer_size_check); StaticAssert(sizeof(eval.value.u512.u8) <= EV_STRING_ITER_STRING_BUFFER_CAPACITY, ev_string_iter_value_string_buffer_size_check);
MemoryCopy(string_buffer, ptr_data->value_eval.value.u512.u8, sizeof(ptr_data->value_eval.value.u512.u8)); MemoryCopy(string_buffer, eval.value.u512.u8, sizeof(eval.value.u512.u8));
} }
else else
{ {
U64 string_memory_addr = ptr_data->value_eval.value.u64;
for(U64 try_size = string_buffer_size; try_size >= 16; try_size /= 2) for(U64 try_size = string_buffer_size; try_size >= 16; try_size /= 2)
{ {
B32 read_good = e_space_read(eval.space, string_buffer, r1u64(string_memory_addr, string_memory_addr+try_size)); B32 read_good = e_space_read(eval.space, string_buffer, r1u64(string_memory_addr, string_memory_addr+try_size));
+48 -8
View File
@@ -4834,6 +4834,9 @@ rd_view_ui(Rng2F32 rect)
RD_CellParams cell_params = {0}; RD_CellParams cell_params = {0};
ProfScope("form cell build parameters") ProfScope("form cell build parameters")
{ {
E_Type *block_type = e_type_from_key__cached(row->block->eval.irtree.type_key);
B32 cells_are_editable = !!(block_type->flags & E_TypeFlag_EditableChildren);
// rjf: set up base parameters // rjf: set up base parameters
cell_params.flags = (RD_CellFlag_KeyboardClickable|RD_CellFlag_NoBackground|RD_CellFlag_CodeContents); cell_params.flags = (RD_CellFlag_KeyboardClickable|RD_CellFlag_NoBackground|RD_CellFlag_CodeContents);
cell_params.depth = (cell->flags & RD_WatchCellFlag_Indented ? row_depth : 0); cell_params.depth = (cell->flags & RD_WatchCellFlag_Indented ? row_depth : 0);
@@ -4857,17 +4860,30 @@ rd_view_ui(Rng2F32 rect)
} }
// rjf: apply expander (or substitute space) // rjf: apply expander (or substitute space)
if(row_is_expandable && cell == row_info->cells.first) if(!ewv->text_editing || !cell_selected)
{ {
cell_params.flags |= RD_CellFlag_Expander; if(row_is_expandable && cell == row_info->cells.first)
{
cell_params.flags |= RD_CellFlag_Expander;
}
else if(cells_are_editable && row_depth == !implicit_root && cell == row_info->cells.first)
{
cell_params.flags |= RD_CellFlag_ExpanderPlaceholder;
}
else if(row_depth != 0 && cell == row_info->cells.first)
{
cell_params.flags |= RD_CellFlag_ExpanderSpace;
}
} }
else if(row_depth == !implicit_root && cell == row_info->cells.first)
// rjf: apply blank cell ghost text
if(row_info->cells.first == row_info->cells.last &&
cells_are_editable &&
row->eval.expr == &e_expr_nil)
{ {
cell_params.flags |= RD_CellFlag_ExpanderSpace; ghost_text = str8_lit("Expression");
} is_non_code = (!cell_selected || !ewv->text_editing);
else if(row_depth != 0 && cell == row_info->cells.first) cell_params.flags &= ~(RD_CellFlag_Expander|RD_CellFlag_ExpanderSpace|RD_CellFlag_ExpanderPlaceholder);
{
cell_params.flags |= RD_CellFlag_ExpanderSpace;
} }
// rjf: apply single-click-activation // rjf: apply single-click-activation
@@ -6629,6 +6645,7 @@ rd_window_frame(void)
B32 pressed; B32 pressed;
B32 pressed_outside; B32 pressed_outside;
}; };
FloatingViewTask *autocomp_floating_view_task = 0;
FloatingViewTask *hover_eval_floating_view_task = 0; FloatingViewTask *hover_eval_floating_view_task = 0;
FloatingViewTask *query_floating_view_task = 0; FloatingViewTask *query_floating_view_task = 0;
FloatingViewTask *first_floating_view_task = 0; FloatingViewTask *first_floating_view_task = 0;
@@ -6679,6 +6696,7 @@ rd_window_frame(void)
{ {
FloatingViewTask *t = push_array(scratch.arena, FloatingViewTask, 1); FloatingViewTask *t = push_array(scratch.arena, FloatingViewTask, 1);
SLLQueuePush(first_floating_view_task, last_floating_view_task, t); SLLQueuePush(first_floating_view_task, last_floating_view_task, t);
autocomp_floating_view_task = t;
t->view = view; t->view = view;
t->rect = rect; t->rect = rect;
t->is_focused = 1; t->is_focused = 1;
@@ -7085,6 +7103,28 @@ rd_window_frame(void)
//- rjf: @window_ui_part do special handling of floating view interactions //- rjf: @window_ui_part do special handling of floating view interactions
// //
{ {
//- rjf: autocompletion view early-closing rules
if(autocomp_floating_view_task)
{
B32 has_autocomplete_hint = 0;
B32 has_accept_operation = 0;
for(UI_Event *evt = 0; ui_next_event(&evt);)
{
if(evt->kind == UI_EventKind_AutocompleteHint)
{
has_autocomplete_hint = 1;
}
if(evt->kind == UI_EventKind_Press && evt->slot == UI_EventActionSlot_Accept)
{
has_accept_operation = 1;
}
}
if(has_autocomplete_hint && has_accept_operation)
{
autocomp_floating_view_task->signal.box->transparency = 1;
}
}
//- rjf: hover eval focus rules //- rjf: hover eval focus rules
if(hover_eval_floating_view_task) if(hover_eval_floating_view_task)
{ {
+2 -2
View File
@@ -3308,7 +3308,7 @@ rd_cell(RD_CellParams *params, String8 string)
{ {
if(ui_top_text_alignment() == UI_TextAlign_Left && (params->flags & (RD_CellFlag_Expander|RD_CellFlag_ExpanderSpace|RD_CellFlag_ExpanderPlaceholder)) == 0) if(ui_top_text_alignment() == UI_TextAlign_Left && (params->flags & (RD_CellFlag_Expander|RD_CellFlag_ExpanderSpace|RD_CellFlag_ExpanderPlaceholder)) == 0)
{ {
ui_spacer(ui_em(0.5f, 1.f)); ui_spacer(ui_em(1.f, 1.f));
} }
UI_Box *name_box = ui_build_box_from_key(UI_BoxFlag_DrawText, ui_key_zero()); UI_Box *name_box = ui_build_box_from_key(UI_BoxFlag_DrawText, ui_key_zero());
ui_box_equip_display_fstrs(name_box, &lhs_name_fstrs); ui_box_equip_display_fstrs(name_box, &lhs_name_fstrs);
@@ -3318,7 +3318,7 @@ rd_cell(RD_CellParams *params, String8 string)
{ {
UI_Row UI_Row
{ {
ui_spacer(ui_em(0.5f, 1.f)); ui_spacer(ui_em(1.f, 1.f));
UI_Box *desc_box = ui_label(params->description).box; UI_Box *desc_box = ui_label(params->description).box;
FuzzyMatchRangeList desc_fuzzy_matches = fuzzy_match_find(scratch.arena, params->search_needle, params->description); FuzzyMatchRangeList desc_fuzzy_matches = fuzzy_match_find(scratch.arena, params->search_needle, params->description);
ui_box_equip_fuzzy_match_ranges(desc_box, &desc_fuzzy_matches); ui_box_equip_fuzzy_match_ranges(desc_box, &desc_fuzzy_matches);