fix a few small issues with insertion/deletion of new watch rows

This commit is contained in:
Ryan Fleury
2024-09-26 16:15:03 -07:00
parent 73c37b4d8b
commit bbac451de4
+9 -2
View File
@@ -1462,12 +1462,15 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
RD_Entity *entity = collection_info.entity; RD_Entity *entity = collection_info.entity;
if(!rd_entity_is_nil(entity) || editing_complete) if(!rd_entity_is_nil(entity) || editing_complete)
{ {
if(rd_entity_is_nil(entity)) if(rd_entity_is_nil(entity) && new_string.size != 0)
{ {
entity = rd_entity_alloc(rd_entity_root(), collection_info.kind); entity = rd_entity_alloc(rd_entity_root(), collection_info.kind);
}
rd_entity_equip_cfg_src(entity, RD_CfgSrc_Project); rd_entity_equip_cfg_src(entity, RD_CfgSrc_Project);
}
if(!rd_entity_is_nil(entity))
{
rd_entity_equip_name(entity, new_string); rd_entity_equip_name(entity, new_string);
}
state_dirty = 1; state_dirty = 1;
snap_to_cursor = 1; snap_to_cursor = 1;
} }
@@ -1632,11 +1635,14 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
{}break; {}break;
default: default:
case RD_WatchViewColumnKind_Expr: case RD_WatchViewColumnKind_Expr:
if(tbl.y != 0)
{ {
RD_WatchViewCollectionInfo collection_info = rd_collection_info_from_num(&block_ranges, tbl.y); RD_WatchViewCollectionInfo collection_info = rd_collection_info_from_num(&block_ranges, tbl.y);
if(collection_info.kind != RD_EntityKind_Nil) if(collection_info.kind != RD_EntityKind_Nil)
{ {
RD_Entity *entity = collection_info.entity; RD_Entity *entity = collection_info.entity;
if(!rd_entity_is_nil(entity))
{
rd_entity_mark_for_deletion(entity); rd_entity_mark_for_deletion(entity);
U64 deleted_id = collection_info.key.child_id; U64 deleted_id = collection_info.key.child_id;
U64 deleted_num = collection_info.block->expand_view_rule_info->expr_expand_num_from_id(deleted_id, collection_info.block->expand_view_rule_info_user_data); U64 deleted_num = collection_info.block->expand_view_rule_info->expr_expand_num_from_id(deleted_id, collection_info.block->expand_view_rule_info_user_data);
@@ -1655,6 +1661,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
ewv->cursor = ewv->mark = ewv->next_cursor = ewv->next_mark = new_pt; ewv->cursor = ewv->mark = ewv->next_cursor = ewv->next_mark = new_pt;
} }
} }
}
}break; }break;
case RD_WatchViewColumnKind_ViewRule: case RD_WatchViewColumnKind_ViewRule:
{ {