18 lines
573 B
TypeScript
18 lines
573 B
TypeScript
import type { SearchAddon } from "@xterm/addon-search";
|
|
|
|
/** Maps a surfaceId to its terminal's SearchAddon so the search bar can reach
|
|
* the focused panel without prop-drilling through the layout tree. */
|
|
const registry = new Map<string, SearchAddon>();
|
|
|
|
export function registerSearch(surfaceId: string, addon: SearchAddon): void {
|
|
registry.set(surfaceId, addon);
|
|
}
|
|
|
|
export function unregisterSearch(surfaceId: string): void {
|
|
registry.delete(surfaceId);
|
|
}
|
|
|
|
export function getSearch(surfaceId: string): SearchAddon | undefined {
|
|
return registry.get(surfaceId);
|
|
}
|