Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve decorations #143130

Merged
merged 7 commits into from Feb 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/vs/workbench/contrib/terminal/browser/media/terminal.css
Expand Up @@ -102,6 +102,16 @@
padding-right: 20px;
}

.monaco-workbench .editor-instance .terminal-group .monaco-split-view2.horizontal .split-view-view:first-child .xterm .terminal-command-decoration,
.monaco-workbench .pane-body.integrated-terminal .terminal-group .monaco-split-view2.horizontal .split-view-view:first-child .xterm .terminal-command-decoration {
margin-left: -17px;
}

.monaco-workbench .editor-instance .terminal-group .monaco-split-view2.horizontal .split-view-view .xterm .terminal-command-decoration,
.monaco-workbench .pane-body.integrated-terminal .terminal-group .monaco-split-view2.horizontal .split-view-view .xterm .terminal-command-decoration {
margin-left: -12px;
}

.monaco-workbench .editor-instance .xterm a:not(.xterm-invalid-link),
.monaco-workbench .pane-body.integrated-terminal .xterm a:not(.xterm-invalid-link) {
/* To support message box sizing */
Expand Down Expand Up @@ -419,3 +429,8 @@
.terminal-command-decoration.skipped {
pointer-events: none;
}

.terminal-command-decoration {
width: 10px;
height: 10px;
}
Expand Up @@ -28,10 +28,9 @@ const enum DecorationSelector {
ErrorColor = 'error',
SkippedColor = 'skipped',
Codicon = 'codicon',
XtermScreen = 'xterm-screen'
}

const enum DecorationStyles { ButtonMargin = 4 }

interface IDisposableDecoration { decoration: IDecoration; disposables: IDisposable[] }

export class DecorationAddon extends Disposable implements ITerminalAddon {
Expand Down Expand Up @@ -121,8 +120,6 @@ export class DecorationAddon extends Disposable implements ITerminalAddon {
this._decorations.set(decoration.marker.id, { decoration, disposables });
}
if (decoration.element?.clientWidth! > 0) {
const marginWidth = ((decoration.element?.parentElement?.parentElement?.previousElementSibling?.clientWidth || 0) - (decoration.element?.parentElement?.parentElement?.clientWidth || 0)) * .5;
target.style.marginLeft = `${((marginWidth - (decoration.element!.clientWidth + DecorationStyles.ButtonMargin)) * .5) - marginWidth}px`;
target.classList.add(DecorationSelector.CommandDecoration);
target.classList.add(DecorationSelector.Codicon);
if (command.exitCode === undefined) {
Expand All @@ -135,8 +132,6 @@ export class DecorationAddon extends Disposable implements ITerminalAddon {
} else {
target.classList.add(`codicon-${this._configurationService.getValue(TerminalSettingId.CommandIcon)}`);
}
target.style.width = `${marginWidth}px`;
target.style.height = `${marginWidth}px`;
}
});
return decoration;
Expand Down Expand Up @@ -199,5 +194,5 @@ registerThemingParticipant((theme: IColorTheme, collector: ICssStyleCollector) =
const commandDecorationSkippedColor = theme.getColor(TERMINAL_COMMAND_DECORATION_SKIPPED_BACKGROUND_COLOR);
collector.addRule(`.${DecorationSelector.CommandDecoration}.${DecorationSelector.SkippedColor} { color: ${commandDecorationSkippedColor ? commandDecorationSkippedColor.toString() : ''}; } `);
const toolbarHoverBackgroundColor = theme.getColor(toolbarHoverBackground);
collector.addRule(`.${DecorationSelector.CommandDecoration}:not(.${DecorationSelector.SkippedColor}):hover { background-color: ${toolbarHoverBackgroundColor ? toolbarHoverBackgroundColor.toString() : ''}; }`);
collector.addRule(`.${DecorationSelector.CommandDecoration}:not(.${DecorationSelector.SkippedColor}):hover { background-color: ${toolbarHoverBackgroundColor ? toolbarHoverBackgroundColor.toString() : ''}; border-radius: 5px; }`);
});