@@ -1222,14 +1222,14 @@ rd_title_fstrs_from_cfg(Arena *arena, RD_Cfg *cfg, Vec4F32 secondary_color, F32
12221222 if(icon_kind != RD_IconKind_Null)
12231223 {
12241224 dr_fstrs_push_new(arena, &result, ¶ms, rd_icon_kind_text_table[icon_kind], .font = rd_font_from_slot(RD_FontSlot_Icons), .raster_flags = rd_raster_flags_from_slot(RD_FontSlot_Icons), .color = secondary_color);
1225- dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
1225+ dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
12261226 }
12271227
12281228 //- rjf: push warning icon for command-line entities
12291229 if(is_from_command_line)
12301230 {
12311231 dr_fstrs_push_new(arena, &result, ¶ms, rd_icon_kind_text_table[RD_IconKind_Info], .font = rd_font_from_slot(RD_FontSlot_Icons), .raster_flags = rd_raster_flags_from_slot(RD_FontSlot_Icons), .color = rd_rgba_from_theme_color(RD_ThemeColor_TextNegative));
1232- dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
1232+ dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
12331233 }
12341234
12351235 //- rjf: push view title, if from window, and no file path
@@ -1239,7 +1239,7 @@ rd_title_fstrs_from_cfg(Arena *arena, RD_Cfg *cfg, Vec4F32 secondary_color, F32
12391239 if(view_display_name.size != 0)
12401240 {
12411241 dr_fstrs_push_new(arena, &result, ¶ms, view_display_name);
1242- dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
1242+ dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
12431243 start_secondary();
12441244 }
12451245 }
@@ -1248,69 +1248,162 @@ rd_title_fstrs_from_cfg(Arena *arena, RD_Cfg *cfg, Vec4F32 secondary_color, F32
12481248 if(label_string.size != 0)
12491249 {
12501250 dr_fstrs_push_new(arena, &result, ¶ms, label_string, .font = rd_font_from_slot(RD_FontSlot_Code));
1251- dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
1251+ dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
12521252 start_secondary();
12531253 }
12541254
12551255 //- rjf: push expression
12561256 if(collection_name.size != 0)
12571257 {
12581258 dr_fstrs_push_new(arena, &result, ¶ms, collection_name);
1259- dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
1259+ dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
12601260 start_secondary();
12611261 }
1262+
1263+ //- rjf: query is file path - do specific file name strings
12621264 else if(file_path.size != 0)
12631265 {
1264- dr_fstrs_push_new(arena, &result, ¶ms, str8_skip_last_slash(file_path));
1265- dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
1266+ // rjf: compute disambiguated file name
1267+ String8List qualifiers = {0};
1268+ String8 file_name = str8_skip_last_slash(file_path);
1269+ if(rd_state->ambiguous_path_slots_count != 0)
1270+ {
1271+ U64 hash = d_hash_from_string__case_insensitive(file_name);
1272+ U64 slot_idx = hash%rd_state->ambiguous_path_slots_count;
1273+ RD_AmbiguousPathNode *node = 0;
1274+ {
1275+ for(RD_AmbiguousPathNode *n = rd_state->ambiguous_path_slots[slot_idx];
1276+ n != 0;
1277+ n = n->next)
1278+ {
1279+ if(str8_match(n->name, file_name, StringMatchFlag_CaseInsensitive))
1280+ {
1281+ node = n;
1282+ break;
1283+ }
1284+ }
1285+ }
1286+ if(node != 0 && node->paths.node_count > 1)
1287+ {
1288+ // rjf: get all colliding paths
1289+ String8Array collisions = str8_array_from_list(scratch.arena, &node->paths);
1290+
1291+ // rjf: get all reversed path parts for each collision
1292+ String8List *collision_parts_reversed = push_array(scratch.arena, String8List, collisions.count);
1293+ for EachIndex(idx, collisions.count)
1294+ {
1295+ String8List parts = str8_split_path(scratch.arena, collisions.v[idx]);
1296+ for(String8Node *n = parts.first; n != 0; n = n->next)
1297+ {
1298+ str8_list_push_front(scratch.arena, &collision_parts_reversed[idx], n->string);
1299+ }
1300+ }
1301+
1302+ // rjf: get the search path & its reversed parts
1303+ String8List parts = str8_split_path(scratch.arena, file_path);
1304+ String8List parts_reversed = {0};
1305+ for(String8Node *n = parts.first; n != 0; n = n->next)
1306+ {
1307+ str8_list_push_front(scratch.arena, &parts_reversed, n->string);
1308+ }
1309+
1310+ // rjf: iterate all collision part reversed lists, in lock-step with
1311+ // search path; disqualify until we only have one path remaining; gather
1312+ // qualifiers
1313+ {
1314+ U64 num_collisions_left = collisions.count;
1315+ String8Node **collision_nodes = push_array(scratch.arena, String8Node *, collisions.count);
1316+ for EachIndex(idx, collisions.count)
1317+ {
1318+ collision_nodes[idx] = collision_parts_reversed[idx].first;
1319+ }
1320+ for(String8Node *n = parts_reversed.first; num_collisions_left > 1 && n != 0; n = n->next)
1321+ {
1322+ B32 part_is_qualifier = 0;
1323+ for EachIndex(idx, collisions.count)
1324+ {
1325+ if(collision_nodes[idx] != 0 && !str8_match(collision_nodes[idx]->string, n->string, StringMatchFlag_CaseInsensitive))
1326+ {
1327+ collision_nodes[idx] = 0;
1328+ num_collisions_left -= 1;
1329+ part_is_qualifier = 1;
1330+ }
1331+ else if(collision_nodes[idx] != 0)
1332+ {
1333+ collision_nodes[idx] = collision_nodes[idx]->next;
1334+ }
1335+ }
1336+ if(part_is_qualifier)
1337+ {
1338+ str8_list_push_front(scratch.arena, &qualifiers, n->string);
1339+ }
1340+ }
1341+ }
1342+ }
1343+ }
1344+
1345+ // rjf: push qualifiers
1346+ for(String8Node *n = qualifiers.first; n != 0; n = n->next)
1347+ {
1348+ String8 string = push_str8f(arena, "<%S> ", n->string);
1349+ dr_fstrs_push_new(arena, &result, ¶ms, string, .color = secondary_color);
1350+ }
1351+
1352+ // rjf: push file name
1353+ dr_fstrs_push_new(arena, &result, ¶ms, push_str8_copy(arena, str8_skip_last_slash(file_path)));
1354+ dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
12661355 start_secondary();
12671356 }
1357+
1358+ //- rjf: cfg has expression attached -> use that
12681359 else if(expr_string.size != 0 && !str8_match(cfg->string, str8_lit("watch"), 0))
12691360 {
12701361 dr_fstrs_push_new(arena, &result, ¶ms, expr_string);
1271- dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
1362+ dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
12721363 start_secondary();
12731364 }
12741365
12751366 //- rjf: push text location
12761367 if(loc.file_path.size != 0)
12771368 {
1278- String8 location_string = push_str8f(arena, "%S:%I64d:%I64d", loc.file_path, loc.pt.line, loc.pt.column);
1369+ String8 location_string = push_str8f(arena, "%S:%I64d:%I64d", str8_skip_last_slash( loc.file_path) , loc.pt.line, loc.pt.column);
12791370 dr_fstrs_push_new(arena, &result, ¶ms, location_string);
1371+ dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
12801372 start_secondary();
12811373 }
12821374
12831375 //- rjf: push target executable name
12841376 if(target.exe.size != 0)
12851377 {
12861378 dr_fstrs_push_new(arena, &result, ¶ms, str8_skip_last_slash(target.exe));
1287- dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
1379+ dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
12881380 start_secondary();
12891381 }
12901382
12911383 //- rjf: push target arguments
12921384 if(target.args.size != 0)
12931385 {
12941386 dr_fstrs_push_new(arena, &result, ¶ms, target.args);
1295- dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
1387+ dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
12961388 }
12971389
12981390 //- rjf: push conditions
12991391 {
13001392 String8 condition = rd_cfg_child_from_string(cfg, str8_lit("condition"))->first->string;
13011393 if(condition.size != 0)
13021394 {
1395+ dr_fstrs_push_new(arena, &result, ¶ms, str8_lit("if "), .font = rd_font_from_slot(RD_FontSlot_Code));
13031396 DR_FStrList fstrs = rd_fstrs_from_code_string(arena, 1.f, 0, params.color, condition);
13041397 dr_fstrs_concat_in_place(&result, &fstrs);
1305- dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
1398+ dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
13061399 }
13071400 }
13081401
13091402 //- rjf: push disabled marker
13101403 if(is_disabled)
13111404 {
13121405 dr_fstrs_push_new(arena, &result, ¶ms, str8_lit("(Disabled)"));
1313- dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
1406+ dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
13141407 }
13151408
13161409 //- rjf: push hit count
0 commit comments