diff options
author | Daniel Imms <2193314+Tyriar@users.noreply.github.com> | 2022-05-13 20:17:33 +0300 |
---|---|---|
committer | Daniel Imms <2193314+Tyriar@users.noreply.github.com> | 2022-05-13 20:17:33 +0300 |
commit | 99e15df830e18ef2abaccf52ceec7819408c5927 (patch) | |
tree | 7000529ceb5cf06b1eeeb4eb029121b8c743c74d | |
parent | 62bd3d754ac95fb1063affa7b905d986895605fb (diff) |
Update xterm and make term find styles consistent with editor
- A bunch of changes to xterm.js including bg/fg decoration overrides
- Tweak find colors to use background instead of border, align with the editor
- Change high contrast themes to also align, including selection bg
- Clear the find active result decoration on blur and when the selection changes
Fixes #147013
Fixes #145751
-rw-r--r-- | package.json | 8 | ||||
-rw-r--r-- | remote/package.json | 8 | ||||
-rw-r--r-- | remote/web/package.json | 6 | ||||
-rw-r--r-- | remote/web/yarn.lock | 24 | ||||
-rw-r--r-- | remote/yarn.lock | 32 | ||||
-rw-r--r-- | src/vs/workbench/contrib/terminal/browser/media/terminal.css | 6 | ||||
-rw-r--r-- | src/vs/workbench/contrib/terminal/browser/terminal.ts | 7 | ||||
-rw-r--r-- | src/vs/workbench/contrib/terminal/browser/terminalFindWidget.ts | 45 | ||||
-rw-r--r-- | src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts | 17 | ||||
-rw-r--r-- | src/vs/workbench/contrib/terminal/common/terminalColorRegistry.ts | 28 | ||||
-rw-r--r-- | yarn.lock | 32 |
11 files changed, 130 insertions, 83 deletions
diff --git a/package.json b/package.json index 4cbb594e9c8..acc64a5ce02 100644 --- a/package.json +++ b/package.json @@ -84,12 +84,12 @@ "vscode-proxy-agent": "^0.12.0", "vscode-regexpp": "^3.1.0", "vscode-textmate": "7.0.1", - "xterm": "4.19.0-beta.29", - "xterm-addon-search": "0.9.0-beta.26", + "xterm": "4.19.0-beta.41", + "xterm-addon-search": "0.9.0-beta.35", "xterm-addon-serialize": "0.7.0-beta.12", "xterm-addon-unicode11": "0.4.0-beta.3", - "xterm-addon-webgl": "0.12.0-beta.29", - "xterm-headless": "4.19.0-beta.29", + "xterm-addon-webgl": "0.12.0-beta.33", + "xterm-headless": "4.19.0-beta.41", "yauzl": "^2.9.2", "yazl": "^2.4.3" }, diff --git a/remote/package.json b/remote/package.json index ad16af4878c..2d7ace1fd91 100644 --- a/remote/package.json +++ b/remote/package.json @@ -24,12 +24,12 @@ "vscode-proxy-agent": "^0.12.0", "vscode-regexpp": "^3.1.0", "vscode-textmate": "7.0.1", - "xterm": "4.19.0-beta.29", - "xterm-addon-search": "0.9.0-beta.26", + "xterm": "4.19.0-beta.41", + "xterm-addon-search": "0.9.0-beta.35", "xterm-addon-serialize": "0.7.0-beta.12", "xterm-addon-unicode11": "0.4.0-beta.3", - "xterm-addon-webgl": "0.12.0-beta.29", - "xterm-headless": "4.19.0-beta.29", + "xterm-addon-webgl": "0.12.0-beta.33", + "xterm-headless": "4.19.0-beta.41", "yauzl": "^2.9.2", "yazl": "^2.4.3" }, diff --git a/remote/web/package.json b/remote/web/package.json index b56da999d19..4a477cd72d7 100644 --- a/remote/web/package.json +++ b/remote/web/package.json @@ -10,9 +10,9 @@ "tas-client-umd": "0.1.5", "vscode-oniguruma": "1.6.1", "vscode-textmate": "7.0.1", - "xterm": "4.19.0-beta.29", - "xterm-addon-search": "0.9.0-beta.26", + "xterm": "4.19.0-beta.41", + "xterm-addon-search": "0.9.0-beta.35", "xterm-addon-unicode11": "0.4.0-beta.3", - "xterm-addon-webgl": "0.12.0-beta.29" + "xterm-addon-webgl": "0.12.0-beta.33" } } diff --git a/remote/web/yarn.lock b/remote/web/yarn.lock index 0e4285693c1..a852b0f91e9 100644 --- a/remote/web/yarn.lock +++ b/remote/web/yarn.lock @@ -113,22 +113,22 @@ vscode-textmate@7.0.1: resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-7.0.1.tgz#8118a32b02735dccd14f893b495fa5389ad7de79" integrity sha512-zQ5U/nuXAAMsh691FtV0wPz89nSkHbs+IQV8FDk+wew9BlSDhf4UmWGlWJfTR2Ti6xZv87Tj5fENzKf6Qk7aLw== -xterm-addon-search@0.9.0-beta.26: - version "0.9.0-beta.26" - resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.9.0-beta.26.tgz#24259b892ce5cd8eff207e4e334dc06776356fe5" - integrity sha512-gOz6v9do7yBDP8e4zdpnDIi3DsyPdLA10lsJDucfMN4nJFM2PjJAsu1fbqq1pXdcu14fHIYzbsp9wIMiW524zQ== +xterm-addon-search@0.9.0-beta.35: + version "0.9.0-beta.35" + resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.9.0-beta.35.tgz#524ee3be855c1e8db234c6795bdb44bb6baff8fd" + integrity sha512-hTDqAhqlhBvz3dtdK1Tg5Al2U3HquSHpV1xCX+bbOmbgprAxUrSQxslUPDD69CTazzTyif3L19M08hccRyr1Ug== xterm-addon-unicode11@0.4.0-beta.3: version "0.4.0-beta.3" resolved "https://registry.yarnpkg.com/xterm-addon-unicode11/-/xterm-addon-unicode11-0.4.0-beta.3.tgz#f350184155fafd5ad0d6fbf31d13e6ca7dea1efa" integrity sha512-FryZAVwbUjKTmwXnm1trch/2XO60F5JsDvOkZhzobV1hm10sFLVuZpFyHXiUx7TFeeFsvNP+S77LAtWoeT5z+Q== -xterm-addon-webgl@0.12.0-beta.29: - version "0.12.0-beta.29" - resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.12.0-beta.29.tgz#7a508595c4521d14d7ed4315a121f9e3f230a0f0" - integrity sha512-NcZBsD0ar3ZpQX070hDIsyEBl/StRMNu6U+9crNpiD2rQVfkM1vcWkOv31Zlj3eu6/f8z5aStyZLRMCGFwiRbA== +xterm-addon-webgl@0.12.0-beta.33: + version "0.12.0-beta.33" + resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.12.0-beta.33.tgz#cb539db9e41f06087b692f0f42491a73bc4bd013" + integrity sha512-seOm06exR36U0/EvR/CUNGuy99RAndoyWEdXg6S16rgEZ4G2Yj9iov/QdCtc4gwq9hFzVETFPlDW+Ge8xeHIzA== -xterm@4.19.0-beta.29: - version "4.19.0-beta.29" - resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.19.0-beta.29.tgz#f0727ddbfe54f3c34a58e57ecbfcbb4d03a30386" - integrity sha512-ZlgrxgotcCB06W0Pk5ClHDkIDE62s1LebgehEsmaksJJtoOQJIxCVu1Kop4EnnPQzZxFaG7uYumfwe0tfd6uWA== +xterm@4.19.0-beta.41: + version "4.19.0-beta.41" + resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.19.0-beta.41.tgz#acb6009028898e9cfac41d4aa2865f81f6f56c5f" + integrity sha512-WY1NuxF/yUVN3l0TgzQGjrGM26eOu5g0Dbfam8GCkgdK5yrsgPF0xwM7UEj8sDjp5FbxEkSm//X86IIsgzqqFw== diff --git a/remote/yarn.lock b/remote/yarn.lock index 46f213014ee..968449c7184 100644 --- a/remote/yarn.lock +++ b/remote/yarn.lock @@ -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.26: - version "0.9.0-beta.26" - resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.9.0-beta.26.tgz#24259b892ce5cd8eff207e4e334dc06776356fe5" - integrity sha512-gOz6v9do7yBDP8e4zdpnDIi3DsyPdLA10lsJDucfMN4nJFM2PjJAsu1fbqq1pXdcu14fHIYzbsp9wIMiW524zQ== +xterm-addon-search@0.9.0-beta.35: + version "0.9.0-beta.35" + resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.9.0-beta.35.tgz#524ee3be855c1e8db234c6795bdb44bb6baff8fd" + integrity sha512-hTDqAhqlhBvz3dtdK1Tg5Al2U3HquSHpV1xCX+bbOmbgprAxUrSQxslUPDD69CTazzTyif3L19M08hccRyr1Ug== xterm-addon-serialize@0.7.0-beta.12: version "0.7.0-beta.12" @@ -929,20 +929,20 @@ xterm-addon-unicode11@0.4.0-beta.3: resolved "https://registry.yarnpkg.com/xterm-addon-unicode11/-/xterm-addon-unicode11-0.4.0-beta.3.tgz#f350184155fafd5ad0d6fbf31d13e6ca7dea1efa" integrity sha512-FryZAVwbUjKTmwXnm1trch/2XO60F5JsDvOkZhzobV1hm10sFLVuZpFyHXiUx7TFeeFsvNP+S77LAtWoeT5z+Q== -xterm-addon-webgl@0.12.0-beta.29: - version "0.12.0-beta.29" - resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.12.0-beta.29.tgz#7a508595c4521d14d7ed4315a121f9e3f230a0f0" - integrity sha512-NcZBsD0ar3ZpQX070hDIsyEBl/StRMNu6U+9crNpiD2rQVfkM1vcWkOv31Zlj3eu6/f8z5aStyZLRMCGFwiRbA== +xterm-addon-webgl@0.12.0-beta.33: + version "0.12.0-beta.33" + resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.12.0-beta.33.tgz#cb539db9e41f06087b692f0f42491a73bc4bd013" + integrity sha512-seOm06exR36U0/EvR/CUNGuy99RAndoyWEdXg6S16rgEZ4G2Yj9iov/QdCtc4gwq9hFzVETFPlDW+Ge8xeHIzA== -xterm-headless@4.19.0-beta.29: - version "4.19.0-beta.29" - resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-4.19.0-beta.29.tgz#9151a1506ddcad3402ce456bbbc6af0828952742" - integrity sha512-wAPyWOp2whY9kT9NL7PMQtvR/A9UO1A4bhP0nOOhZxg9GDeCy5EvsuDn2x+dtsh4jK/L2SZxM6SPHLpNoZpbTQ== +xterm-headless@4.19.0-beta.41: + version "4.19.0-beta.41" + resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-4.19.0-beta.41.tgz#f495ff173c7952aafa0c785acf15f20942c6fdc7" + integrity sha512-j09IFsM4tBSpjgY5OQSB1llojwEGyFFxgD36MYXZtopmB8p9+0l5GFq5hYfJojGfHCNaB/RwWAexGUxBK2ABRA== -xterm@4.19.0-beta.29: - version "4.19.0-beta.29" - resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.19.0-beta.29.tgz#f0727ddbfe54f3c34a58e57ecbfcbb4d03a30386" - integrity sha512-ZlgrxgotcCB06W0Pk5ClHDkIDE62s1LebgehEsmaksJJtoOQJIxCVu1Kop4EnnPQzZxFaG7uYumfwe0tfd6uWA== +xterm@4.19.0-beta.41: + version "4.19.0-beta.41" + resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.19.0-beta.41.tgz#acb6009028898e9cfac41d4aa2865f81f6f56c5f" + integrity sha512-WY1NuxF/yUVN3l0TgzQGjrGM26eOu5g0Dbfam8GCkgdK5yrsgPF0xwM7UEj8sDjp5FbxEkSm//X86IIsgzqqFw== yallist@^4.0.0: version "4.0.0" diff --git a/src/vs/workbench/contrib/terminal/browser/media/terminal.css b/src/vs/workbench/contrib/terminal/browser/media/terminal.css index 02867a99753..945161cad7f 100644 --- a/src/vs/workbench/contrib/terminal/browser/media/terminal.css +++ b/src/vs/workbench/contrib/terminal/browser/media/terminal.css @@ -458,3 +458,9 @@ .hc-light .xterm-find-result-decoration { outline-style: dotted !important; } + +.hc-black .xterm-find-active-result-decoration, +.hc-light .xterm-find-active-result-decoration { + outline-style: solid !important; + outline-width: 2px !important; +} diff --git a/src/vs/workbench/contrib/terminal/browser/terminal.ts b/src/vs/workbench/contrib/terminal/browser/terminal.ts index 7a9ca118355..6d1494b10d3 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminal.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminal.ts @@ -862,6 +862,8 @@ export interface IXtermTerminal { */ readonly shellIntegration: IShellIntegration; + readonly onDidChangeSelection: Event<void>; + /** * The position of the terminal. */ @@ -906,6 +908,11 @@ export interface IXtermTerminal { * Clears the search result decorations */ clearSearchDecorations(): void; + + /** + * Clears the active search result decorations + */ + clearActiveSearchDecoration(): void; } export interface IRequestAddInstanceToGroupEvent { diff --git a/src/vs/workbench/contrib/terminal/browser/terminalFindWidget.ts b/src/vs/workbench/contrib/terminal/browser/terminalFindWidget.ts index 4ba93e51fb3..ec9e1af2191 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalFindWidget.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalFindWidget.ts @@ -7,12 +7,14 @@ import { SimpleFindWidget } from 'vs/workbench/contrib/codeEditor/browser/find/s import { IContextViewService } from 'vs/platform/contextview/browser/contextView'; import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey'; import { FindReplaceState } from 'vs/editor/contrib/find/browser/findState'; -import { ITerminalGroupService, ITerminalService } from 'vs/workbench/contrib/terminal/browser/terminal'; +import { ITerminalGroupService, ITerminalService, IXtermTerminal } from 'vs/workbench/contrib/terminal/browser/terminal'; import { TerminalContextKeys } from 'vs/workbench/contrib/terminal/common/terminalContextKey'; import { TerminalLocation } from 'vs/platform/terminal/common/terminal'; import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; +import { Event } from 'vs/base/common/event'; +import { ISearchOptions } from 'xterm-addon-search'; export class TerminalFindWidget extends SimpleFindWidget { protected _findInputFocused: IContextKey<boolean>; @@ -50,23 +52,24 @@ export class TerminalFindWidget extends SimpleFindWidget { } find(previous: boolean, update?: boolean) { - const instance = this._terminalService.activeInstance; - if (!instance) { + const xterm = this._terminalService.activeInstance?.xterm; + if (!xterm) { return; } if (previous) { - instance.xterm?.findPrevious(this.inputValue, { regex: this._getRegexValue(), wholeWord: this._getWholeWordValue(), caseSensitive: this._getCaseSensitiveValue(), incremental: update }); + this._findPreviousWithEvent(xterm, this.inputValue, { regex: this._getRegexValue(), wholeWord: this._getWholeWordValue(), caseSensitive: this._getCaseSensitiveValue(), incremental: update }); } else { - instance.xterm?.findNext(this.inputValue, { regex: this._getRegexValue(), wholeWord: this._getWholeWordValue(), caseSensitive: this._getCaseSensitiveValue() }); + this._findNextWithEvent(xterm, this.inputValue, { regex: this._getRegexValue(), wholeWord: this._getWholeWordValue(), caseSensitive: this._getCaseSensitiveValue() }); } } override reveal(initialInput?: string): void { - const instance = this._terminalService.activeInstance; - if (instance && this.inputValue && this.inputValue !== '') { + const xterm = this._terminalService.activeInstance?.xterm; + if (xterm && this.inputValue && this.inputValue !== '') { // trigger highlight all matches - instance.xterm?.findPrevious(this.inputValue, { incremental: true, regex: this._getRegexValue(), wholeWord: this._getWholeWordValue(), caseSensitive: this._getCaseSensitiveValue() }).then(foundMatch => { + this._findPreviousWithEvent(xterm, this.inputValue, { incremental: true, regex: this._getRegexValue(), wholeWord: this._getWholeWordValue(), caseSensitive: this._getCaseSensitiveValue() }).then(foundMatch => { this.updateButtons(foundMatch); + this._register(Event.once(xterm.onDidChangeSelection)(() => xterm.clearActiveSearchDecoration())); }); } this.updateButtons(false); @@ -109,9 +112,9 @@ export class TerminalFindWidget extends SimpleFindWidget { protected _onInputChanged() { // Ignore input changes for now - const instance = this._terminalService.activeInstance; - if (instance?.xterm) { - instance.xterm.findPrevious(this.inputValue, { regex: this._getRegexValue(), wholeWord: this._getWholeWordValue(), caseSensitive: this._getCaseSensitiveValue(), incremental: true }).then(foundMatch => { + const xterm = this._terminalService.activeInstance?.xterm; + if (xterm) { + this._findPreviousWithEvent(xterm, this.inputValue, { regex: this._getRegexValue(), wholeWord: this._getWholeWordValue(), caseSensitive: this._getCaseSensitiveValue(), incremental: true }).then(foundMatch => { this.updateButtons(foundMatch); }); } @@ -130,6 +133,7 @@ export class TerminalFindWidget extends SimpleFindWidget { const instance = this._terminalService.activeInstance; if (instance) { instance.notifyFindWidgetFocusChanged(false); + instance.xterm?.clearActiveSearchDecoration(); } this._findWidgetFocused.reset(); } @@ -148,7 +152,24 @@ export class TerminalFindWidget extends SimpleFindWidget { if (instance.hasSelection()) { instance.clearSelection(); } - instance.xterm?.findPrevious(this.inputValue, { regex: this._getRegexValue(), wholeWord: this._getWholeWordValue(), caseSensitive: this._getCaseSensitiveValue() }); + const xterm = instance.xterm; + if (xterm) { + this._findPreviousWithEvent(xterm, this.inputValue, { regex: this._getRegexValue(), wholeWord: this._getWholeWordValue(), caseSensitive: this._getCaseSensitiveValue() }); + } } } + + private async _findNextWithEvent(xterm: IXtermTerminal, term: string, options: ISearchOptions): Promise<boolean> { + return xterm.findNext(term, options).then(foundMatch => { + this._register(Event.once(xterm.onDidChangeSelection)(() => xterm.clearActiveSearchDecoration())); + return foundMatch; + }); + } + + private async _findPreviousWithEvent(xterm: IXtermTerminal, term: string, options: ISearchOptions): Promise<boolean> { + return xterm.findPrevious(term, options).then(foundMatch => { + this._register(Event.once(xterm.onDidChangeSelection)(() => xterm.clearActiveSearchDecoration())); + return foundMatch; + }); + } } diff --git a/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts b/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts index 27c0a94e424..e36ce5e9de6 100644 --- a/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts +++ b/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts @@ -73,9 +73,10 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal { private readonly _onDidRequestRunCommand = new Emitter<{ command: ITerminalCommand; copyAsHtml?: boolean }>(); readonly onDidRequestRunCommand = this._onDidRequestRunCommand.event; - private readonly _onDidChangeFindResults = new Emitter<{ resultIndex: number; resultCount: number } | undefined>(); readonly onDidChangeFindResults = this._onDidChangeFindResults.event; + private readonly _onDidChangeSelection = new Emitter<void>(); + readonly onDidChangeSelection = this._onDidChangeSelection.event; get commandTracker(): ICommandTracker { return this._commandNavigationAddon; } get shellIntegration(): IShellIntegration { return this._shellIntegrationAddon; } @@ -165,6 +166,9 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal { } })); + // Refire events + this.add(this.raw.onSelectionChange(() => this._onDidChangeSelection.fire())); + // Load addons this._updateUnicodeVersion(); this._commandNavigationAddon = this._instantiationService.createInstance(CommandNavigationAddon, _capabilities); @@ -173,6 +177,7 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal { this.raw.loadAddon(this._shellIntegrationAddon); this._updateDecorationAddon(); } + private _createDecorationAddon(): void { this._decorationAddon = this._instantiationService.createInstance(DecorationAddon, this._capabilities); this._decorationAddon.onDidRequestRunCommand(e => this._onDidRequestRunCommand.fire(e)); @@ -287,6 +292,7 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal { // The mapping is as follows: // - findMatch -> activeMatch // - findMatchHighlight -> match + const terminalBackground = theme.getColor(TERMINAL_BACKGROUND_COLOR) || theme.getColor(PANEL_BACKGROUND); const findMatchBackground = theme.getColor(TERMINAL_FIND_MATCH_BACKGROUND_COLOR); const findMatchBorder = theme.getColor(TERMINAL_FIND_MATCH_BORDER_COLOR); const findMatchOverviewRuler = theme.getColor(TERMINAL_OVERVIEW_RULER_CURSOR_FOREGROUND_COLOR); @@ -294,10 +300,11 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal { const findMatchHighlightBorder = theme.getColor(TERMINAL_FIND_MATCH_HIGHLIGHT_BORDER_COLOR); const findMatchHighlightOverviewRuler = theme.getColor(TERMINAL_OVERVIEW_RULER_FIND_MATCH_FOREGROUND_COLOR); searchOptions.decorations = { - activeMatchBackground: findMatchBackground?.toString() || 'transparent', + activeMatchBackground: findMatchBackground?.toString(), activeMatchBorder: findMatchBorder?.toString() || 'transparent', activeMatchColorOverviewRuler: findMatchOverviewRuler?.toString() || 'transparent', - matchBackground: findMatchHighlightBackground?.toString() || 'transparent', + // decoration bgs don't support the alpha channel so blend it with the regular bg + matchBackground: terminalBackground ? findMatchHighlightBackground?.blend(terminalBackground).toString() : undefined, matchBorder: findMatchHighlightBorder?.toString() || 'transparent', matchOverviewRuler: findMatchHighlightOverviewRuler?.toString() || 'transparent' }; @@ -321,6 +328,10 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal { this._searchAddon?.clearDecorations(); } + clearActiveSearchDecoration(): void { + this._searchAddon?.clearActiveDecoration(); + } + getFont(): ITerminalFont { return this._configHelper.getFont(this._core); } diff --git a/src/vs/workbench/contrib/terminal/common/terminalColorRegistry.ts b/src/vs/workbench/contrib/terminal/common/terminalColorRegistry.ts index 59ba5731ce5..9390d7ccdd7 100644 --- a/src/vs/workbench/contrib/terminal/common/terminalColorRegistry.ts +++ b/src/vs/workbench/contrib/terminal/common/terminalColorRegistry.ts @@ -5,7 +5,7 @@ import * as nls from 'vs/nls'; -import { registerColor, ColorIdentifier, ColorDefaults, editorFindMatch, editorFindMatchHighlight, overviewRulerFindMatchForeground } from 'vs/platform/theme/common/colorRegistry'; +import { registerColor, ColorIdentifier, ColorDefaults, editorFindMatch, editorFindMatchHighlight, overviewRulerFindMatchForeground, editorSelectionBackground } from 'vs/platform/theme/common/colorRegistry'; import { EDITOR_DRAG_AND_DROP_BACKGROUND, PANEL_BORDER, TAB_ACTIVE_BORDER } from 'vs/workbench/common/theme'; /** @@ -24,10 +24,11 @@ export const TERMINAL_FOREGROUND_COLOR = registerColor('terminal.foreground', { export const TERMINAL_CURSOR_FOREGROUND_COLOR = registerColor('terminalCursor.foreground', null, nls.localize('terminalCursor.foreground', 'The foreground color of the terminal cursor.')); export const TERMINAL_CURSOR_BACKGROUND_COLOR = registerColor('terminalCursor.background', null, nls.localize('terminalCursor.background', 'The background color of the terminal cursor. Allows customizing the color of a character overlapped by a block cursor.')); export const TERMINAL_SELECTION_BACKGROUND_COLOR = registerColor('terminal.selectionBackground', { - light: '#00000040', - dark: '#FFFFFF40', + light: editorSelectionBackground, + dark: editorSelectionBackground, + // TODO: hcDark should be editorSelectionBackground (white) when min contrast ratio moves luminance the other way when needed https://github.com/xtermjs/xterm.js/issues/3720 hcDark: '#FFFFFF80', - hcLight: '#0F4A85' + hcLight: editorSelectionBackground }, nls.localize('terminal.selectionBackground', 'The selection background color of the terminal.')); export const TERMINAL_COMMAND_DECORATION_DEFAULT_BACKGROUND_COLOR = registerColor('terminalCommandDecoration.defaultBackground', { light: '#00000040', @@ -60,26 +61,27 @@ export const TERMINAL_BORDER_COLOR = registerColor('terminal.border', { hcLight: PANEL_BORDER }, nls.localize('terminal.border', 'The color of the border that separates split panes within the terminal. This defaults to panel.border.')); export const TERMINAL_FIND_MATCH_BACKGROUND_COLOR = registerColor('terminal.findMatchBackground', { - dark: null, - light: null, + dark: editorFindMatch, + light: editorFindMatch, + // Use regular selection background in high contrast with a thick border hcDark: null, - hcLight: null + hcLight: '#0F4A85' }, nls.localize('terminal.findMatchBackground', 'Color of the current search match in the terminal. The color must not be opaque so as not to hide underlying terminal content.')); export const TERMINAL_FIND_MATCH_BORDER_COLOR = registerColor('terminal.findMatchBorder', { - dark: editorFindMatch, - light: editorFindMatch, + dark: null, + light: null, hcDark: '#f38518', hcLight: '#0F4A85' }, nls.localize('terminal.findMatchBorder', 'Border color of the current search match in the terminal.')); export const TERMINAL_FIND_MATCH_HIGHLIGHT_BACKGROUND_COLOR = registerColor('terminal.findMatchHighlightBackground', { - dark: null, - light: null, + dark: editorFindMatchHighlight, + light: editorFindMatchHighlight, hcDark: null, hcLight: null }, nls.localize('terminal.findMatchHighlightBackground', 'Color of the other search matches in the terminal. The color must not be opaque so as not to hide underlying terminal content.')); export const TERMINAL_FIND_MATCH_HIGHLIGHT_BORDER_COLOR = registerColor('terminal.findMatchHighlightBorder', { - dark: editorFindMatchHighlight, - light: editorFindMatchHighlight, + dark: null, + light: null, hcDark: '#f38518', hcLight: '#0F4A85' }, nls.localize('terminal.findMatchHighlightBorder', 'Border color of the other search matches in the terminal.')); diff --git a/yarn.lock b/yarn.lock index 13805339355..8b7a2c516e6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12194,10 +12194,10 @@ xtend@~2.1.1: dependencies: object-keys "~0.4.0" -xterm-addon-search@0.9.0-beta.26: - version "0.9.0-beta.26" - resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.9.0-beta.26.tgz#24259b892ce5cd8eff207e4e334dc06776356fe5" - integrity sha512-gOz6v9do7yBDP8e4zdpnDIi3DsyPdLA10lsJDucfMN4nJFM2PjJAsu1fbqq1pXdcu14fHIYzbsp9wIMiW524zQ== +xterm-addon-search@0.9.0-beta.35: + version "0.9.0-beta.35" + resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.9.0-beta.35.tgz#524ee3be855c1e8db234c6795bdb44bb6baff8fd" + integrity sha512-hTDqAhqlhBvz3dtdK1Tg5Al2U3HquSHpV1xCX+bbOmbgprAxUrSQxslUPDD69CTazzTyif3L19M08hccRyr1Ug== xterm-addon-serialize@0.7.0-beta.12: version "0.7.0-beta.12" @@ -12209,20 +12209,20 @@ xterm-addon-unicode11@0.4.0-beta.3: resolved "https://registry.yarnpkg.com/xterm-addon-unicode11/-/xterm-addon-unicode11-0.4.0-beta.3.tgz#f350184155fafd5ad0d6fbf31d13e6ca7dea1efa" integrity sha512-FryZAVwbUjKTmwXnm1trch/2XO60F5JsDvOkZhzobV1hm10sFLVuZpFyHXiUx7TFeeFsvNP+S77LAtWoeT5z+Q== -xterm-addon-webgl@0.12.0-beta.29: - version "0.12.0-beta.29" - resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.12.0-beta.29.tgz#7a508595c4521d14d7ed4315a121f9e3f230a0f0" - integrity sha512-NcZBsD0ar3ZpQX070hDIsyEBl/StRMNu6U+9crNpiD2rQVfkM1vcWkOv31Zlj3eu6/f8z5aStyZLRMCGFwiRbA== +xterm-addon-webgl@0.12.0-beta.33: + version "0.12.0-beta.33" + resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.12.0-beta.33.tgz#cb539db9e41f06087b692f0f42491a73bc4bd013" + integrity sha512-seOm06exR36U0/EvR/CUNGuy99RAndoyWEdXg6S16rgEZ4G2Yj9iov/QdCtc4gwq9hFzVETFPlDW+Ge8xeHIzA== -xterm-headless@4.19.0-beta.29: - version "4.19.0-beta.29" - resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-4.19.0-beta.29.tgz#9151a1506ddcad3402ce456bbbc6af0828952742" - integrity sha512-wAPyWOp2whY9kT9NL7PMQtvR/A9UO1A4bhP0nOOhZxg9GDeCy5EvsuDn2x+dtsh4jK/L2SZxM6SPHLpNoZpbTQ== +xterm-headless@4.19.0-beta.41: + version "4.19.0-beta.41" + resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-4.19.0-beta.41.tgz#f495ff173c7952aafa0c785acf15f20942c6fdc7" + integrity sha512-j09IFsM4tBSpjgY5OQSB1llojwEGyFFxgD36MYXZtopmB8p9+0l5GFq5hYfJojGfHCNaB/RwWAexGUxBK2ABRA== -xterm@4.19.0-beta.29: - version "4.19.0-beta.29" - resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.19.0-beta.29.tgz#f0727ddbfe54f3c34a58e57ecbfcbb4d03a30386" - integrity sha512-ZlgrxgotcCB06W0Pk5ClHDkIDE62s1LebgehEsmaksJJtoOQJIxCVu1Kop4EnnPQzZxFaG7uYumfwe0tfd6uWA== +xterm@4.19.0-beta.41: + version "4.19.0-beta.41" + resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.19.0-beta.41.tgz#acb6009028898e9cfac41d4aa2865f81f6f56c5f" + integrity sha512-WY1NuxF/yUVN3l0TgzQGjrGM26eOu5g0Dbfam8GCkgdK5yrsgPF0xwM7UEj8sDjp5FbxEkSm//X86IIsgzqqFw== y18n@^3.2.1: version "3.2.2" |