mirror of
https://github.com/microsoft/vscode.git
synced 2026-02-15 07:28:05 +00:00
Merge pull request #209271 from microsoft/tyriar/xterm_private
Remove usage of several xterm private APIs
This commit is contained in:
@@ -856,7 +856,11 @@
|
||||
}, // TODO@layers
|
||||
"tas-client-umd", // node module allowed even in /common/
|
||||
"vscode-textmate", // node module allowed even in /common/
|
||||
"@vscode/vscode-languagedetection" // node module allowed even in /common/
|
||||
"@vscode/vscode-languagedetection", // node module allowed even in /common/
|
||||
{
|
||||
"when": "hasBrowser",
|
||||
"pattern": "@xterm/xterm"
|
||||
} // node module allowed even in /browser/
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1858,10 +1858,6 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
|
||||
|
||||
this.xterm.raw.resize(cols, rows);
|
||||
TerminalInstance._lastKnownGridDimensions = { cols, rows };
|
||||
|
||||
if (this._isVisible) {
|
||||
this.xterm.forceUnpause();
|
||||
}
|
||||
}
|
||||
|
||||
if (immediate) {
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
|
||||
import { IBufferCell } from '@xterm/xterm';
|
||||
|
||||
export type XtermAttributes = Omit<IBufferCell, 'getWidth' | 'getChars' | 'getCode'> & { clone?(): XtermAttributes };
|
||||
@@ -14,17 +12,6 @@ export interface IXtermCore {
|
||||
readonly scrollBarWidth: number;
|
||||
_innerRefresh(): void;
|
||||
};
|
||||
_onData: IEventEmitter<string>;
|
||||
_onKey: IEventEmitter<{ key: string }>;
|
||||
|
||||
_charSizeService: {
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
|
||||
coreService: {
|
||||
triggerDataEvent(data: string, wasUserInput?: boolean): void;
|
||||
};
|
||||
|
||||
_inputHandler: {
|
||||
_curAttrData: XtermAttributes;
|
||||
@@ -42,10 +29,5 @@ export interface IXtermCore {
|
||||
_renderer: {
|
||||
value?: unknown;
|
||||
};
|
||||
_handleIntersectionChange: any;
|
||||
};
|
||||
}
|
||||
|
||||
export interface IEventEmitter<T> {
|
||||
fire(e: T): void;
|
||||
}
|
||||
|
||||
@@ -437,19 +437,6 @@ export class XtermTerminal extends Disposable implements IXtermTerminal, IDetach
|
||||
this._core.viewport?._innerRefresh();
|
||||
}
|
||||
|
||||
forceUnpause() {
|
||||
// HACK: Force the renderer to unpause by simulating an IntersectionObserver event.
|
||||
// This is to fix an issue where dragging the windpow to the top of the screen to
|
||||
// maximize on Windows/Linux would fire an event saying that the terminal was not
|
||||
// visible.
|
||||
if (!!this._canvasAddon) {
|
||||
this._core._renderService?._handleIntersectionChange({ intersectionRatio: 1 });
|
||||
// HACK: Force a refresh of the screen to ensure links are refresh corrected.
|
||||
// This can probably be removed when the above hack is fixed in Chromium.
|
||||
this.raw.refresh(0, this.raw.rows - 1);
|
||||
}
|
||||
}
|
||||
|
||||
async findNext(term: string, searchOptions: ISearchOptions): Promise<boolean> {
|
||||
this._updateFindColors(searchOptions);
|
||||
return (await this._getSearchAddon()).findNext(term, searchOptions);
|
||||
|
||||
@@ -3,20 +3,15 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { deepStrictEqual } from 'assert';
|
||||
import { PartialCommandDetectionCapability } from 'vs/platform/terminal/common/capabilities/partialCommandDetectionCapability';
|
||||
import type { IMarker, Terminal } from '@xterm/xterm';
|
||||
import { IXtermCore } from 'vs/workbench/contrib/terminal/browser/xterm-private';
|
||||
import { deepStrictEqual } from 'assert';
|
||||
import { importAMDNodeModule } from 'vs/amdX';
|
||||
import { writeP } from 'vs/workbench/contrib/terminal/browser/terminalTestHelpers';
|
||||
import { ensureNoDisposablesAreLeakedInTestSuite } from 'vs/base/test/common/utils';
|
||||
|
||||
interface TestTerminal extends Terminal {
|
||||
_core: IXtermCore;
|
||||
}
|
||||
import { PartialCommandDetectionCapability } from 'vs/platform/terminal/common/capabilities/partialCommandDetectionCapability';
|
||||
import { writeP } from 'vs/workbench/contrib/terminal/browser/terminalTestHelpers';
|
||||
|
||||
suite('PartialCommandDetectionCapability', () => {
|
||||
let xterm: TestTerminal;
|
||||
let xterm: Terminal;
|
||||
let capability: PartialCommandDetectionCapability;
|
||||
let addEvents: IMarker[];
|
||||
|
||||
@@ -28,7 +23,7 @@ suite('PartialCommandDetectionCapability', () => {
|
||||
setup(async () => {
|
||||
const TerminalCtor = (await importAMDNodeModule<typeof import('@xterm/xterm')>('@xterm/xterm', 'lib/xterm.js')).Terminal;
|
||||
|
||||
xterm = new TerminalCtor({ allowProposedApi: true, cols: 80 }) as TestTerminal;
|
||||
xterm = new TerminalCtor({ allowProposedApi: true, cols: 80 }) as Terminal;
|
||||
capability = new PartialCommandDetectionCapability(xterm);
|
||||
addEvents = [];
|
||||
capability.onCommandFinished(e => addEvents.push(e));
|
||||
@@ -38,11 +33,11 @@ suite('PartialCommandDetectionCapability', () => {
|
||||
|
||||
test('should not add commands when the cursor position is too close to the left side', async () => {
|
||||
assertCommands([]);
|
||||
xterm._core._onData.fire('\x0d');
|
||||
xterm.input('\x0d');
|
||||
await writeP(xterm, '\r\n');
|
||||
assertCommands([]);
|
||||
await writeP(xterm, 'a');
|
||||
xterm._core._onData.fire('\x0d');
|
||||
xterm.input('\x0d');
|
||||
await writeP(xterm, '\r\n');
|
||||
assertCommands([]);
|
||||
});
|
||||
@@ -50,11 +45,11 @@ suite('PartialCommandDetectionCapability', () => {
|
||||
test('should add commands when the cursor position is not too close to the left side', async () => {
|
||||
assertCommands([]);
|
||||
await writeP(xterm, 'ab');
|
||||
xterm._core._onData.fire('\x0d');
|
||||
xterm.input('\x0d');
|
||||
await writeP(xterm, '\r\n\r\n');
|
||||
assertCommands([0]);
|
||||
await writeP(xterm, 'cd');
|
||||
xterm._core._onData.fire('\x0d');
|
||||
xterm.input('\x0d');
|
||||
await writeP(xterm, '\r\n');
|
||||
assertCommands([0, 2]);
|
||||
});
|
||||
|
||||
@@ -17,6 +17,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
|
||||
import { IWindowDriver, IElement, ILocaleInfo, ILocalizedStrings } from 'vs/workbench/services/driver/common/driver';
|
||||
import { ILifecycleService, LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
|
||||
import type { Terminal as XtermTerminal } from '@xterm/xterm';
|
||||
|
||||
export class BrowserWindowDriver implements IWindowDriver {
|
||||
|
||||
@@ -174,13 +175,13 @@ export class BrowserWindowDriver implements IWindowDriver {
|
||||
throw new Error(`Element not found: ${selector}`);
|
||||
}
|
||||
|
||||
const xterm = (element as any).xterm;
|
||||
const xterm = (element as any).xterm as (XtermTerminal | undefined);
|
||||
|
||||
if (!xterm) {
|
||||
throw new Error(`Xterm not found: ${selector}`);
|
||||
}
|
||||
|
||||
xterm._core.coreService.triggerDataEvent(text);
|
||||
xterm.input(text);
|
||||
}
|
||||
|
||||
getLocaleInfo(): Promise<ILocaleInfo> {
|
||||
|
||||
Reference in New Issue
Block a user