@singapore-editor/find 0.2.11 → 0.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"findController.js","names":[],"sources":["../src/findController.ts"],"sourcesContent":["import {\n wordRangeAtOffset,\n type TextEdit,\n type TextReadSnapshot,\n} from '@singapore-editor/core/document'\nimport type { EditorSetSelectionOptions } from '@singapore-editor/core/editor'\nimport type {\n EditorContributionChange,\n EditorDisposable,\n EditorResolvedSelection,\n EditorSelectionRange,\n EditorViewContributionUpdateKind,\n} from '@singapore-editor/core/extensions'\nimport type { VirtualizedTextHighlightStyle } from '@singapore-editor/core/rendering'\nimport { EditorSecondaryViewScheduler } from '@singapore-editor/core/secondary-views'\nimport {\n countMatches,\n escapeRegExpCharacters,\n FIND_MATCHES_LIMIT,\n FIND_REPLACE_ALL_LIMIT,\n findLineRange,\n findMatchIndex,\n findMatches,\n findNextMatchFrom,\n findPreviousMatchFrom,\n findTextSourceFromSnapshot,\n type FindMatch,\n type FindMatchFromOptions,\n type FindMatchFromSearcher,\n type FindQuery,\n type FindRange,\n type FindTextSource,\n} from './search'\nimport { parseReplaceString, ReplacePattern } from './replacePattern'\nimport type { EditorFindOptions } from './types'\n\n// These three overlap by construction — the current match is always also a\n// match, and both sit inside the scope — so their stacking is declared rather\n// than left to the order the groups happen to reach the highlight registry in.\n//\n// The numbers are exported because they are half of a cross-package agreement: the highlight\n// priority space is one namespace that several subsystems write into, and priority is what settles\n// a contest between two of them that declare the same property. A regression test elsewhere asserts\n// the resulting order, and it can only do that by reading these rather than by restating them.\n//\n// They sit above the error diagnostic, which declares a background of its own at 2. `current` is the\n// only find style that declares a `color`, so it is the only one contending on that axis — but all\n// three declare a background, and so does the error, which is why none of them may share its number.\n// A tie there would put the background contest back where the numbers exist to take it out of:\n// registration order in the document's shared registry.\nexport const FIND_HIGHLIGHT_Z_INDEX = {\n scope: 4,\n match: 5,\n current: 6,\n} as const\n\nconst FIND_MATCH_STYLE = {\n dimmable: false,\n backgroundColor: 'rgba(234, 179, 8, 0.34)',\n zIndex: FIND_HIGHLIGHT_Z_INDEX.match,\n}\nconst FIND_CURRENT_STYLE = {\n dimmable: false,\n backgroundColor: 'rgba(245, 158, 11, 0.72)',\n color: '#111827',\n zIndex: FIND_HIGHLIGHT_Z_INDEX.current,\n}\nconst FIND_SCOPE_STYLE = {\n dimmable: false,\n backgroundColor: 'rgba(59, 130, 246, 0.22)',\n zIndex: FIND_HIGHLIGHT_Z_INDEX.scope,\n}\n\n// A match on screen stays where the reader is looking at it; one that is not lands\n// in the middle, with context on both sides rather than on the viewport's edge.\nfunction findReveal(match: FindRange, committed = true): EditorSetSelectionOptions {\n return {\n ...(committed ? { jumpCause: 'find' as const } : {}),\n revealOffset: match.end,\n revealBlock: 'center-if-outside',\n }\n}\n\n// Seeding stops here rather than pushing a multi-megabyte selection through the\n// find input and searching for it.\nconst SEARCH_STRING_MAX_LENGTH = 524_288\n\n// A re-search reads the whole document, which is not a bill a keystroke can be\n// handed. The ceiling is the load-bearing half: a sustained typing run never\n// leaves the quiet gap, so waiting only for quiet would mean never re-searching\n// at all for as long as the user keeps going.\nconst FIND_RESEARCH_KEY = 'find.research'\nconst FIND_RESEARCH_DELAY_MS = 100\nconst FIND_RESEARCH_MAX_DELAY_MS = 400\n\ntype EditorFindSelectionRange = EditorSelectionRange\n\nexport type EditorFindResolvedSelection = EditorResolvedSelection & {\n readonly collapsed: boolean\n}\n\n/**\n * Ranges the host follows through edits on find's behalf.\n *\n * A scope outlives the selection it was taken from: the first replace inside it moves the caret off\n * that selection, so a scope re-derived from what is selected now would be re-derived from\n * something else — or from nothing, and a scope of nothing is indistinguishable from no scope at\n * all. Handed over once, it answers from wherever its text went, however many edits later.\n */\nexport type FindTrackedRanges = {\n resolve(): readonly FindRange[]\n}\n\nexport type EditorFindHost = {\n hasDocument(): boolean\n // Ranges rather than a string, so nothing find does can cost a copy of the\n // document — the reason there is no full-text accessor here to reach for.\n textSource(): FindTextSource\n hasTextSnapshot(snapshot: TextReadSnapshot): boolean\n // Followed wherever they end up, however far off screen: a scope decides where\n // Replace All rewrites, and one that stopped being followed would rewrite text\n // the user never marked.\n trackRanges(ranges: readonly FindRange[]): FindTrackedRanges\n // Followed only as far as the host paints them, the rest answered with the\n // offsets they were handed; see adoptMatches.\n trackPaintedRanges(ranges: readonly FindRange[]): FindTrackedRanges\n getSelections(): readonly EditorFindResolvedSelection[]\n focusEditor(): void\n announce(message: string): void\n setSelection(\n anchor: number,\n head: number,\n timingName: string,\n options?: EditorSetSelectionOptions,\n ): void\n setSelections(\n selections: readonly EditorFindSelectionRange[],\n timingName: string,\n revealOffset?: number,\n ): void\n setRangeHighlight(\n name: string,\n ranges: readonly FindRange[],\n style: VirtualizedTextHighlightStyle,\n ): void\n clearRangeHighlight(name: string): void\n}\n\nexport type EditorFindEditHost = {\n textSnapshot(): TextReadSnapshot | null\n getSelections(): readonly EditorFindResolvedSelection[]\n applyEdits(\n edits: readonly TextEdit[],\n timingName: string,\n selection?: EditorFindSelectionRange,\n ): void\n}\n\nexport type EditorFindStartOptions = {\n readonly replace: boolean\n readonly focus: 'find' | 'replace' | 'none'\n}\n\nexport type EditorFindState = FindQuery & {\n readonly replaceString: string\n readonly preserveCase: boolean\n readonly revealed: boolean\n readonly replaceRevealed: boolean\n readonly inSelection: boolean\n}\n\nexport type EditorFindWidgetState = EditorFindState & {\n // Every match in the searched text, however many of them are painted.\n readonly matchesCount: number\n readonly matchesPosition: number\n // Painting stopped at FIND_MATCHES_LIMIT. The count and navigation did not.\n readonly highlightsTruncated: boolean\n}\n\nexport type EditorFindUiEvent =\n | { readonly type: 'show'; readonly replaceVisible: boolean }\n | { readonly type: 'hide' }\n | { readonly type: 'focus'; readonly target: 'find' | 'replace' }\n | { readonly type: 'update'; readonly state: EditorFindWidgetState }\n\ntype ResolvedFindOptions = Required<EditorFindOptions>\ntype EditorFindUiListener = (event: EditorFindUiEvent) => void\n\n// What every search resolves to before it runs: the text, and the ranges of it\n// the query is allowed to answer from. Null scopes are the whole document; an\n// empty scope refuses the search outright, so it is never one of these.\ntype FindSearchTarget = {\n readonly source: FindTextSource\n readonly scopes: readonly FindRange[] | null\n}\n\nexport class EditorFindController {\n private readonly options: ResolvedFindOptions\n private readonly listeners = new Set<EditorFindUiListener>()\n private host: EditorFindHost | null = null\n private editHost: EditorFindEditHost | null = null\n private matchHighlightName = ''\n private currentHighlightName = ''\n private scopeHighlightName = ''\n private state: EditorFindState = {\n searchString: '',\n replaceString: '',\n isRegex: false,\n matchCase: false,\n wholeWord: false,\n preserveCase: false,\n revealed: false,\n replaceRevealed: false,\n inSelection: false,\n }\n private readonly scheduler = new EditorSecondaryViewScheduler()\n private matches: readonly FindMatch[] = []\n private highlightsTruncated = false\n // Counted rather than listed, so it is exact past the paint cap.\n private totalMatches = 0\n private scope: FindTrackedRanges | null = null\n // What the host follows the painted matches by, so a deferred re-search cannot\n // leave a highlight standing on text that moved out from under it.\n private trackedMatches: FindTrackedRanges | null = null\n private currentMatch: FindMatch | null = null\n private replacing = false\n private pendingResearch = false\n\n public constructor(options: EditorFindOptions = {}) {\n this.options = resolveFindOptions(options)\n }\n\n public attachHost(host: EditorFindHost, highlightPrefix: string): EditorDisposable {\n if (this.host && this.host !== host) this.clearHighlights()\n\n this.host = host\n this.matchHighlightName = `${highlightPrefix}-find-match`\n this.currentHighlightName = `${highlightPrefix}-find-current`\n this.scopeHighlightName = `${highlightPrefix}-find-scope`\n return { dispose: () => this.detachHost(host) }\n }\n\n public attachEditHost(host: EditorFindEditHost): EditorDisposable {\n this.editHost = host\n return { dispose: () => this.detachEditHost(host) }\n }\n\n public subscribe(listener: EditorFindUiListener): EditorDisposable {\n this.listeners.add(listener)\n return { dispose: () => this.listeners.delete(listener) }\n }\n\n public dispose(): void {\n this.pendingResearch = false\n this.scheduler.dispose()\n this.clearHighlights()\n this.listeners.clear()\n this.host = null\n this.editHost = null\n }\n\n public isVisible(): boolean {\n return this.state.revealed\n }\n\n public openFind(): boolean {\n return this.open({ replace: false, focus: 'find' })\n }\n\n public toggleFind(): boolean {\n if (this.state.revealed) return this.close()\n return this.openFind()\n }\n\n public openFindReplace(): boolean {\n return this.open({ replace: true, focus: 'replace' })\n }\n\n public close(): boolean {\n const host = this.host\n if (!this.state.revealed || !host) return false\n\n this.pendingResearch = false\n this.state = { ...this.state, revealed: false, inSelection: false }\n this.scope = null\n this.trackedMatches = null\n this.currentMatch = null\n this.scheduler.cancel(FIND_RESEARCH_KEY)\n this.clearHighlights()\n this.emit({ type: 'hide' })\n host.focusEditor()\n return true\n }\n\n public findNext(): boolean {\n if (!this.ensureFindReady('none')) return false\n\n const startOffset = this.primarySelection()?.endOffset ?? 0\n const match = this.nextMatchAt(startOffset, true)\n // Landing behind where the search started is the search having run out and begun again. Nothing\n // on screen says so to a reader who cannot see the caret jump back up the file.\n if (match && match.start < startOffset) this.host?.announce('Wrapped to the first match')\n\n return this.selectMatch(match)\n }\n\n public findPrevious(): boolean {\n if (!this.ensureFindReady('none')) return false\n\n const startOffset = this.primarySelection()?.startOffset ?? 0\n const match = this.searchFrom(findPreviousMatchFrom, startOffset, {\n escapeEmptyMatchAtOffset: true,\n })\n if (match && match.start > startOffset) this.host?.announce('Wrapped to the last match')\n\n return this.selectMatch(match)\n }\n\n public replaceOne(): boolean {\n if (!this.ensureFindReady('replace')) return false\n const editHost = this.editHost\n if (!editHost) return false\n\n const selection = this.primarySelection()\n if (!selection) return false\n const search = this.commandSearchTarget()\n if (!search) return false\n\n // One scan, from the cursor, with the capture groups of the one match that\n // may be about to be rewritten: enumerating the document for them allocates\n // a capture array per match in it to use exactly one.\n const match = findNextMatchFrom(\n search.source,\n this.state,\n selection.startOffset,\n search.scopes,\n { captureMatches: true, loop: this.options.loop },\n )\n if (!match) return false\n // Not on it yet, so this press is the one that selects it and the next one\n // replaces it.\n if (match.start !== selection.startOffset || match.end !== selection.endOffset)\n return this.selectMatch(match)\n\n const replaceText = this.replacePattern().buildReplaceString(\n match.matches,\n this.state.preserveCase,\n )\n this.applyReplacement(\n [{ from: match.start, to: match.end, text: replaceText }],\n 'input.findReplaceOne',\n { anchor: match.start + replaceText.length, head: match.start + replaceText.length },\n )\n this.selectNextReplacementMatch()\n this.research(false)\n return true\n }\n\n public replaceAll(): boolean {\n if (!this.ensureFindReady('replace')) return false\n const editHost = this.editHost\n if (!editHost) return false\n const search = this.commandSearchTarget()\n if (!search) return false\n\n const pattern = this.replacePattern()\n // Deliberately not FIND_MATCHES_LIMIT: that cap exists to bound painting,\n // and applying it here would rewrite the first 19,999 matches and leave the\n // rest, silently.\n const matches = findMatches(\n search.source,\n this.state,\n search.scopes,\n pattern.hasReplacementPatterns || this.state.preserveCase,\n FIND_REPLACE_ALL_LIMIT,\n )\n if (matches.length === 0) return false\n\n const edits = mergeAdjacentReplaceEdits(\n matches.map((match) => ({\n from: match.start,\n to: match.end,\n text: pattern.buildReplaceString(match.matches, this.state.preserveCase),\n })),\n )\n this.applyReplacement(edits, 'input.findReplaceAll')\n this.research(false)\n return true\n }\n\n public selectAllMatches(): boolean {\n const host = this.host\n if (!host) return false\n if (!this.ensureFindReady('none')) return false\n\n // Re-queried uncapped for the same reason Replace All is: FIND_MATCHES_LIMIT\n // bounds painting, and a cursor set that silently stopped at the paint cap\n // would let the next keystroke edit only part of what the user selected.\n const search = this.commandSearchTarget()\n if (!search) return false\n const matches = findMatches(\n search.source,\n this.state,\n search.scopes,\n false,\n FIND_REPLACE_ALL_LIMIT,\n )\n if (matches.length === 0) return false\n\n const selections = orderedMatchSelections(matches, this.primarySelection())\n host.setSelections(selections, 'input.findSelectAll', selections[0]?.head)\n return true\n }\n\n public toggleMatchCase(): boolean {\n this.state = { ...this.state, matchCase: !this.state.matchCase }\n this.research(this.options.cursorMoveOnType)\n return true\n }\n\n public toggleWholeWord(): boolean {\n this.state = { ...this.state, wholeWord: !this.state.wholeWord }\n this.research(this.options.cursorMoveOnType)\n return true\n }\n\n public toggleRegex(): boolean {\n this.state = { ...this.state, isRegex: !this.state.isRegex }\n this.research(this.options.cursorMoveOnType)\n return true\n }\n\n public togglePreserveCase(): boolean {\n this.state = { ...this.state, preserveCase: !this.state.preserveCase }\n this.updateWidget()\n return true\n }\n\n public toggleReplace(): boolean {\n this.state = { ...this.state, replaceRevealed: !this.state.replaceRevealed }\n this.updateWidget()\n return true\n }\n\n public toggleFindInSelection(): boolean {\n if (this.state.inSelection) {\n this.state = { ...this.state, inSelection: false }\n this.scope = null\n this.research(this.options.cursorMoveOnType)\n return true\n }\n\n const host = this.host\n if (!host) return false\n\n const scopes = nonEmptySelectionRanges(this.commandSelections())\n if (scopes.length === 0) return false\n\n this.state = { ...this.state, inSelection: true }\n this.scope = host.trackRanges(scopes)\n this.research(this.options.cursorMoveOnType)\n return true\n }\n\n public setSearchString(value: string): void {\n this.state = { ...this.state, searchString: value }\n if (this.options.findOnType) this.research(this.options.cursorMoveOnType)\n }\n\n public setReplaceString(value: string): void {\n this.state = { ...this.state, replaceString: value }\n this.updateWidget()\n }\n\n public handleViewUpdate(\n kind: EditorViewContributionUpdateKind,\n change: EditorContributionChange | null,\n ): void {\n if (!this.state.revealed) return\n if (!isFindDocumentUpdate(kind)) return\n if (change?.kind === 'selection' || change?.kind === 'none') return\n\n if (kind === 'clear') {\n this.close()\n return\n }\n\n // Find's own replace re-searches once the edit it is applying has landed,\n // rather than from inside it, so the matches it is about to discard are not\n // followed through the edit first.\n if (this.replacing) return\n // Nothing to follow across a document swap: the ranges being tracked belong\n // to the buffer that was just replaced. A scope among them is the one that\n // cannot simply be dropped on the floor — resolved against the new buffer it\n // answers with offsets of text the user never marked, and a search confined\n // to those is a Replace All rewriting inside a region nobody drew.\n if (kind === 'document') {\n this.pendingResearch = false\n this.scope = null\n this.state = { ...this.state, inSelection: false }\n this.research(false)\n return\n }\n\n if (this.pendingResearch) {\n this.research(false)\n return\n }\n this.scheduleResearch()\n }\n\n private detachHost(host: EditorFindHost): void {\n if (this.host !== host) return\n\n this.pendingResearch = false\n this.clearHighlights()\n this.host = null\n this.matchHighlightName = ''\n this.currentHighlightName = ''\n this.scopeHighlightName = ''\n this.state = { ...this.state, revealed: false, inSelection: false }\n this.matches = []\n this.highlightsTruncated = false\n this.totalMatches = 0\n this.scope = null\n this.trackedMatches = null\n this.currentMatch = null\n this.scheduler.cancel(FIND_RESEARCH_KEY)\n }\n\n private detachEditHost(host: EditorFindEditHost): void {\n if (this.editHost !== host) return\n\n this.pendingResearch = false\n this.editHost = null\n }\n\n private open(options: EditorFindStartOptions): boolean {\n const host = this.host\n if (!host || !host.hasDocument()) return false\n\n const searchString = this.seedSearchString()\n this.state = {\n ...this.state,\n searchString: searchString || this.state.searchString,\n revealed: true,\n replaceRevealed: options.replace || this.state.replaceRevealed,\n }\n this.applyAutoFindInSelection(host)\n this.emit({ type: 'show', replaceVisible: this.state.replaceRevealed })\n this.research(false)\n this.focusWidget(options.focus)\n return true\n }\n\n private ensureFindReady(focus: 'find' | 'replace' | 'none'): boolean {\n if (!this.state.revealed) return this.open({ replace: focus === 'replace', focus })\n if (this.matches.length === 0) this.research(false)\n return this.state.searchString.length > 0\n }\n\n private research(moveCursor: boolean): void {\n if (!this.host) return\n if (!this.canPaintCurrentDocument()) {\n this.pendingResearch = true\n if (moveCursor) this.selectFirstMatchFromSelection()\n return\n }\n this.pendingResearch = false\n\n // Whatever a deferred run was going to answer, this run answers now.\n this.scheduler.cancel(FIND_RESEARCH_KEY)\n // One past the cap, so a document holding exactly FIND_MATCHES_LIMIT\n // matches is reported as a complete count rather than an overflow.\n const found = this.findAll(false, FIND_MATCHES_LIMIT + 1)\n this.highlightsTruncated = found.length > FIND_MATCHES_LIMIT\n this.totalMatches = this.highlightsTruncated ? this.countAll() : found.length\n this.adoptMatches(this.highlightsTruncated ? found.slice(0, FIND_MATCHES_LIMIT) : found)\n this.currentMatch = matchAtSelection(this.matches, this.primarySelection())\n this.updateHighlights()\n this.updateWidget()\n // Nothing listed is nothing to land on, and asking anyway is two more passes\n // over the document for every keystroke of a query that matches nothing.\n if (moveCursor && found.length > 0) this.selectFirstMatchFromSelection()\n }\n\n private scheduleResearch(): void {\n this.followPendingMatches()\n this.scheduler.schedule({\n key: FIND_RESEARCH_KEY,\n taskClass: 'background-derived',\n delayMs: FIND_RESEARCH_DELAY_MS,\n maxDelayMs: FIND_RESEARCH_MAX_DELAY_MS,\n run: () => this.research(false),\n })\n }\n\n /**\n * Adopts a match set and hands it to the host to follow as far as it is painted.\n *\n * Handed over now rather than when an edit arrives: find is told about an edit\n * once the text has already moved, and a range recorded against the document\n * as it is by then is a range that will never shift.\n *\n * What the reader can see is the bound. A set stopping at the paint cap holds\n * twenty thousand matches, and asking the host to carry all of them costs more\n * per keystroke than the search this deferral exists to keep off it.\n */\n private adoptMatches(matches: readonly FindMatch[]): void {\n this.matches = matches\n this.trackedMatches = this.host?.trackPaintedRanges(matches) ?? null\n }\n\n /**\n * Carries the painted matches through the edit that deferred their re-search.\n *\n * Until it lands they are what the reader sees, and the offsets they were found\n * at address text that has since moved — so they are read back from where that\n * text went. A match whose text is gone resolves to nothing and stops being\n * painted.\n */\n /** Takes the offsets again from what the host is following, after the line it follows to moved. */\n public refreshTrackedMatches(): void {\n this.followPendingMatches()\n }\n\n private followPendingMatches(): void {\n if (!this.canPaintCurrentDocument()) return\n const tracked = this.trackedMatches\n if (!tracked || this.matches.length === 0) return\n\n // The capture groups belonged to the text that was there; only the ranges\n // survive the edit, and the re-search is what recovers the rest.\n this.matches = tracked.resolve().map((range) => ({ ...range, matches: null }))\n this.currentMatch = matchAtSelection(this.matches, this.primarySelection())\n this.updateHighlights()\n this.updateWidget()\n }\n\n private applyReplacement(\n edits: readonly TextEdit[],\n timingName: string,\n selection?: EditorFindSelectionRange,\n ): void {\n const editHost = this.editHost\n if (!editHost) return\n\n this.replacing = true\n try {\n editHost.applyEdits(edits, timingName, selection)\n } finally {\n this.replacing = false\n }\n }\n\n private selectNextReplacementMatch(): void {\n const offset = this.primarySelection()?.endOffset ?? 0\n const match = this.searchFrom(findNextMatchFrom, offset, {})\n if (!match) return\n this.host?.setSelection(match.start, match.end, 'input.findNavigate', findReveal(match))\n }\n\n private canPaintCurrentDocument(): boolean {\n if (!this.editHost) return true\n const snapshot = this.editHost.textSnapshot()\n return snapshot !== null && this.host?.hasTextSnapshot(snapshot) === true\n }\n\n private commandTextSource(): FindTextSource | undefined {\n if (!this.editHost) return this.host?.textSource()\n const snapshot = this.editHost.textSnapshot()\n return snapshot ? findTextSourceFromSnapshot(snapshot) : undefined\n }\n\n private commandSelections(): readonly EditorFindResolvedSelection[] {\n return this.editHost?.getSelections() ?? this.host?.getSelections() ?? []\n }\n\n private commandSearchTarget(): FindSearchTarget | null {\n const source = this.commandTextSource()\n return source ? this.searchTarget(source) : null\n }\n\n private findAll(captureMatches: boolean, limit = FIND_MATCHES_LIMIT): readonly FindMatch[] {\n const search = this.searchTarget()\n if (!search) return []\n\n return findMatches(search.source, this.state, search.scopes, captureMatches, limit)\n }\n\n private countAll(before?: number): number {\n const search = this.searchTarget()\n return search ? countMatches(search.source, this.state, search.scopes, before) : 0\n }\n\n private searchFrom(\n find: FindMatchFromSearcher,\n offset: number,\n options: FindMatchFromOptions,\n ): FindMatch | null {\n const search = this.commandSearchTarget()\n if (!search) return null\n\n return find(search.source, this.state, offset, search.scopes, {\n loop: this.options.loop,\n ...options,\n })\n }\n\n private searchTarget(source = this.host?.textSource()): FindSearchTarget | null {\n if (!source) return null\n\n const scopes = this.scopeRanges()\n // A scope that has run out of ranges is not the absence of a scope: every\n // range the user marked was edited away, and widening the search to the\n // document would let the next Replace All rewrite text they never marked.\n if (scopes && scopes.length === 0) return null\n\n return { source, scopes }\n }\n\n private scopeRanges(): readonly FindRange[] | null {\n return this.scope?.resolve() ?? null\n }\n\n private selectFirstMatchFromSelection(): void {\n const offset = this.primarySelection()?.endOffset ?? 0\n // Deliberately not escaping an empty match here: re-searching should land\n // on the match at the cursor, empty or not. Only an explicit Find\n // Next/Previous is asking to move off it.\n this.selectMatch(this.nextMatchAt(offset, false), false)\n }\n\n private nextMatchAt(offset: number, escapeEmptyMatchAtOffset: boolean): FindMatch | null {\n return this.searchFrom(findNextMatchFrom, offset, { escapeEmptyMatchAtOffset })\n }\n\n private selectMatch(match: FindMatch | null, committed = true): boolean {\n const host = this.host\n if (!match || !host) return false\n\n if (this.canPaintCurrentDocument()) this.currentMatch = match\n host.setSelection(match.start, match.end, 'input.findNavigate', findReveal(match, committed))\n if (!this.canPaintCurrentDocument()) return true\n this.updateHighlights()\n this.updateWidget()\n return true\n }\n\n private updateHighlights(): void {\n if (!this.canPaintCurrentDocument()) return\n const host = this.host\n if (!host) return\n\n host.setRangeHighlight(this.matchHighlightName, this.matches, FIND_MATCH_STYLE)\n host.setRangeHighlight(this.currentHighlightName, this.currentMatchRanges(), FIND_CURRENT_STYLE)\n const scopes = this.scopeRanges()\n if (scopes) {\n host.setRangeHighlight(this.scopeHighlightName, scopes, FIND_SCOPE_STYLE)\n return\n }\n\n host.clearRangeHighlight(this.scopeHighlightName)\n }\n\n private currentMatchRanges(): readonly FindRange[] {\n return this.currentMatch ? [this.currentMatch] : []\n }\n\n private clearHighlights(): void {\n const host = this.host\n if (!host || !this.matchHighlightName) return\n\n host.clearRangeHighlight(this.matchHighlightName)\n host.clearRangeHighlight(this.currentHighlightName)\n host.clearRangeHighlight(this.scopeHighlightName)\n }\n\n private updateWidget(): void {\n this.emit({ type: 'update', state: this.widgetState() })\n }\n\n private widgetState(): EditorFindWidgetState {\n return {\n ...this.state,\n // Between an edit and its re-search the painted matches are what is known.\n matchesCount: this.highlightsTruncated ? this.totalMatches : this.matches.length,\n matchesPosition: this.currentMatchPosition(),\n highlightsTruncated: this.highlightsTruncated,\n }\n }\n\n // Past the paint cap the match is in no list to look it up in, so its place is\n // the number of matches in front of it.\n private currentMatchPosition(): number {\n if (!this.currentMatch) return 0\n\n const painted = findMatchIndex(this.matches, this.currentMatch)\n if (painted >= 0 || !this.highlightsTruncated) return painted + 1\n return this.countAll(this.currentMatch.start) + 1\n }\n\n private focusWidget(focus: 'find' | 'replace' | 'none'): void {\n if (focus === 'find') this.emit({ type: 'focus', target: 'find' })\n if (focus === 'replace') this.emit({ type: 'focus', target: 'replace' })\n }\n\n private seedSearchString(): string {\n if (this.options.seedSearchStringFromSelection === 'never') return ''\n\n const selection = this.primarySelection()\n if (!selection) return ''\n\n const source = this.commandTextSource()\n if (!source) return ''\n if (!selection.collapsed)\n return this.seedFromLiteralText(selectedSingleLineText(source, selection))\n if (this.options.seedSearchStringFromSelection === 'selection') return ''\n\n return this.seedFromLiteralText(wordTextAtOffset(source, selection.headOffset))\n }\n\n // The seed is document text, never a pattern: unescaped, `foo(bar)` seeded\n // into a regex search becomes a capture group and finds nothing, with no hint\n // to the user why.\n private seedFromLiteralText(value: string): string {\n return this.state.isRegex ? escapeRegExpCharacters(value) : value\n }\n\n private applyAutoFindInSelection(host: EditorFindHost): void {\n const scopes = nonEmptySelectionRanges(this.commandSelections())\n if (scopes.length === 0) return\n if (this.options.autoFindInSelection === 'never') return\n if (this.options.autoFindInSelection === 'always') {\n this.state = { ...this.state, inSelection: true }\n this.scope = host.trackRanges(scopes)\n return\n }\n\n const source = this.commandTextSource()\n if (!source || !hasMultilineScope(source, scopes)) return\n\n this.state = { ...this.state, inSelection: true }\n this.scope = host.trackRanges(scopes)\n }\n\n private replacePattern(): ReplacePattern {\n if (this.state.isRegex) return parseReplaceString(this.state.replaceString)\n return ReplacePattern.fromStaticValue(this.state.replaceString)\n }\n\n private primarySelection(): EditorFindResolvedSelection | null {\n return this.commandSelections()[0] ?? null\n }\n\n private emit(event: EditorFindUiEvent): void {\n for (const listener of this.listeners) listener(event)\n }\n}\n\nfunction resolveFindOptions(options: EditorFindOptions): ResolvedFindOptions {\n return {\n loop: options.loop ?? true,\n seedSearchStringFromSelection: options.seedSearchStringFromSelection ?? 'always',\n findOnType: options.findOnType ?? true,\n cursorMoveOnType: options.cursorMoveOnType ?? true,\n autoFindInSelection: options.autoFindInSelection ?? 'never',\n }\n}\n\nfunction isFindDocumentUpdate(kind: EditorViewContributionUpdateKind): boolean {\n return kind === 'document' || kind === 'content' || kind === 'clear'\n}\n\nfunction selectedSingleLineText(\n source: FindTextSource,\n selection: EditorFindResolvedSelection,\n): string {\n // Both bounds are checked before the read, so an oversized or multi-line\n // selection is never copied at all.\n if (selection.endOffset - selection.startOffset >= SEARCH_STRING_MAX_LENGTH) return ''\n if (spansLines(source, selection.startOffset, selection.endOffset)) return ''\n\n return source.readRange(selection.startOffset, selection.endOffset)\n}\n\n// A word ends at a line break, so the line holding the caret is the whole\n// haystack the scan can need.\nfunction wordTextAtOffset(source: FindTextSource, offset: number): string {\n const line = findLineRange(source, offset)\n const text = source.readRange(line.start, line.end)\n const word = wordRangeAtOffset(text, offset - line.start)\n return text.slice(word.start, word.end)\n}\n\nfunction nonEmptySelectionRanges(\n selections: readonly EditorFindResolvedSelection[],\n): readonly FindRange[] {\n return selections\n .filter((selection) => !selection.collapsed)\n .map((selection) => ({ start: selection.startOffset, end: selection.endOffset }))\n}\n\nfunction hasMultilineScope(source: FindTextSource, scopes: readonly FindRange[]): boolean {\n return scopes.some((scope) => spansLines(source, scope.start, scope.end))\n}\n\n// Asked of the line index instead of the text: whether two offsets sit on one\n// line is already known there, and reading the span out to look for a break\n// would copy a selection that can be the whole document.\nfunction spansLines(source: FindTextSource, start: number, end: number): boolean {\n const lineStartsView = source.lineStartsView\n return lineStartsView.indexForOffset(start) !== lineStartsView.indexForOffset(end)\n}\n\nfunction matchAtSelection(\n matches: readonly FindMatch[],\n selection: EditorFindResolvedSelection | null,\n): FindMatch | null {\n if (!selection) return null\n return (\n matches.find(\n (match) => match.start === selection.startOffset && match.end === selection.endOffset,\n ) ?? null\n )\n}\n\nfunction orderedMatchSelections(\n matches: readonly FindMatch[],\n currentSelection: EditorFindResolvedSelection | null,\n): readonly EditorFindSelectionRange[] {\n const selections = matches.map(selectionForMatch)\n const currentMatch = matchAtSelection(matches, currentSelection)\n const currentIndex = currentMatch ? findMatchIndex(matches, currentMatch) : -1\n if (!currentSelection || currentIndex < 0) return selections\n\n const current: EditorFindSelectionRange = {\n anchor: currentSelection.anchorOffset,\n head: currentSelection.headOffset,\n affinity: currentSelection.affinity,\n }\n if (currentIndex === 0) return [current].concat(selections.slice(1))\n return [current].concat(selections.slice(0, currentIndex), selections.slice(currentIndex + 1))\n}\n\nfunction selectionForMatch(match: FindMatch): EditorFindSelectionRange {\n return { anchor: match.start, head: match.end, affinity: 'after' }\n}\n\nfunction mergeAdjacentReplaceEdits(edits: TextEdit[]): readonly TextEdit[] {\n const sorted = edits.sort((left, right) => left.from - right.from || left.to - right.to)\n const merged: TextEdit[] = []\n for (const edit of sorted) mergeReplaceEdit(merged, edit)\n return merged\n}\n\nfunction mergeReplaceEdit(merged: TextEdit[], edit: TextEdit): void {\n const previous = merged.at(-1)\n if (!previous || previous.to !== edit.from) {\n merged.push({ ...edit })\n return\n }\n\n merged[merged.length - 1] = {\n from: previous.from,\n to: edit.to,\n text: previous.text + edit.text,\n }\n}\n"],"mappings":";;;;;AAkDA,IAAa,yBAAyB;CACpC,OAAO;CACP,OAAO;CACP,SAAS;AACX;AAEA,IAAM,mBAAmB;CACvB,UAAU;CACV,iBAAiB;CACjB,QAAQ,uBAAuB;AACjC;AACA,IAAM,qBAAqB;CACzB,UAAU;CACV,iBAAiB;CACjB,OAAO;CACP,QAAQ,uBAAuB;AACjC;AACA,IAAM,mBAAmB;CACvB,UAAU;CACV,iBAAiB;CACjB,QAAQ,uBAAuB;AACjC;AAIA,SAAS,WAAW,OAAkB,YAAY,MAAiC;CACjF,OAAO;EACL,GAAI,YAAY,EAAE,WAAW,OAAgB,IAAI,CAAC;EAClD,cAAc,MAAM;EACpB,aAAa;CACf;AACF;AAIA,IAAM,2BAA2B;AAMjC,IAAM,oBAAoB;AAC1B,IAAM,yBAAyB;AAC/B,IAAM,6BAA6B;AAuGnC,IAAa,uBAAb,MAAkC;CAChC;CACA,4BA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AAO,MAAM,QAAQ,KAAK,KAAK,MAAM,EAAE;CACvF,MAAM,SAAqB,CAAC;CAC5B,KAAK,MAAM,QAAQ,QAAQ,iBAAiB,QAAQ,IAAI;CACxD,OAAO;AACT;AAEA,SAAS,iBAAiB,QAAoB,MAAsB;CAClE,MAAM,WAAW,OAAO,GAAG,EAAE;CAC7B,IAAI,CAAC,YAAY,SAAS,OAAO,KAAK,MAAM;EAC1C,OAAO,KAAK,EAAE,GAAG,KAAK,CAAC;EACvB;CACF;CAEA,OAAO,OAAO,SAAS,KAAK;EAC1B,MAAM,SAAS;EACf,IAAI,KAAK;EACT,MAAM,SAAS,OAAO,KAAK;CAC7B;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"findIcons.js","names":[],"sources":["../src/findIcons.ts"],"sourcesContent":["// Phosphor regular-weight glyphs as path data. Inline paths keep the icon font\n// (and its 4 MB of unused formats) out of every host's boot path.\nconst FIND_ICON_VIEW_BOX = '0 0 256 256'\n\nexport const FIND_ICONS = {\n caseSensitive: {\n name: 'text-a-underline',\n path: 'M60.59,175.24a8,8,0,0,0,10.65-3.83L87.9,136h80.2l16.66,35.41a8,8,0,1,0,14.48-6.82l-64-136a8,8,0,0,0-14.48,0l-64,136A8,8,0,0,0,60.59,175.24ZM128,50.79,160.57,120H95.43ZM224,216a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,216Z',\n },\n close: {\n name: 'x',\n path: 'M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z',\n },\n next: {\n name: 'caret-down',\n path: 'M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z',\n },\n preserveCase: {\n name: 'text-aa',\n path: 'M87.24,52.59a8,8,0,0,0-14.48,0l-64,136a8,8,0,1,0,14.48,6.81L39.9,160h80.2l16.66,35.4a8,8,0,1,0,14.48-6.81ZM47.43,144,80,74.79,112.57,144ZM200,96c-12.76,0-22.73,3.47-29.63,10.32a8,8,0,0,0,11.26,11.36c3.8-3.77,10-5.68,18.37-5.68,13.23,0,24,9,24,20v3.22A42.76,42.76,0,0,0,200,128c-22.06,0-40,16.15-40,36s17.94,36,40,36a42.73,42.73,0,0,0,24-7.25,8,8,0,0,0,16-.75V132C240,112.15,222.06,96,200,96Zm0,88c-13.23,0-24-9-24-20s10.77-20,24-20,24,9,24,20S213.23,184,200,184Z',\n },\n previous: {\n name: 'caret-up',\n path: 'M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z',\n },\n regex: {\n name: 'asterisk',\n path: 'M214.86,180.12a8,8,0,0,1-11,2.74L136,142.13V216a8,8,0,0,1-16,0V142.13L52.12,182.86a8,8,0,1,1-8.23-13.72L112.45,128,43.89,86.86a8,8,0,1,1,8.23-13.72L120,113.87V40a8,8,0,0,1,16,0v73.87l67.88-40.73a8,8,0,1,1,8.23,13.72L143.55,128l68.56,41.14A8,8,0,0,1,214.86,180.12Z',\n },\n replace: {\n name: 'swap',\n path: 'M224,48V152a16,16,0,0,1-16,16H99.31l10.35,10.34a8,8,0,0,1-11.32,11.32l-24-24a8,8,0,0,1,0-11.32l24-24a8,8,0,0,1,11.32,11.32L99.31,152H208V48H96v8a8,8,0,0,1-16,0V48A16,16,0,0,1,96,32H208A16,16,0,0,1,224,48ZM168,192a8,8,0,0,0-8,8v8H48V104H156.69l-10.35,10.34a8,8,0,0,0,11.32,11.32l24-24a8,8,0,0,0,0-11.32l-24-24a8,8,0,0,0-11.32,11.32L156.69,88H48a16,16,0,0,0-16,16V208a16,16,0,0,0,16,16H160a16,16,0,0,0,16-16v-8A8,8,0,0,0,168,192Z',\n },\n replaceAll: {\n name: 'arrows-clockwise',\n path: 'M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z',\n },\n replaceToggle: {\n name: 'caret-right',\n path: 'M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z',\n },\n scope: {\n name: 'selection',\n path: 'M152,40a8,8,0,0,1-8,8H112a8,8,0,0,1,0-16h32A8,8,0,0,1,152,40Zm-8,168H112a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16ZM208,32H184a8,8,0,0,0,0,16h24V72a8,8,0,0,0,16,0V48A16,16,0,0,0,208,32Zm8,72a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V112A8,8,0,0,0,216,104Zm0,72a8,8,0,0,0-8,8v24H184a8,8,0,0,0,0,16h24a16,16,0,0,0,16-16V184A8,8,0,0,0,216,176ZM40,152a8,8,0,0,0,8-8V112a8,8,0,0,0-16,0v32A8,8,0,0,0,40,152Zm32,56H48V184a8,8,0,0,0-16,0v24a16,16,0,0,0,16,16H72a8,8,0,0,0,0-16ZM72,32H48A16,16,0,0,0,32,48V72a8,8,0,0,0,16,0V48H72a8,8,0,0,0,0-16Z',\n },\n wholeWord: {\n name: 'textbox',\n path: 'M112,40a8,8,0,0,0-8,8V64H24A16,16,0,0,0,8,80v96a16,16,0,0,0,16,16h80v16a8,8,0,0,0,16,0V48A8,8,0,0,0,112,40ZM24,176V80h80v96ZM248,80v96a16,16,0,0,1-16,16H144a8,8,0,0,1,0-16h88V80H144a8,8,0,0,1,0-16h88A16,16,0,0,1,248,80ZM88,112a8,8,0,0,1-8,8H72v24a8,8,0,0,1-16,0V120H48a8,8,0,0,1,0-16H80A8,8,0,0,1,88,112Z',\n },\n} as const\n\nexport type FindIcon = (typeof FIND_ICONS)[keyof typeof FIND_ICONS]\n\nconst SVG_NAMESPACE = 'http://www.w3.org/2000/svg'\n\nexport function createFindIcon(document: Document, icon: FindIcon): SVGSVGElement {\n const svg = document.createElementNS(SVG_NAMESPACE, 'svg')\n svg.setAttribute('class', 'editor-find-icon')\n svg.setAttribute('viewBox', FIND_ICON_VIEW_BOX)\n svg.setAttribute('fill', 'currentColor')\n svg.setAttribute('aria-hidden', 'true')\n svg.dataset.icon = icon.name\n const path = document.createElementNS(SVG_NAMESPACE, 'path')\n path.setAttribute('d', icon.path)\n svg.appendChild(path)\n return svg\n}\n"],"mappings":";AAEA,IAAM,qBAAqB;AAE3B,IAAa,aAAa;CACxB,eAAe;EACb,MAAM;EACN,MAAM;CACR;CACA,OAAO;EACL,MAAM;EACN,MAAM;CACR;CACA,MAAM;EACJ,MAAM;EACN,MAAM;CACR;CACA,cAAc;EACZ,MAAM;EACN,MAAM;CACR;CACA,UAAU;EACR,MAAM;EACN,MAAM;CACR;CACA,OAAO;EACL,MAAM;EACN,MAAM;CACR;CACA,SAAS;EACP,MAAM;EACN,MAAM;CACR;CACA,YAAY;EACV,MAAM;EACN,MAAM;CACR;CACA,eAAe;EACb,MAAM;EACN,MAAM;CACR;CACA,OAAO;EACL,MAAM;EACN,MAAM;CACR;CACA,WAAW;EACT,MAAM;EACN,MAAM;CACR;AACF;AAIA,IAAM,gBAAgB;AAEtB,SAAgB,eAAe,UAAoB,MAA+B;CAChF,MAAM,MAAM,SAAS,gBAAgB,eAAe,KAAK;CACzD,IAAI,aAAa,SAAS,kBAAkB;CAC5C,IAAI,aAAa,WAAW,kBAAkB;CAC9C,IAAI,aAAa,QAAQ,cAAc;CACvC,IAAI,aAAa,eAAe,MAAM;CACtC,IAAI,QAAQ,OAAO,KAAK;CACxB,MAAM,OAAO,SAAS,gBAAgB,eAAe,MAAM;CAC3D,KAAK,aAAa,KAAK,KAAK,IAAI;CAChC,IAAI,YAAY,IAAI;CACpB,OAAO;AACT"}
1
+ {"version":3,"file":"findIcons.js","names":[],"sources":["../src/findIcons.ts"],"mappings":";AAEA,IAAM,qBAAqB;AAE3B,IAAa,aAAa;CACxB,eAAe;EACb,MAAM;EACN,MAAM;CACR;CACA,OAAO;EACL,MAAM;EACN,MAAM;CACR;CACA,MAAM;EACJ,MAAM;EACN,MAAM;CACR;CACA,cAAc;EACZ,MAAM;EACN,MAAM;CACR;CACA,UAAU;EACR,MAAM;EACN,MAAM;CACR;CACA,OAAO;EACL,MAAM;EACN,MAAM;CACR;CACA,SAAS;EACP,MAAM;EACN,MAAM;CACR;CACA,YAAY;EACV,MAAM;EACN,MAAM;CACR;CACA,eAAe;EACb,MAAM;EACN,MAAM;CACR;CACA,OAAO;EACL,MAAM;EACN,MAAM;CACR;CACA,WAAW;EACT,MAAM;EACN,MAAM;CACR;AACF;AAIA,IAAM,gBAAgB;AAEtB,SAAgB,eAAe,UAAoB,MAA+B;CAChF,MAAM,MAAM,SAAS,gBAAgB,eAAe,KAAK;CACzD,IAAI,aAAa,SAAS,kBAAkB;CAC5C,IAAI,aAAa,WAAW,kBAAkB;CAC9C,IAAI,aAAa,QAAQ,cAAc;CACvC,IAAI,aAAa,eAAe,MAAM;CACtC,IAAI,QAAQ,OAAO,KAAK;CACxB,MAAM,OAAO,SAAS,gBAAgB,eAAe,MAAM;CAC3D,KAAK,aAAa,KAAK,KAAK,IAAI;CAChC,IAAI,YAAY,IAAI;CACpB,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"findWidget.js","names":[],"sources":["../src/findWidget.ts"],"sourcesContent":["import './style.css'\nimport { createEditorWidgetKeymap } from '@singapore-editor/core/extensions'\nimport type {\n EditorViewContributionContext,\n EditorDisposable,\n} from '@singapore-editor/core/extensions'\nimport type { EditorFindWidgetState } from './findController'\nimport { createFindIcon, FIND_ICONS, type FindIcon } from './findIcons'\nimport { FIND_MATCHES_LIMIT } from './search'\n\nconst EDITOR_THEME_VARIABLES = [\n '--editor-background',\n '--editor-foreground',\n '--editor-caret-color',\n] as const\n\nexport type EditorFindWidgetOptions = {\n readonly registerKeymapNode?: EditorViewContributionContext['registerKeymapNode']\n readonly onSearchInput: (value: string) => void\n readonly onReplaceInput: (value: string) => void\n readonly onToggleReplace: () => void\n readonly onPrevious: () => void\n readonly onNext: () => void\n readonly onClose: () => void\n readonly onToggleCase: () => void\n readonly onToggleWholeWord: () => void\n readonly onToggleRegex: () => void\n readonly onToggleScope: () => void\n readonly onTogglePreserveCase: () => void\n readonly onReplaceOne: () => void\n readonly onReplaceAll: () => void\n}\n\nexport class EditorFindWidget {\n private readonly hotkeys: EditorDisposable[] = []\n private readonly root: HTMLDivElement\n private readonly findInput: HTMLInputElement\n private readonly replaceInput: HTMLInputElement\n private readonly replaceRow: HTMLDivElement\n private readonly count: HTMLSpanElement\n private readonly replaceToggleButton: HTMLButtonElement\n private readonly caseButton: HTMLButtonElement\n private readonly wordButton: HTMLButtonElement\n private readonly regexButton: HTMLButtonElement\n private readonly scopeButton: HTMLButtonElement\n private readonly preserveButton: HTMLButtonElement\n\n public constructor(\n container: HTMLElement,\n private readonly themeSource: HTMLElement,\n private readonly options: EditorFindWidgetOptions,\n ) {\n const document = container.ownerDocument\n const position = container.ownerDocument.defaultView?.getComputedStyle(container).position\n if (!position || position === 'static') container.style.position = 'relative'\n this.root = document.createElement('div')\n this.findInput = document.createElement('input')\n this.replaceInput = document.createElement('input')\n this.replaceRow = document.createElement('div')\n this.count = document.createElement('span')\n this.replaceToggleButton = createFindButton(\n document,\n FIND_ICONS.replaceToggle,\n 'Toggle Replace',\n )\n this.replaceToggleButton.classList.add('editor-find-replace-toggle')\n this.caseButton = createFindButton(document, FIND_ICONS.caseSensitive, 'Match Case')\n this.wordButton = createFindButton(document, FIND_ICONS.wholeWord, 'Whole Word')\n this.regexButton = createFindButton(document, FIND_ICONS.regex, 'Use Regular Expression')\n this.scopeButton = createFindButton(document, FIND_ICONS.scope, 'Find in Selection')\n this.preserveButton = createFindButton(document, FIND_ICONS.preserveCase, 'Preserve Case')\n this.build(document)\n container.appendChild(this.root)\n }\n\n public show(replaceVisible: boolean): void {\n syncEditorThemeVariables(this.root, this.themeSource)\n this.root.hidden = false\n this.replaceRow.hidden = !replaceVisible\n }\n\n public hide(): void {\n this.root.hidden = true\n }\n\n // The stylesheet anchors the widget a fixed inset from the container's\n // trailing edge, which is also where a minimap parks. Margin keeps that inset\n // authoritative and shifts the whole widget inboard of the claimed strip.\n public setTrailingInset(width: number): void {\n this.root.style.marginRight = width > 0 ? `${Math.ceil(width)}px` : ''\n }\n\n public update(state: EditorFindWidgetState): void {\n syncEditorThemeVariables(this.root, this.themeSource)\n if (this.findInput.value !== state.searchString) this.findInput.value = state.searchString\n if (this.replaceInput.value !== state.replaceString)\n this.replaceInput.value = state.replaceString\n this.replaceRow.hidden = !state.replaceRevealed\n setToggleExpanded(this.replaceToggleButton, state.replaceRevealed, 'Replace')\n this.count.textContent = resultCountText(state.matchesPosition, state.matchesCount)\n this.count.title = state.highlightsTruncated\n ? TRUNCATED_HIGHLIGHTS_TITLE\n : this.count.textContent\n setTogglePressed(this.caseButton, state.matchCase, 'Match Case')\n setTogglePressed(this.wordButton, state.wholeWord, 'Match Whole Word')\n setTogglePressed(this.regexButton, state.isRegex, 'Use Regular Expression')\n setTogglePressed(this.scopeButton, state.inSelection, 'Find in Selection')\n setTogglePressed(this.preserveButton, state.preserveCase, 'Preserve Case')\n }\n\n public focusFindInput(): void {\n this.findInput.focus()\n this.findInput.select()\n }\n\n public focusReplaceInput(): void {\n this.replaceInput.focus()\n this.replaceInput.select()\n }\n\n public dispose(): void {\n for (const registration of this.hotkeys) registration.dispose()\n this.root.remove()\n }\n\n private build(document: Document): void {\n this.root.className = 'editor-find-widget'\n this.root.hidden = true\n // Layer from the editor's shared stacking scale so the widget keeps its\n // place as other surfaces claim tiers; the literal is the standalone\n // fallback for hosts that ship this stylesheet without the editor's.\n this.root.style.zIndex = 'var(--editor-z-overlay-widget, 20)'\n this.findInput.className = 'editor-find-input'\n this.findInput.type = 'text'\n this.findInput.placeholder = 'Find'\n this.findInput.title = 'Find'\n this.findInput.spellcheck = false\n this.findInput.autocomplete = 'off'\n this.findInput.setAttribute('aria-label', 'Find')\n this.replaceInput.className = 'editor-find-input editor-find-input-standalone'\n this.replaceInput.type = 'text'\n this.replaceInput.placeholder = 'Replace'\n this.replaceInput.title = 'Replace'\n this.replaceInput.spellcheck = false\n this.replaceInput.autocomplete = 'off'\n this.replaceInput.setAttribute('aria-label', 'Replace')\n this.replaceRow.className = 'editor-find-row editor-find-replace-row'\n this.count.className = 'editor-find-count'\n\n this.root.append(this.findRow(document), this.replaceRow)\n this.installHandlers()\n }\n\n private findRow(document: Document): HTMLDivElement {\n const row = document.createElement('div')\n row.className = 'editor-find-row'\n row.append(\n this.replaceToggleButton,\n this.findInputFrame(document),\n this.count,\n this.scopeButton,\n createFindButton(document, FIND_ICONS.previous, 'Previous Match', this.options.onPrevious),\n createFindButton(document, FIND_ICONS.next, 'Next Match', this.options.onNext),\n createFindButton(document, FIND_ICONS.close, 'Close', this.options.onClose),\n )\n this.replaceRow.append(\n this.replaceInput,\n this.preserveButton,\n createFindButton(document, FIND_ICONS.replace, 'Replace', this.options.onReplaceOne),\n createFindButton(document, FIND_ICONS.replaceAll, 'Replace All', this.options.onReplaceAll),\n )\n return row\n }\n\n private findInputFrame(document: Document): HTMLDivElement {\n const frame = document.createElement('div')\n const controls = document.createElement('div')\n frame.className = 'editor-find-input-frame'\n controls.className = 'editor-find-input-controls'\n controls.append(this.caseButton, this.wordButton, this.regexButton)\n frame.append(this.findInput, controls)\n return frame\n }\n\n private installHandlers(): void {\n const standalone = this.options.registerKeymapNode ? null : createEditorWidgetKeymap(this.root)\n if (standalone) this.hotkeys.push(standalone)\n const register = this.options.registerKeymapNode ?? standalone?.registerKeymapNode\n if (register) {\n const commands = {\n closeFind: () => this.options.onClose(),\n findNext: () => this.options.onNext(),\n findPrevious: () => this.options.onPrevious(),\n replaceOne: () => this.options.onReplaceOne(),\n }\n this.hotkeys.push(\n register({ element: this.root, context: 'EditorWidget FindWidget', commands }),\n )\n this.hotkeys.push(\n register({\n element: this.replaceInput,\n context: 'EditorWidget FindWidget ReplaceInput',\n commands,\n }),\n )\n }\n this.findInput.addEventListener('input', () => this.options.onSearchInput(this.findInput.value))\n this.replaceInput.addEventListener('input', () =>\n this.options.onReplaceInput(this.replaceInput.value),\n )\n this.caseButton.addEventListener('click', this.options.onToggleCase)\n this.wordButton.addEventListener('click', this.options.onToggleWholeWord)\n this.regexButton.addEventListener('click', this.options.onToggleRegex)\n this.replaceToggleButton.addEventListener('click', this.options.onToggleReplace)\n this.scopeButton.addEventListener('click', this.options.onToggleScope)\n this.preserveButton.addEventListener('click', this.options.onTogglePreserveCase)\n }\n}\n\nfunction createFindButton(\n document: Document,\n icon: FindIcon,\n title: string,\n onClick?: () => void,\n): HTMLButtonElement {\n const button = document.createElement('button')\n button.type = 'button'\n button.className = 'editor-find-button'\n button.appendChild(createFindIcon(document, icon))\n setNativeTooltip(button, title)\n if (onClick) button.addEventListener('click', onClick)\n return button\n}\n\nfunction syncEditorThemeVariables(target: HTMLElement, source: HTMLElement): void {\n const style = source.ownerDocument.defaultView?.getComputedStyle(source)\n if (!style) return\n\n for (const variable of EDITOR_THEME_VARIABLES) {\n const value =\n source.style.getPropertyValue(variable).trim() || style.getPropertyValue(variable).trim()\n if (value) target.style.setProperty(variable, value)\n }\n}\n\nfunction setTogglePressed(button: HTMLButtonElement, pressed: boolean, label: string): void {\n button.classList.toggle('active', pressed)\n button.setAttribute('aria-pressed', pressed ? 'true' : 'false')\n setNativeTooltip(button, toggleTooltip(label, pressed))\n}\n\nfunction setToggleExpanded(button: HTMLButtonElement, expanded: boolean, label: string): void {\n button.classList.toggle('active', expanded)\n button.setAttribute('aria-expanded', expanded ? 'true' : 'false')\n setNativeTooltip(button, expanded ? `Hide ${label}` : `Show ${label}`)\n}\n\nfunction setNativeTooltip(element: HTMLElement, value: string): void {\n element.title = value\n element.setAttribute('aria-label', value)\n}\n\nfunction toggleTooltip(label: string, active: boolean): string {\n return active ? `${label} (On)` : `${label} (Off)`\n}\n\nfunction resultCountText(position: number, count: number): string {\n if (count === 0) return 'No results'\n return `${position || '?'} of ${count}`\n}\n\n// The count is exact; what stops at the cap is the painting, and saying so is the\n// only sign a reader gets that an unpainted match further down is still a match.\nconst TRUNCATED_HIGHLIGHTS_TITLE = `Only the first ${FIND_MATCHES_LIMIT} results are highlighted. Every result is counted, and Find Next, Replace All and Select All Matches cover the entire text.`\n"],"mappings":";;;;;AAUA,IAAM,yBAAyB;CAC7B;CACA;CACA;AACF;AAmBA,IAAa,mBAAb,MAA8B;CAgBT;CACA;CAhBnB,UAA+C,CAAC;CAChD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,YACE,WACA,aACA,SACA;EAFiB,KAAA,cAAA;EACA,KAAA,UAAA;EAEjB,MAAM,WAAW,UAAU;EAC3B,MAAM,WAAW,UAAU,cAAc,aAAa,iBAAiB,SAAS,CAAC,CAAC;EAClF,IAAI,CAAC,YAAY,aAAa,UAAU,UAAU,MAAM,WAAW;EACnE,KAAK,OAAO,SAAS,cAAc,KAAK;EACxC,KAAK,YAAY,SAAS,cAAc,OAAO;EAC/C,KAAK,eAAe,SAAS,cAAc,OAAO;EAClD,KAAK,aAAa,SAAS,cAAc,KAAK;EAC9C,KAAK,QAAQ,SAAS,cAAc,MAAM;EAC1C,KAAK,sBAAsB,iBACzB,UACA,WAAW,eACX,gBACF;EACA,KAAK,oBAAoB,UAAU,IAAI,4BAA4B;EACnE,KAA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qB,QAA2B;CAChF,MAAM,QAAQ,OAAO,cAAc,aAAa,iBAAiB,MAAM;CACvE,IAAI,CAAC,OAAO;CAEZ,KAAK,MAAM,YAAY,wBAAwB;EAC7C,MAAM,QACJ,OAAO,MAAM,iBAAiB,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM,iBAAiB,QAAQ,CAAC,CAAC,KAAK;EAC1F,IAAI,OAAO,OAAO,MAAM,YAAY,UAAU,KAAK;CACrD;AACF;AAEA,SAAS,iBAAiB,QAA2B,SAAkB,OAAqB;CAC1F,OAAO,UAAU,OAAO,UAAU,OAAO;CACzC,OAAO,aAAa,gBAAgB,UAAU,SAAS,OAAO;CAC9D,iBAAiB,QAAQ,cAAc,OAAO,OAAO,CAAC;AACxD;AAEA,SAAS,kBAAkB,QAA2B,UAAmB,OAAqB;CAC5F,OAAO,UAAU,OAAO,UAAU,QAAQ;CAC1C,OAAO,aAAa,iBAAiB,WAAW,SAAS,OAAO;CAChE,iBAAiB,QAAQ,WAAW,QAAQ,UAAU,QAAQ,OAAO;AACvE;AAEA,SAAS,iBAAiB,SAAsB,OAAqB;CACnE,QAAQ,QAAQ;CAChB,QAAQ,aAAa,cAAc,KAAK;AAC1C;AAEA,SAAS,cAAc,OAAe,QAAyB;CAC7D,OAAO,SAAS,GAAG,MAAM,SAAS,GAAG,MAAM;AAC7C;AAEA,SAAS,gBAAgB,UAAkB,OAAuB;CAChE,IAAI,UAAU,GAAG,OAAO;CACxB,OAAO,GAAG,YAAY,IAAI,MAAM;AAClC;AAIA,IAAM,6BAA6B,kBAAkB,mBAAmB"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","names":[],"sources":["../src/plugin.ts"],"sourcesContent":["import { compareTextOffsetRanges, type DocumentSyncPoint } from '@singapore-editor/core/document'\nimport {\n type EditorContributionChange,\n projectDecorationRangeThroughEdits,\n} from '@singapore-editor/core/extensions'\nimport type {\n EditorCapabilityContribution,\n EditorCapabilityContributionContext,\n EditorCapabilityContributionProvider,\n EditorCommandContribution,\n EditorCommandContributionContext,\n EditorCommandContributionProvider,\n EditorDisposable,\n EditorEditContribution,\n EditorEditContributionContext,\n EditorEditContributionProvider,\n EditorFindFeature,\n EditorMinimapDecoration,\n EditorMinimapFeature,\n EditorPlugin,\n EditorResolvedSelection,\n EditorViewContribution,\n EditorViewContributionContext,\n EditorViewContributionProvider,\n EditorViewContributionUpdateKind,\n EditorViewSnapshot,\n} from '@singapore-editor/core/extensions'\nimport {\n EDITOR_FIND_FEATURE,\n EDITOR_FIND_FEATURE_ID,\n EDITOR_MINIMAP_FEATURE,\n} from '@singapore-editor/core/extensions'\nimport type { VirtualizedTextHighlightStyle } from '@singapore-editor/core/rendering'\nimport {\n EditorFindController,\n type EditorFindHost,\n type EditorFindResolvedSelection,\n type EditorFindUiEvent,\n type FindTrackedRanges,\n} from './findController'\nimport { EditorFindWidget, type EditorFindWidgetOptions } from './findWidget'\nimport { type FindLineStartsView, type FindRange, type FindTextSource } from './search'\nimport type { EditorFindOptions } from './types'\n\nexport { EDITOR_FIND_FEATURE, EDITOR_FIND_FEATURE_ID }\n\nexport type EditorFindContributionProviders = {\n readonly view: EditorViewContributionProvider\n readonly command: EditorCommandContributionProvider\n readonly capability: EditorCapabilityContributionProvider\n readonly edit: EditorEditContributionProvider\n}\n\nexport function createEditorFindPlugin(options: EditorFindOptions = {}): EditorPlugin {\n return {\n name: 'editor.find',\n activate(context) {\n const providers = createEditorFindContributionProviders(options)\n return [\n context.registerViewContribution(providers.view),\n context.registerCommandContribution(providers.command),\n context.registerCapabilityContribution(providers.capability),\n context.registerEditContribution(providers.edit),\n ]\n },\n }\n}\n\nexport function createEditorFindContributionProviders(\n options: EditorFindOptions = {},\n): EditorFindContributionProviders {\n const controller = new EditorFindController(options)\n return {\n view: {\n createContribution: (context) => new EditorFindViewContribution(context, controller),\n },\n command: {\n createContribution: (context) => new EditorFindCommandContribution(context, controller),\n },\n capability: {\n createContribution: (context) => new EditorFindCapabilityContribution(context, controller),\n },\n edit: {\n createContribution: (context) => new EditorFindEditContribution(context, controller),\n },\n }\n}\n\nclass EditorFindViewContribution implements EditorViewContribution {\n private readonly hostRegistration: EditorDisposable\n private readonly subscription: EditorDisposable\n private readonly visibleKey: EditorDisposable\n private latestSnapshot: EditorViewSnapshot\n private widget: EditorFindWidget | null = null\n private reservationListener: EditorDisposable | null = null\n private paintedMatches: PaintedFindRanges | null = null\n\n public constructor(\n private readonly context: EditorViewContributionContext,\n private readonly controller: EditorFindController,\n ) {\n this.latestSnapshot = context.getSnapshot()\n this.hostRegistration = controller.attachHost(\n createFindHost(context, () => this.latestSnapshot, this.trackPaintedRanges),\n context.highlightPrefix,\n )\n this.subscription = controller.subscribe(this.handleUiEvent)\n this.visibleKey = context.registerKeymapContextKey('findVisible', () => controller.isVisible())\n }\n\n public update(\n snapshot: EditorViewSnapshot,\n kind: EditorViewContributionUpdateKind,\n change?: EditorContributionChange | null,\n ): void {\n if (\n kind === 'layout' ||\n snapshot.viewport.clientWidth !== this.latestSnapshot.viewport.clientWidth\n ) {\n this.syncTrailingInset()\n }\n this.latestSnapshot = snapshot\n // Scrolling is the one thing that moves rows under the marks without an edit\n // having happened yet, which is the only moment left to start following the\n // ones it brought in front of the reader.\n // Re-read after the line moves, not only after an edit: the set the controller is painting was\n // copied out of these ranges, so a match promoted into the mounted rows by the scroll is still\n // at the offset it was found at until the copy is taken again.\n if (kind === 'viewport' || kind === 'layout') {\n if (this.paintedMatches?.repartition(snapshot)) this.controller.refreshTrackedMatches()\n }\n this.controller.handleViewUpdate(kind, change ?? null)\n }\n\n public dispose(): void {\n this.visibleKey.dispose()\n this.subscription.dispose()\n this.reservationListener?.dispose()\n this.reservationListener = null\n this.widget?.dispose()\n this.widget = null\n this.paintedMatches = null\n this.hostRegistration.dispose()\n }\n\n private readonly trackPaintedRanges = (ranges: readonly FindRange[]): FindTrackedRanges => {\n this.paintedMatches = new PaintedFindRanges(this.context, this.latestSnapshot, ranges)\n return this.paintedMatches\n }\n\n private readonly handleUiEvent = (event: EditorFindUiEvent): void => {\n if (event.type === 'show') {\n this.ensureWidget().show(event.replaceVisible)\n return\n }\n\n if (event.type === 'hide') {\n this.widget?.hide()\n // Nothing reads the set once it is off screen, so leaving it here would\n // have every scroll from now on redraw a line across it for nobody.\n this.paintedMatches = null\n return\n }\n\n if (event.type === 'update') {\n this.widget?.update(event.state)\n return\n }\n\n this.focusWidget(event.target)\n }\n\n private focusWidget(target: 'find' | 'replace'): void {\n const widget = this.widget\n if (!widget) return\n\n if (target === 'find') widget.focusFindInput()\n if (target === 'replace') widget.focusReplaceInput()\n }\n\n private ensureWidget(): EditorFindWidget {\n if (this.widget) return this.widget\n\n this.widget = new EditorFindWidget(\n this.context.container,\n this.context.scrollElement,\n this.createWidgetOptions(),\n )\n this.observeReservedWidth()\n this.syncTrailingInset()\n return this.widget\n }\n\n private observeReservedWidth(): void {\n this.reservationListener ??= this.context.onDidChangeReservedOverlayWidth((side) => {\n if (side === 'right') this.syncTrailingInset()\n })\n }\n\n private syncTrailingInset(): void {\n if (!this.widget) return\n\n const { container, scrollElement } = this.context\n const containerRight =\n container.getBoundingClientRect().left + container.clientLeft + container.clientWidth\n const viewportRight =\n scrollElement.getBoundingClientRect().left +\n scrollElement.clientLeft +\n scrollElement.clientWidth\n const reservedWidth = this.context.getReservedOverlayWidth('right')\n this.widget.setTrailingInset(reservedWidth + Math.max(0, containerRight - viewportRight))\n }\n\n private createWidgetOptions(): EditorFindWidgetOptions {\n return {\n registerKeymapNode: (options) => this.context.registerKeymapNode(options),\n onSearchInput: (value) => this.controller.setSearchString(value),\n onReplaceInput: (value) => this.controller.setReplaceString(value),\n onToggleReplace: () => this.controller.toggleReplace(),\n onPrevious: () => this.controller.findPrevious(),\n onNext: () => this.controller.findNext(),\n onClose: () => this.controller.close(),\n onToggleCase: () => this.controller.toggleMatchCase(),\n onToggleWholeWord: () => this.controller.toggleWholeWord(),\n onToggleRegex: () => this.controller.toggleRegex(),\n onToggleScope: () => this.controller.toggleFindInSelection(),\n onTogglePreserveCase: () => this.controller.togglePreserveCase(),\n onReplaceOne: () => this.controller.replaceOne(),\n onReplaceAll: () => this.controller.replaceAll(),\n }\n }\n}\n\nclass EditorFindCommandContribution implements EditorCommandContribution {\n private readonly commands: readonly EditorDisposable[]\n\n public constructor(context: EditorCommandContributionContext, controller: EditorFindController) {\n this.commands = [\n context.registerCommand('find', () => controller.toggleFind()),\n context.registerCommand('findReplace', () => controller.openFindReplace()),\n context.registerCommand('findNext', () => controller.findNext()),\n context.registerCommand('findPrevious', () => controller.findPrevious()),\n context.registerCommand('closeFind', () => controller.close()),\n context.registerCommand('toggleFindCaseSensitive', () => controller.toggleMatchCase()),\n context.registerCommand('toggleFindWholeWord', () => controller.toggleWholeWord()),\n context.registerCommand('toggleFindRegex', () => controller.toggleRegex()),\n context.registerCommand('toggleFindInSelection', () => controller.toggleFindInSelection()),\n context.registerCommand('togglePreserveCase', () => controller.togglePreserveCase()),\n context.registerCommand('replaceOne', () => controller.replaceOne()),\n context.registerCommand('replaceAll', () => controller.replaceAll()),\n context.registerCommand('selectAllMatches', () => controller.selectAllMatches()),\n ]\n }\n\n public dispose(): void {\n disposeAll(this.commands)\n }\n}\n\nclass EditorFindCapabilityContribution implements EditorCapabilityContribution {\n private readonly registration: EditorDisposable\n\n public constructor(\n context: EditorCapabilityContributionContext,\n controller: EditorFindController,\n ) {\n this.registration = context.registerFeature(EDITOR_FIND_FEATURE, createFindFeature(controller))\n }\n\n public dispose(): void {\n this.registration.dispose()\n }\n}\n\nclass EditorFindEditContribution implements EditorEditContribution {\n private readonly registration: EditorDisposable\n\n public constructor(context: EditorEditContributionContext, controller: EditorFindController) {\n this.registration = controller.attachEditHost({\n textSnapshot: () => context.getCurrentDocumentSnapshot()?.textSnapshot ?? null,\n getSelections: () => findSelections(context.getSelections()),\n applyEdits: (edits, timingName, selection) =>\n context.applyEdits(edits, timingName, selection),\n })\n }\n\n public dispose(): void {\n this.registration.dispose()\n }\n}\n\nfunction createFindFeature(controller: EditorFindController): EditorFindFeature {\n return {\n openFind: () => controller.openFind(),\n toggleFind: () => controller.toggleFind(),\n openFindReplace: () => controller.openFindReplace(),\n closeFind: () => controller.close(),\n findNext: () => controller.findNext(),\n findPrevious: () => controller.findPrevious(),\n replaceOne: () => controller.replaceOne(),\n replaceAll: () => controller.replaceAll(),\n selectAllMatches: () => controller.selectAllMatches(),\n }\n}\n\nfunction createFindHost(\n context: EditorViewContributionContext,\n getSnapshot: () => EditorViewSnapshot,\n trackPaintedRanges: (ranges: readonly FindRange[]) => FindTrackedRanges,\n): EditorFindHost {\n const textSource = snapshotTextSource()\n return {\n hasDocument: () => context.hasDocument(),\n textSource: () => textSource(getSnapshot()),\n hasTextSnapshot: (snapshot) => getSnapshot().textSnapshot === snapshot,\n trackRanges: (ranges) => context.trackRanges(ranges),\n trackPaintedRanges,\n getSelections: () => findSelections(getSnapshot().selections),\n focusEditor: () => context.focusEditor(),\n announce: (message) => context.announce(message),\n setSelection: (anchor, head, timingName, options) =>\n context.setSelection(anchor, head, timingName, options),\n setSelections: (selections, timingName, revealOffset) =>\n context.setSelections(selections, timingName, revealOffset),\n setRangeHighlight: (name, ranges, style) => {\n context.setRangeHighlight(name, ranges, style)\n minimapFeature(context)?.setDecorations(\n name,\n minimapBands(textSource(getSnapshot()).lineStartsView, ranges, style),\n )\n },\n clearRangeHighlight: (name) => {\n context.clearRangeHighlight(name)\n minimapFeature(context)?.clearDecorations(name)\n },\n }\n}\n\nfunction minimapFeature(context: EditorViewContributionContext): EditorMinimapFeature | null {\n return context.getFeature(EDITOR_MINIMAP_FEATURE)\n}\n\n/**\n * A count says how many matches there are and nothing says where they are until\n * they reach the scroll furniture, so every group find paints in the text is\n * published under the name it is painted under.\n *\n * The band keeps its group's own colour: the minimap paints onto a canvas from a\n * worker, which has no element to resolve a registered colour against and\n * silently substitutes the selection colour for anything it cannot parse, so the\n * literal has to travel with the group rather than be looked up there.\n */\nfunction minimapBands(\n lineStartsView: FindLineStartsView,\n ranges: readonly FindRange[],\n style: VirtualizedTextHighlightStyle,\n): readonly EditorMinimapDecoration[] {\n return ranges.map((range): EditorMinimapDecoration => {\n const rows = bandRows(lineStartsView, range)\n return {\n startLineNumber: rows.start,\n startColumn: 1,\n endLineNumber: rows.end,\n endColumn: 1,\n color: style.backgroundColor,\n position: 'inline',\n zIndex: style.zIndex,\n }\n })\n}\n\n// A range ending exactly at a line start ends on the row before it: the break\n// belongs to the line it terminates, and a selection taken to the end of one row\n// should not shade the next.\nfunction bandRows(\n lineStartsView: FindLineStartsView,\n range: FindRange,\n): { readonly start: number; readonly end: number } {\n const startIndex = lineStartsView.indexForOffset(range.start)\n const endIndex = lineStartsView.indexForOffset(range.end)\n if (endIndex > startIndex && lineStartsView.at(endIndex) === range.end) {\n return { start: startIndex + 1, end: endIndex }\n }\n\n return { start: startIndex + 1, end: endIndex + 1 }\n}\n\n/**\n * Follows the ranges as far as they are painted, answering for the rest with the\n * offsets it was handed.\n *\n * A span the reader cannot see cannot be seen standing on text that moved out\n * from under it, and the re-search already on its way replaces the whole set\n * either way. Handing the document every match instead costs it an anchor pair\n * each, on every keystroke — the bill deferring that re-search was supposed to\n * take off the keystroke in the first place.\n *\n * Which of them those are is a fact about the rows mounted at the time and not\n * about the set, so it stops being true the moment the reader scrolls. Drawn once\n * and left, the line would divide the screenful they have scrolled away from,\n * and every mark now in front of them would be one nobody is following.\n */\n// A match is the text the query answered for, so typing against either edge of one is not part of\n// it — unlike a scope, which is a region the reader drew and which takes in what they add at its\n// edges. The same pair decides how an offset is carried across an edit nobody was following.\nconst MATCH_BIAS = { startBias: 'right', endBias: 'left' } as const\n\nclass PaintedFindRanges implements FindTrackedRanges {\n private span: FindRange | null = null\n private tracked: FindTrackedRanges | null = null\n private elsewhere: readonly FindRange[]\n /** Text version the offsets in `elsewhere` describe, which is not always the document's. */\n private elsewhereVersion: number\n private elsewhereSyncPoint: DocumentSyncPoint\n\n public constructor(\n private readonly context: EditorViewContributionContext,\n snapshot: EditorViewSnapshot,\n ranges: readonly FindRange[],\n ) {\n this.elsewhere = ranges\n this.elsewhereVersion = snapshot.textVersion\n this.elsewhereSyncPoint = snapshot.documentSyncPoint\n this.partition(snapshot)\n }\n\n public resolve(): readonly FindRange[] {\n if (!this.tracked) return this.elsewhere\n return mergeRanges(this.tracked.resolve(), this.elsewhere)\n }\n\n /** Answers whether the line moved, so a caller only re-reads the set when there is a reason to. */\n public repartition(snapshot: EditorViewSnapshot): boolean {\n return this.partition(snapshot)\n }\n\n private partition(snapshot: EditorViewSnapshot): boolean {\n const span = paintedSpan(snapshot)\n if (!span || sameSpan(span, this.span)) return false\n\n // Read back first: what is already followed has moved since it was handed\n // over, and re-partitioning the offsets of the search would undo that.\n this.carryElsewhereForward(snapshot)\n const ranges = this.resolve()\n const painted = ranges.filter((range) => overlapsSpan(range, span))\n const tracked = painted.length === 0 ? null : this.context.trackRanges(painted, MATCH_BIAS)\n\n this.span = span\n this.tracked = tracked\n this.elsewhere = tracked ? ranges.filter((range) => !overlapsSpan(range, span)) : ranges\n this.elsewhereVersion = snapshot.textVersion\n this.elsewhereSyncPoint = snapshot.documentSyncPoint\n return true\n }\n\n /**\n * Brings the unfollowed half up to the document before any of it is promoted.\n *\n * Nothing follows a match the reader cannot see, so an edit that lands while they are looking\n * elsewhere leaves those offsets describing text that has moved. Scrolling then hands one of them\n * to the document to be followed from where it used to be, and the mark lands beside its word —\n * the defect being followed at all was supposed to prevent, arriving one scroll later. The edits\n * are replayed where the host can name them, and where it cannot the offsets are dropped rather\n * than promoted: no mark is the honest answer for the moment before the re-search lands, and a\n * mark on the wrong word is not.\n */\n private carryElsewhereForward(snapshot: EditorViewSnapshot): void {\n if (snapshot.textVersion === this.elsewhereVersion) return\n if (this.elsewhere.length === 0) {\n this.elsewhereVersion = snapshot.textVersion\n this.elsewhereSyncPoint = snapshot.documentSyncPoint\n return\n }\n\n const edits =\n snapshot.changesSinceDocumentSyncPoint(this.elsewhereSyncPoint, null)?.edits ?? null\n this.elsewhere = edits\n ? this.elsewhere\n .map((range) => projectDecorationRangeThroughEdits({ ...range, ...MATCH_BIAS }, edits))\n .filter((range) => range !== null)\n .map((range) => ({ end: range.end, start: range.start }))\n : []\n this.elsewhereVersion = snapshot.textVersion\n this.elsewhereSyncPoint = snapshot.documentSyncPoint\n }\n}\n\n// The view adds a range highlight to the rows it has mounted and to no others.\nfunction paintedSpan(snapshot: EditorViewSnapshot): FindRange | null {\n const first = snapshot.visibleRows[0]\n const last = snapshot.visibleRows.at(-1)\n if (!first || !last) return null\n\n return { start: first.startOffset, end: last.endOffset }\n}\n\nfunction overlapsSpan(range: FindRange, span: FindRange): boolean {\n return range.end > span.start && range.start < span.end\n}\n\nfunction sameSpan(span: FindRange, other: FindRange | null): boolean {\n return other !== null && span.start === other.start && span.end === other.end\n}\n\n// Navigation steps the set rather than searching it, so an entry out of order\n// answers the next press with the wrong match.\nfunction mergeRanges(\n left: readonly FindRange[],\n right: readonly FindRange[],\n): readonly FindRange[] {\n if (right.length === 0) return left\n\n const merged: FindRange[] = []\n let leftIndex = 0\n let rightIndex = 0\n while (leftIndex < left.length && rightIndex < right.length) {\n if (compareTextOffsetRanges(left[leftIndex]!, right[rightIndex]!) <= 0) {\n merged.push(left[leftIndex]!)\n leftIndex += 1\n continue\n }\n\n merged.push(right[rightIndex]!)\n rightIndex += 1\n }\n\n for (; leftIndex < left.length; leftIndex += 1) merged.push(left[leftIndex]!)\n for (; rightIndex < right.length; rightIndex += 1) merged.push(right[rightIndex]!)\n return merged\n}\n\n/**\n * The text a search reads, kept for as long as the snapshot it was taken from.\n *\n * Either view can be absent, and standing in for a missing one materializes what\n * it exists to avoid: a copy of the document, or the whole line-start array.\n * Every press in the find box searches again, so a stand-in built per search\n * would hand a keystroke exactly the bill that ranged reads are here to spare it.\n * Held against the snapshot itself rather than its text version, because a\n * document swap can carry that version across unchanged.\n */\nfunction snapshotTextSource(): (snapshot: EditorViewSnapshot) => FindTextSource {\n let cached: { readonly snapshot: EditorViewSnapshot; readonly source: FindTextSource } | null =\n null\n return (snapshot) => {\n if (cached?.snapshot !== snapshot) cached = { snapshot, source: findTextSource(snapshot) }\n return cached.source\n }\n}\n\nfunction findTextSource(snapshot: EditorViewSnapshot): FindTextSource {\n const text = snapshot.textSnapshot\n return {\n length: text.length,\n readRange: (start, end) => text.readRange(start, end),\n lineStartsView: snapshot.lineStartsView,\n }\n}\n\nfunction findSelections(\n selections: readonly EditorResolvedSelection[],\n): readonly EditorFindResolvedSelection[] {\n return selections.map((selection) => ({\n ...selection,\n collapsed: selection.startOffset === selection.endOffset,\n }))\n}\n\nfunction disposeAll(disposables: readonly EditorDisposable[]): void {\n for (const disposable of disposables.toReversed()) disposable.dispose()\n}\n\nexport type { EditorFindFeature, EditorFindOptions }\n"],"mappings":";;;;;AAqDA,SAAgB,uBAAuB,UAA6B,CAAC,GAAiB;CACpF,OAAO;EACL,MAAM;EACN,SAAS,SAAS;GAChB,MAAM,YAAY,sCAAsC,OAAO;GAC/D,OAAO;IACL,QAAQ,yBAAyB,UAAU,IAAI;IAC/C,QAAQ,4BAA4B,UAAU,OAAO;IACrD,QAAQ,+BAA+B,UAAU,UAAU;IAC3D,QAAQ,yBAAyB,UAAU,IAAI;GACjD;EACF;CACF;AACF;AAEA,SAAgB,sCACd,UAA6B,CAAC,GACG;CACjC,MAAM,aAAa,IAAI,qBAAqB,OAAO;CACnD,OAAO;EACL,MAAM,EACJ,qBAAqB,YAAY,IAAI,2BAA2B,SAAS,UAAU,EACrF;EACA,SAAS,EACP,qBAAqB,YAAY,IAAI,8BAA8B,SAAS,UAAU,EACxF;EACA,YAAY,EACV,qBAAqB,YAAY,IAAI,iCAAiC,SAAS,UAAU,EAC3F;EACA,MAAM,EACJ,qBAAqB,YAAY,IAAI,2BAA2B,SAAS,UAAU,EACrF;CACF;AACF;AAEA,IAAM,6BAAN,MAAmE;CAU9C;CACA;CAVnB;CACA;CACA;CACA;CACA,SAA0C;CAC1C,sBAAuD;CACvD,iBAAmD;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,IAAI,SACF;CACF,QAAQ,aAAa;EACnB,IAAI,QAAQ,aAAa,UAAU,SAAS;GAAE;GAAU,QAAQ,eAAe,QAAQ;EAAE;EACzF,OAAO,OAAO;CAChB;AACF;AAEA,SAAS,eAAe,UAA8C;CACpE,MAAM,OAAO,SAAS;CACtB,OAAO;EACL,QAAQ,KAAK;EACb,YAAY,OAAO,QAAQ,KAAK,UAAU,OAAO,GAAG;EACpD,gBAAgB,SAAS;CAC3B;AACF;AAEA,SAAS,eACP,YACwC;CACxC,OAAO,WAAW,KAAK,eAAe;EACpC,GAAG;EACH,WAAW,UAAU,gBAAgB,UAAU;CACjD,EAAE;AACJ;AAEA,SAAS,WAAW,aAAgD;CAClE,KAAK,MAAM,cAAc,YAAY,WAAW,GAAG,WAAW,QAAQ;AACxE"}
@@ -1 +1 @@
1
- {"version":3,"file":"replacePattern.js","names":[],"sources":["../src/replacePattern.ts"],"sourcesContent":["export class ReplacePattern {\n public static fromStaticValue(value: string): ReplacePattern {\n return new ReplacePattern([{ kind: 'static', value }])\n }\n\n public readonly hasReplacementPatterns: boolean\n\n public constructor(private readonly pieces: readonly ReplacePiece[]) {\n this.hasReplacementPatterns = pieces.some((piece) => piece.kind !== 'static')\n }\n\n public buildReplaceString(matches: readonly string[] | null, preserveCase = false): string {\n if (!this.hasReplacementPatterns) {\n const value = this.pieces[0]?.kind === 'static' ? this.pieces[0].value : ''\n return preserveCase ? buildReplaceStringWithCasePreserved(matches, value) : value\n }\n\n let result = ''\n for (const piece of this.pieces) {\n result += replacePieceValue(piece, matches)\n }\n return result\n }\n}\n\ntype ReplacePiece =\n | { readonly kind: 'static'; readonly value: string }\n | { readonly kind: 'match'; readonly index: number; readonly caseOps: readonly string[] }\n\nexport function parseReplaceString(replaceString: string): ReplacePattern {\n if (replaceString.length === 0) return new ReplacePattern([])\n\n const builder = new ReplacePieceBuilder(replaceString)\n const caseOps: string[] = []\n for (let index = 0; index < replaceString.length; index += 1) {\n const nextIndex = consumeReplaceEscape(replaceString, index, builder, caseOps)\n if (nextIndex !== index) {\n index = nextIndex\n continue\n }\n\n index = consumeReplaceDollar(replaceString, index, builder, caseOps)\n }\n\n return builder.finalize()\n}\n\nfunction buildReplaceStringWithCasePreserved(\n matches: readonly string[] | null,\n pattern: string,\n): string {\n const match = matches?.[0]\n if (!match) return pattern\n\n const hyphenated = validateSpecificSpecialCharacter(match, pattern, '-')\n const underscored = validateSpecificSpecialCharacter(match, pattern, '_')\n if (hyphenated && !underscored) return buildReplaceStringForSpecialCharacter(match, pattern, '-')\n if (!hyphenated && underscored) return buildReplaceStringForSpecialCharacter(match, pattern, '_')\n if (match.toLocaleUpperCase() === match) return pattern.toLocaleUpperCase()\n if (match.toLocaleLowerCase() === match) return pattern.toLocaleLowerCase()\n if (startsWithUppercase(match) && pattern.length > 0) return upperFirst(pattern)\n if (!startsWithUppercase(match) && pattern.length > 0) return lowerFirst(pattern)\n return pattern\n}\n\nclass ReplacePieceBuilder {\n private readonly pieces: ReplacePiece[] = []\n private lastIndex = 0\n private staticValue = ''\n\n public constructor(private readonly source: string) {}\n\n public emitUnchanged(toIndex: number): void {\n this.appendStatic(this.source.slice(this.lastIndex, toIndex))\n this.lastIndex = toIndex\n }\n\n public emitStatic(value: string, toIndex: number): void {\n this.appendStatic(value)\n this.lastIndex = toIndex\n }\n\n public emitMatch(index: number, toIndex: number, caseOps: readonly string[]): void {\n this.flushStatic()\n this.pieces.push({ kind: 'match', index, caseOps: [...caseOps] })\n this.lastIndex = toIndex\n }\n\n public finalize(): ReplacePattern {\n this.emitUnchanged(this.source.length)\n this.flushStatic()\n return new ReplacePattern(this.pieces)\n }\n\n private appendStatic(value: string): void {\n if (value.length === 0) return\n this.staticValue += value\n }\n\n private flushStatic(): void {\n if (this.staticValue.length === 0) return\n\n this.pieces.push({ kind: 'static', value: this.staticValue })\n this.staticValue = ''\n }\n}\n\nfunction consumeReplaceEscape(\n source: string,\n index: number,\n builder: ReplacePieceBuilder,\n caseOps: string[],\n): number {\n if (source[index] !== '\\\\') return index\n if (index + 1 >= source.length) return index\n\n const next = source[index + 1]!\n const staticValue = escapeStaticValue(next)\n if (staticValue !== null) {\n builder.emitUnchanged(index)\n builder.emitStatic(staticValue, index + 2)\n return index + 1\n }\n\n // An unrecognized escape still swallows the escaped character, so `\\$1` stays literal\n // instead of the '$' being re-read as a capture reference by consumeReplaceDollar.\n if (!isCaseOperation(next)) return index + 1\n\n builder.emitUnchanged(index)\n builder.emitStatic('', index + 2)\n caseOps.push(next)\n return index + 1\n}\n\nfunction consumeReplaceDollar(\n source: string,\n index: number,\n builder: ReplacePieceBuilder,\n caseOps: string[],\n): number {\n if (source[index] !== '$') return index\n if (index + 1 >= source.length) return index\n\n const next = source[index + 1]!\n if (next === '$') {\n builder.emitUnchanged(index)\n builder.emitStatic('$', index + 2)\n return index + 1\n }\n\n if (next === '&' || next === '0') {\n builder.emitUnchanged(index)\n builder.emitMatch(0, index + 2, caseOps)\n caseOps.length = 0\n return index + 1\n }\n\n return consumeReplaceCapture(source, index, builder, caseOps)\n}\n\nfunction consumeReplaceCapture(\n source: string,\n index: number,\n builder: ReplacePieceBuilder,\n caseOps: string[],\n): number {\n const first = source[index + 1]!\n if (!isNonZeroDigit(first)) return index\n\n const second = source[index + 2]\n const hasSecondDigit = second !== undefined && isDigit(second)\n const capture = hasSecondDigit ? Number(`${first}${second}`) : Number(first)\n const end = hasSecondDigit ? index + 3 : index + 2\n builder.emitUnchanged(index)\n builder.emitMatch(capture, end, caseOps)\n caseOps.length = 0\n return end - 1\n}\n\nfunction replacePieceValue(piece: ReplacePiece, matches: readonly string[] | null): string {\n if (piece.kind === 'static') return piece.value\n\n const value = substituteMatch(piece.index, matches)\n return applyCaseOperations(value, piece.caseOps)\n}\n\nfunction substituteMatch(index: number, matches: readonly string[] | null): string {\n if (!matches) return ''\n if (index === 0) return matches[0] ?? ''\n\n // An out-of-range index degrades digit by digit, the way JavaScript's own String.replace\n // does: with a single capture group `$12` is group 1 followed by a literal '2', and only a\n // first digit that is also out of range falls back to the literal `$…`.\n let captureIndex = index\n let remainder = ''\n while (captureIndex > 0) {\n if (captureIndex < matches.length) return `${matches[captureIndex] ?? ''}${remainder}`\n\n remainder = `${captureIndex % 10}${remainder}`\n captureIndex = Math.floor(captureIndex / 10)\n }\n return `$${remainder}`\n}\n\nfunction applyCaseOperations(value: string, caseOps: readonly string[]): string {\n if (caseOps.length === 0) return value\n\n let opIndex = 0\n let result = ''\n for (let index = 0; index < value.length; index += 1) {\n const op = caseOps[opIndex]\n if (!op) {\n result += value.slice(index)\n break\n }\n\n result += applyCaseOperation(value[index]!, op)\n if (op === 'u' || op === 'l') opIndex += 1\n }\n return result\n}\n\nfunction escapeStaticValue(value: string): string | null {\n if (value === '\\\\') return '\\\\'\n if (value === 'n') return '\\n'\n if (value === 't') return '\\t'\n return null\n}\n\nfunction isCaseOperation(value: string): boolean {\n return value === 'u' || value === 'U' || value === 'l' || value === 'L'\n}\n\nfunction applyCaseOperation(value: string, operation: string): string {\n if (operation === 'u' || operation === 'U') return value.toLocaleUpperCase()\n if (operation === 'l' || operation === 'L') return value.toLocaleLowerCase()\n return value\n}\n\nfunction validateSpecificSpecialCharacter(\n match: string,\n pattern: string,\n separator: string,\n): boolean {\n if (!match.includes(separator) || !pattern.includes(separator)) return false\n return match.split(separator).length === pattern.split(separator).length\n}\n\nfunction buildReplaceStringForSpecialCharacter(\n match: string,\n pattern: string,\n separator: string,\n): string {\n const matchParts = match.split(separator)\n return pattern\n .split(separator)\n .map((part, index) => buildReplaceStringWithCasePreserved([matchParts[index] ?? ''], part))\n .join(separator)\n}\n\nfunction startsWithUppercase(value: string): boolean {\n const first = value[0]\n return first !== undefined && first.toLocaleUpperCase() === first\n}\n\nfunction upperFirst(value: string): string {\n return `${value[0]!.toLocaleUpperCase()}${value.slice(1)}`\n}\n\nfunction lowerFirst(value: string): string {\n return `${value[0]!.toLocaleLowerCase()}${value.slice(1)}`\n}\n\nfunction isDigit(value: string): boolean {\n return value >= '0' &&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ACP,OACA,SACA,WACQ;CACR,MAAM,aAAa,MAAM,MAAM,SAAS;CACxC,OAAO,QACJ,MAAM,SAAS,CAAC,CAChB,KAAK,MAAM,UAAU,oCAAoC,CAAC,WAAW,UAAU,EAAE,GAAG,IAAI,CAAC,CAAC,CAC1F,KAAK,SAAS;AACnB;AAEA,SAAS,oBAAoB,OAAwB;CACnD,MAAM,QAAQ,MAAM;CACpB,OAAO,UAAU,KAAA,KAAa,MAAM,kBAAkB,MAAM;AAC9D;AAEA,SAAS,WAAW,OAAuB;CACzC,OAAO,GAAG,MAAM,EAAE,CAAE,kBAAkB,IAAI,MAAM,MAAM,CAAC;AACzD;AAEA,SAAS,WAAW,OAAuB;CACzC,OAAO,GAAG,MAAM,EAAE,CAAE,kBAAkB,IAAI,MAAM,MAAM,CAAC;AACzD;AAEA,SAAS,QAAQ,OAAwB;CACvC,OAAO,SAAS,OAAO,SAAS;AAClC;AAEA,SAAS,eAAe,OAAwB;CAC9C,OAAO,SAAS,OAAO,SAAS;AAClC"}
@@ -1 +1 @@
1
- {"version":3,"file":"search.js","names":[],"sources":["../src/search.ts"],"sourcesContent":["import {\n codePointSizeAt,\n compareTextOffsetRanges,\n isWholeWordRange,\n type TextOffsetRange,\n type TextReadSnapshot,\n} from '@singapore-editor/core/document'\n\n// Bounds the match set the widget counts and paints, so a pathological query\n// on a huge file cannot stall the frame.\nexport const FIND_MATCHES_LIMIT = 19_999\n\n// Replace All must never apply to a truncated match set: stopping early would\n// silently rewrite part of the document and leave the rest, with no signal to\n// the user. Searching is linear, so the only real cost of lifting the cap here\n// is the edit batch itself.\nexport const FIND_REPLACE_ALL_LIMIT = 1_073_741_824\n\n// How much text a windowed scan reads at once, rounded up to whole lines. Large\n// enough that the tree descent per read is noise, small enough that a fragmented\n// document is never joined into one string the size of the file.\nexport const FIND_WINDOW_UNITS = 65_536\n\n// Escapes whose class cannot hold a line break, so a pattern built only from\n// these can be answered a line at a time. A carriage return is among them: it\n// sits inside a line, not between two.\nconst LINE_SAFE_ESCAPES = new Set(['d', 'w', 't', 'r', 'f', 'v', 'b', 'B', '0'])\n\nexport type FindRange = TextOffsetRange\n\n// Read-only line-start access, structurally the view a document snapshot\n// already hands out, so a search never asks for the array behind it.\nexport type FindLineStartsView = {\n readonly length: number\n at(index: number): number | undefined\n indexForOffset(offset: number): number\n}\n\n/**\n * The text a search reads, in ranges rather than as one string.\n *\n * A query that cannot match a line break is answered a line at a time, so a\n * keystroke in the find box costs the lines examined instead of a copy of the\n * whole document — and a chunked buffer gets searched where it lies.\n */\nexport type FindTextSource = {\n readonly length: number\n readRange(start: number, end: number): string\n readonly lineStartsView: FindLineStartsView\n}\n\nexport function findTextSourceFromSnapshot(snapshot: TextReadSnapshot): FindTextSource {\n return {\n length: snapshot.length,\n readRange: (start, end) => snapshot.readRange(start, end),\n lineStartsView: {\n length: snapshot.lineCount,\n at: (index) =>\n index < 0 || index >= snapshot.lineCount ? undefined : snapshot.lineStart(index),\n indexForOffset: (offset) => snapshot.lineAt(offset),\n },\n }\n}\n\nexport type FindQuery = {\n readonly searchString: string\n readonly isRegex: boolean\n readonly matchCase: boolean\n readonly wholeWord: boolean\n}\n\nexport type FindMatch = FindRange & {\n readonly matches: readonly string[] | null\n}\n\nexport type FindMatchFromOptions = {\n readonly captureMatches?: boolean\n readonly loop?: boolean\n readonly escapeEmptyMatchAtOffset?: boolean\n}\n\n/** What the two directions have in common, so one caller can hold either. */\nexport type FindMatchFromSearcher = (\n source: FindTextSource,\n query: FindQuery,\n offset: number,\n ranges: readonly FindRange[] | null,\n options: FindMatchFromOptions,\n) => FindMatch | null\n\ntype CompiledFindQuery = {\n readonly regex: RegExp\n // Non-null only when a plain indexOf over the untouched text is exactly\n // equivalent to the regex; see compileFindQuery.\n readonly simpleSearch: string | null\n readonly wholeWord: boolean\n readonly plan: FindQueryPlan\n}\n\n/**\n * How much text one match can depend on, which is what decides how it is read.\n *\n * `lines` and `anchored-lines` cannot match a break, so they are read in windows\n * of whole lines. `literal-lines` is a literal holding breaks: it spans a known\n * number of lines, so it is windowed too. `range` is every pattern nothing here\n * can bound, read as one window because that is the only reading always correct.\n */\nexport type FindQueryPlan =\n | { readonly kind: 'lines' }\n | { readonly kind: 'anchored-lines' }\n | { readonly kind: 'literal-lines'; readonly lineBreaks: number }\n | { readonly kind: 'range'; readonly reason: 'pattern-may-match-line-break' }\n\n// One stretch of the document already read: the text of\n// `[start, start + text.length)`, to be searched from `from` onward.\ntype FindWindow = {\n readonly text: string\n readonly start: number\n readonly from: number\n}\n\nexport function findMatches(\n source: FindTextSource,\n query: FindQuery,\n ranges: readonly FindRange[] | null = null,\n captureMatches = false,\n limit = FIND_MATCHES_LIMIT,\n): readonly FindMatch[] {\n const compiled = compileFindQuery(query)\n if (!compiled || limit <= 0) return []\n\n const matches: FindMatch[] = []\n const collect: FindMatchVisitor = (start, end, captures) => {\n matches.push({ start, end, matches: captures })\n return matches.length < limit\n }\n for (const range of searchRanges(source, ranges)) {\n scanRange(source, compiled, range, captureMatches, collect)\n if (matches.length >= limit) break\n }\n\n return matches\n}\n\n/**\n * Every match counted, none kept: a total costs no record per match.\n *\n * With `before`, only the matches starting in front of that offset, which is the\n * position of a match the listing stopped short of.\n */\nexport function countMatches(\n source: FindTextSource,\n query: FindQuery,\n ranges: readonly FindRange[] | null = null,\n before = Number.POSITIVE_INFINITY,\n): number {\n const compiled = compileFindQuery(query)\n if (!compiled) return 0\n\n let count = 0\n const tally: FindMatchVisitor = (start) => {\n if (start >= before) return false\n\n count += 1\n return true\n }\n for (const range of searchRanges(source, ranges)) {\n if (range.start >= before) break\n scanRange(source, compiled, range, false, tally)\n }\n\n return count\n}\n\n/** Null for a query that cannot be compiled, which is one that finds nothing. */\nexport function findQueryPlan(query: FindQuery): FindQueryPlan | null {\n return compileFindQuery(query)?.plan ?? null\n}\n\n/** The line holding `offset`, break excluded. */\nexport function findLineRange(source: FindTextSource, offset: number): FindRange {\n const index = source.lineStartsView.indexForOffset(offset)\n return { start: source.lineStartsView.at(index) ?? 0, end: lineEndAt(source, index) }\n}\n\n/**\n * One match, scanned for from an offset instead of picked out of a list.\n *\n * A listing stops at FIND_MATCHES_LIMIT, and past that every entry in it sits\n * behind the cursor: picking from it answers each press with the top of the\n * document. Scanning outward stops at the first match it reaches, so how far\n * navigation can go is not what a paint budget allowed.\n */\nexport function findNextMatchFrom(\n source: FindTextSource,\n query: FindQuery,\n offset: number,\n ranges: readonly FindRange[] | null = null,\n options: FindMatchFromOptions = {},\n): FindMatch | null {\n const compiled = compileFindQuery(query)\n if (!compiled) return null\n\n const searched = searchRanges(source, ranges)\n const from = clampSourceOffset(source, offset)\n const ahead = firstMatchAfter(source, compiled, searched, from, options)\n if (ahead) return ahead\n if (options.loop === false) return null\n\n // Wrapping is a second bounded scan rather than a listing, so a cursor past\n // the last match still costs only the text up to the first one.\n return firstMatchAtOrAfter(source, compiled, searched, searched[0]?.start ?? 0, options)\n}\n\nexport function findPreviousMatchFrom(\n source: FindTextSource,\n query: FindQuery,\n offset: number,\n ranges: readonly FindRange[] | null = null,\n options: FindMatchFromOptions = {},\n): FindMatch | null {\n const compiled = compileFindQuery(query)\n if (!compiled) return null\n\n const searched = searchRanges(source, ranges)\n const from = clampSourceOffset(source, offset)\n const behind = lastMatchBefore(source, compiled, searched, from, options)\n if (behind) return behind\n if (options.loop === false) return null\n\n return lastMatchBefore(source, compiled, searched, source.length, {\n ...options,\n escapeEmptyMatchAtOffset: false,\n })\n}\n\nexport function findMatchIndex(matches: readonly FindMatch[], range: FindRange): number {\n return matches.findIndex((match) => match.start === range.start && match.end === range.end)\n}\n\nexport function escapeRegExpCharacters(value: string): string {\n return value.replace(/[\\\\{}*+?|^$.[\\]()]/g, '\\\\$&')\n}\n\n// The break belongs to no line: a query that cannot match one would otherwise be\n// handed a haystack whose `$` sits behind it.\nfunction lineEndAt(source: FindTextSource, index: number): number {\n const nextLineStart = source.lineStartsView.at(index + 1)\n return nextLineStart === undefined ? source.length : nextLineStart - 1\n}\n\nfunction escapesEmptyMatch(match: FindMatch, offset: number, escape: boolean): boolean {\n return escape && match.start === match.end && match.start === offset\n}\n\nfunction firstMatchAfter(\n source: FindTextSource,\n query: CompiledFindQuery,\n ranges: readonly FindRange[],\n offset: number,\n options: FindMatchFromOptions,\n): FindMatch | null {\n const found = firstMatchAtOrAfter(source, query, ranges, offset, options)\n if (!found) return null\n if (!escapesEmptyMatch(found, offset, options.escapeEmptyMatchAtOffset ?? false)) return found\n\n // Resumed past the offset itself, once: whatever stands there is the entry\n // after the one being escaped, empty or not.\n return firstMatchAtOrAfter(source, query, ranges, nextCodePointOffset(source, offset), options)\n}\n\nfunction firstMatchAtOrAfter(\n source: FindTextSource,\n query: CompiledFindQuery,\n ranges: readonly FindRange[],\n offset: number,\n options: FindMatchFromOptions,\n): FindMatch | null {\n for (const range of ranges) {\n if (range.end < offset) continue\n\n const found = firstMatchInRange(source, query, range, offset, options.captureMatches ?? false)\n if (found) return found\n }\n\n return null\n}\n\n// The range is never cut at the offset: a pattern resumed there simply begins a\n// fresh match at the cursor — 'pha' inside 'alpha' for `\\w+` — and a range no\n// listing of the document holds is one the reader was never shown and Replace\n// must never rewrite. What the offset decides is which matches are kept, not\n// where the scan starts. Uncapped, because what stands at the cursor is being\n// asked for regardless of where the paint budget ran out.\nfunction firstMatchInRange(\n source: FindTextSource,\n query: CompiledFindQuery,\n range: FindRange,\n offset: number,\n captureMatches: boolean,\n): FindMatch | null {\n let found: FindMatch | null = null\n const scanned = { start: forwardScanStart(source, query, range, offset), end: range.end }\n scanRange(source, query, scanned, captureMatches, (start, end, captures) => {\n if (start < offset) return true\n\n found = { start, end, matches: captures }\n return false\n })\n\n return found\n}\n\n// Lines in front of the cursor are skipped rather than searched: a match that\n// cannot hold a break cannot reach out of the line it starts on, so none of them\n// could answer at or after the offset anyway.\nfunction forwardScanStart(\n source: FindTextSource,\n query: CompiledFindQuery,\n range: FindRange,\n offset: number,\n): number {\n if (!isLineLocalPlan(query.plan)) return range.start\n\n const lineStartsView = source.lineStartsView\n const line = lineStartsView.indexForOffset(Math.max(range.start, offset))\n return Math.max(range.start, lineStartsView.at(line) ?? 0)\n}\n\nfunction isLineLocalPlan(plan: FindQueryPlan): boolean {\n return plan.kind === 'lines' || plan.kind === 'anchored-lines'\n}\n\nfunction lastMatchBefore(\n source: FindTextSource,\n query: CompiledFindQuery,\n ranges: readonly FindRange[],\n offset: number,\n options: FindMatchFromOptions,\n): FindMatch | null {\n for (const range of ranges.toReversed()) {\n if (range.start > offset) continue\n\n const found = lastMatchInRange(source, query, range, offset, options)\n if (found) return found\n }\n\n return null\n}\n\n// Walked back a window at a time, because the match before the cursor is the one\n// being asked for and listing everything behind it to reach the last entry is\n// the whole document on a search that started near its end.\nfunction lastMatchInRange(\n source: FindTextSource,\n query: CompiledFindQuery,\n searched: FindRange,\n offset: number,\n options: FindMatchFromOptions,\n): FindMatch | null {\n // A pattern that can run past a break is shown the text behind the cursor too:\n // cut at the cursor's line, `[^a]+$` would end there on a match no listing of\n // the document holds. The scan still stops at the first match past the cursor.\n if (!isLineLocalPlan(query.plan))\n return lastMatchInWindow(source, query, searched, offset, options)\n\n const range = { start: searched.start, end: Math.min(searched.end, offset) }\n const lineStartsView = source.lineStartsView\n let last = lineStartsView.indexForOffset(range.end)\n while (last >= 0) {\n const reach = Math.max(range.start, (lineStartsView.at(last) ?? 0) - FIND_WINDOW_UNITS)\n const first = lineStartsView.indexForOffset(reach)\n const firstStart = lineStartsView.at(first) ?? 0\n const window = {\n start: Math.max(range.start, firstStart),\n end: Math.min(range.end, lineEndAt(source, last)),\n }\n const found =\n window.end < window.start ? null : lastMatchInWindow(source, query, window, offset, options)\n if (found) return found\n if (firstStart <= range.start) return null\n\n last = first - 1\n }\n\n return null\n}\n\n// The last match in one window, escaping the same way stepping an ordered list\n// does: what stands before a zero-width match parked on the cursor is the entry\n// the search is being asked for, and it may be in an earlier window. Uncapped,\n// and only the last two are kept: a listing that stopped at the paint cap would\n// answer every press behind the cursor with the 19,999th match.\nfunction lastMatchInWindow(\n source: FindTextSource,\n query: CompiledFindQuery,\n range: FindRange,\n offset: number,\n options: FindMatchFromOptions,\n): FindMatch | null {\n let last: FindMatch | null = null\n let beforeLast: FindMatch | null = null\n scanRange(source, query, range, options.captureMatches ?? false, (start, end, captures) => {\n if (end > offset) return false\n\n beforeLast = last\n last = { start, end, matches: captures }\n return true\n })\n if (!last) return null\n if (!escapesEmptyMatch(last, offset, options.escapeEmptyMatchAtOffset ?? false)) return last\n\n return beforeLast\n}\n\n// A pattern compiled with the unicode flag may not be resumed inside a surrogate\n// pair, so stepping off an empty match steps a code point rather than a unit.\nfunction nextCodePointOffset(source: FindTextSource, offset: number): number {\n const text = source.readRange(offset, Math.min(source.length, offset + 2))\n return offset + Math.max(1, codePointSizeAt(text, 0))\n}\n\n// True when the query contains at least one character whose case can differ,\n// which is the only situation where matchCase changes what a plain search\n// finds. Digits, punctuation and CJK are caseless, so an untouched indexOf is\n// still exact for them even with matchCase off.\nfunction queryIsCaseSensitiveByContent(searchString: string): boolean {\n return searchString.toLowerCase() !== searchString.toUpperCase()\n}\n\n/**\n * Whether every part of a pattern is provably unable to match a line break.\n *\n * Asked the safe way round. Listing the constructs that CAN hold a break means\n * one nobody thought of routes a query to the windowed path, where it answers\n * \"no results\" for text that is plainly there — the one wrong answer a search\n * must never give. So a query is windowed only when every part of it is provably\n * break-free, and anything unrecognized takes the slower path that is always\n * correct.\n */\nfunction isLineSafePattern(pattern: string): boolean {\n for (let index = 0; index < pattern.length; index += 1) {\n const char = pattern[index]\n if (char === '\\n') return false\n if (char === '[') {\n const end = characterClassEnd(pattern, index)\n if (end === null || !isLineSafeCharacterClass(pattern.slice(index + 1, end))) return false\n\n index = end\n continue\n }\n\n if (char === '(' && !isLineSafeGroupOpener(pattern, index)) return false\n if (char !== '\\\\') continue\n\n index += 1\n const escaped = pattern[index]\n if (escaped === undefined) return false\n // A hex or unicode escape can spell the break itself, and reading which one\n // it spells is more machinery than routing it to the correct path costs.\n if (!LINE_SAFE_ESCAPES.has(escaped) && /[\\p{L}\\p{N}]/u.test(escaped)) return false\n }\n\n return true\n}\n\n/**\n * Only a group that bundles what is written inside it, leaving its meaning alone.\n *\n * A capture, a non-capture and either lookaround are all of those. A modifier\n * group is not: it can switch on the flag under which a dot spans a break, so the\n * characters inside it stop saying what they say anywhere else — and reading back\n * which flags one names is more machinery than routing it to the correct path\n * costs. Every other spelling is one nobody here recognized, which is the same\n * answer.\n */\nfunction isLineSafeGroupOpener(pattern: string, index: number): boolean {\n if (pattern[index + 1] !== '?') return true\n\n const kind = pattern[index + 2]\n // '<' opens a lookbehind or names a capture, and neither changes what matches.\n return kind === ':' || kind === '=' || kind === '!' || kind === '<'\n}\n\n// Only a positive class naming its members outright: a negated one holds a break\n// unless it names it, and an escape inside one can bring a whole class with it.\nfunction isLineSafeCharacterClass(body: string): boolean {\n if (body.startsWith('^')) return false\n return !body.includes('\\\\') && !body.includes('\\n')\n}\n\nfunction characterClassEnd(pattern: string, from: number): number | null {\n for (let index = from + 1; index < pattern.length; index += 1) {\n if (pattern[index] === '\\\\') index += 1\n else if (pattern[index] === ']') return index\n }\n\n return null\n}\n\nfunction compileFindQuery(query: FindQuery): CompiledFindQuery | null {\n if (query.searchString.length === 0) return null\n\n const source = query.isRegex ? query.searchString : escapeRegExpCharacters(query.searchString)\n const plan = planFindQuery(query)\n const lineCrossing = plan.kind === 'range' || plan.kind === 'literal-lines'\n // Flags describe the haystack, and only a line-crossing search is ever handed\n // one holding a break: a per-line slice bounds `^` and `$` by itself, so `m`\n // there would only claim breaks the slice does not contain.\n const flags = `g${query.matchCase ? '' : 'i'}${lineCrossing ? 'm' : ''}`\n\n // The fast path may never case-fold the haystack: folding is not\n // length-preserving (U+0130 'İ' lowercases to two code units), so an index\n // into folded text does not address the original text, and a match reported\n // from it slices the wrong characters — Replace would then overwrite them.\n // Fall back to the case-insensitive regex, which reports original indices.\n const canUseSimpleSearch =\n !query.isRegex && (query.matchCase || !queryIsCaseSensitiveByContent(query.searchString))\n\n const regex = compileRegex(source, flags)\n if (!regex) return null\n\n return {\n regex,\n simpleSearch: canUseSimpleSearch ? query.searchString : null,\n wholeWord: query.wholeWord,\n plan,\n }\n}\n\nfunction planFindQuery(query: FindQuery): FindQueryPlan {\n if (!query.isRegex) {\n const lineBreaks = query.searchString.split('\\n').length - 1\n return lineBreaks === 0 ? { kind: 'lines' } : { kind: 'literal-lines', lineBreaks }\n }\n\n if (!isLineSafePattern(query.searchString))\n return { kind: 'range', reason: 'pattern-may-match-line-break' }\n return hasLineAnchor(query.searchString) ? { kind: 'anchored-lines' } : { kind: 'lines' }\n}\n\n// Asked of a pattern already known to be line-safe, so a class cannot be negated\n// and a `^` inside one is a member rather than an anchor.\nfunction hasLineAnchor(pattern: string): boolean {\n for (let index = 0; index < pattern.length; index += 1) {\n const char = pattern[index]\n if (char === '\\\\') index += 1\n else if (char === '[') index = characterClassEnd(pattern, index) ?? pattern.length\n else if (char === '^' || char === '$') return true\n }\n\n return false\n}\n\n/**\n * The pattern under the unicode flag where it takes it, and without it where it\n * does not.\n *\n * Wanted, because `u` is what makes a surrogate pair one character to a dot and\n * `\\p{...}` mean anything at all. Not required, because its grammar rejects\n * spellings the flagless one accepts — an identity escape of a character that\n * needs none (`\\-`, `\\ `), a brace or bracket standing for itself, a legacy\n * back-reference — and every one of those is what escaping a search by hand\n * produces. A rejected pattern is not reported anywhere the user can see it: it\n * reaches them as \"No results\", indistinguishable from text that is not there.\n */\nfunction compileRegex(source: string, flags: string): RegExp | null {\n try {\n return new RegExp(source, `${flags}u`)\n } catch {\n // Ignored: whether the pattern is invalid outright or only invalid under the\n // stricter grammar is what the second construction answers.\n }\n\n try {\n return new RegExp(source, flags)\n } catch {\n return null\n }\n}\n\nfunction searchRanges(\n source: FindTextSource,\n ranges: readonly FindRange[] | null,\n): readonly FindRange[] {\n if (!ranges || ranges.length === 0) return [{ start: 0, end: source.length }]\n\n const clamped = ranges\n .map((range) => ({\n start: clampSourceOffset(source, range.start),\n end: clampSourceOffset(source, range.end),\n }))\n .filter((range) => range.start <= range.end)\n .sort(compareTextOffsetRanges)\n\n // Scopes are followed through edits, and an edit spanning the seam between two\n // of them leaves them overlapping. Searching both would report the text they\n // share twice, which a Replace All then tries to rewrite twice.\n const merged: FindRange[] = []\n for (const range of clamped) {\n const previous = merged.at(-1)\n if (previous && range.start <= previous.end) {\n merged[merged.length - 1] = { start: previous.start, end: Math.max(previous.end, range.end) }\n continue\n }\n\n merged.push(range)\n }\n\n return merged\n}\n\nfunction clampSourceOffset(source: FindTextSource, offset: number): number {\n return Math.min(Math.max(0, offset), source.length)\n}\n\n// Visited in document order; false stops the scan where it stands.\ntype FindMatchVisitor = (start: number, end: number, captures: RegExpExecArray | null) => boolean\n\n/** False once the range is spent or the visitor stopped: nothing later in it is read. */\nfunction scanRange(\n source: FindTextSource,\n query: CompiledFindQuery,\n range: FindRange,\n captureMatches: boolean,\n visit: FindMatchVisitor,\n): boolean {\n if (query.plan.kind === 'range')\n return scanWholeRange(source, query, range, captureMatches, visit)\n if (query.plan.kind === 'literal-lines')\n return scanSpanningLiteral(source, query, range, query.plan.lineBreaks, visit)\n\n return scanLines(source, query, range, captureMatches, visit)\n}\n\n// Whole lines, even where the range was cut inside one: the anchors and the word\n// boundaries have to answer for the line the reader sees rather than for where\n// the range happens to end, so the range only decides which matches are kept.\n//\n// Read many lines to a window. A match that cannot hold a break cannot leave its\n// line, and a break is no word character, so a pattern with no `^` or `$` finds in\n// the window exactly what it finds line by line, without a tree descent per line.\nfunction scanLines(\n source: FindTextSource,\n query: CompiledFindQuery,\n range: FindRange,\n captureMatches: boolean,\n visit: FindMatchVisitor,\n): boolean {\n const lineStartsView = source.lineStartsView\n let index = lineStartsView.indexForOffset(range.start)\n while (index < lineStartsView.length) {\n const start = lineStartsView.at(index)\n if (start === undefined || start > range.end) return true\n\n const last = lastWindowLine(source, index, start, range.end)\n const window = readWindow(source, start, lineEndAt(source, last), range)\n if (!scanLineWindow(window, query, range, captureMatches, visit)) return false\n index = last + 1\n }\n\n return true\n}\n\nfunction lastWindowLine(\n source: FindTextSource,\n first: number,\n start: number,\n rangeEnd: number,\n): number {\n const reach = Math.min(rangeEnd, start + FIND_WINDOW_UNITS)\n return Math.max(first, source.lineStartsView.indexForOffset(reach))\n}\n\nfunction scanLineWindow(\n window: FindWindow,\n query: CompiledFindQuery,\n range: FindRange,\n captureMatches: boolean,\n visit: FindMatchVisitor,\n): boolean {\n if (query.plan.kind !== 'anchored-lines')\n return scanWindow(window, query, range, captureMatches, visit)\n\n // `^` and `$` answer for the ends of the haystack, so each line is its own.\n let lineStart = 0\n while (lineStart <= window.text.length) {\n const found = window.text.indexOf('\\n', lineStart)\n const lineEnd = found === -1 ? window.text.length : found\n const line = {\n text: window.text.slice(lineStart, lineEnd),\n start: window.start + lineStart,\n from: Math.max(0, window.from - lineStart),\n }\n if (lineEnd >= window.from && !scanWindow(line, query, range, captureMatches, visit))\n return false\n\n lineStart = lineEnd + 1\n }\n\n return true\n}\n\n// A literal holding breaks spans exactly that many lines past the one it starts\n// on, so windows overlapping by that many lines show every match whole to at\n// least one of them. The cursor is carried across: restarting the greedy scan at\n// an overlap's first character would change which of two overlapping candidates\n// wins, and with it every match after them.\nfunction scanSpanningLiteral(\n source: FindTextSource,\n query: CompiledFindQuery,\n range: FindRange,\n lineBreaks: number,\n visit: FindMatchVisitor,\n): boolean {\n const lineStartsView = source.lineStartsView\n const finalLine = lineStartsView.indexForOffset(range.end)\n let first = lineStartsView.indexForOffset(range.start)\n const cursor = { offset: range.start }\n while (first <= finalLine) {\n const start = lineStartsView.at(first) ?? 0\n const last = Math.min(\n finalLine,\n Math.max(first + lineBreaks, lastWindowLine(source, first, start, range.end)),\n )\n const text = source.readRange(start, Math.max(start, lineEndAt(source, last)))\n const window = { text, start, from: Math.max(0, cursor.offset - start) }\n if (!scanWindow(window, query, range, false, visit, cursor)) return false\n if (last === finalLine) return true\n\n first = last + 1 - lineBreaks\n }\n\n return true\n}\n\n// Listing every match of a pattern that can span the range's ends has to look at\n// every character between them, so the range is read as one window: a window\n// grown in steps would only re-run the pattern over text it already scanned. The\n// window still stops on line boundaries, or `^` and `$` would answer for its cut\n// ends instead of for real ones.\nfunction scanWholeRange(\n source: FindTextSource,\n query: CompiledFindQuery,\n range: FindRange,\n captureMatches: boolean,\n visit: FindMatchVisitor,\n): boolean {\n const lineStartsView = source.lineStartsView\n const start = lineStartsView.at(lineStartsView.indexForOffset(range.start)) ?? 0\n const end = lineEndAt(source, lineStartsView.indexForOffset(range.end))\n const window = readWindow(source, start, Math.max(start, end), range)\n return scanWindow(window, query, range, captureMatches, visit)\n}\n\nfunction readWindow(\n source: FindTextSource,\n start: number,\n end: number,\n range: FindRange,\n): FindWindow {\n return { text: source.readRange(start, end), start, from: Math.max(0, range.start - start) }\n}\n\n// Where the next raw match may begin. It moves past every raw match, including\n// one the whole-word filter rejects, so the scan keeps one non-overlap phase.\ntype FindCursor = { offset: number }\n\n/** False once the range is spent or the visitor stopped, so no later window can add anything. */\nfunction scanWindow(\n window: FindWindow,\n query: CompiledFindQuery,\n range: FindRange,\n captureMatches: boolean,\n visit: FindMatchVisitor,\n cursor?: FindCursor,\n): boolean {\n if (query.simpleSearch && !captureMatches)\n return scanSimpleMatches(window, query.simpleSearch, query.wholeWord, range, visit, cursor)\n\n return scanRegexMatches(window, query, range, captureMatches, visit, cursor)\n}\n\nfunction scanSimpleMatches(\n window: FindWindow,\n searchString: string,\n wholeWord: boolean,\n range: FindRange,\n visit: FindMatchVisitor,\n cursor?: FindCursor,\n): boolean {\n // Searched as-is: no folded copy of the text is allocated, and every index\n // returned addresses the window it came from.\n let index = window.text.indexOf(searchString, window.from)\n while (index !== -1) {\n const start = window.start + index\n const end = start + searchString.length\n if (end > range.end) return false\n if (cursor) cursor.offset = end\n if (validWholeWordMatch(window.text, index, searchString.length, wholeWord)) {\n if (!visit(start, end, null)) return false\n }\n\n index = window.text.indexOf(searchString, index + searchString.length)\n }\n\n return true\n}\n\nfunction scanRegexMatches(\n window: FindWindow,\n query: CompiledFindQuery,\n range: FindRange,\n captureMatches: boolean,\n visit: FindMatchVisitor,\n cursor?: FindCursor,\n): boolean {\n query.regex.lastIndex = window.from\n while (true) {\n const match = query.regex.exec(window.text)\n if (!match) return true\n\n const start = window.start + match.index\n const end = start + match[0].length\n if (start > range.end || end > range.end) return false\n if (cursor) cursor.offset = end\n if (validWholeWordMatch(window.text, match.index, match[0].length, query.wholeWord)) {\n if (!visit(start, end, captureMatches ? match : null)) return false\n }\n\n if (match[0].length === 0) advancePastEmptyMatch(query.regex, window.text)\n }\n}\n\nfunction advancePastEmptyMatch(regex: RegExp, text: string): void {\n const current = regex.lastIndex\n if (current > text.length) return\n\n const size = codePointSizeAt(text, current)\n regex.lastIndex = current + Math.max(1, size)\n}\n\nfunction validWholeWordMatch(\n text: string,\n start: number,\n length: number,\n wholeWord: boolean,\n): boolean {\n if (!wholeWord) return true\n return isWholeWordRange(text, { start, end: start + length })\n}\n"],"mappings":";;AAUA,IAAa,qBAAqB;AAMlC,IAAa,yBAAyB;AAKtC,IAAa,oBAAoB;AAKjC,IAAM,oCAAoB,IAAI,IAAI;CAAC;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;AAAG,CAAC;AAyB/E,SAAgB,2BAA2B,UAA4C;CACrF,OAAO;EACL,QAAQ,SAAS;EACjB,YAAY,OAAO,QAAQ,SAAS,UAAU,OAAO,GAAG;EACxD,gBAAgB;GACd,QAAQ,SAAS;GACjB,KAAK,UACH,QAAQ,KAAK,SAAS,SAAS,YAAY,KAAA,IAAY,SAAS,UAAU,KAAK;GACjF,iBAAiB,WAAW,SAAS,OAAO,MAAM;EACpD;CACF;AACF;AA2DA,SAAgB,YACd,QACA,OACA,SAAsC,MACtC,iBAAiB,OACjB,QAAQ,oBACc;CACtB,MAAM,WAAW,iBAAiB,KAAK;CACvC,IAAI,CAAC,YAAY,SAAS,GAAG,OAAO,CAAC;CAErC,MAAM,UAAuB,CAAC;C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AE,CAAC;EAC7B,IAAI,QAAQ,MAAM,OAAO,MAAM,MAAM,KAAK,OAAO;EACjD,IAAI,QAAQ,OAAO,SAAS;EAC5B,IAAI,oBAAoB,OAAO,MAAM,MAAM,OAAO,MAAM,EAAE,CAAC,QAAQ,MAAM,SAAS,GAC5E;OAAA,CAAC,MAAM,OAAO,KAAK,iBAAiB,QAAQ,IAAI,GAAG,OAAO;EAAA;EAGhE,IAAI,MAAM,EAAE,CAAC,WAAW,GAAG,sBAAsB,MAAM,OAAO,OAAO,IAAI;CAC3E;AACF;AAEA,SAAS,sBAAsB,OAAe,MAAoB;CAChE,MAAM,UAAU,MAAM;CACtB,IAAI,UAAU,KAAK,QAAQ;CAE3B,MAAM,OAAO,gBAAgB,MAAM,OAAO;CAC1C,MAAM,YAAY,UAAU,KAAK,IAAI,GAAG,IAAI;AAC9C;AAEA,SAAS,oBACP,MACA,OACA,QACA,WACS;CACT,IAAI,CAAC,WAAW,OAAO;CACvB,OAAO,iBAAiB,MAAM;EAAE;EAAO,KAAK,QAAQ;CAAO,CAAC;AAC9D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singapore-editor/find",
3
- "version": "0.2.11",
3
+ "version": "0.2.13",
4
4
  "description": "Find and replace with regular expressions and case-preserving replacements for the Singapore editor.",
5
5
  "keywords": [
6
6
  "browser",
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "devDependencies": {
54
54
  "@playwright/test": "^1.63.0",
55
- "@singapore-editor/core": "0.2.11",
55
+ "@singapore-editor/core": "0.2.13",
56
56
  "@vitest/browser-playwright": "5.0.2",
57
57
  "happy-dom": "^20.14.5",
58
58
  "oxfmt": "0.70.0",
@@ -61,6 +61,6 @@
61
61
  "vitest": "5.0.2"
62
62
  },
63
63
  "peerDependencies": {
64
- "@singapore-editor/core": "0.2.11"
64
+ "@singapore-editor/core": "0.2.13"
65
65
  }
66
66
  }