mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 13:29:44 +00:00
add accessibility buffer (#171118)
This commit is contained in:
parent
3fd6567102
commit
ef9fb8a4ea
|
@ -87,13 +87,13 @@
|
|||
"vscode-proxy-agent": "^0.12.0",
|
||||
"vscode-regexpp": "^3.1.0",
|
||||
"vscode-textmate": "8.0.0",
|
||||
"xterm": "5.2.0-beta.10",
|
||||
"xterm-addon-canvas": "0.4.0-beta.6",
|
||||
"xterm": "5.2.0-beta.15",
|
||||
"xterm-addon-canvas": "0.4.0-beta.7",
|
||||
"xterm-addon-search": "0.11.0",
|
||||
"xterm-addon-serialize": "0.9.0",
|
||||
"xterm-addon-unicode11": "0.5.0",
|
||||
"xterm-addon-webgl": "0.15.0-beta.4",
|
||||
"xterm-headless": "5.2.0-beta.10",
|
||||
"xterm-headless": "5.2.0-beta.15",
|
||||
"yauzl": "^2.9.2",
|
||||
"yazl": "^2.4.3"
|
||||
},
|
||||
|
|
|
@ -24,13 +24,13 @@
|
|||
"vscode-proxy-agent": "^0.12.0",
|
||||
"vscode-regexpp": "^3.1.0",
|
||||
"vscode-textmate": "8.0.0",
|
||||
"xterm": "5.2.0-beta.10",
|
||||
"xterm-addon-canvas": "0.4.0-beta.6",
|
||||
"xterm": "5.2.0-beta.15",
|
||||
"xterm-addon-canvas": "0.4.0-beta.7",
|
||||
"xterm-addon-search": "0.11.0",
|
||||
"xterm-addon-serialize": "0.9.0",
|
||||
"xterm-addon-unicode11": "0.5.0",
|
||||
"xterm-addon-webgl": "0.15.0-beta.4",
|
||||
"xterm-headless": "5.2.0-beta.10",
|
||||
"xterm-headless": "5.2.0-beta.15",
|
||||
"yauzl": "^2.9.2",
|
||||
"yazl": "^2.4.3"
|
||||
},
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
"tas-client-umd": "0.1.6",
|
||||
"vscode-oniguruma": "1.7.0",
|
||||
"vscode-textmate": "8.0.0",
|
||||
"xterm": "5.2.0-beta.10",
|
||||
"xterm-addon-canvas": "0.4.0-beta.6",
|
||||
"xterm": "5.2.0-beta.15",
|
||||
"xterm-addon-canvas": "0.4.0-beta.7",
|
||||
"xterm-addon-search": "0.11.0",
|
||||
"xterm-addon-unicode11": "0.5.0",
|
||||
"xterm-addon-webgl": "0.15.0-beta.4"
|
||||
|
|
|
@ -68,10 +68,10 @@ vscode-textmate@8.0.0:
|
|||
resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-8.0.0.tgz#2c7a3b1163ef0441097e0b5d6389cd5504b59e5d"
|
||||
integrity sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==
|
||||
|
||||
xterm-addon-canvas@0.4.0-beta.6:
|
||||
version "0.4.0-beta.6"
|
||||
resolved "https://registry.yarnpkg.com/xterm-addon-canvas/-/xterm-addon-canvas-0.4.0-beta.6.tgz#f8cb09ef980f1fa9d73f067e00f7a879c374ad68"
|
||||
integrity sha512-x5OY0VOJxqvXdyXpW9aug3vaeQX/+r7TZk13MujReuJRLRAjCHaH6ep6g9ZOVlqa8VCBWPwmm/eXH05SGUbnQQ==
|
||||
xterm-addon-canvas@0.4.0-beta.7:
|
||||
version "0.4.0-beta.7"
|
||||
resolved "https://registry.yarnpkg.com/xterm-addon-canvas/-/xterm-addon-canvas-0.4.0-beta.7.tgz#ae365d8e10c900292186529f70f7f275ac94b3d5"
|
||||
integrity sha512-r1hbQTsulI49orR5G3qWrJCwn2dKsEUCrgj6xsmgXuTeoUcGfed6lly+MvYlL3P8aPrxS2fC2TEzSM0Au4SX+w==
|
||||
|
||||
xterm-addon-search@0.11.0:
|
||||
version "0.11.0"
|
||||
|
@ -88,7 +88,7 @@ xterm-addon-webgl@0.15.0-beta.4:
|
|||
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.15.0-beta.4.tgz#d03a98e446372a5dbb7d92075d1f125eec23b030"
|
||||
integrity sha512-W9N0+5i3trQhgBOHDsnNiBbBiJpleFenY668wWaZ9GlvWseCTnjnWis1kfnM9WASDh/0+7aOjWrD089o+QeHGQ==
|
||||
|
||||
xterm@5.2.0-beta.10:
|
||||
version "5.2.0-beta.10"
|
||||
resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.2.0-beta.10.tgz#33e67a8397937dd8b731a2f315c67f4bd63f3c28"
|
||||
integrity sha512-3zVxU/0XrUWpvOIU/KkXREweq7hCxNGFt4asT4D/SsRlRKYOnO+vooz1CjLO6USY++iHXicgf8PdgRDeYj5fFQ==
|
||||
xterm@5.2.0-beta.15:
|
||||
version "5.2.0-beta.15"
|
||||
resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.2.0-beta.15.tgz#958ff5487cd45ee9aa8afa0015cf51ad7b0fe10f"
|
||||
integrity sha512-PalmC7RNKzTVbRAERaW57jj5OhjYiASggODvCSNOje4bXcXNYzi74NHBRDyVu33zzsiiVQYLq4xjb8teBCrznw==
|
||||
|
|
|
@ -841,10 +841,10 @@ wrappy@1:
|
|||
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
|
||||
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
|
||||
|
||||
xterm-addon-canvas@0.4.0-beta.6:
|
||||
version "0.4.0-beta.6"
|
||||
resolved "https://registry.yarnpkg.com/xterm-addon-canvas/-/xterm-addon-canvas-0.4.0-beta.6.tgz#f8cb09ef980f1fa9d73f067e00f7a879c374ad68"
|
||||
integrity sha512-x5OY0VOJxqvXdyXpW9aug3vaeQX/+r7TZk13MujReuJRLRAjCHaH6ep6g9ZOVlqa8VCBWPwmm/eXH05SGUbnQQ==
|
||||
xterm-addon-canvas@0.4.0-beta.7:
|
||||
version "0.4.0-beta.7"
|
||||
resolved "https://registry.yarnpkg.com/xterm-addon-canvas/-/xterm-addon-canvas-0.4.0-beta.7.tgz#ae365d8e10c900292186529f70f7f275ac94b3d5"
|
||||
integrity sha512-r1hbQTsulI49orR5G3qWrJCwn2dKsEUCrgj6xsmgXuTeoUcGfed6lly+MvYlL3P8aPrxS2fC2TEzSM0Au4SX+w==
|
||||
|
||||
xterm-addon-search@0.11.0:
|
||||
version "0.11.0"
|
||||
|
@ -866,15 +866,15 @@ xterm-addon-webgl@0.15.0-beta.4:
|
|||
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.15.0-beta.4.tgz#d03a98e446372a5dbb7d92075d1f125eec23b030"
|
||||
integrity sha512-W9N0+5i3trQhgBOHDsnNiBbBiJpleFenY668wWaZ9GlvWseCTnjnWis1kfnM9WASDh/0+7aOjWrD089o+QeHGQ==
|
||||
|
||||
xterm-headless@5.2.0-beta.10:
|
||||
version "5.2.0-beta.10"
|
||||
resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-5.2.0-beta.10.tgz#fc7b11b0395f6bb934b0c9373b412bc4d3247148"
|
||||
integrity sha512-jjylqERzLWWrPLpehL1v0Y3JaZqQksoqE04g5H+tNceQemoBlIpbA5OgPrbcjz5xxFIR9mVWppFR7klWox5/Sg==
|
||||
xterm-headless@5.2.0-beta.15:
|
||||
version "5.2.0-beta.15"
|
||||
resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-5.2.0-beta.15.tgz#492eeb62f39e8e49d31e3f762895a0bc3eba6446"
|
||||
integrity sha512-moZ90KqzwDdotq9hCrwS006haMBq0kVybYHZSZXriqRvBXHpePC3i/70OZZL0kTSG1aLo3A5VwrO3zj0quN0DQ==
|
||||
|
||||
xterm@5.2.0-beta.10:
|
||||
version "5.2.0-beta.10"
|
||||
resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.2.0-beta.10.tgz#33e67a8397937dd8b731a2f315c67f4bd63f3c28"
|
||||
integrity sha512-3zVxU/0XrUWpvOIU/KkXREweq7hCxNGFt4asT4D/SsRlRKYOnO+vooz1CjLO6USY++iHXicgf8PdgRDeYj5fFQ==
|
||||
xterm@5.2.0-beta.15:
|
||||
version "5.2.0-beta.15"
|
||||
resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.2.0-beta.15.tgz#958ff5487cd45ee9aa8afa0015cf51ad7b0fe10f"
|
||||
integrity sha512-PalmC7RNKzTVbRAERaW57jj5OhjYiASggODvCSNOje4bXcXNYzi74NHBRDyVu33zzsiiVQYLq4xjb8teBCrznw==
|
||||
|
||||
yallist@^4.0.0:
|
||||
version "4.0.0"
|
||||
|
|
|
@ -542,3 +542,4 @@
|
|||
.monaco-workbench .pane-body.integrated-terminal .xterm .xterm-viewport::-webkit-scrollbar-thumb:active {
|
||||
background-color: var(--vscode-scrollbarSlider-activeBackground);
|
||||
}
|
||||
|
||||
|
|
|
@ -208,3 +208,24 @@
|
|||
z-index: 2;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.xterm .xterm-accessibility-buffer {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
padding: .5em;
|
||||
opacity: 0;
|
||||
overflow: scroll;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.xterm .xterm-accessibility-buffer:focus {
|
||||
opacity: 1;
|
||||
z-index: 33;
|
||||
top: -5px;
|
||||
left: 5px;
|
||||
pointer-events: none;
|
||||
background-color: var(--vscode-terminal-background, --vscode-panel-background);
|
||||
}
|
||||
|
|
|
@ -705,6 +705,11 @@ export interface ITerminalInstance {
|
|||
*/
|
||||
detachProcessAndDispose(reason: TerminalExitReason): Promise<void>;
|
||||
|
||||
/**
|
||||
* Focuses the terminal buffer accessibility element
|
||||
*/
|
||||
focusAccessibilityBuffer(): void;
|
||||
|
||||
/**
|
||||
* Check if anything is selected in terminal.
|
||||
*/
|
||||
|
|
|
@ -382,6 +382,25 @@ export function registerTerminalActions() {
|
|||
}
|
||||
}
|
||||
});
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: TerminalCommandId.EnterAccessibilityMode,
|
||||
title: { value: localize('workbench.action.terminal.enterAccessibilityMode', 'Enter Accessibility Mode'), original: 'Enter Accessibility Mode' },
|
||||
f1: true,
|
||||
category,
|
||||
precondition: ContextKeyExpr.and(CONTEXT_ACCESSIBILITY_MODE_ENABLED, ContextKeyExpr.or(TerminalContextKeys.processSupported, TerminalContextKeys.terminalHasBeenCreated)),
|
||||
keybinding: {
|
||||
primary: KeyMod.Shift | KeyCode.Tab,
|
||||
weight: KeybindingWeight.WorkbenchContrib,
|
||||
when: TerminalContextKeys.focus
|
||||
}
|
||||
});
|
||||
}
|
||||
async run(accessor: ServicesAccessor): Promise<void> {
|
||||
accessor.get(ITerminalService).activeInstance?.focusAccessibilityBuffer();
|
||||
}
|
||||
});
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
|
|
|
@ -215,6 +215,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
|
|||
get usedShellIntegrationInjection(): boolean { return this._usedShellIntegrationInjection; }
|
||||
private _quickFixAddon: TerminalQuickFixAddon | undefined;
|
||||
private _lineDataEventAddon: LineDataEventAddon | undefined;
|
||||
private _accessibilityBuffer: HTMLElement | undefined;
|
||||
|
||||
readonly capabilities = new TerminalCapabilityStoreMultiplexer();
|
||||
readonly statusList: ITerminalStatusList;
|
||||
|
@ -1095,6 +1096,20 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
|
|||
}
|
||||
}
|
||||
|
||||
focusAccessibilityBuffer(): void {
|
||||
if (!this.xterm?.raw.element) {
|
||||
return;
|
||||
}
|
||||
this._accessibilityBuffer = this.xterm.raw.element.querySelector('.xterm-accessibility-buffer') as HTMLElement || undefined;
|
||||
if (!this._accessibilityBuffer) {
|
||||
return;
|
||||
}
|
||||
// The viewport is undefined when this is focused, so we cannot get the cell height from that. Instead, estimate using the font.
|
||||
const cellHeight = this._configHelper.getFont((this.xterm.raw as any)._core)?.charHeight || undefined;
|
||||
this._accessibilityBuffer.style.lineHeight = cellHeight ? (this._configurationService.getValue(TerminalSettingId.LineHeight) as number) * cellHeight + 'px' : '';
|
||||
this._accessibilityBuffer.focus();
|
||||
}
|
||||
|
||||
private _setShellIntegrationContextKey(): void {
|
||||
if (this.xterm) {
|
||||
this._terminalShellIntegrationEnabledContextKey.set(this.xterm.shellIntegration.status === ShellIntegrationStatus.VSCode);
|
||||
|
|
|
@ -498,6 +498,7 @@ export const enum TerminalCommandId {
|
|||
OpenFileLink = 'workbench.action.terminal.openFileLink',
|
||||
OpenWebLink = 'workbench.action.terminal.openUrlLink',
|
||||
RunRecentCommand = 'workbench.action.terminal.runRecentCommand',
|
||||
EnterAccessibilityMode = 'workbench.action.terminal.enterAccessibilityMode',
|
||||
CopyLastCommandOutput = 'workbench.action.terminal.copyLastCommandOutput',
|
||||
GoToRecentDirectory = 'workbench.action.terminal.goToRecentDirectory',
|
||||
CopyAndClearSelection = 'workbench.action.terminal.copyAndClearSelection',
|
||||
|
|
24
yarn.lock
24
yarn.lock
|
@ -11717,10 +11717,10 @@ xtend@~2.1.1:
|
|||
dependencies:
|
||||
object-keys "~0.4.0"
|
||||
|
||||
xterm-addon-canvas@0.4.0-beta.6:
|
||||
version "0.4.0-beta.6"
|
||||
resolved "https://registry.yarnpkg.com/xterm-addon-canvas/-/xterm-addon-canvas-0.4.0-beta.6.tgz#f8cb09ef980f1fa9d73f067e00f7a879c374ad68"
|
||||
integrity sha512-x5OY0VOJxqvXdyXpW9aug3vaeQX/+r7TZk13MujReuJRLRAjCHaH6ep6g9ZOVlqa8VCBWPwmm/eXH05SGUbnQQ==
|
||||
xterm-addon-canvas@0.4.0-beta.7:
|
||||
version "0.4.0-beta.7"
|
||||
resolved "https://registry.yarnpkg.com/xterm-addon-canvas/-/xterm-addon-canvas-0.4.0-beta.7.tgz#ae365d8e10c900292186529f70f7f275ac94b3d5"
|
||||
integrity sha512-r1hbQTsulI49orR5G3qWrJCwn2dKsEUCrgj6xsmgXuTeoUcGfed6lly+MvYlL3P8aPrxS2fC2TEzSM0Au4SX+w==
|
||||
|
||||
xterm-addon-search@0.11.0:
|
||||
version "0.11.0"
|
||||
|
@ -11742,15 +11742,15 @@ xterm-addon-webgl@0.15.0-beta.4:
|
|||
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.15.0-beta.4.tgz#d03a98e446372a5dbb7d92075d1f125eec23b030"
|
||||
integrity sha512-W9N0+5i3trQhgBOHDsnNiBbBiJpleFenY668wWaZ9GlvWseCTnjnWis1kfnM9WASDh/0+7aOjWrD089o+QeHGQ==
|
||||
|
||||
xterm-headless@5.2.0-beta.10:
|
||||
version "5.2.0-beta.10"
|
||||
resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-5.2.0-beta.10.tgz#fc7b11b0395f6bb934b0c9373b412bc4d3247148"
|
||||
integrity sha512-jjylqERzLWWrPLpehL1v0Y3JaZqQksoqE04g5H+tNceQemoBlIpbA5OgPrbcjz5xxFIR9mVWppFR7klWox5/Sg==
|
||||
xterm-headless@5.2.0-beta.15:
|
||||
version "5.2.0-beta.15"
|
||||
resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-5.2.0-beta.15.tgz#492eeb62f39e8e49d31e3f762895a0bc3eba6446"
|
||||
integrity sha512-moZ90KqzwDdotq9hCrwS006haMBq0kVybYHZSZXriqRvBXHpePC3i/70OZZL0kTSG1aLo3A5VwrO3zj0quN0DQ==
|
||||
|
||||
xterm@5.2.0-beta.10:
|
||||
version "5.2.0-beta.10"
|
||||
resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.2.0-beta.10.tgz#33e67a8397937dd8b731a2f315c67f4bd63f3c28"
|
||||
integrity sha512-3zVxU/0XrUWpvOIU/KkXREweq7hCxNGFt4asT4D/SsRlRKYOnO+vooz1CjLO6USY++iHXicgf8PdgRDeYj5fFQ==
|
||||
xterm@5.2.0-beta.15:
|
||||
version "5.2.0-beta.15"
|
||||
resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.2.0-beta.15.tgz#958ff5487cd45ee9aa8afa0015cf51ad7b0fe10f"
|
||||
integrity sha512-PalmC7RNKzTVbRAERaW57jj5OhjYiASggODvCSNOje4bXcXNYzi74NHBRDyVu33zzsiiVQYLq4xjb8teBCrznw==
|
||||
|
||||
y18n@^3.2.1:
|
||||
version "3.2.2"
|
||||
|
|
Loading…
Reference in a new issue