Skip to content
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
5 changes: 4 additions & 1 deletion packages/diff-view/src/parts/RenderCss/RenderCss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import * as CursorConstants from '../CursorConstants/CursorConstants.ts'
import { getSashWidth } from '../GetPaneWidths/GetPaneWidths.ts'
import { getScrollBarThumbTop } from '../GetScrollBarThumbTop/GetScrollBarThumbTop.ts'

const ScrollBarWidth = 44

const getEmptyLineNumberHeights = (visibleLines: readonly VisibleLine[], itemHeight: number): readonly number[] => {
const heights: number[] = []
let emptyLineCount = 0
Expand Down Expand Up @@ -86,6 +88,7 @@ export const renderCss = (oldState: DiffViewState, newState: DiffViewState): any
--ScrollBarHeight: ${scrollBarHeight}px;
--ScrollBarBackgroundImage: ${scrollBarBackgroundImage};
--ScrollBarThumbTop: ${scrollBarThumbTop}px;
--ScrollBarWidth: ${ScrollBarWidth}px;
--DiffFontFamily: ${newState.fontFamily};
}

Expand Down Expand Up @@ -452,7 +455,7 @@ ${getEmptyLineNumberCss(newState.visibleLinesLeft, newState.visibleLinesRight, i
position: absolute;
right: 2px;
top: 0;
width: 8px;
width: var(--ScrollBarWidth);
}

.DiffScrollBarThumb {
Expand Down
2 changes: 2 additions & 0 deletions packages/diff-view/test/RenderCss.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ test('renderCss renders left and right widths as css variables', (): void => {
expect(result[2]).not.toContain('--DiffEditorSashLeft')
expect(result[2]).not.toContain('left: var(--DiffEditorSashLeft);')
expect(result[2]).toContain('--ScrollBarHeight: 40px;')
expect(result[2]).toContain('--ScrollBarWidth: 44px;')
expect(result[2]).toContain('.DiffEditorHorizontal {')
expect(result[2]).toContain('.DiffEditorVertical {')
expect(result[2]).toContain('.DiffEditorWithSearch.DiffEditorHorizontal,\n.DiffEditorWithSearch.DiffEditorVertical {\n flex-direction: column;\n}')
Expand Down Expand Up @@ -79,6 +80,7 @@ test('renderCss renders left and right widths as css variables', (): void => {
expect(result[2]).toContain('overflow: auto;')
expect(result[2]).toContain('text-underline-offset: 2px;')
expect(result[2]).toContain('.DiffScrollBarThumb {')
expect(result[2]).toContain('width: var(--ScrollBarWidth);')
expect(result[2]).toContain('background-image: var(--ScrollBarBackgroundImage);')
})

Expand Down
1 change: 1 addition & 0 deletions packages/e2e/src/diff.package-lock-json-thousand-lines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export const test: Test = async ({ DiffView, expect, FileSystem, Locator, Worksp
await expect(beforePane).toContainText('"version": "1.0.0"')
await expect(afterPane).toContainText('"version": "1.0.1"')
await expect(scrollBar).toHaveCount(1)
await expect(scrollBar).toHaveCSS('width', '44px')

// await Command.execute('DiffView.handleWheel', 0, 999_999)

Expand Down