barGroupKey: strip final same-class char run, no ID parsing

This commit is contained in:
c0dev0id
2026-06-30 12:19:14 +02:00
parent 89f46e7579
commit e011c9e7d8

View File

@@ -2,12 +2,11 @@ import { h } from 'vue';
import { ObjectShort } from './ObjectShort.js'; import { ObjectShort } from './ObjectShort.js';
import { getKindGroups } from '../subobject-kinds.js'; import { getKindGroups } from '../subobject-kinds.js';
// Extract the P?L? fragment as a visual grouping key. // Strip the final maximal run of same-class characters (all-digits or all-non-digits)
// Falls back to stripping trailing digits if the pattern is absent, // from the ID tail. Everything before that run is the group key.
// which yields singleton groups — not a crash, just no visual grouping.
function barGroupKey(id) { function barGroupKey(id) {
const m = id.match(/P\d+L\d+/); const m = id.match(/(\d+|\D+)$/);
return m ? m[0] : id.replace(/\d+$/, ''); return m ? id.slice(0, m.index) : id;
} }
export const PaneSubObjects = { export const PaneSubObjects = {