Skip to content

Commit

Permalink
Merge pull request #145628 from microsoft/merogge/find
Browse files Browse the repository at this point in the history
use decorations for terminal find
  • Loading branch information
Tyriar authored Mar 22, 2022
2 parents 3b3dbf0 + 706909e commit 4b92538
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 40 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@
"vscode-proxy-agent": "^0.12.0",
"vscode-regexpp": "^3.1.0",
"vscode-textmate": "6.0.0",
"xterm": "4.19.0-beta.7",
"xterm-addon-search": "0.9.0-beta.11",
"xterm": "4.19.0-beta.11",
"xterm-addon-search": "0.9.0-beta.12",
"xterm-addon-serialize": "0.7.0-beta.11",
"xterm-addon-unicode11": "0.4.0-beta.3",
"xterm-addon-webgl": "0.12.0-beta.24",
"xterm-headless": "4.19.0-beta.7",
"xterm-headless": "4.19.0-beta.11",
"yauzl": "^2.9.2",
"yazl": "^2.4.3"
},
Expand Down
6 changes: 3 additions & 3 deletions remote/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
"vscode-proxy-agent": "^0.12.0",
"vscode-regexpp": "^3.1.0",
"vscode-textmate": "6.0.0",
"xterm": "4.19.0-beta.7",
"xterm-addon-search": "0.9.0-beta.11",
"xterm": "4.19.0-beta.11",
"xterm-addon-search": "0.9.0-beta.12",
"xterm-addon-serialize": "0.7.0-beta.11",
"xterm-addon-unicode11": "0.4.0-beta.3",
"xterm-addon-webgl": "0.12.0-beta.24",
"xterm-headless": "4.19.0-beta.7",
"xterm-headless": "4.19.0-beta.11",
"yauzl": "^2.9.2",
"yazl": "^2.4.3"
},
Expand Down
4 changes: 2 additions & 2 deletions remote/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"tas-client-umd": "0.1.4",
"vscode-oniguruma": "1.6.1",
"vscode-textmate": "6.0.0",
"xterm": "4.19.0-beta.7",
"xterm-addon-search": "0.9.0-beta.11",
"xterm": "4.19.0-beta.11",
"xterm-addon-search": "0.9.0-beta.12",
"xterm-addon-unicode11": "0.4.0-beta.3",
"xterm-addon-webgl": "0.12.0-beta.24"
}
Expand Down
16 changes: 8 additions & 8 deletions remote/web/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ vscode-textmate@6.0.0:
resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-6.0.0.tgz#a3777197235036814ac9a92451492f2748589210"
integrity sha512-gu73tuZfJgu+mvCSy4UZwd2JXykjK9zAZsfmDeut5dx/1a7FeTk0XwJsSuqQn+cuMCGVbIBfl+s53X4T19DnzQ==

xterm-addon-search@0.9.0-beta.11:
version "0.9.0-beta.11"
resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.9.0-beta.11.tgz#e6af723903e470564682eb80e5f0ca7e5d291c60"
integrity sha512-sUaOrgqFJvN7oI20ruKVOEqN5t4UK9q/pAR7FSjH5vVl6h0Hhtndh9bhrgoKCSe+Do1YfZCcpWx0Sbs9Y+2Ptg==
xterm-addon-search@0.9.0-beta.12:
version "0.9.0-beta.12"
resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.9.0-beta.12.tgz#8b0005aee9c212bf0d884cdf34cb81cd2a72b13c"
integrity sha512-NzZsfxGmHanCKbZLkCZMIqqioiUsFWyvZncN+FOoc5MpFZ5ytDjHkDOb5ZTEYfm+5FaVt2JTx7nZTsoEDXT+Xw==

xterm-addon-unicode11@0.4.0-beta.3:
version "0.4.0-beta.3"
Expand All @@ -128,7 +128,7 @@ xterm-addon-webgl@0.12.0-beta.24:
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.12.0-beta.24.tgz#5c17256933991856554c95c9bd1eaab42e9727a0"
integrity sha512-+wZxKReEOlfN9JRHyikoffA6Do61/THR7QY35ajkQo0lLutKr6hTd/TLTuZh0PhFVelgTgudpXqlP++Lc0WFIA==

xterm@4.19.0-beta.7:
version "4.19.0-beta.7"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.19.0-beta.7.tgz#25165366e005876d1e11418989b88687530ad902"
integrity sha512-BusEhdm+7Dwhtilk67mEISfYzrwJYXLgN+N+jbwVPZqDR9/CwPoG/cq6InibLAvciK1JCBwzSB32XeHFtZskWA==
xterm@4.19.0-beta.11:
version "4.19.0-beta.11"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.19.0-beta.11.tgz#36987dcf31ec1aa9c55a3e9d1fc4233407f4fba4"
integrity sha512-8fWXecwLn8EL5UwOZeigCb6cg3w3GOQT8AQvaWCVdsBAi4bgwY8UoRkMMtZf5yiWbHgnaMrwNk6/iZgyM2JDzQ==
24 changes: 12 additions & 12 deletions remote/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -914,10 +914,10 @@ wrappy@1:
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=

xterm-addon-search@0.9.0-beta.11:
version "0.9.0-beta.11"
resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.9.0-beta.11.tgz#e6af723903e470564682eb80e5f0ca7e5d291c60"
integrity sha512-sUaOrgqFJvN7oI20ruKVOEqN5t4UK9q/pAR7FSjH5vVl6h0Hhtndh9bhrgoKCSe+Do1YfZCcpWx0Sbs9Y+2Ptg==
xterm-addon-search@0.9.0-beta.12:
version "0.9.0-beta.12"
resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.9.0-beta.12.tgz#8b0005aee9c212bf0d884cdf34cb81cd2a72b13c"
integrity sha512-NzZsfxGmHanCKbZLkCZMIqqioiUsFWyvZncN+FOoc5MpFZ5ytDjHkDOb5ZTEYfm+5FaVt2JTx7nZTsoEDXT+Xw==

xterm-addon-serialize@0.7.0-beta.11:
version "0.7.0-beta.11"
Expand All @@ -934,15 +934,15 @@ xterm-addon-webgl@0.12.0-beta.24:
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.12.0-beta.24.tgz#5c17256933991856554c95c9bd1eaab42e9727a0"
integrity sha512-+wZxKReEOlfN9JRHyikoffA6Do61/THR7QY35ajkQo0lLutKr6hTd/TLTuZh0PhFVelgTgudpXqlP++Lc0WFIA==

xterm-headless@4.19.0-beta.7:
version "4.19.0-beta.7"
resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-4.19.0-beta.7.tgz#82de331ec183bfe8758250617b1dff700dc9380a"
integrity sha512-wLzw3Kro1UYXLd4ytk7mISrj7IytEAVCHEuk+Cdckknh+HiX1zFU351uOOh+IqpElIbibgor8kqB5ZDuptfaYw==
xterm-headless@4.19.0-beta.11:
version "4.19.0-beta.11"
resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-4.19.0-beta.11.tgz#848e8eaa1e5c11099ca62b61b6d2229af86ee4f2"
integrity sha512-xH8uNtrdVLGf3y7tt9t7L4SwuL1uiYGOSkbIsU24E5++8yOnzRXTUU3ux2ux6YA0/rOdAkTnGu5f839UGimapA==

xterm@4.19.0-beta.7:
version "4.19.0-beta.7"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.19.0-beta.7.tgz#25165366e005876d1e11418989b88687530ad902"
integrity sha512-BusEhdm+7Dwhtilk67mEISfYzrwJYXLgN+N+jbwVPZqDR9/CwPoG/cq6InibLAvciK1JCBwzSB32XeHFtZskWA==
xterm@4.19.0-beta.11:
version "4.19.0-beta.11"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.19.0-beta.11.tgz#36987dcf31ec1aa9c55a3e9d1fc4233407f4fba4"
integrity sha512-8fWXecwLn8EL5UwOZeigCb6cg3w3GOQT8AQvaWCVdsBAi4bgwY8UoRkMMtZf5yiWbHgnaMrwNk6/iZgyM2JDzQ==

yallist@^4.0.0:
version "4.0.0"
Expand Down
5 changes: 5 additions & 0 deletions src/vs/workbench/contrib/terminal/browser/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,11 @@ export interface IXtermTerminal {
* Clears decorations - for example, when shell integration is disabled.
*/
clearDecorations(): void;

/**
* Clears the search result decorations
*/
clearSearchDecorations(): void;
}

export interface IRequestAddInstanceToGroupEvent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export class TerminalFindWidget extends SimpleFindWidget {
if (instance) {
instance.focus();
}
instance?.xterm?.clearSearchDecorations();
}

protected _onInputChanged() {
Expand Down
20 changes: 20 additions & 0 deletions src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { DecorationAddon } from 'vs/workbench/contrib/terminal/browser/xterm/decorationAddon';
import { ITerminalCapabilityStore } from 'vs/platform/terminal/common/capabilities/capabilities';
import { Emitter } from 'vs/base/common/event';
import { ColorScheme } from 'vs/platform/theme/common/theme';

// How long in milliseconds should an average frame take to render for a notification to appear
// which suggests the fallback DOM-based renderer
Expand Down Expand Up @@ -252,13 +253,28 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal {
}

async findNext(term: string, searchOptions: ISearchOptions): Promise<boolean> {
this._updateFindColors(searchOptions);
return (await this._getSearchAddon()).findNext(term, searchOptions);
}

async findPrevious(term: string, searchOptions: ISearchOptions): Promise<boolean> {
this._updateFindColors(searchOptions);
return (await this._getSearchAddon()).findPrevious(term, searchOptions);
}

private _updateFindColors(searchOptions: ISearchOptions): void {
let selectedColor: string | undefined = this._configurationService.getValue('workbench.colorCustomizations.editor.findMatchBackground');
let matchColor: string | undefined = this._configurationService.getValue('workbench.colorCustomizations.editor.findMatchHighlightBackground') || '#EA5C0055';
if (!selectedColor) {
if (this._themeService.getColorTheme().type === ColorScheme.DARK) {
selectedColor = '#515C6A';
} else {
selectedColor = '#A8AC94';
}
}
searchOptions.decorations = { selectedColor, matchColor };
}

private async _getSearchAddon(): Promise<SearchAddonType> {
if (this._searchAddon) {
return this._searchAddon;
Expand All @@ -269,6 +285,10 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal {
return this._searchAddon;
}

clearSearchDecorations(): void {
this._searchAddon?.clearDecorations();
}

getFont(): ITerminalFont {
return this._configHelper.getFont(this._core);
}
Expand Down
24 changes: 12 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12330,10 +12330,10 @@ xtend@~2.1.1:
dependencies:
object-keys "~0.4.0"

xterm-addon-search@0.9.0-beta.11:
version "0.9.0-beta.11"
resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.9.0-beta.11.tgz#e6af723903e470564682eb80e5f0ca7e5d291c60"
integrity sha512-sUaOrgqFJvN7oI20ruKVOEqN5t4UK9q/pAR7FSjH5vVl6h0Hhtndh9bhrgoKCSe+Do1YfZCcpWx0Sbs9Y+2Ptg==
xterm-addon-search@0.9.0-beta.12:
version "0.9.0-beta.12"
resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.9.0-beta.12.tgz#8b0005aee9c212bf0d884cdf34cb81cd2a72b13c"
integrity sha512-NzZsfxGmHanCKbZLkCZMIqqioiUsFWyvZncN+FOoc5MpFZ5ytDjHkDOb5ZTEYfm+5FaVt2JTx7nZTsoEDXT+Xw==

xterm-addon-serialize@0.7.0-beta.11:
version "0.7.0-beta.11"
Expand All @@ -12350,15 +12350,15 @@ xterm-addon-webgl@0.12.0-beta.24:
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.12.0-beta.24.tgz#5c17256933991856554c95c9bd1eaab42e9727a0"
integrity sha512-+wZxKReEOlfN9JRHyikoffA6Do61/THR7QY35ajkQo0lLutKr6hTd/TLTuZh0PhFVelgTgudpXqlP++Lc0WFIA==

xterm-headless@4.19.0-beta.7:
version "4.19.0-beta.7"
resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-4.19.0-beta.7.tgz#82de331ec183bfe8758250617b1dff700dc9380a"
integrity sha512-wLzw3Kro1UYXLd4ytk7mISrj7IytEAVCHEuk+Cdckknh+HiX1zFU351uOOh+IqpElIbibgor8kqB5ZDuptfaYw==
xterm-headless@4.19.0-beta.11:
version "4.19.0-beta.11"
resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-4.19.0-beta.11.tgz#848e8eaa1e5c11099ca62b61b6d2229af86ee4f2"
integrity sha512-xH8uNtrdVLGf3y7tt9t7L4SwuL1uiYGOSkbIsU24E5++8yOnzRXTUU3ux2ux6YA0/rOdAkTnGu5f839UGimapA==

xterm@4.19.0-beta.7:
version "4.19.0-beta.7"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.19.0-beta.7.tgz#25165366e005876d1e11418989b88687530ad902"
integrity sha512-BusEhdm+7Dwhtilk67mEISfYzrwJYXLgN+N+jbwVPZqDR9/CwPoG/cq6InibLAvciK1JCBwzSB32XeHFtZskWA==
xterm@4.19.0-beta.11:
version "4.19.0-beta.11"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.19.0-beta.11.tgz#36987dcf31ec1aa9c55a3e9d1fc4233407f4fba4"
integrity sha512-8fWXecwLn8EL5UwOZeigCb6cg3w3GOQT8AQvaWCVdsBAi4bgwY8UoRkMMtZf5yiWbHgnaMrwNk6/iZgyM2JDzQ==

y18n@^3.2.1:
version "3.2.2"
Expand Down

0 comments on commit 4b92538

Please sign in to comment.