Skip to content
Open
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
12 changes: 12 additions & 0 deletions apps/lite/ui/src/routes/project/$id/workspace/diff-minimap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,13 @@ export const getMinimapFiles = ({
});
};

/**
* Windows of diff below which the native scrollbar says everything a map could:
* a couple of flicks of the wheel covers it, and a ruler is only worth its
* column once scrolling stops being enough to hold the whole shape in your head.
*/
const MIN_MAPPED_WINDOWS = 3;

/**
* File positions, or null when the diff is too short to be worth mapping.
*
Expand All @@ -351,6 +358,11 @@ export const getMinimapGeometry = (
const first = files[0];
if (first === undefined) return null;

// A window of zero is a pane that hasn't been laid out yet, not a short diff;
// the resize that gives it a height brings us back.
const window = viewer.getHeight();
if (window > 0 && total < window * MIN_MAPPED_WINDOWS) return null;

const blocks: Array<{ top: number; height: number }> = [];

// Each file's own top is the one the file before it measured to, so ask once
Expand Down
Loading