Hide the diff minimap when the diff barely scrolls - #15343
Open
mtsgrd wants to merge 1 commit into
Open
Conversation
The ruler took a column on every diff, including ones a flick of the wheel covers, where it says nothing the native scrollbar does not. Below three windows of content it now stands down. Expressed as a null geometry rather than a new flag: that is already the "nothing worth mapping" path, so it hides the ruler and hands the scrollbar back with no new wiring — both the CSS and the geometry doc already described this case, it was simply never enforced. Measured in windows to match MAX_MAP_TRACKS next door, where a track is a ruler-full.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Lite diff minimap so it automatically hides (by returning null geometry) when the diff content is short enough that the native scrollbar provides sufficient navigation, restoring the scrollbar in those cases without adding new flags or wiring.
Changes:
- Introduces a “minimum mapped windows” threshold (
MIN_MAPPED_WINDOWS = 3) to decide when the minimap is worth showing. - Updates
getMinimapGeometryto returnnullwhen the total diff content height is less than 3× the viewer height (excluding the pre-layoutheight === 0case).
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The minimap ruler took a column on every diff, including ones a flick of the
wheel covers, where it says nothing the native scrollbar does not. Below three
windows of content it now stands down.
Expressed as a null geometry rather than a new flag:
getMinimapGeometryalready returns
nullfor "nothing worth mapping", so this path hides the rulerand hands the scrollbar back with no new wiring — both the CSS and the geometry
doc already described this case, it was simply never enforced.
The threshold is measured in windows to match
MAX_MAP_TRACKSnext door, wherea track is a ruler-full. A window of zero is a pane that hasn't been laid out
yet rather than a short diff, so it is excluded from the test; the resize that
gives the pane a height brings the map back.