Private AI meeting notes that stay on your computer. No meeting bot. Free and open source for Mac, Windows and Linux. An alternative to Granola, Otter and Fireflies.
TypeScript ai-meeting-assistantai-notetakerelectrongranola-alternativelinuxllama-cpplocal-ailocal-firstmacosmcpmeeting-minutesmeeting-notesoffline-firstopen-sourceprivacyspeech-to-texttranscriptionwhisperwhisper-cppwindows
Transcript: find in place, with a count, next, previous and close, instead of filtering the lines
Eric Brownrout1029a8243d83
diff --git a/app/e2e/note.spec.ts b/app/e2e/note.spec.tsindex eac0eaf2..bad502f4 100644--- a/app/e2e/note.spec.ts+++ b/app/e2e/note.spec.ts@@ -339,9 +339,11 @@ test('the recording header keeps status, time and actions while Transcript and Aawait expect(theirs).toHaveText(/^Sure\./, { timeout: 30_000 })await expect(page.getByTestId('transcript-turn').filter({ has: theirs }).getByTestId('transcript-who')).toHaveText('Ann Lee')await expect(page.getByTestId('transcript')).not.toContainText(/Speaker/)+ await page.getByTestId('transcript-find-open').click()await page.getByTestId('transcript-search').fill('tuesday')- await expect(lines).toHaveCount(1)- await expect(lines.first()).toContainText('The site goes live on Tuesday')+ await expect(page.getByTestId('transcript-find-count')).toHaveText('1 of 1')+ await expect(lines.filter({ hasText: 'Can we go over the launch plan' })).toHaveCount(1)+ await expect(theirs).toContainText('The site goes live on Tuesday')await page.getByTestId('transcript-search').fill('')await expect(lines.filter({ hasText: 'Can we go over the launch plan' })).toHaveCount(1)await page.getByTestId('chat-open').click()@@ -354,10 +356,10 @@ test('the recording header keeps status, time and actions while Transcript and Aawait expect(page.getByTestId('chat-panel')).toHaveCount(0)await expect(page.getByTestId('share-button')).toBeVisible()await expect(page.getByTestId('transcript-close')).toHaveCount(0)- await page.getByTestId('transcript-search').focus()+ await page.getByTestId('transcript-find-open').click()await page.keyboard.press('Escape')await expect(panel).toBeVisible()- await expect(page.getByTestId('transcript-search')).toBeFocused()+ await expect(page.getByTestId('transcript-find-open')).toBeFocused()await page.getByTestId('note-notes-tab').click()await expect(panel).toBeHidden()await expect(bar).toBeVisible()diff --git a/app/e2e/noteFooter.spec.ts b/app/e2e/noteFooter.spec.tsindex c684ddbe..6eeaa5b8 100644--- a/app/e2e/noteFooter.spec.ts+++ b/app/e2e/noteFooter.spec.ts@@ -78,7 +78,7 @@ test('recording controls stay in the header and Ask lives in the footer with sta}expect((await page.getByTestId('transcript-panel').boundingBox())!.height).toBeGreaterThan(100)await page.getByTestId('transcript-panel').scrollIntoViewIfNeeded()- await expect(page.getByTestId('transcript-search')).toBeInViewport()+ await expect(page.getByTestId('transcript-find-open')).toBeInViewport()await page.getByTestId('note-pause').scrollIntoViewIfNeeded()const recordingWidth = (await controls.boundingBox())!.widthawait page.getByTestId('note-pause').click()diff --git a/app/e2e/noteTools.spec.ts b/app/e2e/noteTools.spec.tsindex 9edb554e..9ee6d488 100644--- a/app/e2e/noteTools.spec.ts+++ b/app/e2e/noteTools.spec.ts@@ -17,27 +17,97 @@ test('meeting tools expose all copy choices, an anchored search, and a multilineawait expect(page.locator('.note-header').getByTestId('share-button')).toHaveText('Copy')await copy.click()await expect(page.getByTestId('share-menu').getByRole('menuitem')).toHaveText(['Copy my notes', 'Copy summary', 'Copy transcript', 'Export Markdown…'])+ await expect(page.getByTestId('share-copy-notes')).toBeFocused()await page.keyboard.press('Escape')+ await expect(page.getByTestId('share-menu')).toHaveCount(0)await page.getByTestId('note-transcript-toggle').click()const search = page.getByTestId('transcript-search'), field = page.locator('.transcript-search-field')- await expect(page.locator('.note-primary-tabs').getByTestId('transcript-search')).toBeVisible()+ const trigger = page.getByTestId('transcript-find-open')+ await expect(page.locator('.note-primary-tabs').getByTestId('transcript-find-open')).toBeVisible()const tabs = (await page.locator('.note-primary-tabs').boundingBox())!- const compact = (await field.boundingBox())!+ const compact = (await trigger.boundingBox())!expect(compact.x + compact.width).toBeCloseTo(tabs.x + tabs.width, 1)await expect(page.getByTestId('transcript-copy')).toHaveCount(0)await page.emulateMedia({ reducedMotion: 'no-preference' })+ await trigger.click()+ await expect(search).toBeFocused()await expect(search).toHaveCSS('text-align', 'start')- await search.click()- expect((await field.boundingBox())!.width).toBe(224)- await expect(field).toHaveCSS('transition-property', 'background-color, border-color')- await expect(field).toHaveCSS('transition-duration', '0.12s, 0.12s')- await expect(field).toHaveCSS('box-shadow', 'none')- await expect(search).toHaveCSS('text-align', 'start')+ await expect(field).toHaveCSS('transition-property', 'transform')+ await expect(field).toHaveCSS('transition-duration', '0.18s')+ const previous = page.getByTestId('transcript-find-previous'), next = page.getByTestId('transcript-find-next')+ await expect(page.locator('.transcript-find-results')).toHaveAttribute('inert', '')+ await expect(page.locator('.transcript-find-results')).toHaveCSS('opacity', '0')+ await expect(previous).toBeDisabled()+ await expect(next).toBeDisabled()+ await expect(page.locator('.transcript-find-arrows')).toHaveCSS('gap', '2px')+ const close = page.getByTestId('transcript-find-close')+ await expect(close).toBeEnabled()+ await expect(close).toHaveCSS('opacity', '1')+ await expect(close).toHaveAttribute('title', 'Close (Esc)')+ await expect(page.locator('.transcript-find-controls')).toHaveCSS('gap', '8px')+ for (const arrow of [previous, next, close]) {+ await expect(arrow).toHaveCSS('width', '24px')+ await expect(arrow).toHaveCSS('height', '24px')+ await expect(arrow.locator('svg')).toHaveAttribute('width', '14')+ }+ const arrowX = (await next.boundingBox())!.x+ const lines = page.getByTestId('transcript-line')+ await expect(lines.first()).toBeVisible()+ const lineCount = await lines.count()+ await search.fill('not present')+ await expect(page.locator('.transcript-find-results')).toHaveCSS('opacity', '1')+ await expect(page.getByTestId('transcript-find-count')).toHaveText('No matches')+ await expect(lines).toHaveCount(lineCount)+ await expect(previous).toBeDisabled()+ await expect(next).toBeDisabled()+ expect((await next.boundingBox())!.x).toBe(arrowX)+ await close.click()+ await expect(trigger).toBeFocused()+ await expect(search).toHaveValue('')+ await trigger.click()+ await expect(close).toBeEnabled()await page.getByTestId('note-transcript-toggle').click()- expect((await field.boundingBox())!.width).toBe(compact.width)+ await expect(trigger).toHaveAttribute('aria-expanded', 'false')await page.emulateMedia({ reducedMotion: 'reduce' })- await search.click()+ await trigger.click()await expect(field).toHaveCSS('transition-duration', '0s')+ await search.fill('not present')+ for (const width of [1100, 720, 640, 520]) {+ await page.setViewportSize({ width, height: 700 })+ const openBox = (await field.boundingBox())!+ const tabBoxes = await page.locator('.note-primary-tabs [role=tab]').evaluateAll(tabs => tabs.map(tab => { const r=tab.getBoundingClientRect();return { top:r.top,bottom:r.bottom,left:r.left,right:r.right } }))+ expect(tabBoxes.every(tab => openBox.y >= tab.bottom || openBox.x >= tab.right || openBox.x + openBox.width <= tab.left)).toBe(true)+ const available = (await page.locator('.note-primary-tools').boundingBox())!.width+ const minimum = Math.max(240, (await page.locator('.transcript-find-controls').boundingBox())!.width + 76)+ if (available >= minimum) {+ expect(openBox.y).toBeLessThan(tabBoxes[0].bottom)+ expect(openBox.width).toBeCloseTo(Math.min(376, available), 1)+ } else expect(openBox.y).toBeGreaterThanOrEqual(tabBoxes[0].bottom)+ const blocked = await page.locator('.note-meta-row button').evaluateAll(buttons => buttons.flatMap(button => {+ const r = button.getBoundingClientRect()+ if (!r.width || !r.height) return []+ const points = [[r.x + r.width / 2, r.y + r.height / 2], [r.left + 3, r.top + 3], [r.right - 3, r.bottom - 3]]+ return points.every(([x, y]) => button.contains(document.elementFromPoint(x, y))) ? [] : [button.getAttribute('data-testid') ?? button.textContent]+ }))+ expect(blocked).toEqual([])+ // Normal clicks must reach the header while find stays open; Escape belongs to each open menu.+ await page.getByTestId('note-folders').click()+ await expect(page.getByTestId('folder-menu')).toBeVisible()+ // Folder rows load asynchronously; Escape must wait for the menu to own focus.+ await expect(page.getByTestId('folder-new')).toBeFocused()+ await page.keyboard.press('Escape')+ await expect(page.getByTestId('folder-menu')).toHaveCount(0)+ await expect(page.getByTestId('note-folders')).toBeFocused()+ await copy.click()+ await expect(page.getByTestId('share-menu')).toBeVisible()+ await expect(page.getByTestId('share-copy-notes')).toBeFocused()+ await page.keyboard.press('Escape')+ await expect(page.getByTestId('share-menu')).toHaveCount(0)+ await expect(copy).toBeFocused()+ await expect(trigger).toHaveAttribute('aria-expanded', 'true')+ await expect(search).toHaveValue('not present')+ }+ await page.setViewportSize({ width: 1100, height: 760 })await page.getByTestId('chat-open').click()const input = page.getByTestId('chat-input')await expect(input).toHaveJSProperty('tagName', 'TEXTAREA')diff --git a/app/e2e/transcript.spec.ts b/app/e2e/transcript.spec.tsindex e37366b2..bb7eb6db 100644--- a/app/e2e/transcript.spec.ts+++ b/app/e2e/transcript.spec.ts@@ -123,20 +123,25 @@ test('Transcript is a primary page: Escape keeps it open and Notes switches awayawait expect(transcript).toHaveAttribute('aria-selected', 'true')await expect(page.getByTestId('transcript-panel')).toBeVisible()await expect(page.getByTestId('transcript-close')).toHaveCount(0)- const search = page.getByTestId('transcript-search')- await expect(page.locator('.note-primary-tabs').getByTestId('transcript-search')).toBeVisible()- expect((await search.boundingBox())!.width).toBeLessThan(130)- await search.click()- await expect.poll(async () => (await search.boundingBox())!.width).toBeGreaterThan(160)- await page.getByTestId('transcript-search').fill('unlikely phrase with no matches')+ const search = page.getByTestId('transcript-search'), trigger = page.getByTestId('transcript-find-open')+ await expect(trigger).toBeVisible()+ await page.keyboard.press('ControlOrMeta+f')+ await expect(search).toBeFocused()+ const lines = page.getByTestId('transcript-line'), before = await lines.count()+ await search.fill('unlikely phrase with no matches')+ await expect(page.getByTestId('transcript-find-count')).toHaveText('No matches')+ await expect(page.getByTestId('transcript-find-next')).toBeDisabled()+ await expect(lines).toHaveCount(before)await transcript.click()- expect((await search.boundingBox())!.width).toBeGreaterThan(160)+ await expect(trigger).toHaveAttribute('aria-expanded', 'true')await search.fill('')await transcript.click()- await expect.poll(async () => (await search.boundingBox())!.width).toBeLessThan(130)+ await expect(trigger).toHaveAttribute('aria-expanded', 'false')+ await trigger.click()await search.fill('unlikely phrase with no matches')await page.keyboard.press('Escape')- await expect(page.getByTestId('transcript-search')).toHaveValue('unlikely phrase with no matches')+ await expect(search).toHaveValue('')+ await expect(trigger).toBeFocused()await expect(page.getByTestId('transcript-panel')).toBeVisible()await expect(transcript).toHaveAttribute('aria-selected', 'true')await notes.click()@@ -562,9 +567,10 @@ test('paused, the mark stays and nothing scrolls; clicking a line follows again;await expect.poll(playingNo).toBe(155)// Highlighting renders before the coalesced scroll frame, even when reduced motion jumps instead of gliding.await expect.poll(comfy).toBe(true)- // a search that leaves the line being played out: nothing jumps (no line from 151 to 159 has a 0, 2 s at 2×)+ // Finding keeps the playing line, but playback must not take over the search position.+ await page.getByTestId('transcript-find-open').click()await page.getByTestId('transcript-search').fill('0')- await expect(playingLine).toHaveCount(0)+ await expect(playingLine).toHaveCount(1)const searched = await scrollTop()await page.waitForTimeout(800)expect(await scrollTop()).toBe(searched)@@ -644,3 +650,51 @@ for (const colorScheme of ['light', 'dark'] as const) test(`the player pill hideawait page.context().tracing.stop({ path: testInfo.outputPath('trace.zip') }).finally(() => app.close())}})++test('find navigates a long transcript without filtering or redrawing its rows', async () => {+ const { app, page } = await launch()+ try {+ const id = await fake<string>(app, 'bigMeeting', 5400)+ await fake(app, 'go', `/note/${id}`)+ await page.getByTestId('note-transcript-toggle').click()+ await expect(page.getByTestId('transcript-line')).toHaveCount(5400)+ await page.emulateMedia({ reducedMotion: 'reduce' })+ await page.keyboard.press('ControlOrMeta+f')+ const input = page.getByTestId('transcript-search'), count = page.getByTestId('transcript-find-count')+ await expect(input).toBeFocused()+ const rendered = () => page.evaluate(() => (window as unknown as { __rowRenders: number }).__rowRenders)+ const before = await rendered()+ await input.fill('long meeting')+ await expect(count).toHaveText('1 of 5,400')+ await expect(page.getByTestId('transcript-line')).toHaveCount(5400)+ const hit = () => page.evaluate(() => {+ const range = CSS.highlights.get('transcript-find-current')?.values().next().value as Range | undefined+ return range?.startContainer.parentElement?.closest<HTMLElement>('[data-key]')?.dataset.key+ })+ const first = await hit()+ await input.press('Shift+Enter')+ await expect(count).toHaveText('5,400 of 5,400')+ expect(await hit()).not.toBe(first)+ await expect.poll(() => page.evaluate(() => {+ const range = CSS.highlights.get('transcript-find-current')?.values().next().value as Range | undefined+ const el = document.querySelector('[data-testid="transcript"]')!+ const r = range?.getBoundingClientRect(), box = el.getBoundingClientRect()+ return !!r && r.top >= box.top && r.bottom <= box.bottom+ })).toBe(true)+ await page.keyboard.press('ControlOrMeta+g')+ await expect(count).toHaveText('1 of 5,400')+ expect(await hit()).toBe(first)+ await page.keyboard.press('ControlOrMeta+Shift+g')+ await expect(count).toHaveText('5,400 of 5,400')+ await input.press('Enter')+ await expect(count).toHaveText('1 of 5,400')+ expect(await rendered()).toBe(before)+ await page.keyboard.press('Escape')+ await expect(page.getByTestId('transcript-find-open')).toBeFocused()+ expect(await page.evaluate(() => CSS.highlights.get('transcript-find')?.size ?? 0)).toBe(0)+ await page.getByTestId('note-notes-tab').click()+ await page.keyboard.press('ControlOrMeta+f')+ await expect(input).toHaveCount(0)+ await expect(page.getByTestId('note-notes-tab')).toBeFocused()+ } finally { await app.close() }+})diff --git a/app/src/renderer/src/components/FolderPicker.tsx b/app/src/renderer/src/components/FolderPicker.tsxindex 4c8fdf44..a1e7dc8d 100644--- a/app/src/renderer/src/components/FolderPicker.tsx+++ b/app/src/renderer/src/components/FolderPicker.tsx@@ -1,5 +1,5 @@import { FolderGlyph } from './FolderAppearance'-import { useEffect, useMemo, useRef, useState, type KeyboardEvent, type ReactNode } from 'react'+import { useEffect, useLayoutEffect, useMemo, useRef, useState, type KeyboardEvent, type ReactNode } from 'react'import { Check, FolderIcon, Minus, Plus, X } from 'lucide-react'import type { Folder, MeetingCard } from '../../../shared/types'import { t } from '../../../shared/i18n'@@ -84,6 +84,12 @@ export function FolderChip({ meetingId, onNew, suggestion: manualSuggestion, rowconst presence = usePopoverPresence(open)const root = useRef<HTMLDivElement>(null)const chip = useRef<HTMLButtonElement>(null)+ const focusAfterCommit = useRef<HTMLButtonElement | null>(null)+ useLayoutEffect(() => {+ const focus = focusAfterCommit.current+ focusAfterCommit.current = null+ if (focus && document.activeElement === document.body) (row ? focus : chip.current)?.focus({ preventScroll: true })+ })useEffect(() => {if (suggestion && folders?.length) suggestion.dismiss()if (transition?.phase === 'settled' && folders?.length) setTransition(null)@@ -109,9 +115,9 @@ export function FolderChip({ meetingId, onNew, suggestion: manualSuggestion, rowconst label = proposed?.name ?? (!folders?.length ? t('Add to folder') : folders.length === 1 ? folders[0].name : t('{name} + {more}', { name: folders[0].name, more: folders.length - 1 }))const focusAfterSuggestion = () => row ? root.current?.closest('li')?.querySelector<HTMLButtonElement>('.native-meeting-link') : chip.currentconst clearSuggestion = (focus: HTMLButtonElement | null | undefined) => {+ focusAfterCommit.current = focus ?? nulltoasts.close(`folder-suggestion-${meetingId}`); suggestion?.dismiss()setAutomatic(null); setOpen(false)- requestAnimationFrame(() => { if (document.activeElement === document.body) (row ? focus : chip.current)?.focus({ preventScroll: true }) })}const dismissSuggestion = async () => {if (!proposed || adding || held) return@@ -141,8 +147,8 @@ export function FolderChip({ meetingId, onNew, suggestion: manualSuggestion, rowif (!transition || transition.phase === 'saving' || transition.phase === 'settled') returnconst focus = focusAfterSuggestion()const finish = () => {+ focusAfterCommit.current = focus ?? nullsetTransition(transition.phase === 'accepted' ? { ...transition, phase: 'settled' } : null)- requestAnimationFrame(() => { if (document.activeElement === document.body) (row ? focus : chip.current)?.focus({ preventScroll: true }) })}const timer = setTimeout(finish, reduced ? motion.micro : motion.base)return () => clearTimeout(timer)diff --git a/app/src/renderer/src/components/Transcript.tsx b/app/src/renderer/src/components/Transcript.tsxindex b9503000..da97de8f 100644--- a/app/src/renderer/src/components/Transcript.tsx+++ b/app/src/renderer/src/components/Transcript.tsx@@ -4,13 +4,12 @@ import { ScrollFade } from './ScrollFade'import { Loading } from './Loading'import { useLoadingState } from '../useLoadingState'import { Fragment, memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type KeyboardEvent, type MouseEvent } from 'react'-import { createPortal } from 'react-dom'-import { AudioLines, ArrowDown, ChevronDown, Search as SearchIcon } from 'lucide-react'+import { AudioLines, ArrowDown } from 'lucide-react'import type { Segment, TranscriptPartial } from '../../../shared/types'import { t } from '../../../shared/i18n'import { useLanguage } from '../i18n'-import { bubbles, clock, echoRuns, filterLines, lineAt, recentRuns, stableKeys, turns, withLive, type LiveSaid } from '../../../shared/transcript'-import { markWords } from '../../../shared/highlight'+import { bubbles, clock, echoRuns, lineAt, recentRuns, stableKeys, turns, withLive, type LiveSaid } from '../../../shared/transcript'+import { TranscriptFind } from './TranscriptFind'import { Player, type PlayerHandle } from './Player'import { attachPlayerVisibility } from '../playerVisibility'import { rememberedScroll, useScrollMemory } from '../useScrollMemory'@@ -116,7 +115,7 @@ type RowProps = {line: Line/** the line an answer across meetings pointed to */focused?: boolean- name: string; query: string+ name: stringplaying: boolean; playable: boolean; focusable: boolean/** arrived while watching: fades in, or settles in place where live words stood for it */arrived: 'fade' | 'settle' | null@@ -126,7 +125,7 @@ type RowProps = {* One line of the transcript, a stretch of text in its bubble (who said it heads the turn). Drawn again only when what* it shows changes (a long meeting has thousands).*/-const Row = memo(function Row({ line: l, focused, name, query, playing, playable, focusable, arrived, onPlay, onFocusLine }: RowProps) {+const Row = memo(function Row({ line: l, focused, name, playing, playable, focusable, arrived, onPlay, onFocusLine }: RowProps) {// memo skips it otherwise when the language changesuseLanguage()if (window.yogurt.fake) (window as unknown as { __rowRenders?: number }).__rowRenders = ((window as unknown as { __rowRenders?: number }).__rowRenders ?? 0) + 1@@ -139,7 +138,7 @@ const Row = memo(function Row({ line: l, focused, name, query, playing, playabledata-hidden={l.hidden || undefined} data-focused={focused || undefined}className={`line ${arrived === 'fade' ? 'line-in' : arrived === 'settle' ? 'line-settle' : ''} ${playable ? 'line-playable cursor-pointer' : ''}`}><span data-testid="transcript-text">- {query ? markWords(l.text, query).map((p, i) => (p.hit ? <mark key={i} className="search-mark">{p.text}</mark> : <span key={i}>{p.text}</span>)) : l.text}+ {l.text}</span><time data-testid="transcript-time" className="sr-only">{time}</time></span>@@ -160,11 +159,11 @@ export function Transcript({ id, recording, inline = false, active = true, onCloconst { live: liveSaid, previewed } = useLive(id, recording)// the mic's copy of the call (hidden as an echo) never showsconst timeline = useMemo(() => echoRuns(withLive(allLines, liveSaid)).filter(run => !run.echo), [allLines, liveSaid])- const lines = useMemo(() => timeline.flatMap(run => run.lines.filter((l): l is Line => !('live' in l))), [timeline])- const [query, setQuery] = useState('')+ const lines = useMemo(() => echoRuns(allLines).filter(run => !run.echo).flatMap(run => run.lines), [allLines])+ const [finding, setFinding] = useState(false)// a long recording draws its latest lines; the earlier ones on request (recentRuns)const [showAll, setShowAll] = useState(false)- useEffect(() => { setQuery(''); setShowAll(false) }, [id])+ useEffect(() => { setFinding(false); setShowAll(false) }, [id])// the recording is only playable once it is finishedconst [tracks, setTracks] = useState<Array<'me' | 'them'>>([])@@ -234,8 +233,8 @@ export function Transcript({ id, recording, inline = false, active = true, onClo}useLayoutEffect(() => {const el = list.current- if (active && recording && el && stick.current) { visibility.current?.programmatic(); el.scrollTop = el.scrollHeight }- }, [lines, liveSaid, recording, active])+ if (active && recording && !finding && el && stick.current) { visibility.current?.programmatic(); el.scrollTop = el.scrollHeight }+ }, [lines, liveSaid, recording, active, finding])const toLatest = () => { const el = list.current; if (el) { visibility.current?.programmatic(); stick.current = true; setBehind(false); el.scrollTo({ top: el.scrollHeight, behavior: scrollBehavior() }) } }// playing follows along: the line being played kept comfortably in view, until they scroll it out of sight@@ -259,7 +258,7 @@ export function Transcript({ id, recording, inline = false, active = true, onClo}const showPlaying = (always: boolean) => {const el = list.current, row = rowOf(shownKeyRef.current)- if (!el || !row || (!always && performance.now() - handsOn.current < HANDS_OFF_MS)) return+ if (finding || !el || !row || (!always && performance.now() - handsOn.current < HANDS_OFF_MS)) returnconst { row: r, view } = measure(row)const to = followTarget(r, view, always)if (to === null || !ours.current && Math.abs(to - el.scrollTop) < 2) return@@ -308,8 +307,6 @@ export function Transcript({ id, recording, inline = false, active = true, onCloplayer.current?.playFrom(l.startMs)}, [follow])- const shownLines = useMemo(() => filterLines(lines, query), [lines, query])-// the line an answer pointed to: in the middle of the panel, marked, and the list's tab stopconst [focusedKey, setFocusedKey] = useState<string>()const focusDone = useRef<number | undefined>(undefined)@@ -332,48 +329,36 @@ export function Transcript({ id, recording, inline = false, active = true, onClo}, [focusedKey, focus?.seq])// one tab stop for the whole list (the line last focused, or playing, or the first); arrows move between linesconst [focusKey, setFocusKey] = useState<string>()- const tabKey = focusKey ?? shownKey ?? (shownLines[0] && key(shownLines[0]))+ const tabKey = focusKey ?? shownKey ?? (lines[0] && key(lines[0]))const onKeyDown = (e: KeyboardEvent<HTMLOListElement>) => {const row = (e.target as HTMLElement).closest<HTMLElement>('[data-testid="transcript-line"]')if (!playable || !row || row !== e.target) return- const i = shownLines.findIndex((l) => key(l) === row.dataset.key)+ const i = lines.findIndex((l) => key(l) === row.dataset.key)if (i < 0) return- const go = (j: number) => { const next = rowOf(key(shownLines[Math.max(0, Math.min(shownLines.length - 1, j))])); visibility.current?.programmatic(); next?.focus({ preventScroll: true }); next?.scrollIntoView({ block: 'nearest' }) }+ const go = (j: number) => { const next = rowOf(key(lines[Math.max(0, Math.min(lines.length - 1, j))])); visibility.current?.programmatic(); next?.focus({ preventScroll: true }); next?.scrollIntoView({ block: 'nearest' }) }if (e.key === 'ArrowDown') { e.preventDefault(); go(i + 1) }else if (e.key === 'ArrowUp') { e.preventDefault(); go(i - 1) }else if (e.key === 'Home') { e.preventDefault(); go(0) }- else if (e.key === 'End') { e.preventDefault(); go(shownLines.length - 1) }- else if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); follow(); player.current?.playFrom(shownLines[i].startMs) }+ else if (e.key === 'End') { e.preventDefault(); go(lines.length - 1) }+ else if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); follow(); player.current?.playFrom(lines[i].startMs) }}- const typed = query.trim()- // what is being said joins the bubble it carries on; not while searching- const grouped = useMemo(() => timeline.map(run => ({ ...run, k: key(run.lines[0]), lines: typed ? run.lines.filter(l => !('live' in l) && filterLines([l], typed).length) : run.lines })).filter(run => run.lines.length), [timeline, typed])- // while recording (not searching), the latest lines only: over hours every line on the page grew the window past a GB- const drawn = useMemo(() => (recording && !typed && !showAll ? recentRuns(grouped, LIVE_LINES, LIVE_STEP) : { runs: grouped, earlier: 0 }), [grouped, recording, typed, showAll])- /** the line being played is on screen, not left out by the search */- const playingShown = useMemo(() => !!shownKey && shownLines.some((l) => key(l) === shownKey), [shownKey, shownLines])+ const grouped = useMemo(() => timeline.map(run => ({ ...run, k: key(run.lines[0]) })), [timeline])+ const drawn = useMemo(() => (recording && !showAll ? recentRuns(grouped, LIVE_LINES, LIVE_STEP) : { runs: grouped, earlier: 0 }), [grouped, recording, showAll])+ const find = useCallback((open: boolean) => {+ setFinding(open)+ if (open) { setShowAll(true); stick.current = false; ours.current?.stop(); ours.current = null }+ }, [])const Surface = inline ? 'section' : 'aside'- const tools = (- <div className="transcript-toolbar">- <label className="transcript-search-field">- <SearchIcon size={14} strokeWidth={1.75} aria-hidden="true" className="shrink-0 text-muted" />- <input data-testid="transcript-search" value={query} onChange={(e) => { visibility.current?.programmatic(); setQuery(e.target.value) }} placeholder={t('Search')} aria-label={t('Search the transcript')} spellCheck={false} />- </label>- {!inline && onClose && <div className="transcript-actions"><button data-testid="transcript-close" onClick={onClose} aria-label={t('Hide transcript')} title={t('Hide transcript')} className="ghost-btn !p-1.5"><ChevronDown size={15} aria-hidden="true" /></button></div>}- </div>- )-return (<Surface style={{ '--playback-inset': `${playbackInset}px` } as CSSProperties} data-testid="transcript-panel" aria-label={t('Transcript')} onKeyDown={(e) => { if (!inline && e.key === 'Escape') { e.stopPropagation(); onClose?.() } }}className={inline ? 'transcript-inline' : 'chat-in pointer-events-auto absolute inset-x-0 bottom-1 z-20 mx-auto flex h-[min(44vh,480px)] w-[min(720px,calc(100%-48px))] flex-col rounded-xl border border-line bg-float shadow-[var(--shadow)]'}>- {active && (toolbar ? createPortal(tools, toolbar) : tools)}+ <TranscriptFind key={id} lines={lines} list={list} active={active} playbackInset={playbackInset} beforeScroll={() => visibility.current?.programmatic()} onFinding={find} toolbar={toolbar} onClose={!inline ? onClose : undefined} /><div className="transcript-scroll-wrap relative flex min-h-0 flex-1 flex-col"><ScrollFade enabled={active && loaded}><ol data-loaded={loaded} data-loading-phase={loadingPhase} data-testid="transcript" ref={list} onScroll={onScroll} onWheel={theirs} onTouchStart={theirs} onPointerDown={theirs} onKeyDownCapture={theirs} onKeyDown={onKeyDown} className="loading-content transcript-loading-content flex flex-1 flex-col gap-2 overflow-y-auto px-4 pb-4 pt-2 text-sm leading-[1.55]">{loadingPhase !== 'ready' && <li className="loading-placeholder"><Loading layout="transcript" /></li>}{loaded && allLines.length === 0 && liveSaid.length === 0 && <li data-testid="transcript-empty" className="note-empty empty-state"><div className="empty-state-content"><div className="empty-tile"><AudioLines size={28} strokeWidth={1.5} aria-hidden="true" /></div>{t('Nothing heard yet.')}</div></li>}- {allLines.length > 0 && grouped.length === 0 && <li data-testid="transcript-none" className="note-empty">{t('Nothing found for “{query}”.', { query: typed })}</li>}{drawn.earlier > 0 && <li className="flex justify-center"><button data-testid="transcript-earlier" onClick={() => { visibility.current?.programmatic(); stick.current = false; setShowAll(true) }} className="ghost-btn !px-2 !py-1 text-xs text-muted">{t('Show earlier lines')}</button></li>}{drawn.runs.map(run => <Fragment key={run.k}>{turns(run.lines).map((turn) => {@@ -395,7 +380,7 @@ export function Transcript({ id, recording, inline = false, active = true, onCloconst k = key(x)return (<Fragment key={k}>{i > 0 && ' '}- <Row line={x} focused={k === focusedKey} name={who(x)} query={typed}+ <Row line={x} focused={k === focusedKey} name={who(x)}playing={k === shownKey} playable={playable} focusable={k === tabKey} arrived={live.current.has(k) ? (previewed(x) ? 'settle' : 'fade') : null} onPlay={onPlay} onFocusLine={setFocusKey} /></Fragment>)@@ -406,12 +391,12 @@ export function Transcript({ id, recording, inline = false, active = true, onClo)})}</Fragment>)}</ol></ScrollFade>- {recording && behind && (+ {recording && behind && !finding && (<button data-testid="transcript-latest" onClick={toLatest} className="absolute bottom-3 start-1/2 flex -translate-x-1/2 items-center gap-1 rounded-md border border-line bg-float px-3 py-1 text-xs shadow-[var(--shadow)] rtl:translate-x-1/2"><ArrowDown size={12} aria-hidden="true" />{t('Latest')}</button>)}- {!recording && audioOn && away && playingShown && (+ {!recording && audioOn && away && shownKey && !finding && (<button data-testid="transcript-follow" onClick={backToPlaying} className="absolute bottom-3 start-1/2 flex -translate-x-1/2 items-center gap-1 rounded-md border border-line bg-float px-3 py-1 text-xs shadow-[var(--shadow)] rtl:translate-x-1/2"><ArrowDown size={12} aria-hidden="true" className="follow-arrow" data-up={away === 'up'} />{t('Back to playing')}</button>diff --git a/app/src/renderer/src/components/TranscriptFind.tsx b/app/src/renderer/src/components/TranscriptFind.tsxnew file mode 100644index 00000000..7f9c5528--- /dev/null+++ b/app/src/renderer/src/components/TranscriptFind.tsx@@ -0,0 +1,152 @@+import { useEffect, useId, useLayoutEffect, useRef, useState, type RefObject } from 'react'+import { createPortal } from 'react-dom'+import { ChevronDown, ChevronUp, Search, X } from 'lucide-react'+import { t } from '../../../shared/i18n'+import { stepTranscriptMatch, transcriptMatchIndex, transcriptFindScrollTop, type TranscriptMatch } from '../../../shared/transcriptFind'+import { useLanguage } from '../i18n'+import { command, keys, onMac } from '../keys'+import { scrollBehavior } from '../motion'+import { transcriptFindRanges } from '../transcriptFindRanges'++type Props = {+ lines: ReadonlyArray<{ track: string; startMs: number; text: string }>+ list: RefObject<HTMLOListElement | null>+ active: boolean+ playbackInset: number+ /** called before find scrolls the list itself, so the player can tell it from the person's own scroll */+ beforeScroll?: () => void+ onFinding: (finding: boolean) => void+ toolbar?: HTMLElement | null+ onClose?: () => void+}++/** Search owns its state and paints native text ranges; keystrokes never redraw the transcript. */+export function TranscriptFind({ lines, list, active, playbackInset, beforeScroll, onFinding, toolbar, onClose }: Props) {+ useLanguage()+ const countId = useId(), fieldId = useId()+ const [open, setOpen] = useState(false), [query, setQuery] = useState('')+ const [navigation, setNavigation] = useState(0)+ const [selected, setSelected] = useState<TranscriptMatch | null>(null)+ const input = useRef<HTMLInputElement>(null), trigger = useRef<HTMLButtonElement>(null)+ const [found, setFound] = useState<ReturnType<typeof transcriptFindRanges>>({ query: '', matches: [], ranges: [] })+ const { matches, ranges } = found+ const index = transcriptMatchIndex(matches, selected), current = matches[index]+ const controlRef = useRef<HTMLDivElement>(null)+ const reveal = useRef(false)+ const searching = !!query.trim()+ const show = () => {+ setOpen(true); onFinding(true)+ if (open) { input.current?.focus({ preventScroll: true }); input.current?.select() }+ }+ const close = () => { setQuery(''); setSelected(null); setOpen(false); onFinding(false); trigger.current?.focus({ preventScroll: true }) }+ const move = (step: number) => {+ if (!matches.length) return+ reveal.current = true+ setSelected(matches[stepTranscriptMatch(index, step, matches.length)])+ setNavigation(n => n + 1)+ }+ // Focus only after React removes inert; focusing the closed field can blur the trigger.+ useLayoutEffect(() => { if (open) { input.current?.focus({ preventScroll: true }); input.current?.select() } }, [open])+ useLayoutEffect(() => {+ const control = controlRef.current, controls = control?.querySelector('.transcript-find-controls')+ if (!active || !toolbar || !control || !controls) return+ const fit = () => {+ // Leave 32px for typing after the fixed controls and 44px of field chrome.+ const minimum = Math.max(240, controls.getBoundingClientRect().width + 76)+ control.dataset.findBelow = String(toolbar.getBoundingClientRect().width < minimum)+ }+ fit()+ const observer = new ResizeObserver(fit)+ observer.observe(toolbar); observer.observe(controls)+ return () => observer.disconnect()+ }, [active, toolbar])++ useLayoutEffect(() => {+ if (found.query === query && current && (current.key !== selected?.key || current.start !== selected.start)) setSelected(current)+ }, [current, selected, found.query, query])++ useLayoutEffect(() => {+ const el = list.current+ if (!active || !open || !query.trim() || !el) { setFound({ query, matches: [], ranges: [] }); return }+ const refresh = () => setFound(transcriptFindRanges(el, lines, query))+ refresh()+ const observer = new MutationObserver(refresh)+ observer.observe(el, { childList: true, characterData: true, subtree: true })+ return () => observer.disconnect()+ }, [lines, query, open, active, list])++ useLayoutEffect(() => {+ if (!active) return+ const all = new Highlight()+ for (const range of ranges) all.add(range)+ CSS.highlights.set('transcript-find', all)+ return () => { if (CSS.highlights.get('transcript-find') === all) CSS.highlights.delete('transcript-find') }+ }, [ranges, active])++ useLayoutEffect(() => {+ if (!active) return+ if (found.query !== query) return+ const range = ranges[index]+ const highlight = new Highlight(...(range ? [range] : []))+ highlight.priority = 1+ CSS.highlights.set('transcript-find-current', highlight)+ const el = list.current+ if (reveal.current && range && el) {+ const r = range.getBoundingClientRect(), box = el.getBoundingClientRect()+ const field = input.current?.getBoundingClientRect()+ const top = field && field.bottom > box.top && r.right > field.left && r.left < field.right ? field.bottom + 8 : box.top+ const target = transcriptFindScrollTop(r, { top, bottom: box.bottom - playbackInset, scrollTop: el.scrollTop })+ if (r.height && target !== null) { beforeScroll?.(); el.scrollTo({ top: target, behavior: scrollBehavior() }) }+ }+ reveal.current = false+ return () => { if (CSS.highlights.get('transcript-find-current') === highlight) CSS.highlights.delete('transcript-find-current') }+ }, [ranges, index, selected, navigation, active, playbackInset, list, found.query, query])++ useEffect(() => {+ if (!active) return+ const onKey = (event: KeyboardEvent) => {+ if (event.defaultPrevented || event.isComposing || event.altKey || document.querySelector('dialog:modal, [aria-modal="true"]')) return+ if (command(event) && (event.code === 'KeyF' || event.code === 'KeyG')) {+ event.preventDefault(); event.stopPropagation()+ if (event.code === 'KeyF') show()+ else if (searching) move(event.shiftKey ? -1 : 1)+ } else if (event.key === 'Escape' && open && (controlRef.current?.contains(event.target as Node) || list.current?.contains(event.target as Node))) {+ event.preventDefault(); event.stopPropagation(); close()+ }+ }+ window.addEventListener('keydown', onKey, true)+ return () => window.removeEventListener('keydown', onKey, true)+ })++ const control = <div ref={controlRef} className="transcript-toolbar"><div className="transcript-find" data-open={open} onBlur={event => {+ if (open && !event.currentTarget.contains(event.relatedTarget) && !searching) { setOpen(false); onFinding(false) }+ }}>+ <button ref={trigger} type="button" data-testid="transcript-find-open" className="ghost-btn transcript-find-trigger" aria-label={t('Search the transcript')} title={`${t('Search the transcript')} (${keys('⌘F')})`} aria-expanded={open} aria-hidden={open} aria-controls={fieldId} tabIndex={open ? -1 : 0} onClick={show}><Search size={14} strokeWidth={1.75} aria-hidden="true" /></button>+ <div id={fieldId} className="transcript-find-clip" inert={!open} aria-hidden={!open}>+ <div className="transcript-search-field">+ <Search size={14} strokeWidth={1.75} aria-hidden="true" className="shrink-0 text-muted" />+ <input ref={input} data-testid="transcript-search" value={query} onChange={event => { reveal.current = true; setSelected(null); setQuery(event.target.value) }} onKeyDown={event => {+ if (event.nativeEvent.isComposing) return+ if (event.key === 'Enter') { event.preventDefault(); move(event.shiftKey ? -1 : 1) }+ }} placeholder={t('Search')} aria-label={t('Search the transcript')} aria-describedby={countId} spellCheck={false} />+ <span className="transcript-find-controls">+ <span className="transcript-find-results" data-visible={searching} inert={!searching} aria-hidden={!searching}>+ <span className="transcript-find-count">+ <span aria-hidden="true" className="transcript-find-reserve">{t('{current} of {count}', { current: 99999, count: 99999 })}</span>+ <span aria-hidden="true" className="transcript-find-reserve">{t('No matches')}</span>+ <span id={countId} data-testid="transcript-find-count" role="status" aria-live="polite" aria-atomic="true">{searching ? matches.length ? t('{current} of {count}', { current: index + 1, count: matches.length }) : t('No matches') : ''}</span>+ </span>+ <span className="transcript-find-arrows">+ <button type="button" data-testid="transcript-find-previous" className="ghost-btn" disabled={!matches.length} aria-label={t('Previous match')} title={`${t('Previous match')} (⇧Enter · ${keys('⇧⌘G')})`} aria-keyshortcuts={`Shift+Enter ${onMac() ? 'Meta' : 'Control'}+Shift+G`} onClick={() => move(-1)}><ChevronUp size={14} strokeWidth={1.75} aria-hidden="true" /></button>+ <button type="button" data-testid="transcript-find-next" className="ghost-btn" disabled={!matches.length} aria-label={t('Next match')} title={`${t('Next match')} (Enter · ${keys('⌘G')})`} aria-keyshortcuts={`Enter ${onMac() ? 'Meta' : 'Control'}+G`} onClick={() => move(1)}><ChevronDown size={14} strokeWidth={1.75} aria-hidden="true" /></button>+ </span>+ </span>+ <button type="button" data-testid="transcript-find-close" className="ghost-btn transcript-find-close" aria-label={t('Close')} title={`${t('Close')} (Esc)`} aria-keyshortcuts="Escape" onClick={close}><X size={14} strokeWidth={1.75} aria-hidden="true" /></button>+ </span>+ </div>+ </div>+ </div>+ {onClose && <div className="transcript-actions"><button data-testid="transcript-close" onClick={onClose} aria-label={t('Hide transcript')} title={t('Hide transcript')} className="ghost-btn !p-1.5"><ChevronDown size={15} aria-hidden="true" /></button></div>}+ </div>+ return active ? toolbar ? createPortal(control, toolbar) : control : null+}diff --git a/app/src/renderer/src/styles.css b/app/src/renderer/src/styles.cssindex 686299a2..8cb52ae5 100644--- a/app/src/renderer/src/styles.css+++ b/app/src/renderer/src/styles.css@@ -493,7 +493,7 @@ html.widget { --pill:#232326;--pill-ink:#F7F7FA;--accent:#B780FF;--pill-accent:v.modal-copy { padding:22px 20px 18px; }.modal-copy h2 { font-size:14px;line-height:20px;font-weight:600;letter-spacing:-.15px;overflow-wrap:anywhere; }.modal-copy p { margin-top:8px;color:var(--muted);font-size:12px;line-height:18px; }-.inline-error { display:flex;align-items:center;gap:10px;padding:10px 12px;border:1px solid var(--line);border-radius:8px;background:var(--float);color:var(--written);font-size:13px;line-height:20px;text-align:start; }+.inline-error { display:flex;align-items:center;gap:10px;padding:10px 12px;border:1px solid var(--line);border-radius:8px;background:var(--float);color:var(--written);font-size:13px;line-height:20px;text-align:start;text-overflow:ellipsis; }.inline-error>svg { flex:none;align-self:flex-start;margin-block-start:2px;color:var(--danger); }.inline-error>span { flex:1;min-width:0;overflow-wrap:anywhere; }.inline-error-action { flex:none;border-radius:4px;padding:2px 3px;color:var(--accent);font-size:12px;font-weight:500;text-decoration:underline;text-underline-offset:3px; }@@ -666,21 +666,46 @@ input::selection, textarea::selection, .note-prose ::selection { background: var.note-record-action.primary:hover:not(:disabled) { background:var(--primary-hover); }@media(prefers-reduced-motion:reduce) { .note-record-action { transition:none; } }[data-testid="transcript-panel"] { border-radius: 12px; }-.note-primary-tools { display:flex;align-items:center;align-self:flex-start;height:34px;margin-inline-start:auto;min-width:0; }-.note-primary-tools .transcript-toolbar { padding:0;border:0;flex-wrap:nowrap; }+.note-primary-tools { display:flex;align-items:center;align-self:flex-start;height:34px;margin-inline-start:auto;min-width:32px;flex:1;container-type:inline-size; }+.note-primary-tools .transcript-toolbar { padding:0;border:0;flex-wrap:nowrap;width:100%;justify-content:flex-end; }+.note-primary-tools .transcript-find-clip { width:clamp(240px,100cqw,376px); }.note-primary-tools .transcript-actions { order:-1;margin-inline-start:0; }.transcript-toolbar { display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px 16px;padding:10px 12px;border-bottom:1px solid var(--line); }-.transcript-search-field { display:flex;align-items:center;gap:8px;flex:0 1 auto;width:68px;max-width:100%;min-width:32px;height:32px;padding-inline:0;border:1px solid transparent;border-radius:6px;background:transparent; }-.transcript-search-field { transition:background-color var(--dur-micro) ease,border-color var(--dur-micro) ease; }-@media(prefers-reduced-motion:reduce) { .transcript-search-field { transition:none; } }-/* collapsed it reads as a button: a pointer, no hover box (with no padding yet it hugged the word); it opens on click */-.transcript-search-field,.transcript-search-field [data-testid="transcript-search"] { cursor:pointer; }-.transcript-search-field:focus-within [data-testid="transcript-search"],.transcript-search-field:has(input:not(:placeholder-shown)) [data-testid="transcript-search"] { cursor:text; }-.transcript-search-field:focus-within,.transcript-search-field:has(input:not(:placeholder-shown)) { width:224px;padding-inline:10px;border-color:var(--line);background:var(--control); }-.transcript-search-field:focus-within { border-color:var(--accent); }-[data-testid="transcript-search"] { min-width:0;width:100%;height:100%;padding:0;border:0;background:transparent;color:var(--ink);font-size:13px;font-weight:500;line-height:20px;text-align:start; }+.note-primary-tabs { z-index:2; }+.transcript-find { position:relative;width:32px;height:32px;z-index:2;clip-path:inset(-4px -4px -4px -600px); }+.transcript-find-trigger { width:32px;height:32px;justify-content:center;padding:0;opacity:1;transition:opacity var(--dur-micro) var(--ease-out) var(--dur-micro); }+.transcript-find[data-open=true] .transcript-find-trigger { opacity:0;pointer-events:none;transition-delay:0s; }+.transcript-find-clip { position:absolute;inset-inline-end:0;top:0;width:min(376px,calc(100vw - 48px));height:32px;overflow:hidden;border-radius:6px;opacity:0;pointer-events:none;transform:translateX(calc(100% - 32px));transition:transform var(--dur-micro) var(--ease-out),opacity var(--dur-micro) var(--ease-out); }+.transcript-search-field { display:flex;align-items:center;gap:8px;height:32px;padding-inline:10px 4px;background:var(--control);border-radius:6px;transform:translateX(calc(32px - 100%));transition:transform var(--dur-micro) var(--ease-out); }+.transcript-find[data-open=true] .transcript-find-clip { opacity:1;pointer-events:auto;transform:none;transition-duration:var(--dur-base); }+.transcript-find[data-open=true] .transcript-search-field { transform:none;transition-duration:var(--dur-base); }+.transcript-search-field:focus-within { box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--ink) 22%,transparent); }+[data-testid="transcript-search"] { flex:1;min-width:0;width:0;height:100%;padding:0;border:0;background:transparent;color:var(--ink);font-size:13px;font-weight:400;line-height:20px;text-align:start; }[data-testid="transcript-search"]::placeholder { color:var(--muted); }[data-testid="transcript-search"]:focus-visible { outline:none;box-shadow:none; }+.transcript-find-controls { display:flex;align-items:center;gap:8px;flex:none; }+.transcript-find-results { display:flex;align-items:center;gap:8px;flex:none;opacity:0;pointer-events:none;transition:opacity var(--dur-micro) var(--ease-out); }+.transcript-find-results[data-visible=true] { opacity:1;pointer-events:auto; }+.transcript-find-count { display:grid;flex:none;color:var(--muted);font-size:11px;line-height:20px;font-variant-numeric:tabular-nums;white-space:nowrap;text-align:end; }+.transcript-find-count>span { grid-area:1/1; }+.transcript-find-reserve { visibility:hidden; }+.transcript-find-arrows { display:flex;align-items:center;gap:2px;flex:none; }+.transcript-find-controls .ghost-btn { display:grid;place-items:center;width:24px;height:24px;padding:0;flex:none; }+.transcript-find-controls .ghost-btn:disabled { opacity:.35;background:transparent;color:var(--muted);cursor:default; }+.transcript-find-controls svg { display:block; }+/* The trigger finishes fading before the close glyph appears in its old position. */+.transcript-find-close { opacity:0;transition:opacity var(--dur-micro) var(--ease-out); }+.transcript-find[data-open=true] .transcript-find-close { opacity:1;transition-delay:var(--dur-micro); }+::highlight(transcript-find) { background:var(--accent-soft);color:var(--ink); }+::highlight(transcript-find-current) { background:var(--primary);color:#FFFFFF; }+.transcript-find:dir(rtl) { clip-path:inset(-4px -600px -4px -4px); }+.transcript-find:dir(rtl) .transcript-find-clip { transform:translateX(calc(32px - 100%)); }+.transcript-find:dir(rtl) .transcript-search-field { transform:translateX(calc(100% - 32px)); }+.transcript-find:dir(rtl)[data-open=true] :is(.transcript-find-clip,.transcript-search-field) { transform:none; }+.note-primary-tools [data-find-below=true] .transcript-find { clip-path:inset(-4px -4px -48px -600px); }+.note-primary-tools [data-find-below=true] .transcript-find:dir(rtl) { clip-path:inset(-4px -600px -48px -4px); }+.note-primary-tools [data-find-below=true] .transcript-find-clip { top:40px;width:min(376px,calc(100vw - 60px)); }+@media(prefers-reduced-motion:reduce) { .transcript-find[data-open] :is(.transcript-find-trigger,.transcript-find-clip,.transcript-search-field,.transcript-find-results,.transcript-find-close) { transition:none; } }.transcript-actions { display:flex;align-items:center;gap:4px;margin-inline-start:auto; }/* Electron zoom can make the CSS viewport narrower than the native window minimum. */@@ -692,8 +717,6 @@ input::selection, textarea::selection, .note-prose ::selection { background: var.note-header-actions { gap:8px; }.note-primary-tabs { margin-top:12px;gap:16px;flex-wrap:wrap; }.note-primary-tools { max-width:100%; }- .note-primary-tools .transcript-search-field { width:32px;min-width:32px; }- .note-primary-tools .transcript-search-field:focus-within,.note-primary-tools .transcript-search-field:has(input:not(:placeholder-shown)) { width:160px; }}/* At large zoom, let the page scroll instead of compressing the transcript to a single line. */@media (max-height:420px) {diff --git a/app/src/renderer/src/transcriptFindRanges.ts b/app/src/renderer/src/transcriptFindRanges.tsnew file mode 100644index 00000000..8db246b3--- /dev/null+++ b/app/src/renderer/src/transcriptFindRanges.ts@@ -0,0 +1,48 @@+import { transcriptMatches, type TranscriptMatch } from '../../shared/transcriptFind'++type TextSpan = { node: Text; start: number; end: number }++/** Search and range offsets share the same rendered text, including nested word spans. */+export function transcriptFindRanges(list: HTMLElement, lines: ReadonlyArray<{ track: string; startMs: number; text: string }>, query: string) {+ const rows = new Map<string, { root: Element; text: string; spans: TextSpan[] }>()+ for (const row of list.querySelectorAll<HTMLElement>('[data-key]')) {+ const root = row.querySelector('[data-testid="transcript-text"]')+ if (!root) continue+ const spans: TextSpan[] = [], chunks: string[] = []+ const walker = root.ownerDocument.createTreeWalker(root, NodeFilter.SHOW_TEXT)+ let node: Node | null, offset = 0+ while ((node = walker.nextNode())) {+ const text = node as Text+ if (!text.length) continue+ spans.push({ node: text, start: offset, end: offset + text.length })+ chunks.push(text.data); offset += text.length+ }+ rows.set(row.dataset.key!, { root, text: chunks.join(''), spans })+ }+ const rendered = lines.map(line => ({ ...line, text: rows.get(`${line.track}:${line.startMs}`)?.text ?? '' }))+ const matches: TranscriptMatch[] = [], ranges: Range[] = []+ for (const hit of transcriptMatches(rendered, query)) {+ const row = rows.get(hit.key)!+ // DOM can change between indexing and placement; discard an unplaceable occurrence.+ try {+ const start = boundary(row.spans, hit.start), end = boundary(row.spans, hit.end)+ if (!row.root.isConnected || !start || !end || !row.root.contains(start.node) || !row.root.contains(end.node)) continue+ const range = row.root.ownerDocument.createRange()+ range.setStart(start.node, hit.start - start.start)+ range.setEnd(end.node, hit.end - end.start)+ if (range.toString() !== row.text.slice(hit.start, hit.end)) continue+ matches.push(hit); ranges.push(range)+ } catch { /* A stale row must never take down the transcript. */ }+ }+ return { query, matches, ranges }+}++function boundary(spans: TextSpan[], offset: number) {+ let lo = 0, hi = spans.length+ while (lo < hi) {+ const mid = (lo + hi) >>> 1+ if (spans[mid].end < offset) lo = mid + 1+ else hi = mid+ }+ return spans[lo]+}diff --git a/app/src/shared/locales/ar.json b/app/src/shared/locales/ar.jsonindex 58a5733f..827563fc 100644--- a/app/src/shared/locales/ar.json+++ b/app/src/shared/locales/ar.json@@ -742,5 +742,12 @@"Waiting for Yogurt AI to download": "بانتظار تنزيل ذكاء Yogurt الاصطناعي","Stop summary": "إيقاف التلخيص","Summary stopped.": "توقف التلخيص.",- "This window couldn't be displayed.": "تعذّر عرض هذه النافذة."+ "This window couldn't be displayed.": "تعذّر عرض هذه النافذة.",+ "{current} of {count}": {+ "one": "{current} من {count}",+ "other": "{current} من {count}"+ },+ "No matches": "لا توجد نتائج",+ "Previous match": "النتيجة السابقة",+ "Next match": "النتيجة التالية"}diff --git a/app/src/shared/locales/bn.json b/app/src/shared/locales/bn.jsonindex f314529f..1b8ddc5f 100644--- a/app/src/shared/locales/bn.json+++ b/app/src/shared/locales/bn.json@@ -674,5 +674,12 @@"Waiting for Yogurt AI to download": "Yogurt AI ডাউনলোডের অপেক্ষায়","Stop summary": "সারসংক্ষেপ বন্ধ করুন","Summary stopped.": "সারসংক্ষেপ তৈরি বন্ধ হয়েছে।",- "This window couldn't be displayed.": "এই উইন্ডোটি দেখানো যায়নি।"+ "This window couldn't be displayed.": "এই উইন্ডোটি দেখানো যায়নি।",+ "{current} of {count}": {+ "one": "{count}টির মধ্যে {current}",+ "other": "{count}টির মধ্যে {current}"+ },+ "No matches": "কোনো মিল নেই",+ "Previous match": "আগের মিল",+ "Next match": "পরের মিল"}diff --git a/app/src/shared/locales/cs.json b/app/src/shared/locales/cs.jsonindex fd581043..1ad0e4a6 100644--- a/app/src/shared/locales/cs.json+++ b/app/src/shared/locales/cs.json@@ -717,5 +717,12 @@"Waiting for Yogurt AI to download": "Čekání na stažení Yogurt AI","Stop summary": "Zastavit shrnutí","Summary stopped.": "Vytváření shrnutí zastaveno.",- "This window couldn't be displayed.": "Toto okno se nepodařilo zobrazit."+ "This window couldn't be displayed.": "Toto okno se nepodařilo zobrazit.",+ "{current} of {count}": {+ "one": "{current} z {count}",+ "other": "{current} z {count}"+ },+ "No matches": "Žádné shody",+ "Previous match": "Předchozí shoda",+ "Next match": "Další shoda"}diff --git a/app/src/shared/locales/da.json b/app/src/shared/locales/da.jsonindex 45ae3d2d..3c6bbb0c 100644--- a/app/src/shared/locales/da.json+++ b/app/src/shared/locales/da.json@@ -686,5 +686,12 @@"Waiting for Yogurt AI to download": "Venter på download af Yogurt AI","Stop summary": "Stop opsummering","Summary stopped.": "Opsummering stoppet.",- "This window couldn't be displayed.": "Dette vindue kunne ikke vises."+ "This window couldn't be displayed.": "Dette vindue kunne ikke vises.",+ "{current} of {count}": {+ "one": "{current} af {count}",+ "other": "{current} af {count}"+ },+ "No matches": "Ingen resultater",+ "Previous match": "Forrige resultat",+ "Next match": "Næste resultat"}diff --git a/app/src/shared/locales/de.json b/app/src/shared/locales/de.jsonindex 5f9efae1..2027bf05 100644--- a/app/src/shared/locales/de.json+++ b/app/src/shared/locales/de.json@@ -686,5 +686,12 @@"Waiting for Yogurt AI to download": "Warten auf den Download von Yogurt AI","Stop summary": "Zusammenfassung stoppen","Summary stopped.": "Zusammenfassung gestoppt.",- "This window couldn't be displayed.": "Dieses Fenster konnte nicht angezeigt werden."+ "This window couldn't be displayed.": "Dieses Fenster konnte nicht angezeigt werden.",+ "{current} of {count}": {+ "one": "{current} von {count}",+ "other": "{current} von {count}"+ },+ "No matches": "Keine Treffer",+ "Previous match": "Vorheriger Treffer",+ "Next match": "Nächster Treffer"}diff --git a/app/src/shared/locales/el.json b/app/src/shared/locales/el.jsonindex 6e842bae..1b883ea4 100644--- a/app/src/shared/locales/el.json+++ b/app/src/shared/locales/el.json@@ -689,5 +689,12 @@"Waiting for Yogurt AI to download": "Αναμονή λήψης του Yogurt AI","Stop summary": "Διακοπή σύνοψης","Summary stopped.": "Η σύνοψη διακόπηκε.",- "This window couldn't be displayed.": "Δεν ήταν δυνατή η εμφάνιση αυτού του παραθύρου."+ "This window couldn't be displayed.": "Δεν ήταν δυνατή η εμφάνιση αυτού του παραθύρου.",+ "{current} of {count}": {+ "one": "{current} από {count}",+ "other": "{current} από {count}"+ },+ "No matches": "Δεν βρέθηκαν αποτελέσματα",+ "Previous match": "Προηγούμενο αποτέλεσμα",+ "Next match": "Επόμενο αποτέλεσμα"}diff --git a/app/src/shared/locales/en.json b/app/src/shared/locales/en.jsonindex 81482a3e..3f72400d 100644--- a/app/src/shared/locales/en.json+++ b/app/src/shared/locales/en.json@@ -209,5 +209,13 @@"Waiting for Yogurt AI to download": "Waiting for Yogurt AI to download","Stop summary": "Stop summary","Summary stopped.": "Summary stopped.",- "This window couldn't be displayed.": "This window couldn't be displayed."+ "This window couldn't be displayed.": "This window couldn't be displayed.",+ "Close": "Close",+ "{current} of {count}": {+ "one": "{current} of {count}",+ "other": "{current} of {count}"+ },+ "No matches": "No matches",+ "Previous match": "Previous match",+ "Next match": "Next match"}diff --git a/app/src/shared/locales/es.json b/app/src/shared/locales/es.jsonindex 0b8cbe8a..4d079a8e 100644--- a/app/src/shared/locales/es.json+++ b/app/src/shared/locales/es.json@@ -699,5 +699,12 @@"Waiting for Yogurt AI to download": "Esperando la descarga de Yogurt AI","Stop summary": "Detener resumen","Summary stopped.": "Resumen detenido.",- "This window couldn't be displayed.": "No se pudo mostrar esta ventana."+ "This window couldn't be displayed.": "No se pudo mostrar esta ventana.",+ "{current} of {count}": {+ "one": "{current} de {count}",+ "other": "{current} de {count}"+ },+ "No matches": "Sin coincidencias",+ "Previous match": "Coincidencia anterior",+ "Next match": "Coincidencia siguiente"}diff --git a/app/src/shared/locales/fi.json b/app/src/shared/locales/fi.jsonindex 5effcd16..b12dcae6 100644--- a/app/src/shared/locales/fi.json+++ b/app/src/shared/locales/fi.json@@ -692,5 +692,12 @@"Waiting for Yogurt AI to download": "Odotetaan Yogurt AI:n latausta","Stop summary": "Pysäytä yhteenveto","Summary stopped.": "Yhteenvedon luonti pysäytetty.",- "This window couldn't be displayed.": "Tätä ikkunaa ei voitu näyttää."+ "This window couldn't be displayed.": "Tätä ikkunaa ei voitu näyttää.",+ "{current} of {count}": {+ "one": "{current}/{count}",+ "other": "{current}/{count}"+ },+ "No matches": "Ei osumia",+ "Previous match": "Edellinen osuma",+ "Next match": "Seuraava osuma"}diff --git a/app/src/shared/locales/fil.json b/app/src/shared/locales/fil.jsonindex d1e785ac..eee3df72 100644--- a/app/src/shared/locales/fil.json+++ b/app/src/shared/locales/fil.json@@ -686,5 +686,12 @@"Waiting for Yogurt AI to download": "Hinihintay ang pag-download ng Yogurt AI","Stop summary": "Ihinto ang buod","Summary stopped.": "Nahinto ang paggawa ng buod.",- "This window couldn't be displayed.": "Hindi maipakita ang window na ito."+ "This window couldn't be displayed.": "Hindi maipakita ang window na ito.",+ "{current} of {count}": {+ "one": "{current} sa {count}",+ "other": "{current} sa {count}"+ },+ "No matches": "Walang tugma",+ "Previous match": "Nakaraang tugma",+ "Next match": "Susunod na tugma"}diff --git a/app/src/shared/locales/fr.json b/app/src/shared/locales/fr.jsonindex 1f8df5d2..f372bec0 100644--- a/app/src/shared/locales/fr.json+++ b/app/src/shared/locales/fr.json@@ -702,5 +702,12 @@"Waiting for Yogurt AI to download": "En attente du téléchargement de l’IA Yogurt","Stop summary": "Arrêter le résumé","Summary stopped.": "Résumé arrêté.",- "This window couldn't be displayed.": "Cette fenêtre n’a pas pu être affichée."+ "This window couldn't be displayed.": "Cette fenêtre n’a pas pu être affichée.",+ "{current} of {count}": {+ "one": "{current} sur {count}",+ "other": "{current} sur {count}"+ },+ "No matches": "Aucune correspondance",+ "Previous match": "Correspondance précédente",+ "Next match": "Correspondance suivante"}diff --git a/app/src/shared/locales/he.json b/app/src/shared/locales/he.jsonindex 7f0fa609..7d203218 100644--- a/app/src/shared/locales/he.json+++ b/app/src/shared/locales/he.json@@ -696,5 +696,12 @@"Waiting for Yogurt AI to download": "ממתינים להורדת Yogurt AI","Stop summary": "עצירת הסיכום","Summary stopped.": "הסיכום נעצר.",- "This window couldn't be displayed.": "לא ניתן היה להציג חלון זה."+ "This window couldn't be displayed.": "לא ניתן היה להציג חלון זה.",+ "{current} of {count}": {+ "one": "{current} מתוך {count}",+ "other": "{current} מתוך {count}"+ },+ "No matches": "אין התאמות",+ "Previous match": "ההתאמה הקודמת",+ "Next match": "ההתאמה הבאה"}diff --git a/app/src/shared/locales/hi.json b/app/src/shared/locales/hi.jsonindex 7f576ea3..ab2ccf42 100644--- a/app/src/shared/locales/hi.json+++ b/app/src/shared/locales/hi.json@@ -674,5 +674,12 @@"Waiting for Yogurt AI to download": "Yogurt AI डाउनलोड होने का इंतज़ार","Stop summary": "सारांश रोकें","Summary stopped.": "सारांश बनाना रोक दिया गया।",- "This window couldn't be displayed.": "यह विंडो दिखाई नहीं जा सकी।"+ "This window couldn't be displayed.": "यह विंडो दिखाई नहीं जा सकी।",+ "{current} of {count}": {+ "one": "{count} में से {current}",+ "other": "{count} में से {current}"+ },+ "No matches": "कोई मेल नहीं",+ "Previous match": "पिछला मेल",+ "Next match": "अगला मेल"}diff --git a/app/src/shared/locales/hu.json b/app/src/shared/locales/hu.jsonindex 6476c4ca..26597ae4 100644--- a/app/src/shared/locales/hu.json+++ b/app/src/shared/locales/hu.json@@ -674,5 +674,12 @@"Waiting for Yogurt AI to download": "Várakozás a Yogurt AI letöltésére","Stop summary": "Összefoglalás leállítása","Summary stopped.": "Az összefoglalás leállt.",- "This window couldn't be displayed.": "Ez az ablak nem jeleníthető meg."+ "This window couldn't be displayed.": "Ez az ablak nem jeleníthető meg.",+ "{current} of {count}": {+ "one": "{current} / {count}",+ "other": "{current} / {count}"+ },+ "No matches": "Nincs találat",+ "Previous match": "Előző találat",+ "Next match": "Következő találat"}diff --git a/app/src/shared/locales/id.json b/app/src/shared/locales/id.jsonindex 96907432..1c4f0f20 100644--- a/app/src/shared/locales/id.json+++ b/app/src/shared/locales/id.json@@ -644,5 +644,12 @@"Waiting for Yogurt AI to download": "Menunggu unduhan Yogurt AI","Stop summary": "Hentikan ringkasan","Summary stopped.": "Pembuatan ringkasan dihentikan.",- "This window couldn't be displayed.": "Jendela ini tidak dapat ditampilkan."+ "This window couldn't be displayed.": "Jendela ini tidak dapat ditampilkan.",+ "{current} of {count}": {+ "one": "{current} dari {count}",+ "other": "{current} dari {count}"+ },+ "No matches": "Tidak ada kecocokan",+ "Previous match": "Kecocokan sebelumnya",+ "Next match": "Kecocokan berikutnya"}diff --git a/app/src/shared/locales/it.json b/app/src/shared/locales/it.jsonindex c09d7d9f..8e594400 100644--- a/app/src/shared/locales/it.json+++ b/app/src/shared/locales/it.json@@ -705,5 +705,12 @@"Waiting for Yogurt AI to download": "In attesa del download di Yogurt AI","Stop summary": "Interrompi riepilogo","Summary stopped.": "Riepilogo interrotto.",- "This window couldn't be displayed.": "Non è stato possibile visualizzare questa finestra."+ "This window couldn't be displayed.": "Non è stato possibile visualizzare questa finestra.",+ "{current} of {count}": {+ "one": "{current} di {count}",+ "other": "{current} di {count}"+ },+ "No matches": "Nessuna corrispondenza",+ "Previous match": "Corrispondenza precedente",+ "Next match": "Corrispondenza successiva"}diff --git a/app/src/shared/locales/ja.json b/app/src/shared/locales/ja.jsonindex 2770b0aa..fb510719 100644--- a/app/src/shared/locales/ja.json+++ b/app/src/shared/locales/ja.json@@ -644,5 +644,12 @@"Waiting for Yogurt AI to download": "Yogurt AIのダウンロードを待機中","Stop summary": "要約を停止","Summary stopped.": "要約を停止しました。",- "This window couldn't be displayed.": "このウィンドウを表示できませんでした。"+ "This window couldn't be displayed.": "このウィンドウを表示できませんでした。",+ "{current} of {count}": {+ "one": "{count} 件中 {current} 件目",+ "other": "{count} 件中 {current} 件目"+ },+ "No matches": "一致する結果なし",+ "Previous match": "前の一致",+ "Next match": "次の一致"}diff --git a/app/src/shared/locales/ko.json b/app/src/shared/locales/ko.jsonindex efdc7db4..a84bca75 100644--- a/app/src/shared/locales/ko.json+++ b/app/src/shared/locales/ko.json@@ -644,5 +644,12 @@"Waiting for Yogurt AI to download": "Yogurt AI 다운로드 대기 중","Stop summary": "요약 중지","Summary stopped.": "요약이 중지되었습니다.",- "This window couldn't be displayed.": "이 창을 표시할 수 없습니다."+ "This window couldn't be displayed.": "이 창을 표시할 수 없습니다.",+ "{current} of {count}": {+ "one": "{count}개 중 {current}번째",+ "other": "{count}개 중 {current}번째"+ },+ "No matches": "일치하는 결과 없음",+ "Previous match": "이전 일치 항목",+ "Next match": "다음 일치 항목"}diff --git a/app/src/shared/locales/ms.json b/app/src/shared/locales/ms.jsonindex d85808c8..1229c152 100644--- a/app/src/shared/locales/ms.json+++ b/app/src/shared/locales/ms.json@@ -644,5 +644,12 @@"Waiting for Yogurt AI to download": "Menunggu muat turun Yogurt AI","Stop summary": "Hentikan ringkasan","Summary stopped.": "Ringkasan dihentikan.",- "This window couldn't be displayed.": "Tetingkap ini tidak dapat dipaparkan."+ "This window couldn't be displayed.": "Tetingkap ini tidak dapat dipaparkan.",+ "{current} of {count}": {+ "one": "{current} daripada {count}",+ "other": "{current} daripada {count}"+ },+ "No matches": "Tiada padanan",+ "Previous match": "Padanan sebelumnya",+ "Next match": "Padanan seterusnya"}diff --git a/app/src/shared/locales/nb.json b/app/src/shared/locales/nb.jsonindex 450e534b..58037348 100644--- a/app/src/shared/locales/nb.json+++ b/app/src/shared/locales/nb.json@@ -686,5 +686,12 @@"Waiting for Yogurt AI to download": "Venter på nedlasting av Yogurt AI","Stop summary": "Stopp oppsummering","Summary stopped.": "Oppsummering stoppet.",- "This window couldn't be displayed.": "Dette vinduet kunne ikke vises."+ "This window couldn't be displayed.": "Dette vinduet kunne ikke vises.",+ "{current} of {count}": {+ "one": "{current} av {count}",+ "other": "{current} av {count}"+ },+ "No matches": "Ingen treff",+ "Previous match": "Forrige treff",+ "Next match": "Neste treff"}diff --git a/app/src/shared/locales/nl.json b/app/src/shared/locales/nl.jsonindex cc30381d..cbf45c26 100644--- a/app/src/shared/locales/nl.json+++ b/app/src/shared/locales/nl.json@@ -686,5 +686,12 @@"Waiting for Yogurt AI to download": "Wachten op de download van Yogurt AI","Stop summary": "Samenvatting stoppen","Summary stopped.": "Samenvatting gestopt.",- "This window couldn't be displayed.": "Dit venster kon niet worden weergegeven."+ "This window couldn't be displayed.": "Dit venster kon niet worden weergegeven.",+ "{current} of {count}": {+ "one": "{current} van {count}",+ "other": "{current} van {count}"+ },+ "No matches": "Geen overeenkomsten",+ "Previous match": "Vorige overeenkomst",+ "Next match": "Volgende overeenkomst"}diff --git a/app/src/shared/locales/pl.json b/app/src/shared/locales/pl.jsonindex 364ca5c3..5defc4e8 100644--- a/app/src/shared/locales/pl.json+++ b/app/src/shared/locales/pl.json@@ -722,5 +722,12 @@"Waiting for Yogurt AI to download": "Oczekiwanie na pobranie Yogurt AI","Stop summary": "Zatrzymaj podsumowanie","Summary stopped.": "Podsumowanie zatrzymane.",- "This window couldn't be displayed.": "Nie udało się wyświetlić tego okna."+ "This window couldn't be displayed.": "Nie udało się wyświetlić tego okna.",+ "{current} of {count}": {+ "one": "{current} z {count}",+ "other": "{current} z {count}"+ },+ "No matches": "Brak dopasowań",+ "Previous match": "Poprzednie dopasowanie",+ "Next match": "Następne dopasowanie"}diff --git a/app/src/shared/locales/pt-BR.json b/app/src/shared/locales/pt-BR.jsonindex 42e101af..3d5250d7 100644--- a/app/src/shared/locales/pt-BR.json+++ b/app/src/shared/locales/pt-BR.json@@ -702,5 +702,12 @@"Waiting for Yogurt AI to download": "Aguardando o download do Yogurt AI","Stop summary": "Parar resumo","Summary stopped.": "Resumo interrompido.",- "This window couldn't be displayed.": "Não foi possível exibir esta janela."+ "This window couldn't be displayed.": "Não foi possível exibir esta janela.",+ "{current} of {count}": {+ "one": "{current} de {count}",+ "other": "{current} de {count}"+ },+ "No matches": "Nenhum resultado",+ "Previous match": "Resultado anterior",+ "Next match": "Próximo resultado"}diff --git a/app/src/shared/locales/ro.json b/app/src/shared/locales/ro.jsonindex bae62003..6701a800 100644--- a/app/src/shared/locales/ro.json+++ b/app/src/shared/locales/ro.json@@ -703,5 +703,12 @@"Waiting for Yogurt AI to download": "Se așteaptă descărcarea Yogurt AI","Stop summary": "Oprește rezumatul","Summary stopped.": "Rezumatul a fost oprit.",- "This window couldn't be displayed.": "Această fereastră nu a putut fi afișată."+ "This window couldn't be displayed.": "Această fereastră nu a putut fi afișată.",+ "{current} of {count}": {+ "one": "{current} din {count}",+ "other": "{current} din {count}"+ },+ "No matches": "Nicio potrivire",+ "Previous match": "Potrivirea anterioară",+ "Next match": "Potrivirea următoare"}diff --git a/app/src/shared/locales/ru.json b/app/src/shared/locales/ru.jsonindex cb91157d..80f9b691 100644--- a/app/src/shared/locales/ru.json+++ b/app/src/shared/locales/ru.json@@ -714,5 +714,12 @@"Waiting for Yogurt AI to download": "Ожидание загрузки Yogurt AI","Stop summary": "Остановить сводку","Summary stopped.": "Создание сводки остановлено.",- "This window couldn't be displayed.": "Не удалось отобразить это окно."+ "This window couldn't be displayed.": "Не удалось отобразить это окно.",+ "{current} of {count}": {+ "one": "{current} из {count}",+ "other": "{current} из {count}"+ },+ "No matches": "Нет совпадений",+ "Previous match": "Предыдущее совпадение",+ "Next match": "Следующее совпадение"}diff --git a/app/src/shared/locales/sv.json b/app/src/shared/locales/sv.jsonindex ab3ebe21..41b36484 100644--- a/app/src/shared/locales/sv.json+++ b/app/src/shared/locales/sv.json@@ -686,5 +686,12 @@"Waiting for Yogurt AI to download": "Väntar på nedladdning av Yogurt AI","Stop summary": "Stoppa sammanfattning","Summary stopped.": "Sammanfattningen stoppades.",- "This window couldn't be displayed.": "Det här fönstret kunde inte visas."+ "This window couldn't be displayed.": "Det här fönstret kunde inte visas.",+ "{current} of {count}": {+ "one": "{current} av {count}",+ "other": "{current} av {count}"+ },+ "No matches": "Inga träffar",+ "Previous match": "Föregående träff",+ "Next match": "Nästa träff"}diff --git a/app/src/shared/locales/th.json b/app/src/shared/locales/th.jsonindex 5bbdb34f..04f3c553 100644--- a/app/src/shared/locales/th.json+++ b/app/src/shared/locales/th.json@@ -644,5 +644,12 @@"Waiting for Yogurt AI to download": "รอการดาวน์โหลด Yogurt AI","Stop summary": "หยุดสรุป","Summary stopped.": "หยุดสรุปแล้ว",- "This window couldn't be displayed.": "ไม่สามารถแสดงหน้าต่างนี้ได้"+ "This window couldn't be displayed.": "ไม่สามารถแสดงหน้าต่างนี้ได้",+ "{current} of {count}": {+ "one": "{current} จาก {count}",+ "other": "{current} จาก {count}"+ },+ "No matches": "ไม่พบรายการที่ตรงกัน",+ "Previous match": "รายการก่อนหน้า",+ "Next match": "รายการถัดไป"}diff --git a/app/src/shared/locales/tr.json b/app/src/shared/locales/tr.jsonindex b4a0825e..4f46e2da 100644--- a/app/src/shared/locales/tr.json+++ b/app/src/shared/locales/tr.json@@ -674,5 +674,12 @@"Waiting for Yogurt AI to download": "Yogurt AI indirmesi bekleniyor","Stop summary": "Özeti durdur","Summary stopped.": "Özet durduruldu.",- "This window couldn't be displayed.": "Bu pencere görüntülenemedi."+ "This window couldn't be displayed.": "Bu pencere görüntülenemedi.",+ "{current} of {count}": {+ "one": "{count} sonuçtan {current}.",+ "other": "{count} sonuçtan {current}."+ },+ "No matches": "Eşleşme yok",+ "Previous match": "Önceki eşleşme",+ "Next match": "Sonraki eşleşme"}diff --git a/app/src/shared/locales/uk.json b/app/src/shared/locales/uk.jsonindex 91344e53..be2475d2 100644--- a/app/src/shared/locales/uk.json+++ b/app/src/shared/locales/uk.json@@ -714,5 +714,12 @@"Waiting for Yogurt AI to download": "Очікування завантаження Yogurt AI","Stop summary": "Зупинити підсумок","Summary stopped.": "Створення підсумку зупинено.",- "This window couldn't be displayed.": "Не вдалося відобразити це вікно."+ "This window couldn't be displayed.": "Не вдалося відобразити це вікно.",+ "{current} of {count}": {+ "one": "{current} із {count}",+ "other": "{current} із {count}"+ },+ "No matches": "Немає збігів",+ "Previous match": "Попередній збіг",+ "Next match": "Наступний збіг"}diff --git a/app/src/shared/locales/vi.json b/app/src/shared/locales/vi.jsonindex 697dddc7..aa12c315 100644--- a/app/src/shared/locales/vi.json+++ b/app/src/shared/locales/vi.json@@ -644,5 +644,12 @@"Waiting for Yogurt AI to download": "Đang chờ tải Yogurt AI","Stop summary": "Dừng tóm tắt","Summary stopped.": "Đã dừng tóm tắt.",- "This window couldn't be displayed.": "Không thể hiển thị cửa sổ này."+ "This window couldn't be displayed.": "Không thể hiển thị cửa sổ này.",+ "{current} of {count}": {+ "one": "{current} trên {count}",+ "other": "{current} trên {count}"+ },+ "No matches": "Không có kết quả",+ "Previous match": "Kết quả trước",+ "Next match": "Kết quả tiếp theo"}diff --git a/app/src/shared/locales/zh-CN.json b/app/src/shared/locales/zh-CN.jsonindex 3912bd1b..0dcc1a11 100644--- a/app/src/shared/locales/zh-CN.json+++ b/app/src/shared/locales/zh-CN.json@@ -644,5 +644,12 @@"Waiting for Yogurt AI to download": "等待下载 Yogurt AI","Stop summary": "停止总结","Summary stopped.": "已停止总结。",- "This window couldn't be displayed.": "无法显示此窗口。"+ "This window couldn't be displayed.": "无法显示此窗口。",+ "{current} of {count}": {+ "one": "第 {current} 项,共 {count} 项",+ "other": "第 {current} 项,共 {count} 项"+ },+ "No matches": "无匹配结果",+ "Previous match": "上一个匹配项",+ "Next match": "下一个匹配项"}diff --git a/app/src/shared/locales/zh-TW.json b/app/src/shared/locales/zh-TW.jsonindex 0a982bae..69f784c7 100644--- a/app/src/shared/locales/zh-TW.json+++ b/app/src/shared/locales/zh-TW.json@@ -644,5 +644,12 @@"Waiting for Yogurt AI to download": "等待下載 Yogurt AI","Stop summary": "停止摘要","Summary stopped.": "已停止摘要。",- "This window couldn't be displayed.": "無法顯示此視窗。"+ "This window couldn't be displayed.": "無法顯示此視窗。",+ "{current} of {count}": {+ "one": "第 {current} 項,共 {count} 項",+ "other": "第 {current} 項,共 {count} 項"+ },+ "No matches": "沒有相符結果",+ "Previous match": "上一個相符項目",+ "Next match": "下一個相符項目"}diff --git a/app/src/shared/transcript.ts b/app/src/shared/transcript.tsindex ae78e82e..6d6be69b 100644--- a/app/src/shared/transcript.ts+++ b/app/src/shared/transcript.ts@@ -48,13 +48,6 @@ export function lineAt(lines: Array<{ startMs: number }>, ms: number): number {return found}-/** The lines that hold every word typed (any case); all of them while nothing is typed */-export function filterLines<L extends { text: string }>(lines: L[], query: string): L[] {- const words = query.toLocaleLowerCase().split(/\s+/).filter(Boolean)- if (!words.length) return lines- return lines.filter((l) => { const t = l.text.toLocaleLowerCase(); return words.every((w) => t.includes(w)) })-}-/** a pause this long between lines of one voice starts a new bubble, like a new thought */export const BUBBLE_GAP_MS = 1500diff --git a/app/src/shared/transcriptFind.ts b/app/src/shared/transcriptFind.tsnew file mode 100644index 00000000..113e0a68--- /dev/null+++ b/app/src/shared/transcriptFind.ts@@ -0,0 +1,28 @@+export type TranscriptMatch = { key: string; start: number; end: number }++/** Literal, case-insensitive occurrences. RegExp offsets refer to the original UTF-16 text, even when case folding changes length. */+export function transcriptMatches(lines: ReadonlyArray<{ track: string; startMs: number; text: string }>, query: string): TranscriptMatch[] {+ const text = query.trim()+ if (!text) return []+ const pattern = new RegExp(text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'giu')+ const matches: TranscriptMatch[] = []+ for (const line of lines) {+ for (const match of line.text.matchAll(pattern)) matches.push({ key: `${line.track}:${line.startMs}`, start: match.index, end: match.index + match[0].length })+ }+ return matches+}++/** Keep the same occurrence when another track finishes an earlier line or new lines arrive. */+export function transcriptMatchIndex(matches: TranscriptMatch[], selected: TranscriptMatch | null): number {+ return selected ? Math.max(0, matches.findIndex(hit => hit.key === selected.key && hit.start === selected.start)) : 0+}++export function stepTranscriptMatch(current: number, step: number, count: number): number {+ return count ? ((current + step) % count + count) % count : 0+}++/** Keep fully visible matches still; centre an obscured match inside the usable reading area. */+export function transcriptFindScrollTop(hit: { top: number; bottom: number }, view: { top: number; bottom: number; scrollTop: number }): number | null {+ if (hit.top >= view.top && hit.bottom <= view.bottom) return null+ return view.scrollTop + (hit.top + hit.bottom - view.top - view.bottom) / 2+}diff --git a/app/test/folderPickerFocus.test.ts b/app/test/folderPickerFocus.test.tsindex 13a68df7..82137eea 100644--- a/app/test/folderPickerFocus.test.ts+++ b/app/test/folderPickerFocus.test.ts@@ -1,16 +1,18 @@-import { beforeEach, expect, it, vi } from 'vitest'-import { createElement, useEffect, useRef } from 'react'+import { afterEach, beforeEach, expect, it, vi } from 'vitest'+import { createElement, useEffect, useLayoutEffect, useRef } from 'react'import { renderToStaticMarkup } from 'react-dom/server'import type { Folder } from '../src/shared/types'-import { FolderPicker } from '../src/renderer/src/components/FolderPicker'+import { FolderChip, FolderPicker } from '../src/renderer/src/components/FolderPicker'const state = vi.hoisted(() => ({ all: undefined as Folder[] | undefined }))vi.mock('react', async importOriginal => {const react = await importOriginal<typeof import('react')>()- return { ...react, useEffect: vi.fn(), useRef: vi.fn(react.useRef) }+ return { ...react, useEffect: vi.fn(), useLayoutEffect: vi.fn(), useRef: vi.fn(react.useRef) }})vi.mock('../src/renderer/src/folders', () => ({ useFolders: (id?: string) => id ? [] : state.all, setMeetingsInFolder: vi.fn() }))vi.mock('../src/renderer/src/components/TrashToast', () => ({ toasts: { add: vi.fn(), close: vi.fn() } }))+vi.mock('../src/renderer/src/motion', () => ({ useReducedMotion: () => false, usePopoverPresence: () => ({ value: false, props: {} }) }))+afterEach(() => vi.unstubAllGlobals())const alpha: Folder = { id: 'alpha', name: 'Alpha', icon: 'folder', color: 'default', count: 0, createdAt: 1 }const suggested: Folder = { ...alpha, id: 'suggested', name: 'Suggested folder' }beforeEach(() => { vi.clearAllMocks(); state.all = undefined })@@ -56,3 +58,22 @@ it('focuses New folder for an empty loaded list, and leaves other menu owners inowned.effect()expect(owned.focus).not.toHaveBeenCalled()})++it.each([false, true])('restores suggestion focus after the replacement DOM commits without stealing focus (row: %s)', row => {+ renderToStaticMarkup(createElement(FolderChip, { meetingId: 'meeting', row, rowFolders: [], suggestion: { folder: suggested, dismiss() {} } }))+ const refs = vi.mocked(useRef).mock.results.map(result => result.value)+ const oldTarget = { focus: vi.fn() }, replacement = { focus: vi.fn() }, body = {}+ refs[1].current = replacement+ refs[2].current = oldTarget+ const commit = vi.mocked(useLayoutEffect).mock.calls[0][0]+ vi.stubGlobal('document', { body, activeElement: body })+ commit()+ expect((row ? oldTarget : replacement).focus).toHaveBeenCalledOnce()+ expect((row ? replacement : oldTarget).focus).not.toHaveBeenCalled()+ commit()+ expect((row ? oldTarget : replacement).focus).toHaveBeenCalledOnce()+ refs[2].current = oldTarget+ vi.stubGlobal('document', { body, activeElement: {} })+ commit()+ expect((row ? oldTarget : replacement).focus).toHaveBeenCalledOnce()+})diff --git a/app/test/i18n-tables.test.ts b/app/test/i18n-tables.test.tsindex 68bd9d9b..a5903681 100644--- a/app/test/i18n-tables.test.ts+++ b/app/test/i18n-tables.test.ts@@ -296,3 +296,15 @@ it('translates the ungrouped people heading in every locale', () => {if (id !== 'en') expect(load(id)['Other people']).not.toBe('Other people')}})++it('translates transcript match counts and navigation in every locale', () => {+ for (const { id } of LOCALES) {+ for (const key of ['{current} of {count}', 'No matches', 'Previous match', 'Next match']) {+ expect(keys).toContain(key)+ const entry = load(id)[key]+ expect(entry).toBeDefined()+ expect(forms(entry).every(value => value.trim().length > 0)).toBe(true)+ if (id !== 'en') expect(forms(entry)).not.toContain(key)+ }+ }+})diff --git a/app/test/transcriptFind.test.ts b/app/test/transcriptFind.test.tsnew file mode 100644index 00000000..fab9480f--- /dev/null+++ b/app/test/transcriptFind.test.ts@@ -0,0 +1,64 @@+import { describe, expect, it } from 'vitest'+import { stepTranscriptMatch, transcriptMatches, transcriptMatchIndex, transcriptFindScrollTop } from '../src/shared/transcriptFind'++const line = (text: string, startMs = 0, track = 'me') => ({ text, startMs, track })+describe('finding in the transcript', () => {+ it('counts occurrences instead of removing surrounding lines', () => {+ const lines = [line('A test, another TEST, and the latest plan.'), line('Keep this context.', 1000)]+ const copy = structuredClone(lines)+ expect(transcriptMatches(lines, 'test')).toEqual([+ { key: 'me:0', start: 2, end: 6 }, { key: 'me:0', start: 16, end: 20 }, { key: 'me:0', start: 32, end: 36 },+ ])+ expect(lines).toEqual(copy)+ })+ it('finds literal phrases and punctuation without treating input as a pattern', () => {+ expect(transcriptMatches([line('Review [a+b] now. Then [a+b].')], '[a+b]')).toHaveLength(2)+ expect(transcriptMatches([line('release plan and plan release')], ' release plan ')).toHaveLength(1)+ expect(transcriptMatches([line('aaaa')], 'aa')).toHaveLength(2)+ expect(transcriptMatches([line('text')], ' ')).toEqual([])+ expect(transcriptMatches([line('text')], 'absent')).toEqual([])+ })+ it('keeps original offsets for Unicode, surrogate pairs and case folding', () => {+ for (const [text, query, expected] of [+ ['🙂 CAFÉ café', 'café', ['CAFÉ', 'café']],+ ['İtest TEST', 'test', ['test', 'TEST']],+ ['你好你好', '你好', ['你好', '你好']],+ ['🙂🙂', '🙂', ['🙂', '🙂']],+ ] as const) expect(transcriptMatches([line(text)], query).map(hit => text.slice(hit.start, hit.end))).toEqual(expected)+ })+ it('wraps in both directions, including empty and single results', () => {+ expect(stepTranscriptMatch(0, -1, 12)).toBe(11)+ expect(stepTranscriptMatch(11, 1, 12)).toBe(0)+ expect(stepTranscriptMatch(0, 1, 0)).toBe(0)+ expect(stepTranscriptMatch(0, -1, 1)).toBe(0)+ })+ it('keeps the current occurrence when live lines append or an earlier track settles', () => {+ const original = [line('test test', 1000), line('test again', 2000, 'them')]+ const selected = transcriptMatches(original, 'test')[1]+ const appended = transcriptMatches([...original, line('test test', 3000)], 'test')+ expect(appended).toHaveLength(5)+ expect(transcriptMatchIndex(appended, selected)).toBe(1)+ const settled = transcriptMatches([line('test', 500, 'them'), ...original, line('test', 3000)], 'test')+ expect(transcriptMatchIndex(settled, selected)).toBe(2)+ expect(settled[transcriptMatchIndex(settled, selected)]).toEqual(selected)+ expect(transcriptMatchIndex([], selected)).toBe(0)+ expect(transcriptMatchIndex(transcriptMatches([line('test', 4000)], 'test'), selected)).toBe(0)+ })+ it('indexes a dense three-hour transcript without changing its lines', () => {+ const lines = Array.from({ length: 5400 }, (_, i) => line('Review the release plan. Test the recording and test the summary before the next release.', i * 2000, i % 2 ? 'me' : 'them'))+ const start = performance.now()+ const matches = transcriptMatches(lines, 'test')+ expect(matches).toHaveLength(10800)+ expect(transcriptMatchIndex(matches, matches.at(-1)!)).toBe(10799)+ expect(performance.now() - start).toBeLessThan(100)+ })+})++it('only scrolls obscured matches and centres them below floating controls', () => {+ const view = { top: 100, bottom: 500, scrollTop: 300 }+ expect(transcriptFindScrollTop({ top: 100, bottom: 120 }, view)).toBeNull()+ expect(transcriptFindScrollTop({ top: 480, bottom: 500 }, view)).toBeNull()+ expect(transcriptFindScrollTop({ top: 600, bottom: 620 }, view)).toBe(610)+ expect(transcriptFindScrollTop({ top: 80, bottom: 120 }, view)).toBe(100)+ expect(transcriptFindScrollTop({ top: 105, bottom: 125 }, { ...view, top: 150 })).toBe(90)+})diff --git a/app/test/transcriptFindControls.test.ts b/app/test/transcriptFindControls.test.tsnew file mode 100644index 00000000..4a79ac2e--- /dev/null+++ b/app/test/transcriptFindControls.test.ts@@ -0,0 +1,169 @@+import { afterEach, expect, it, vi } from 'vitest'+import { useEffect, useLayoutEffect, useRef, useState, type ReactElement, type ReactNode } from 'react'+import { TranscriptFind } from '../src/renderer/src/components/TranscriptFind'+import { LOCALES } from '../src/shared/i18n'+import { transcriptDom } from './transcriptFindDom'++vi.mock('react', async original => ({+ ...await original<typeof import('react')>(), useState: vi.fn(), useRef: vi.fn(), useEffect: vi.fn(), useLayoutEffect: vi.fn(),+ useMemo: (make: () => unknown) => make(), useId: () => 'find-count',+}))+vi.mock('../src/renderer/src/i18n', () => ({ useLanguage() {} }))+vi.mock('react-dom', () => ({ createPortal: (child: ReactNode) => child }))+afterEach(() => { vi.unstubAllGlobals(); vi.clearAllMocks() })++function find(node: ReactNode, id: string): ReactElement<any> {+ const visit = (value: ReactNode): ReactElement<any> | undefined => {+ if (Array.isArray(value)) return value.map(visit).find(Boolean)+ if (!value || typeof value !== 'object' || !('props' in value)) return+ const element = value as ReactElement<any>+ return element.props['data-testid'] === id || element.props.className === id ? element : visit(element.props.children)+ }+ const result = visit(node)+ if (!result) throw new Error(`Missing ${id}`)+ return result+}++// Run the real handlers and highlight effects without a browser or Electron.+function harness(parts?: Parameters<typeof transcriptDom>[0], text = 'test test') {+ const states: unknown[] = [], refs: { current: unknown }[] = []+ const effects: { deps?: readonly unknown[]; cleanup?: () => void }[] = []+ let tree: ReactNode, dirty = false+ const dom = transcriptDom(parts)+ let mutated = () => {}+ vi.stubGlobal('MutationObserver', class { constructor(fn: () => void) { mutated = fn } observe() {} disconnect() {} })+ const highlights = new Map<string, Set<unknown>>()+ const input = { focus: vi.fn(), select: vi.fn(), getBoundingClientRect: () => ({ bottom: 0 }) }+ const trigger = { focus: vi.fn() }+ const control = { querySelector: () => null, contains: (target: unknown) => target === input }+ const onFinding = vi.fn()+ const listeners = new Map<string, (event: unknown) => void>()+ vi.stubGlobal('window', { matchMedia: () => ({ matches: false }), addEventListener: (name: string, fn: (event: unknown) => void) => listeners.set(name, fn), removeEventListener: (name: string) => listeners.delete(name) })+ vi.stubGlobal('document', { querySelector: () => null })+ vi.stubGlobal('CSS', { highlights })+ vi.stubGlobal('Highlight', class extends Set { constructor(...ranges: unknown[]) { super(ranges) } })+ const list = { current: dom.list }+ const lines = [{ track: 'me', startMs: 0, text }]+ const render = () => {+ let passes = 0+ do {+ if (++passes > 20) throw new Error('Render loop')+ dirty = false+ let state = 0, ref = 0+ vi.mocked(useState).mockImplementation((initial?: unknown): [unknown, (next: unknown) => void] => {+ const i = state+++ if (!(i in states)) states[i] = typeof initial === 'function' ? initial() : initial+ return [states[i], next => { const value = typeof next === 'function' ? next(states[i]) : next; if (!Object.is(value, states[i])) { states[i] = value; dirty = true } }]+ })+ vi.mocked(useRef).mockImplementation(initial => refs[ref++] ??= { current: initial })+ vi.mocked(useEffect).mockClear(); vi.mocked(useLayoutEffect).mockClear()+ tree = TranscriptFind({ lines, list, active: true, playbackInset: 0, onFinding })+ find(tree, 'transcript-search').props.ref.current = input+ find(tree, 'transcript-find-open').props.ref.current = trigger+ find(tree, 'transcript-toolbar').props.ref.current = control+ let effectIndex = 0+ for (const [effect, deps] of [...vi.mocked(useLayoutEffect).mock.calls, ...vi.mocked(useEffect).mock.calls]) {+ const index = effectIndex++, old = effects[index]+ if (!old || !deps || deps.some((value, i) => !Object.is(value, old.deps?.[i]))) {+ old?.cleanup?.(); effects[index] = { deps, cleanup: effect() || undefined }+ }+ }+ } while (dirty)+ return tree+ }+ render()+ return { render, highlights, trigger, input, onFinding, dom, mutate: () => mutated(),+ get: (id: string) => find(tree, id),+ escape: () => listeners.get('keydown')!({ key: 'Escape', target: input, preventDefault() {}, stopPropagation() {} }),+ }+}++it.each(['', 'test', 'absent'])('keeps Close available and clears find for query %j', query => {+ for (const closeWith of ['button', 'escape']) {+ const h = harness()+ h.get('transcript-find-open').props.onClick(); h.render()+ h.get('transcript-search').props.onChange({ target: { value: query } }); h.render()+ const button = h.get('transcript-find-close')+ expect(button.props.disabled).toBeFalsy()+ expect(button.props['aria-label']).toBe('Close')+ expect(button.props.title).toBe('Close (Esc)')+ expect(button.props['aria-keyshortcuts']).toBe('Escape')+ expect(find(h.get('transcript-find-controls').props.children[1], 'transcript-find-close')).toBe(button)+ expect(h.get('transcript-find-results').props.inert).toBe(!query)+ expect(h.highlights.get('transcript-find')?.size).toBe(query === 'test' ? 2 : 0)+ expect(h.get('transcript-find-next').props.disabled).toBe(query !== 'test')+ if (closeWith === 'button') button.props.onClick(); else h.escape()+ h.render()+ expect(h.get('transcript-find-open').props['aria-expanded']).toBe(false)+ expect(h.get('transcript-find-clip').props.inert).toBe(true)+ expect(h.get('transcript-search').props.value).toBe('')+ expect(h.highlights.get('transcript-find')?.size).toBe(0)+ expect(h.highlights.get('transcript-find-current')?.size).toBe(0)+ expect(h.trigger.focus).toHaveBeenLastCalledWith({ preventScroll: true })+ expect(h.onFinding).toHaveBeenLastCalledWith(false)+ h.get('transcript-find-open').props.onClick(); h.render()+ expect(h.get('transcript-search').props.value).toBe('')+ }+})++it('provides the Close label in every supported language', () => {+ const tables = import.meta.glob<Record<string, string>>('../src/shared/locales/*.json', { eager: true, import: 'default' })+ expect(LOCALES).toHaveLength(32)+ for (const { id } of LOCALES) expect(tables[`../src/shared/locales/${id}.json`].Close?.trim(), id).toBeTruthy()+})+++it('places a match spanning nested text nodes without throwing', () => {+ const h = harness(['', ['te', 'st '], ['te', 'st']])+ h.get('transcript-find-open').props.onClick(); h.render()+ h.get('transcript-search').props.onChange({ target: { value: 'test test' } })+ expect(() => h.render()).not.toThrow()+ const ranges = [...h.highlights.get('transcript-find')!] as Range[]+ expect(ranges).toHaveLength(1)+ expect(ranges[0].toString()).toBe('test test')+ expect(ranges[0].startContainer).not.toBe(ranges[0].endContainer)+})++it('searches rendered text and refreshes ranges when word nodes change', () => {+ const h = harness(['visible ', ['test']], 'stale source text')+ h.get('transcript-find-open').props.onClick(); h.render()+ h.get('transcript-search').props.onChange({ target: { value: 'test' } }); h.render()+ expect(h.get('transcript-find-count').props.children[2].props.children).toBe('1 of 1')+ h.dom.nodes[1].data = 'test test'+ h.mutate(); h.render()+ expect(h.get('transcript-find-count').props.children[2].props.children).toBe('1 of 2')+ expect([...h.highlights.get('transcript-find')!].map(range => String(range))).toEqual(['test', 'test'])+ h.get('transcript-find-next').props.onClick(); h.render()+ h.dom.nodes[1].data = 'test test test'+ h.mutate(); h.render()+ expect(h.get('transcript-find-count').props.children[2].props.children).toBe('2 of 3')+})++it('opens on one click without focusing inert content or letting an opening blur cancel it', () => {+ const h = harness()+ const closed = h.get('transcript-find')+ h.get('transcript-find-open').props.onClick()+ expect(h.input.focus).not.toHaveBeenCalled()+ expect(h.input.select).not.toHaveBeenCalled()+ closed.props.onBlur({ currentTarget: { contains: () => false }, relatedTarget: null })+ h.render()+ expect(h.get('transcript-find-open').props['aria-expanded']).toBe(true)+ expect(h.input.focus).toHaveBeenCalledWith({ preventScroll: true })+ expect(h.input.select).toHaveBeenCalledOnce()+ h.get('transcript-find').props.onBlur({ currentTarget: { contains: () => false }, relatedTarget: null })+ h.render()+ expect(h.get('transcript-find-open').props['aria-expanded']).toBe(false)+})+++it('reveals the new query rather than consuming its scroll request on stale results', () => {+ const h = harness(['test ', ['other']], 'test other')+ vi.spyOn(Range.prototype, 'getBoundingClientRect').mockImplementation(function (this: Range) {+ const top = this.toString() === 'other' ? 1500 : 500+ return { top, bottom: top + 20, height: 20 } as DOMRect+ })+ h.get('transcript-find-open').props.onClick(); h.render()+ h.get('transcript-search').props.onChange({ target: { value: 'test' } }); h.render()+ h.get('transcript-search').props.onChange({ target: { value: 'other' } }); h.render()+ expect(h.dom.list.scrollTo).toHaveBeenLastCalledWith({ top: 1235, behavior: 'smooth' })+})diff --git a/app/test/transcriptFindDom.ts b/app/test/transcriptFindDom.tsnew file mode 100644index 00000000..c0044109--- /dev/null+++ b/app/test/transcriptFindDom.ts@@ -0,0 +1,43 @@+import { vi } from 'vitest'++type Parts = Array<string | Parts>+export function transcriptDom(parts: Parts = ['test test']) {+ const nodes: any[] = []+ const build = (parts: Parts): any => ({ children: parts.map(part => {+ if (typeof part !== 'string') return build(part)+ const node = { data: part, get length() { return this.data.length } }+ nodes.push(node); return node+ }) })+ const element = build(parts)+ const root: any = { ...element, firstChild: element.children[0], isConnected: true, contains: (node: unknown) => nodes.includes(node) }+ class TextRange {+ startContainer: any; endContainer: any; startOffset = 0; endOffset = 0+ setStart(node: any, offset: number) {+ if (offset < 0 || offset > node.length || !('data' in node)) throw new RangeError('Invalid start offset')+ this.startContainer = node; this.startOffset = offset+ }+ setEnd(node: any, offset: number) {+ if (offset < 0 || offset > node.length || !('data' in node)) throw new RangeError('Invalid end offset')+ this.endContainer = node; this.endOffset = offset+ }+ toString() {+ const start = nodes.indexOf(this.startContainer), end = nodes.indexOf(this.endContainer)+ return nodes.slice(start, end + 1).map((node, index) => node.data.slice(index === 0 ? this.startOffset : 0, start + index === end ? this.endOffset : undefined)).join('')+ }+ getBoundingClientRect() { return { top: 100, bottom: 120, height: 20 } }+ }+ const doc = {+ createTreeWalker: vi.fn((node: any, what: number) => {+ if (node !== root || what !== 4) throw new Error('Expected the text root and SHOW_TEXT')+ let index = 0+ return { nextNode: () => nodes[index++] ?? null }+ }),+ createRange: vi.fn(() => new TextRange()),+ }+ root.ownerDocument = doc+ const row = { dataset: { key: 'me:0' }, querySelector: () => root }+ const list = { querySelectorAll: () => [row], getBoundingClientRect: () => ({ top: 50, bottom: 500 }), scrollTop: 0, scrollTo: vi.fn() }+ vi.stubGlobal('Range', TextRange)+ vi.stubGlobal('NodeFilter', { SHOW_TEXT: 4 })+ return { list: list as unknown as HTMLOListElement, root, doc, nodes }+}diff --git a/app/test/transcriptFindRanges.test.ts b/app/test/transcriptFindRanges.test.tsnew file mode 100644index 00000000..71fbbd95--- /dev/null+++ b/app/test/transcriptFindRanges.test.ts@@ -0,0 +1,41 @@+import { afterEach, expect, it, vi } from 'vitest'+import { transcriptFindRanges } from '../src/renderer/src/transcriptFindRanges'+import { transcriptDom } from './transcriptFindDom'++afterEach(() => vi.unstubAllGlobals())+const lines = [{ track: 'me', startMs: 0, text: 'outdated model text' }]++it('maps literal UTF-16 offsets across nested rendered nodes and node boundaries', () => {+ const { list } = transcriptDom(['🙂 ', ['CA', 'FÉ'], ' café'])+ const result = transcriptFindRanges(list, lines, 'café')+ expect(result.matches).toEqual([{ key: 'me:0', start: 3, end: 7 }, { key: 'me:0', start: 8, end: 12 }])+ expect(result.ranges.map(String)).toEqual(['CAFÉ', 'café'])+})++it('skips failed placements without throwing or misaligning navigation and counts', () => {+ const { list, doc } = transcriptDom(['test ', ['test']])+ doc.createRange.mockImplementationOnce(() => { throw new Error('Detached boundary') })+ const result = transcriptFindRanges(list, lines, 'test')+ expect(result.matches).toEqual([{ key: 'me:0', start: 5, end: 9 }])+ expect(result.ranges.map(String)).toEqual(['test'])+})++it('skips missing, disconnected and changed text rather than painting stale matches', () => {+ const { list, root, doc, nodes } = transcriptDom(['test'])+ root.isConnected = false+ expect(transcriptFindRanges(list, lines, 'test').ranges).toEqual([])+ root.isConnected = true+ doc.createRange.mockImplementationOnce(() => { nodes[0].data = ''; return new Range() as any })+ expect(() => transcriptFindRanges(list, lines, 'test')).not.toThrow()+ expect(transcriptFindRanges(list, [{ ...lines[0], startMs: 1 }], 'test').matches).toEqual([])+})++it('indexes a three-hour transcript with split text and a range for every counted hit', () => {+ const { list, root } = transcriptDom(['te', ['st '], 'test'])+ const rows = Array.from({ length: 5400 }, (_, i) => ({ track: 'me', startMs: i * 2000, text: 'model' }))+ list.querySelectorAll = (() => rows.map(row => ({ dataset: { key: `me:${row.startMs}` }, querySelector: () => root }))) as any+ const result = transcriptFindRanges(list, rows, 'test')+ expect(result.matches).toHaveLength(10800)+ expect(result.ranges).toHaveLength(10800)+ expect(result.ranges.every(range => range.toString() === 'test')).toBe(true)+})diff --git a/app/test/transcriptView.test.ts b/app/test/transcriptView.test.tsindex 962abb5c..d673ef19 100644--- a/app/test/transcriptView.test.ts+++ b/app/test/transcriptView.test.ts@@ -1,5 +1,5 @@import { describe, expect, it } from 'vitest'-import { bubbles, clock, filterLines, lineAt, recentRuns, stableKeys, turns, withLive } from '../src/shared/transcript'+import { bubbles, clock, lineAt, recentRuns, stableKeys, turns, withLive } from '../src/shared/transcript'const l = (track: 'me' | 'them', startMs: number, speaker: string | null = null, endMs = startMs + 2000) => ({ track, startMs, endMs, speaker, text: '' })@@ -57,17 +57,6 @@ describe('lineAt', () => {})})-describe('searching the transcript', () => {- const lines = [{ ...l('me', 0), text: 'Hello everyone' }, { ...l('them', 3000, 'A'), text: 'The launch is on Tuesday' }, { ...l('them', 6000, 'A'), text: 'Tuesday works' }]- it('keeps every line with no query, and only the lines with the words typed, any case', () => {- expect(filterLines(lines, '')).toHaveLength(3)- expect(filterLines(lines, ' ')).toHaveLength(3)- expect(filterLines(lines, 'tuesday').map((x) => x.startMs)).toEqual([3000, 6000])- expect(filterLines(lines, 'LAUNCH tuesday').map((x) => x.startMs)).toEqual([3000])- expect(filterLines(lines, 'nothing here')).toEqual([])- })-})-describe('bubbles', () => {it('keeps lines said without a real pause in one bubble, like one thought', () => {const lines = [l('me', 0, null, 2000), l('me', 2400, null, 4000), l('me', 7000, null, 9000), l('me', 9200)]