Revert "[theming] editor.selectionForeground is not working. Fixes #36490"

This reverts commit 3a3f0e4196.

See #36760
This commit is contained in:
Alex Dima committed 2017-10-23 17:14:39 +02:00
1 parent 6c19d7f820
commit ef63dd8b3b
2 files changed
+9 -10

No files matched your search

@@ -15,9 +15,8 @@ import { IVisibleLine } from 'vs/editor/browser/view/viewLayer';
import { RangeUtil } from 'vs/editor/browser/viewParts/lines/rangeUtil';
import { HorizontalRange } from 'vs/editor/common/view/renderingContext';
import { ViewportData } from 'vs/editor/common/viewLayout/viewLinesViewportData';
import { ITheme } from 'vs/platform/theme/common/themeService';
import { ThemeType, HIGH_CONTRAST } from 'vs/platform/theme/common/themeService';
import { IStringBuilder } from 'vs/editor/common/core/stringBuilder';
import { editorSelectionForeground } from 'vs/platform/theme/common/colorRegistry';
const canUseFastRenderedViewLine = (function () {
if (platform.isNative) {
@@ -70,7 +69,7 @@ export class DomReadingContext {
}
export class ViewLineOptions {
public readonly useSelectionForegroundColor: boolean;
public readonly themeType: ThemeType;
public readonly renderWhitespace: 'none' | 'boundary' | 'all';
public readonly renderControlCharacters: boolean;
public readonly spaceWidth: number;
@@ -79,8 +78,8 @@ export class ViewLineOptions {
public readonly stopRenderingLineAfter: number;
public readonly fontLigatures: boolean;
constructor(config: IConfiguration, theme: ITheme) {
this.useSelectionForegroundColor = !!theme.getColor(editorSelectionForeground);
constructor(config: IConfiguration, themeType: ThemeType) {
this.themeType = themeType;
this.renderWhitespace = config.editor.viewInfo.renderWhitespace;
this.renderControlCharacters = config.editor.viewInfo.renderControlCharacters;
this.spaceWidth = config.editor.fontInfo.spaceWidth;
@@ -95,7 +94,7 @@ export class ViewLineOptions {
public equals(other: ViewLineOptions): boolean {
return (
this.useSelectionForegroundColor === other.useSelectionForegroundColor
this.themeType === other.themeType
&& this.renderWhitespace === other.renderWhitespace
&& this.renderControlCharacters === other.renderControlCharacters
&& this.spaceWidth === other.spaceWidth
@@ -151,7 +150,7 @@ export class ViewLine implements IVisibleLine {
this._options = newOptions;
}
public onSelectionChanged(): boolean {
if (alwaysRenderInlineSelection || this._options.useSelectionForegroundColor) {
if (alwaysRenderInlineSelection || this._options.themeType === HIGH_CONTRAST) {
this._isMaybeInvalid = true;
return true;
}
@@ -170,7 +169,7 @@ export class ViewLine implements IVisibleLine {
const options = this._options;
const actualInlineDecorations = LineDecoration.filter(lineData.inlineDecorations, lineNumber, lineData.minColumn, lineData.maxColumn);
if (alwaysRenderInlineSelection || options.useSelectionForegroundColor) {
if (alwaysRenderInlineSelection || options.themeType === HIGH_CONTRAST) {
const selections = viewportData.selections;
for (let i = 0, len = selections.length; i < len; i++) {
const selection = selections[i];
@@ -96,7 +96,7 @@ export class ViewLines extends ViewPart implements IVisibleLinesHost<ViewLine>,
this._isViewportWrapping = conf.editor.wrappingInfo.isViewportWrapping;
this._revealHorizontalRightPadding = conf.editor.viewInfo.revealHorizontalRightPadding;
this._canUseLayerHinting = conf.editor.canUseLayerHinting;
this._viewLineOptions = new ViewLineOptions(conf, this._context.theme);
this._viewLineOptions = new ViewLineOptions(conf, this._context.theme.type);
PartFingerprints.write(this.domNode, PartFingerprint.ViewLines);
this.domNode.setClassName('view-lines');
@@ -170,7 +170,7 @@ export class ViewLines extends ViewPart implements IVisibleLinesHost<ViewLine>,
private _onOptionsMaybeChanged(): boolean {
const conf = this._context.configuration;
let newViewLineOptions = new ViewLineOptions(conf, this._context.theme);
let newViewLineOptions = new ViewLineOptions(conf, this._context.theme.type);
if (!this._viewLineOptions.equals(newViewLineOptions)) {
this._viewLineOptions = newViewLineOptions;