/** Range follows displayed rows only; folded/filtered-out branches cannot leak in. */ export function treeSelectionRange(rows:readonly string[],anchor:string|null,target:string):string[]{ const a=rows.indexOf(anchor??target),b=rows.indexOf(target); return a<0||b<0?[target]:rows.slice(Math.min(a,b),Math.max(a,b)+1); }