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

Fixes #46027 by using box-shadow css to render guides #46029

Merged
merged 2 commits into from
Mar 26, 2018
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/vs/editor/browser/viewParts/indentGuides/indentGuides.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@
*/
.monaco-editor .lines-content .cigr {
position: absolute;
--box-shadow-color: rgba(0, 0, 0, 0);
box-shadow: 1px 0 0 0 var(--box-shadow-color) inset;
}
5 changes: 2 additions & 3 deletions src/vs/editor/browser/viewParts/indentGuides/indentGuides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { RenderingContext } from 'vs/editor/common/view/renderingContext';
import * as viewEvents from 'vs/editor/common/view/viewEvents';
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { editorIndentGuides } from 'vs/editor/common/view/editorColorRegistry';
import * as dom from 'vs/base/browser/dom';
import { Position } from 'vs/editor/common/core/position';

export class IndentGuidesOverlay extends DynamicViewOverlay {
Expand Down Expand Up @@ -94,7 +93,7 @@ export class IndentGuidesOverlay extends DynamicViewOverlay {
const tabSize = this._context.model.getTabSize();
const tabWidth = tabSize * this._spaceWidth;
const lineHeight = this._lineHeight;
const indentGuideWidth = dom.computeScreenAwareSize(1);
const indentGuideWidth = tabWidth;

const indents = this._context.model.getLinesIndentGuides(visibleStartLineNumber, visibleEndLineNumber);

Expand Down Expand Up @@ -131,6 +130,6 @@ export class IndentGuidesOverlay extends DynamicViewOverlay {
registerThemingParticipant((theme, collector) => {
let editorGuideColor = theme.getColor(editorIndentGuides);
if (editorGuideColor) {
collector.addRule(`.monaco-editor .lines-content .cigr { background-color: ${editorGuideColor}; }`);
collector.addRule(`.monaco-editor .lines-content .cigr { --box-shadow-color: ${editorGuideColor}; }`);
}
});
2 changes: 2 additions & 0 deletions src/vs/editor/browser/viewParts/rulers/rulers.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@
.monaco-editor .view-ruler {
position: absolute;
top: 0;
--box-shadow-color: rgba(0, 0, 0, 0);
box-shadow: 1px 0 0 0 var(--box-shadow-color) inset;
}
5 changes: 2 additions & 3 deletions src/vs/editor/browser/viewParts/rulers/rulers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { RenderingContext, RestrictedRenderingContext } from 'vs/editor/common/v
import * as viewEvents from 'vs/editor/common/view/viewEvents';
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { editorRuler } from 'vs/editor/common/view/editorColorRegistry';
import * as dom from 'vs/base/browser/dom';

export class Rulers extends ViewPart {

Expand Down Expand Up @@ -67,7 +66,7 @@ export class Rulers extends ViewPart {
}

if (currentCount < desiredCount) {
const rulerWidth = dom.computeScreenAwareSize(1);
const rulerWidth = this._context.model.getTabSize();
let addCount = desiredCount - currentCount;
while (addCount > 0) {
let node = createFastDomNode(document.createElement('div'));
Expand Down Expand Up @@ -104,6 +103,6 @@ export class Rulers extends ViewPart {
registerThemingParticipant((theme, collector) => {
let rulerColor = theme.getColor(editorRuler);
if (rulerColor) {
collector.addRule(`.monaco-editor .view-ruler { background-color: ${rulerColor}; }`);
collector.addRule(`.monaco-editor .view-ruler { --box-shadow-color: ${rulerColor}; }`);
}
});