Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show all matches when searching #3698

Merged
merged 63 commits into from
Mar 22, 2022
Merged

Show all matches when searching #3698

merged 63 commits into from
Mar 22, 2022

Conversation

meganrogge
Copy link
Member

@meganrogge meganrogge commented Mar 18, 2022

@meganrogge meganrogge self-assigned this Mar 18, 2022
@meganrogge meganrogge requested a review from Tyriar March 18, 2022 18:47
@meganrogge meganrogge added this to the 4.19.0 milestone Mar 18, 2022
@Tyriar Tyriar changed the title find all Show all matches when searching Mar 18, 2022
addons/xterm-addon-search/src/SearchAddon.ts Outdated Show resolved Hide resolved
addons/xterm-addon-search/typings/xterm-addon-search.d.ts Outdated Show resolved Hide resolved
Comment on lines 69 to 76
this._onDataDisposable = this._terminal.onData(() => {
this._dataChanged = true;
setTimeout(() => {
if (this._lastSearchOptions?.decorations && this._cachedSearchTerm && this._resultDecorations.size > 0 && this._lastSearchOptions) {
this._highlightAllMatches(this._cachedSearchTerm, this._lastSearchOptions,'previous');
}
}, 200);
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should get debounced to ensure we're not doing this every 200 ms, but only 200ms after no event

Comment on lines 71 to 75
setTimeout(() => {
if (this._lastSearchOptions?.decorations && this._cachedSearchTerm && this._resultDecorations.size > 0 && this._lastSearchOptions) {
this._highlightAllMatches(this._cachedSearchTerm, this._lastSearchOptions,'previous');
}
}, 200);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This create a new timeout on every onData event, there should only be a single timeout active at any time.

addons/xterm-addon-search/src/SearchAddon.ts Outdated Show resolved Hide resolved
addons/xterm-addon-search/src/SearchAddon.ts Outdated Show resolved Hide resolved
addons/xterm-addon-search/src/SearchAddon.ts Outdated Show resolved Hide resolved
addons/xterm-addon-search/src/SearchAddon.ts Outdated Show resolved Hide resolved
addons/xterm-addon-search/src/SearchAddon.ts Show resolved Hide resolved
addons/xterm-addon-search/src/SearchAddon.ts Show resolved Hide resolved
css/xterm.css Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search addon: Introduce a new selection type so that multiple ranges can be highlighted at once
2 participants