fix drag/drop of immediate views, fix disallowance of [ or { in mdesk tags, other various convergences/fixes

This commit is contained in:
Ryan Fleury
2025-03-21 17:18:16 -07:00
parent c2bebf2a53
commit 02322191fe
6 changed files with 32 additions and 12 deletions
+4 -1
View File
@@ -968,7 +968,10 @@ if(work_top == 0) {work_top = &broken_work;}\
String8 tag_name = md_content_string_from_token_flags_str8(token[1].flags, tag_name_raw);
MD_Node *node = md_push_node(arena, MD_NodeKind_Tag, md_node_flags_from_token_flags(token[1].flags), tag_name, tag_name_raw, token[0].range.min);
DLLPushBack_NPZ(&md_nil_node, work_top->first_gathered_tag, work_top->last_gathered_tag, node, next, prev);
if(token+2 < tokens_opl && token[2].flags & MD_TokenFlag_Reserved && str8_match(str8_substr(text, token[2].range), str8_lit("("), 0))
if(token+2 < tokens_opl && token[2].flags & MD_TokenFlag_Reserved &&
(str8_match(str8_substr(text, token[2].range), str8_lit("("), 0) ||
str8_match(str8_substr(text, token[2].range), str8_lit("["), 0) ||
str8_match(str8_substr(text, token[2].range), str8_lit("{"), 0)))
{
token += 3;
MD_ParseWorkPush(MD_ParseWorkKind_Main, node);
+2 -1
View File
@@ -4,7 +4,7 @@
//- GENERATED CODE
C_LINKAGE_BEGIN
RD_VocabInfo rd_vocab_info_table[304] =
RD_VocabInfo rd_vocab_info_table[305] =
{
{str8_lit_comp("auto_view_rule"), str8_lit_comp("auto_view_rules"), str8_lit_comp("Auto View Rule"), str8_lit_comp("Auto View Rules"), RD_IconKind_Binoculars},
{str8_lit_comp("file_path_map"), str8_lit_comp("file_path_maps"), str8_lit_comp("File Path Map"), str8_lit_comp("File Path Maps"), RD_IconKind_FileOutline},
@@ -95,6 +95,7 @@ RD_VocabInfo rd_vocab_info_table[304] =
{str8_lit_comp("show_symbol_names"), str8_lit_comp(""), str8_lit_comp("Show Symbol Names"), str8_lit_comp(""), RD_IconKind_Null},
{str8_lit_comp("show_line_numbers"), str8_lit_comp(""), str8_lit_comp("Show Line Numbers"), str8_lit_comp(""), RD_IconKind_Null},
{str8_lit_comp("syntax"), str8_lit_comp("syntaxes"), str8_lit_comp("Syntax"), str8_lit_comp("Syntaxes"), RD_IconKind_Null},
{str8_lit_comp("num_columns"), str8_lit_comp(""), str8_lit_comp("Number of Columns"), str8_lit_comp(""), RD_IconKind_Null},
{str8_lit_comp("launch_and_run"), str8_lit_comp(""), str8_lit_comp("Launch and Run"), str8_lit_comp(""), RD_IconKind_Play},
{str8_lit_comp("launch_and_step_into"), str8_lit_comp(""), str8_lit_comp("Launch and Step Into"), str8_lit_comp(""), RD_IconKind_PlayStepForward},
{str8_lit_comp("kill"), str8_lit_comp(""), str8_lit_comp("Kill"), str8_lit_comp(""), RD_IconKind_X},
+1 -1
View File
@@ -637,7 +637,7 @@ RD_Query query;
.os_event = rd_regs()->os_event,\
C_LINKAGE_BEGIN
extern RD_VocabInfo rd_vocab_info_table[304];
extern RD_VocabInfo rd_vocab_info_table[305];
extern RD_NameSchemaInfo rd_name_schema_info_table[16];
extern Rng1U64 rd_reg_slot_range_table[41];
extern String8 rd_binding_version_remap_old_name_table[8];
+1
View File
@@ -108,6 +108,7 @@ RD_VocabTable:
{show_symbol_names "" "Show Symbol Names" "" Null }
{show_line_numbers "" "Show Line Numbers" "" Null }
{syntax syntaxes "Syntax" "Syntaxes" Null }
{num_columns "" "Number of Columns" "" Null }
}
@struct RD_VocabInfo:
+21 -7
View File
@@ -2240,7 +2240,8 @@ rd_setting_from_name(String8 name)
String8 result = {0};
{
// rjf: find most-granular config scope to begin looking for the setting
RD_Cfg *start_cfg = rd_cfg_from_id(rd_regs()->view);
RD_Cfg *view_cfg = rd_cfg_from_id(rd_regs()->view);
RD_Cfg *start_cfg = view_cfg;
for(RD_Cfg *p = start_cfg->parent; p != &rd_nil_cfg; p = p->parent)
{
if(str8_match(p->string, str8_lit("transient"), 0))
@@ -2253,7 +2254,7 @@ rd_setting_from_name(String8 name)
if(start_cfg == &rd_nil_cfg) { start_cfg = rd_cfg_from_id(rd_regs()->window); }
// rjf: scan upwards the config tree until we find the setting
RD_Cfg *setting = &rd_nil_cfg;
RD_Cfg *setting = rd_cfg_child_from_string(view_cfg, name);
for(RD_Cfg *cfg = start_cfg; cfg != &rd_nil_cfg && setting == &rd_nil_cfg; cfg = cfg->parent)
{
setting = rd_cfg_child_from_string(cfg, name);
@@ -2268,7 +2269,7 @@ rd_setting_from_name(String8 name)
Temp scratch = scratch_begin(0, 0);
String8 schema_names[] =
{
start_cfg->string,
view_cfg->string,
str8_lit("settings"),
};
for EachElement(idx, schema_names)
@@ -4053,7 +4054,7 @@ rd_view_ui(Rng2F32 rect)
}
// rjf: use row to complete query
if(row != 0)
if(row->expr != &e_expr_nil)
{
taken = 1;
E_Eval eval = e_eval_from_expr(scratch.arena, row->expr);
@@ -4858,9 +4859,9 @@ rd_view_ui(Rng2F32 rect)
F32 cell_width_px = cell->px + cell->pct * row_width_px;
F32 next_cell_x_px = cell_x_px + cell_width_px;
{
Rng2F32 rect = r2f32p(next_cell_x_px - ui_top_font_size()*0.2f,
Rng2F32 rect = r2f32p(next_cell_x_px - ui_top_font_size()*0.4f,
boundary_start_idx*row_height_px,
next_cell_x_px + ui_top_font_size()*0.2f,
next_cell_x_px + ui_top_font_size()*0.4f,
idx*row_height_px);
UI_Rect(rect) UI_HoverCursor(OS_Cursor_LeftRight)
{
@@ -6741,6 +6742,19 @@ rd_window_frame(void)
//- rjf: tab dragging
if(rd_state->drag_drop_regs_slot == RD_RegSlot_View && view != &rd_nil_cfg)
{
RD_Cfg *immediate_parent = &rd_nil_cfg;
for(RD_Cfg *p = view->parent; p != &rd_nil_cfg; p = p->parent)
{
if(str8_match(p->parent->string, str8_lit("immediate"), 0))
{
immediate_parent = p->parent;
break;
}
}
if(immediate_parent != &rd_nil_cfg)
{
rd_cfg_new(immediate_parent, str8_lit("hot"));
}
UI_Size main_width = ui_top_pref_width();
UI_Size main_height = ui_top_pref_height();
UI_TextAlign main_text_align = ui_top_text_alignment();
@@ -7317,7 +7331,7 @@ rd_window_frame(void)
{
//- rjf: try to add hover eval first
{
B32 build_hover_eval = (hover_eval_is_open && (!rd_drag_is_active() || rd_state->drag_drop_regs_slot == RD_RegSlot_View));
B32 build_hover_eval = (hover_eval_is_open && !rd_drag_is_active());
// rjf: disable hover eval if hovered view is actively scrolling
if(hover_eval_is_open)
+3 -2
View File
@@ -1424,7 +1424,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
ui_set_next_pref_width(ui_px(params->catchall_margin_width_px, 1));
ui_set_next_pref_height(ui_px(params->line_height_px*(dim_1s64(params->line_num_range)+1), 1.f));
ui_set_next_child_layout_axis(Axis2_Y);
catchall_margin_container_box = ui_build_box_from_string(UI_BoxFlag_DrawSideLeft|UI_BoxFlag_Clickable*!!(params->flags & RD_CodeSliceFlag_Clickable), str8_lit("catchall_margin_container"));
catchall_margin_container_box = ui_build_box_from_string(UI_BoxFlag_DrawSideRight|UI_BoxFlag_DrawSideLeft|UI_BoxFlag_Clickable*!!(params->flags & RD_CodeSliceFlag_Clickable), str8_lit("catchall_margin_container"));
UI_Parent(catchall_margin_container_box) UI_PrefHeight(ui_px(params->line_height_px, 1.f))
{
U64 line_idx = 0;
@@ -1436,6 +1436,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
RD_CfgList line_bps = params->line_bps[line_idx];
RD_CfgList line_pins = params->line_pins[line_idx];
ui_set_next_hover_cursor(OS_Cursor_HandPoint);
ui_set_next_background_color(v4f32(0, 0, 0, 0));
UI_Box *line_margin_box = ui_build_box_from_stringf(UI_BoxFlag_Clickable*!!(params->flags & RD_CodeSliceFlag_Clickable)|UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawActiveEffects, "line_margin_%I64x", line_num);
UI_Parent(line_margin_box)
{
@@ -1733,7 +1734,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
ui_set_next_fixed_x(floor_f32(params->margin_float_off_px + params->priority_margin_width_px + params->catchall_margin_width_px));
ui_set_next_pref_width(ui_px(params->line_num_width_px, 1.f));
ui_set_next_pref_height(ui_px(params->line_height_px*(dim_1s64(params->line_num_range)+1), 1.f));
ui_set_next_flags(UI_BoxFlag_DrawSideLeft|UI_BoxFlag_DrawSideRight);
ui_set_next_flags(UI_BoxFlag_DrawSideRight);
UI_Column
UI_PrefHeight(ui_px(params->line_height_px, 1.f))
RD_Font(RD_FontSlot_Code)