get it to work in the demo
This commit is contained in:
@@ -92,6 +92,7 @@ export class SearchAddon implements ITerminalAddon {
|
|||||||
|
|
||||||
// new search, clear out the old decorations
|
// new search, clear out the old decorations
|
||||||
this._resultDecorations.forEach(d => d.dispose());
|
this._resultDecorations.forEach(d => d.dispose());
|
||||||
|
console.log('clearing');
|
||||||
const results: ISearchResult[] = [];
|
const results: ISearchResult[] = [];
|
||||||
searchOptions = searchOptions || {};
|
searchOptions = searchOptions || {};
|
||||||
searchOptions.incremental = false;
|
searchOptions.incremental = false;
|
||||||
@@ -102,7 +103,7 @@ export class SearchAddon implements ITerminalAddon {
|
|||||||
}
|
}
|
||||||
found = this.findNext(term, searchOptions);
|
found = this.findNext(term, searchOptions);
|
||||||
}
|
}
|
||||||
|
console.log(results);
|
||||||
for (const result of results) {
|
for (const result of results) {
|
||||||
if (result) {
|
if (result) {
|
||||||
const resultDecoration = this._showResultDecoration(result);
|
const resultDecoration = this._showResultDecoration(result);
|
||||||
@@ -541,7 +542,10 @@ export class SearchAddon implements ITerminalAddon {
|
|||||||
*/
|
*/
|
||||||
private _showResultDecoration(result: ISearchResult): IDecoration | undefined {
|
private _showResultDecoration(result: ISearchResult): IDecoration | undefined {
|
||||||
const terminal = this._terminal!;
|
const terminal = this._terminal!;
|
||||||
|
// for demo to work
|
||||||
|
// const marker = terminal.registerMarker(undefined, result.row);
|
||||||
const marker = terminal.registerMarker(undefined, result.row);
|
const marker = terminal.registerMarker(undefined, result.row);
|
||||||
|
console.log(result.row, marker?.line);
|
||||||
if (!marker) {
|
if (!marker) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ export class BufferDecorationRenderer extends Disposable {
|
|||||||
|
|
||||||
private _refreshStyle(decoration: IInternalDecoration, element: HTMLElement): void {
|
private _refreshStyle(decoration: IInternalDecoration, element: HTMLElement): void {
|
||||||
const line = decoration.marker.line - this._bufferService.buffers.active.ydisp;
|
const line = decoration.marker.line - this._bufferService.buffers.active.ydisp;
|
||||||
if (line < 0 || line > this._bufferService.rows) {
|
if (line < 0 || line >= this._bufferService.rows) {
|
||||||
// outside of viewport
|
// outside of viewport
|
||||||
element.style.display = 'none';
|
element.style.display = 'none';
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user