Skip to content

Commit 19781f2

Browse files
committed
Sets focus border for focused editors
1 parent be34739 commit 19781f2

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/vs/editor/browser/widget/multiDiffEditorWidget/diffEditorItemTemplate.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@ export class DiffEditorItemTemplate extends Disposable implements IPooledObject<
230230
this._elements.root.style.position = 'absolute';
231231

232232
// For sticky scroll
233-
const delta = Math.max(0, Math.min(verticalRange.length - this._headerHeight, viewPort.start - verticalRange.start));
233+
const maxDelta = verticalRange.length - this._headerHeight;
234+
const delta = Math.max(0, Math.min(viewPort.start - verticalRange.start, maxDelta));
234235
this._elements.header.style.transform = `translateY(${delta}px)`;
235236

236237
globalTransaction(tx => {
@@ -242,6 +243,7 @@ export class DiffEditorItemTemplate extends Disposable implements IPooledObject<
242243
this.editor.getOriginalEditor().setScrollTop(editorScroll);
243244

244245
this._elements.header.classList.toggle('shadow', delta > 0 || editorScroll > 0);
246+
this._elements.header.classList.toggle('collapsed', delta === maxDelta);
245247
}
246248

247249
public hide(): void {

src/vs/editor/browser/widget/multiDiffEditorWidget/style.css

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
background: var(--vscode-multiDiffEditor-background);
88
overflow-y: hidden;
99

10+
.focused {
11+
--vscode-multiDiffEditor-border: var(--vscode-focusBorder);
12+
}
13+
1014
.multiDiffEntry {
1115
display: flex;
1216
flex-direction: column;
@@ -27,6 +31,10 @@
2731
z-index: 1000;
2832
background: var(--vscode-editor-background);
2933

34+
&:not(.collapsed) .header-content {
35+
border-bottom: 1px solid var(--vscode-sideBarSectionHeader-border);
36+
}
37+
3038
.header-content {
3139
margin: 8px 8px 0px 8px;
3240
padding: 8px 5px;
@@ -43,8 +51,6 @@
4351
color: var(--vscode-foreground);
4452
background: var(--vscode-multiDiffEditor-headerBackground);
4553

46-
border-bottom: 1px solid var(--vscode-sideBarSectionHeader-border);
47-
4854
&.shadow {
4955
box-shadow: var(--vscode-scrollbar-shadow) 0px 6px 6px -6px;
5056
}

0 commit comments

Comments
 (0)