Skip to content

A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.

Cut a long place or drive name in the picker with an ellipsis

AdamPlatin123ae7768275348
diff --git a/app/src/page-card.css b/app/src/page-card.css
index 33187fb0..7aa659c7 100644
--- a/app/src/page-card.css
+++ b/app/src/page-card.css
@@ -65,6 +65,7 @@
.dsb-picker-head{margin:6px 8px 4px;font-size:12px;line-height:18px;font-weight:500;color:var(--bt-ink-2)}
.dsb-picker-head:first-child{margin-top:0}
.dsb-picker-root{all:unset;display:flex;align-items:center;gap:8px;min-height:30px;padding:0 8px;border-radius:6px;font-size:13px;line-height:20px;color:var(--bt-ink);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;cursor:pointer}
+.dsb-picker-root-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.dsb-picker-root:hover{background:var(--bt-hover)}
.dsb-picker-root[aria-current]{background:color-mix(in srgb,var(--bt-accent) 12%,transparent)}
.dsb-picker-pane{display:flex;flex-direction:column;min-height:0;border:1px solid var(--bt-line-2);border-radius:10px;background:var(--bt-main);overflow:hidden}
diff --git a/app/src/preload.cjs b/app/src/preload.cjs
index 9857d5eb..0daf4aa5 100644
--- a/app/src/preload.cjs
+++ b/app/src/preload.cjs
@@ -448,7 +448,10 @@ function showPicker(request) {
const group = (heading, items, kind) => {
if (items.length === 0) return []
return [make('h3', 'dsb-picker-head', heading), ...items.map((item) => {
- const root = button('dsb-picker-root', item.label)
+ // The name has a box of its own: as bare text beside the glyph it would be an anonymous
+ // flex item, which no ellipsis reaches.
+ const root = button('dsb-picker-root')
+ root.append(make('span', 'dsb-picker-root-name', item.label))
root.dataset.path = item.path
root.title = item.path
root.prepend(glyph(kind))
diff --git a/app/test/picker.test.mjs b/app/test/picker.test.mjs
index 7974ce4b..12218f63 100644
--- a/app/test/picker.test.mjs
+++ b/app/test/picker.test.mjs
@@ -2,7 +2,7 @@
// and the IPC that only the page showing a picker may use (picker-host.mjs). Temp folders only.
import assert from 'node:assert/strict'
import { EventEmitter } from 'node:events'
-import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
+import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join, parse } from 'node:path'
import { after, test } from 'node:test'
@@ -167,3 +167,17 @@ test('a page that does not show the picker in time gets no answer to wait for',
const loading = Object.assign(new EventEmitter(), { isDestroyed: () => false, isLoading: () => true, send() {} })
assert.equal(await pickers.ask(loading, { mode: 'folder', title: 'Pick', labels: {} }), undefined)
})
+
+// A long drive or folder name in the side column ends in an ellipsis: the name is its own box,
+// for an ellipsis does not reach bare text beside the glyph in the button's flex row.
+test('a place or drive with a long name is cut with an ellipsis, and its title keeps the whole path', () => {
+ const src = new URL('../src/', import.meta.url)
+ const preload = readFileSync(new URL('preload.cjs', src), 'utf8')
+ const side = preload.slice(preload.indexOf("button('dsb-picker-root"), preload.indexOf("root.addEventListener('click'"))
+ assert.match(side, /button\('dsb-picker-root'\)/u, 'no bare label in the button')
+ assert.match(side, /root\.append\(make\('span', 'dsb-picker-root-name', item\.label\)\)/u, 'the name in a span of its own')
+ assert.match(side, /root\.title = item\.path/u, 'the whole path on hover')
+ const css = readFileSync(new URL('page-card.css', src), 'utf8')
+ const rule = css.match(/\.dsb-picker-root-name\{([^}]*)\}/u)?.[1].split(';') ?? []
+ for (const declaration of ['min-width:0', 'overflow:hidden', 'text-overflow:ellipsis', 'white-space:nowrap']) assert.ok(rule.includes(declaration), declaration)
+})