# editor: Ensure minimap top offset is never \`NaN\` \(\#31466\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/24809c4219b66b48b030369775723cdb46151304)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 24809c4219b66b48b030369775723cdb46151304

Requested commit: 24809c4219b66b48b030369775723cdb46151304

Commit: 24809c4219b66b48b030369775723cdb46151304

Tree: 9a2daeee022c05bb47b6aaff7f8df956174a65f9

Author: Finn Evers

Committer: GitHub

## Message

```
editor: Ensure minimap top offset is never `NaN` (#31466)

(Late) Follow-up to
https://github.com/zed-industries/zed/pull/26893#discussion_r2073427393

The mentioned issue of needed zero-division for scrollbars is now fixed
via #30189.
However, whilst the linked PR fixed the issue for the layouting of the
scrollbar thumb, I sadly did not address the (somewhat rare) case of
`document_lines == visible_editor_lines` within the calculation of the
minimap top offset.

This PR adds coverage for that case and ensures that the
`minimap_top_offset` never ends up being `NaN`.

Release Notes:

- N/A
```

## Parents

- [f8365c5375b57270becbd509dfaef81bd19a3bf8](https://git.cafe/gitcafe/zed/commit/f8365c5375b57270becbd509dfaef81bd19a3bf8?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/24809c4219b66b48b030369775723cdb46151304?format=markdown)
