Skip to content

Commit 0354163

Browse files
authored
SCM - fix commit input text selection (microsoft#218249)
1 parent df8835a commit 0354163

File tree

2 files changed

+30
-19
lines changed

2 files changed

+30
-19
lines changed

src/vs/workbench/contrib/scm/browser/media/scm.css

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -353,23 +353,6 @@
353353
border-radius: 2px;
354354
}
355355

356-
.scm-view .scm-editor-container .monaco-editor .selected-text {
357-
background-color: rgba(var(--vscode-input-background), 0.4);
358-
border-radius: 0;
359-
}
360-
361-
.scm-view .scm-editor-container .monaco-editor .focused .selected-text {
362-
background-color: var(--vscode-selection-background, var(--vscode-editor-selectionBackground));
363-
}
364-
365-
.scm-view .scm-editor-container .monaco-editor .view-line span.inline-selected-text {
366-
color: var(--vscode-input-foreground);
367-
}
368-
369-
.scm-view .scm-editor-container .monaco-editor-background {
370-
background-color: var(--vscode-input-background);
371-
}
372-
373356
.scm-view .scm-editor {
374357
box-sizing: border-box;
375358
width: 100%;

src/vs/workbench/contrib/scm/browser/scmViewPane.ts

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
2323
import { MenuItemAction, IMenuService, registerAction2, MenuId, IAction2Options, MenuRegistry, Action2, IMenu } from 'vs/platform/actions/common/actions';
2424
import { IAction, ActionRunner, Action, Separator, IActionRunner } from 'vs/base/common/actions';
2525
import { ActionBar, IActionViewItemProvider } from 'vs/base/browser/ui/actionbar/actionbar';
26-
import { IThemeService, IFileIconTheme } from 'vs/platform/theme/common/themeService';
26+
import { IThemeService, IFileIconTheme, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
2727
import { isSCMResource, isSCMResourceGroup, connectPrimaryMenuToInlineActionBar, isSCMRepository, isSCMInput, collectContextMenuActions, getActionViewItemProvider, isSCMActionButton, isSCMViewService, isSCMHistoryItemGroupTreeElement, isSCMHistoryItemTreeElement, isSCMHistoryItemChangeTreeElement, toDiffEditorArguments, isSCMResourceNode, isSCMHistoryItemChangeNode, isSCMViewSeparator, connectPrimaryMenu, isSCMHistoryItemViewModelTreeElement } from './util';
2828
import { WorkbenchCompressibleAsyncDataTree, IOpenEvent } from 'vs/platform/list/browser/listService';
2929
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
@@ -96,7 +96,7 @@ import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity'
9696
import { EditOperation } from 'vs/editor/common/core/editOperation';
9797
import { stripIcons } from 'vs/base/common/iconLabels';
9898
import { IconLabel } from 'vs/base/browser/ui/iconLabel/iconLabel';
99-
import { foreground, listActiveSelectionForeground, registerColor, transparent } from 'vs/platform/theme/common/colorRegistry';
99+
import { editorSelectionBackground, foreground, inputBackground, inputForeground, listActiveSelectionForeground, registerColor, selectionBackground, transparent } from 'vs/platform/theme/common/colorRegistry';
100100
import { IMenuWorkbenchToolBarOptions, MenuWorkbenchToolBar, WorkbenchToolBar } from 'vs/platform/actions/browser/toolbar';
101101
import { CancellationTokenSource } from 'vs/base/common/cancellation';
102102
import { DropdownWithPrimaryActionViewItem } from 'vs/platform/actions/browser/dropdownWithPrimaryActionViewItem';
@@ -4246,3 +4246,31 @@ export class SCMActionButton implements IDisposable {
42464246
}
42474247
}
42484248
}
4249+
4250+
// Override styles in selections.ts
4251+
registerThemingParticipant((theme, collector) => {
4252+
const selectionBackgroundColor = theme.getColor(selectionBackground);
4253+
4254+
if (selectionBackgroundColor) {
4255+
// Override inactive selection bg
4256+
const inputBackgroundColor = theme.getColor(inputBackground);
4257+
if (inputBackgroundColor) {
4258+
collector.addRule(`.scm-view .scm-editor-container .monaco-editor .selected-text { background-color: ${inputBackgroundColor.transparent(0.4)}; }`);
4259+
}
4260+
4261+
// Override selected fg
4262+
const inputForegroundColor = theme.getColor(inputForeground);
4263+
if (inputForegroundColor) {
4264+
collector.addRule(`.scm-view .scm-editor-container .monaco-editor .view-line span.inline-selected-text { color: ${inputForegroundColor}; }`);
4265+
}
4266+
4267+
const backgroundColor = theme.getColor(inputBackground);
4268+
if (backgroundColor) {
4269+
collector.addRule(`.scm-view .scm-editor-container .monaco-editor-background { background-color: ${backgroundColor}; } `);
4270+
}
4271+
collector.addRule(`.scm-view .scm-editor-container .monaco-editor .focused .selected-text { background-color: ${selectionBackgroundColor}; }`);
4272+
} else {
4273+
// Use editor selection color if theme has not set a selection background color
4274+
collector.addRule(`.scm-view .scm-editor-container .monaco-editor .focused .selected-text { background-color: ${theme.getColor(editorSelectionBackground)}; }`);
4275+
}
4276+
});

0 commit comments

Comments
 (0)