Merge pull request #198316 from microsoft/tyriar/198313

Focus terminal after clicking sticky scroll
This commit is contained in:
Daniel Imms 2023-11-15 06:49:07 -08:00 committed by GitHub
commit 110e7886e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -93,6 +93,7 @@ export class TerminalStickyScrollContribution extends Disposable implements ITer
const xtermCtorEventually = TerminalInstance.getXtermConstructor(this._keybindingService, this._contextKeyService);
this._overlay.value = this._instantiationService.createInstance(
TerminalStickyScrollOverlay,
this._instance,
this._xterm!,
this._instantiationService.createInstance(TerminalInstanceColorProvider, this._instance),
this._instance.capabilities.get(TerminalCapability.CommandDetection)!,

View file

@ -17,7 +17,7 @@ import { ICommandDetectionCapability, ITerminalCommand } from 'vs/platform/termi
import { ICurrentPartialCommand } from 'vs/platform/terminal/common/capabilities/commandDetection/terminalCommand';
import { TerminalSettingId } from 'vs/platform/terminal/common/terminal';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IXtermColorProvider, IXtermTerminal } from 'vs/workbench/contrib/terminal/browser/terminal';
import { ITerminalInstance, IXtermColorProvider, IXtermTerminal } from 'vs/workbench/contrib/terminal/browser/terminal';
import { IXtermCore } from 'vs/workbench/contrib/terminal/browser/xterm-private';
import { TERMINAL_CONFIG_SECTION } from 'vs/workbench/contrib/terminal/common/terminal';
import { terminalStickyScrollHoverBackground } from 'vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollColorRegistry';
@ -49,6 +49,7 @@ export class TerminalStickyScrollOverlay extends Disposable {
private _maxLineCount: number = 5;
constructor(
private readonly _instance: ITerminalInstance,
private readonly _xterm: IXtermTerminal & { raw: RawXtermTerminal },
private readonly _xtermColorProvider: IXtermColorProvider,
private readonly _commandDetection: ICommandDetectionCapability,
@ -273,6 +274,7 @@ export class TerminalStickyScrollOverlay extends Disposable {
this._register(addStandardDisposableListener(hoverOverlay, 'click', () => {
if (this._xterm && this._currentStickyCommand && 'getOutput' in this._currentStickyCommand) {
this._xterm.markTracker.revealCommand(this._currentStickyCommand);
this._instance.focus();
}
}));