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

Add search result count to SearchAddon #3716

Merged
merged 32 commits into from
Mar 31, 2022
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b78cb4c
add find count
meganrogge Mar 23, 2022
bb0f5d6
Merge branch 'xtermjs:master' into findCount
meganrogge Mar 28, 2022
c1c0df4
remove index for now
meganrogge Mar 28, 2022
7cc868b
Merge branch 'findCount' of https://github.com/meganrogge/xterm.js in…
meganrogge Mar 28, 2022
6e7d1de
add jsdoc
meganrogge Mar 28, 2022
6ff999b
update jsdoc
meganrogge Mar 28, 2022
463a0e9
property instead of method
meganrogge Mar 29, 2022
49a170f
return undefined when no search results
meganrogge Mar 29, 2022
691f3c9
initialize maps in highlightAllMatches
meganrogge Mar 29, 2022
9a93d5c
! -> ?
meganrogge Mar 29, 2022
d764281
add event to indicate when results have changed
meganrogge Mar 29, 2022
4b6198e
Update addons/xterm-addon-search/src/SearchAddon.ts
meganrogge Mar 29, 2022
f59db29
refactor
meganrogge Mar 29, 2022
dc490d1
Merge branch 'findCount' of https://github.com/meganrogge/xterm.js in…
meganrogge Mar 29, 2022
3df6be8
clear decorations find previous
meganrogge Mar 30, 2022
e2541a1
import
meganrogge Mar 30, 2022
1f00d13
correct ts config
meganrogge Mar 30, 2022
c7d24bf
Update addons/xterm-addon-search/tsconfig.json
meganrogge Mar 30, 2022
f93e166
Update addons/xterm-addon-search/src/SearchAddon.ts
meganrogge Mar 30, 2022
cd0658d
Update addons/xterm-addon-search/src/SearchAddon.ts
meganrogge Mar 30, 2022
f1a75b4
Merge branch 'master' into findCount
meganrogge Mar 30, 2022
56ab94d
refactor to fire event
meganrogge Mar 30, 2022
371f552
Merge branch 'findCount' of https://github.com/meganrogge/xterm.js in…
meganrogge Mar 30, 2022
7099b03
clean up
meganrogge Mar 30, 2022
3995283
revert changes to d.ts
meganrogge Mar 30, 2022
2bce7f4
d.ts
meganrogge Mar 30, 2022
c01aa9e
fix remaining issues
meganrogge Mar 30, 2022
c2df04a
add webpack config change
meganrogge Mar 30, 2022
0c325c8
fix check
meganrogge Mar 30, 2022
2bbcf8c
remove bad conditional
meganrogge Mar 30, 2022
e5fd206
zero based indexing
meganrogge Mar 30, 2022
0ea5e2b
check not undefined
meganrogge Mar 30, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions addons/xterm-addon-search/src/SearchAddon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export class SearchAddon implements ITerminalAddon {
}, 200);
}
});
this.onDidChangeResults((results) => console.log(results));
Copy link
Member

Choose a reason for hiding this comment

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

Missed this one

Copy link
Member Author

Choose a reason for hiding this comment

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

think that was outdated as I don't see it there

}

public dispose(): void {
Expand Down Expand Up @@ -127,7 +128,7 @@ export class SearchAddon implements ITerminalAddon {
}
const next = this._findNextAndSelect(term, searchOptions);
if (searchOptions?.decorations) {
if (next && this._resultIndex && this._searchResults?.size) {
if (next && this._resultIndex !== undefined && this._searchResults?.size) {
this._onDidChangeResults.fire({ resultIndex: this._resultIndex, resultCount: this._searchResults.size });
} else {
this._onDidChangeResults.fire(undefined);
Expand Down Expand Up @@ -281,12 +282,12 @@ export class SearchAddon implements ITerminalAddon {
}

if (this._searchResults) {
if (!this._resultIndex) {
this._resultIndex = 1;
if (this._resultIndex === undefined) {
this._resultIndex = 0;
} else {
this._resultIndex++;
if (this._resultIndex > this._searchResults.size) {
this._resultIndex = 1;
if (this._resultIndex >= this._searchResults.size) {
this._resultIndex = 0;
}
}
}
Expand Down Expand Up @@ -390,12 +391,12 @@ export class SearchAddon implements ITerminalAddon {
}

if (this._searchResults) {
if (!this._resultIndex) {
this._resultIndex = this._searchResults?.size;
if (this._resultIndex === undefined) {
this._resultIndex = this._searchResults?.size - 1;
} else {
this._resultIndex--;
if (this._resultIndex === 0) {
this._resultIndex = this._searchResults?.size;
if (this._resultIndex === -1) {
this._resultIndex = this._searchResults?.size - 1;
}
}
}
Expand Down