Skip to content

Commit

Permalink
reintroduce hide
Browse files Browse the repository at this point in the history
  • Loading branch information
meganrogge committed Mar 10, 2023
1 parent 8c36549 commit a39a500
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/vs/workbench/contrib/terminal/browser/media/xterm.css
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,7 @@
z-index: 2;
position: relative;
}

.hide {
opacity: 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import type { Terminal } from 'xterm';

const enum AccessibleBufferConstants {
Scheme = 'terminal-accessible-buffer',
Active = 'active'
Active = 'active',
Hide = 'hide'
}

export class AccessibleBufferWidget extends DisposableStore {
Expand Down Expand Up @@ -102,19 +103,20 @@ export class AccessibleBufferWidget extends DisposableStore {

private _hide(): void {
this._accessibleBuffer.classList.remove(AccessibleBufferConstants.Active);
this._xtermElement.classList.remove(AccessibleBufferConstants.Hide);
this._xterm.raw.focus();
}

private async _updateModel(insertion?: boolean): Promise<void> {
let model = this._bufferEditor.getModel();
const lineCount = model?.getLineCount() ?? 0;
if (insertion && model && lineCount > this._xterm.raw.rows) {
const selection = this._bufferEditor.getSelection();
const lineNumber = lineCount + 1;
model.pushEditOperations(selection ? [selection] : null, [{ range: { startLineNumber: lineNumber, endLineNumber: lineNumber, startColumn: 1, endColumn: 1 }, text: await this._getContent(lineNumber - 1) }], () => []);
model.pushEditOperations(null, [{ range: { startLineNumber: lineNumber, endLineNumber: lineNumber, startColumn: 1, endColumn: 1 }, text: await this._getContent(lineNumber - 1) }], () => []);
return;
} else {
model = await this._getTextModel(URI.from({ scheme: `${AccessibleBufferConstants.Scheme}-${this._instanceId}`, fragment: await this._getContent() }));
}
model = await this._getTextModel(URI.from({ scheme: `${AccessibleBufferConstants.Scheme}-${this._instanceId}`, fragment: await this._getContent() }));
if (!model) {
throw new Error('Could not create accessible buffer editor model');
}
Expand All @@ -141,6 +143,7 @@ export class AccessibleBufferWidget extends DisposableStore {
await this._updateEditor();
this._accessibleBuffer.tabIndex = -1;
this._accessibleBuffer.classList.add(AccessibleBufferConstants.Active);
this._xtermElement.classList.add(AccessibleBufferConstants.Hide);
}

private async _getTextModel(resource: URI): Promise<ITextModel | null> {
Expand Down

0 comments on commit a39a500

Please sign in to comment.