Inline base64 source maps had been checked into tracked src files. This strips those comments from the repository without changing runtime behavior or adding ongoing guardrails, per the requested one-time cleanup scope. Constraint: Keep this change limited to tracked source cleanup only Rejected: Add CI/source verification guard | user requested one-time cleanup only Confidence: high Scope-risk: narrow Reversibility: clean Directive: If these directives reappear, fix the producing transform instead of reintroducing repo-side cleanup code Tested: rg -n "sourceMappingURL" ., bun run smoke, bun run verify:privacy, bun run test:provider, npm run test:provider-recommendation Not-tested: bun run typecheck (repository has many pre-existing unrelated failures) Co-authored-by: anandh8x <test@example.com>
28 lines
931 B
TypeScript
28 lines
931 B
TypeScript
import * as React from 'react';
|
|
import { Text } from '../ink.js';
|
|
|
|
/**
|
|
* Inverse-highlight every occurrence of `query` in `text` (case-insensitive).
|
|
* Used by search dialogs to show where the query matched in result rows
|
|
* and preview panes.
|
|
*/
|
|
export function highlightMatch(text: string, query: string): React.ReactNode {
|
|
if (!query) return text;
|
|
const queryLower = query.toLowerCase();
|
|
const textLower = text.toLowerCase();
|
|
const parts: React.ReactNode[] = [];
|
|
let offset = 0;
|
|
let idx = textLower.indexOf(queryLower, offset);
|
|
if (idx === -1) return text;
|
|
while (idx !== -1) {
|
|
if (idx > offset) parts.push(text.slice(offset, idx));
|
|
parts.push(<Text key={idx} inverse>
|
|
{text.slice(idx, idx + query.length)}
|
|
</Text>);
|
|
offset = idx + query.length;
|
|
idx = textLower.indexOf(queryLower, offset);
|
|
}
|
|
if (offset < text.length) parts.push(text.slice(offset));
|
|
return <>{parts}</>;
|
|
}
|