sisyphi 1.2.24 → 1.2.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/daemon.js CHANGED
@@ -11238,13 +11238,22 @@ var Compositor = class {
11238
11238
 
11239
11239
  // src/daemon/segments/sessions.ts
11240
11240
  function orderSessions(sessions, order) {
11241
- if (order.length === 0) return [...sessions].sort();
11242
- const orderMap = new Map(order.map((name, idx) => [name, idx]));
11241
+ const dividerIdx = order.indexOf("---");
11242
+ const front = dividerIdx === -1 ? order : order.slice(0, dividerIdx);
11243
+ const back = dividerIdx === -1 ? [] : order.slice(dividerIdx + 1);
11244
+ const frontMap = new Map(front.map((name, idx) => [name, idx]));
11245
+ const backMap = new Map(back.map((name, idx) => [name, idx]));
11246
+ const rank = (name) => {
11247
+ if (frontMap.has(name)) return { bucket: 0, idx: frontMap.get(name) };
11248
+ if (backMap.has(name)) return { bucket: 2, idx: backMap.get(name) };
11249
+ return { bucket: 1, idx: 0 };
11250
+ };
11243
11251
  return [...sessions].sort((a, b) => {
11244
- const aIdx = orderMap.get(a) ?? Infinity;
11245
- const bIdx = orderMap.get(b) ?? Infinity;
11246
- if (aIdx !== bIdx) return aIdx - bIdx;
11247
- return a.localeCompare(b);
11252
+ const ra = rank(a);
11253
+ const rb = rank(b);
11254
+ if (ra.bucket !== rb.bucket) return ra.bucket - rb.bucket;
11255
+ if (ra.bucket === 1) return a.localeCompare(b);
11256
+ return ra.idx - rb.idx;
11248
11257
  });
11249
11258
  }
11250
11259
  function renderNormalSession(name, color, activeBg, activeText, inactiveText, sectionBg, isActive) {