mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-22 21:42:49 +01:00
add focus hack, still can't get result count to show
This commit is contained in:
parent
5a90debb2e
commit
9453f628a9
@ -363,6 +363,10 @@ class TermViewModel implements ViewModel {
|
||||
}
|
||||
|
||||
giveFocus(): boolean {
|
||||
if (this.searchAtoms && globalStore.get(this.searchAtoms.isOpenAtom)) {
|
||||
console.log("search is open, not giving focus");
|
||||
return true;
|
||||
}
|
||||
let termMode = globalStore.get(this.termMode);
|
||||
if (termMode == "term") {
|
||||
if (this.termRef?.current?.terminal) {
|
||||
@ -840,11 +844,6 @@ const TerminalView = ({ blockId, model }: TerminalViewProps) => {
|
||||
useWebGl: !termSettings?.["term:disablewebgl"],
|
||||
}
|
||||
);
|
||||
termWrap.onSearchResultsDidChange = (results) => {
|
||||
console.log("search results", results);
|
||||
globalStore.set(searchProps.numResultsAtom, results.resultCount);
|
||||
globalStore.set(searchProps.indexAtom, results.resultIndex);
|
||||
};
|
||||
(window as any).term = termWrap;
|
||||
model.termRef.current = termWrap;
|
||||
const rszObs = new ResizeObserver(() => {
|
||||
|
@ -154,8 +154,8 @@ export class TermWrap {
|
||||
}
|
||||
})
|
||||
);
|
||||
if (this.onSearchResultsDidChange)
|
||||
this.searchAddon.onDidChangeResults(this.onSearchResultsDidChange.bind(this));
|
||||
this.searchAddon.onDidChangeResults(this.searchResultsDidChange.bind(this));
|
||||
|
||||
this.mainFileSubject = getFileSubject(this.blockId, TermFileName);
|
||||
this.mainFileSubject.subscribe(this.handleNewFileSubjectData.bind(this));
|
||||
try {
|
||||
@ -310,4 +310,11 @@ export class TermWrap {
|
||||
search(search: string) {
|
||||
this.searchAddon.findNext(search);
|
||||
}
|
||||
|
||||
searchResultsDidChange(result: { resultIndex: number; resultCount: number }) {
|
||||
console.log("search results changed", result);
|
||||
if (this.onSearchResultsDidChange) {
|
||||
this.onSearchResultsDidChange(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user