Repository: vscode
Issue: [bug] Minimap section headers render in wrong place with `fill` option and terminal open
Labels: bug,editor-minimap

Type: <b>Bug</b>

I was excited to see the new section-headers-in-minimap feature in the release notes, because I have my `settings.json` separated into different sections and would like to be able to jump to them easily. (Yes, I can search for a setting name, but I don't always remember what it is, so having the sections is helpful.)

In any case, I added my first `// MARK: ...` comment, but it doesn't show up in the right place.

To reproduce:

- Download a fresh copy of insiders (so no extensions, no non-default settings)
- In Settings, switch the minimap to always show the whole file (`"editor.minimap.size": "fill"`)
- Open a terminal
- In a new editor, paste in a stupid amount of text containing a `// MARK: ...` comment somewhere in the middle
- Notice that that heading shows up in the wrong place in the minimap

Notes:
- The first screenshot in the "Main screenshots of bug" section below shows the problem happening in `settings.json` because at first I thought it only happened there. That's not true, but I kept it because it's interesting that settings has the extra wrinkle of there also being a phantom heading on the default values side. You can see from the second screenshot that it happens in random, non-settings files, too, though. (The contents happen to be the same settings data because that's what I had handy, but it's in a vanilla editor.)
- On my real VSCode, the heading actually jumps around depending on how much room the minimap has to fill (like if I open or close either sidebar - see screenshot in the "Screenshots of heading jumping around" section). That didn't happen with Insiders, not sure why.
- The headings feature seems to work fine with the minimap set to `proportional` and/or with the terminal closed. It has to be on `fill` _and_ the terminal has to be open to trigger the bug.

<details>
<summary> Main screenshots of bug, from Insiders</summary>

![image](https://github.com/microsoft/vscode/assets/14812505/6797aebd-08dd-45f1-8d49-b3e495afaad1)

![image](https://github.com/microsoft/vscode/assets/14812505/f6792248-80a2-4e2a-9bc1-8fc09d4fdcf8)

</details>

<details>
<summary> Screenshots of heading jumping around, from main VSCode</summary>

In all of the cases below, the grey marker to the right of the minimap is where the heading should be. The leftmost minimap is with neither sidebar open, the middle one is with one sidebar open, and the rightmost is with both open. As the minimap gets narrower, the heading jumps to a different spot.

![image](https://github.com/microsoft/vscode/assets/14812505/9c908d0d-dc68-4f4a-ac87-67e738118174)

</details>

VS Code version: Code 1.88.0 (Universal) (5c3e652f63e798a5ac2f31ffd0d863669328dc4c, 2024-04-03T13:28:18.899Z)
OS version: Darwin x64 22.6.0
Modes:

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2600)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: disabled_off<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>skia_graphite: disabled_off<br>video_decode: enabled<br>video_encode: enabled<br>webgl: enabled<br>webgl2: enabled<br>webgpu: enabled|
|Load (avg)|5, 6, 8|
|Memory (System)|32.00GB (0.02GB free)|
|Process Argv|--crash-reporter-id 8c10ff82-725c-40b2-bf04-12f0f88bc109|
|Screen Reader|yes|
|VM|0%|
</details><details><summary>Extensions (76) - though note that this happens without any extensions, too</summary>

Extension|Author (truncated)|Version
---|---|---
Bookmarks|ale|13.5.0
tasks-shell-input|aug|1.9.2
biome|bio|2.2.2
shifty|bme|2.0.1
mermaid-markdown-syntax-highlighting|bpr|1.6.0
multi-cursor-case-preserve|Car|1.0.5
mermaid-comment|Cat|1.2.6
ruff|cha|2024.16.0
npm-intellisense|chr|1.4.5
path-intellisense|chr|2.8.5
bracket-select|chu|2.0.2
vscode-markdownlint|Dav|0.54.0
vscode-eslint|dba|2.4.4
vscode-deno|den|3.36.0
vscode-npm-source|dku|1.0.0
githistory|don|0.6.20
typescript-notebook|don|2.0.6
gitlens|eam|14.9.0
EditorConfig|Edi|0.16.4
vsc-material-theme|Equ|34.3.1
vsc-material-theme-icons|equ|3.5.0
prettier-vscode|esb|10.4.0
shell-format|fox|7.2.5
ghost-text|fre|1.4.0
remotehub|Git|0.62.0
vscode-github-actions|git|0.26.2
vscode-pull-request-github|Git|0.86.0
npm-dependency-links|her|1.2.0
case-sensitive-add-next|jac|0.0.6
background-terminal-notifier|jar|1.0.3
search-node-modules|jas|1.3.0
code-eol|jef|1.0.12
vscode-case-shifter|Jin|1.1.0
docthis|joe|0.7.1
vscode-peacock|joh|4.2.2
bracket-peek|jom|1.4.4
vsc-python-indent|Kev|1.18.0
yarn-lock-syntax|mar|0.2.0
rainbow-csv|mec|3.11.0
template-string-converter|meg|0.6.1
xcodestrings|mhc|1.0.0
git-graph|mhu|1.30.0
dotenv|mik|1.0.1
playwright|ms-|1.0.22
black-formatter|ms-|2024.2.0
debugpy|ms-|2024.4.0
flake8|ms-|2023.10.0
isort|ms-|2023.10.1
mypy-type-checker|ms-|2023.6.0
python|ms-|2024.4.0
vscode-pylance|ms-|2024.4.1
makefile-tools|ms-|0.9.10
remote-repositories|ms-|0.40.0
polacode|pnp|0.3.4
toggle|reb|0.0.2
vscode-yaml|red|1.14.0
vscode-gitweblinks|red|2.11.0
vscode-sort-json|ric|1.20.0
synthwave-vscode|Rob|0.1.15
bash-debug|rog|0.3.9
zsh-debug|rog|0.1.3
gitconfig|sid|2.0.1
sonarlint-vscode|Son|4.4.2
rewrap|stk|1.16.3
vscode-makefile-outliner|tad|0.2.0
even-better-toml|tam|0.19.2
shellcheck|tim|0.37.0
vscode-mermaid-editor|tom|0.19.1
vscode-mdx|uni|1.8.3
errorlens|use|3.16.0
vscode-lldb|vad|1.10.0
vscodeintellicode|Vis|1.3.1
txt-syntax|xsh|0.2.2
vscode-mdx-preview|xyc|0.3.3
power-edit|YuT|1.3.0
vscode-open-in-github|ziy|1.3.6

(10 theme extensions excluded)

</details><details>
<summary>A/B Experiments</summary>

```
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:30899288
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythongtdpath:30769146
welcomedialog:30910333
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
h48ei257:31000450
pythontbext0:30879054
accentitlementst:30995554
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
d34g3935:30971562
fegfb526:30981948
bg6jg535:30979843
ccp2r6:30993542
dsvsc020:30976470
pythonait:31006305
gee8j676:31009558
dsvsc021:30996838
gd77d436:30999572
vstestc:31010171

```

</details>

<!-- generated by issue reporter -->