Repository: vscode
Issue: Editor > Minimap: Size = "fit" setting incorrectly stretches minimap on small files after an integrated terminal panel is initiated and closed from a larger file.
Labels: bug,editor-minimap

This bug happens quite frequently. I like to set the Minimap: Size setting to "fit", but when I do, it stretches the minimap rendering out as if it was set to "fill" sometimes. It's an issue with an integrated panel being opened from another larger file. 

I've experienced this issue for multiple months and finally decided to submit an issue about it. It also occurs in a 2020 version of vscode I use for robotics (WPI Lib from First Robotics), so I'm pretty confident that it's been an issue in many versions previous.

<!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- 🕮 Read our guide about submitting issues: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions -->
<!-- 🔎 Search existing issues to avoid creating duplicates. -->
<!-- 🧪 Test using the latest Insiders build to see if your issue has already been fixed: https://code.visualstudio.com/insiders/ -->
<!-- 💡 Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. -->
<!-- 🔧 Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: **Yes**

<!-- 🪓 If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. -->
<!-- 📣 Issues caused by an extension need to be reported directly to the extension publisher. The 'Help > Report Issue' dialog can assist with this. -->
- VS Code Version: **1.59.0**
- OS Version: **Windows_NT x64 10.0.19042** (Windows 10)

Steps to Reproduce:

1. Change the setting Editor > Minimap: Size to "fit".

2. Open two files in the same pane (not side by side) such that you must change tabs in the editor (see images below:). Ensure that they are of significantly different content lengths.
![image](https://user-images.githubusercontent.com/60321202/128606643-45a035c4-8379-48df-b9c5-739985bd1298.png)
![image](https://user-images.githubusercontent.com/60321202/128606654-f3d6dbdf-e78c-42da-bcaa-8a4f7f62ce09.png)
The minimaps in the above images have minimaps that scale correctly.

3. Here, I switch focus to the notesLarge.txt file. I open an integrated terminal, then close the terminal panel.
![image](https://user-images.githubusercontent.com/60321202/128606982-df7e1989-5c85-41e1-bff8-ea57d3eb8dff.png)
The minimap scales down the content rendering correctly according to how Minimap: Size "fit" should.

4. Next, I switch to the notesSmall.txt file. **The minimap on this smaller file has stretched out as if the Minimap: Size setting was set to "fill". The following image is the bug. It shouldn't be stretched out like that in the "fit" setting.** In "fit", _"the minimap will shrink as necessary to never be larger than than the editor (no scrolling)."_ It shouldn't ever stretch to fill.
![image](https://user-images.githubusercontent.com/60321202/128607023-32423efd-2601-466e-9959-76467c8083ac.png)
If I were to open an integrated terminal when this file editor is in focus, then the minimap scales to what it should. But the moment I close that terminal panel again, it switches back to be incorrectly stretched out:
![image](https://user-images.githubusercontent.com/60321202/128607075-6d53e8ba-1dc4-4d2a-acef-c45e56dbb82c.png)
![image](https://user-images.githubusercontent.com/60321202/128607089-bf679d11-2a91-4d71-97b9-43778cae6545.png)

Thanks!