Skip to content

Fix off-by-one error when calculating popup panel dimensions#5312

Merged
stefanhaller merged 2 commits into
masterfrom
fix-panel-resizing
Mar 8, 2026
Merged

Fix off-by-one error when calculating popup panel dimensions#5312
stefanhaller merged 2 commits into
masterfrom
fix-panel-resizing

Conversation

@stefanhaller

Copy link
Copy Markdown
Collaborator

The symptom of the bug was that confirmation panels with wrapped text were one character too wide, which could sometimes result in them being one line too heigh. One concrete example is the "Discard file changes" confirmation that appears when pressing d in the commit files panel.

@stefanhaller stefanhaller added the bug Something isn't working label Feb 22, 2026
@codacy-production

codacy-production Bot commented Feb 22, 2026

Copy link
Copy Markdown

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for d8f87c61 100.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (d8f87c6) Report Missing Report Missing Report Missing
Head commit (da065b5) 60221 52691 87.50%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#5312) 24 24 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

The symptom of the bug was that confirmation panels with wrapped text were one
character too wide, which could sometimes result in them being one line too
heigh. One concrete example is the "Discard file changes" confirmation that
appears when pressing `d` in the commit files panel.

I got very confused when investigating this bug, and the reason is that
getPopupPanelDimensionsAux took two parameters panelWidth and panelHeight, but
the second was actually contentHeight. Rename it to contentHeight, and change
the first one to also be the content width rather than the panel width. This is
easier for clients, and less confusing.
I got confused when I investigated the bug that was fixed in the previous
commit, so hopefully these will be helpful for the next person reading this
code.
@stefanhaller stefanhaller enabled auto-merge March 8, 2026 16:26
@stefanhaller stefanhaller merged commit 4d08c81 into master Mar 8, 2026
13 checks passed
@stefanhaller stefanhaller deleted the fix-panel-resizing branch March 8, 2026 16:27
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Mar 24, 2026
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [jesseduffield/lazygit](https://github.com/jesseduffield/lazygit) | minor | `v0.59.0` → `v0.60.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>jesseduffield/lazygit (jesseduffield/lazygit)</summary>

### [`v0.60.0`](https://github.com/jesseduffield/lazygit/releases/tag/v0.60.0)

[Compare Source](jesseduffield/lazygit@v0.59.0...v0.60.0)

<!-- Release notes generated using configuration in .github/release.yml at v0.60.0 -->

#### What's Changed

##### Enhancements 🔥

- Rename "Copy commit hash to clipboard" to mention it's an abbreviated hash by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;5331](jesseduffield/lazygit#5331)
- Hide the "Fetching..." status of the auto-fetch when bottom line is hidden by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;5321](jesseduffield/lazygit#5321)
- Allow removing lines from patch directly by [@&#8203;jesseduffield](https://github.com/jesseduffield) in [#&#8203;5277](jesseduffield/lazygit#5277)
- Filter file views rather than search by [@&#8203;jesseduffield](https://github.com/jesseduffield) in [#&#8203;5273](jesseduffield/lazygit#5273)
- Show branch name and detached HEAD in worktrees tab by [@&#8203;ruudk](https://github.com/ruudk) in [#&#8203;5339](jesseduffield/lazygit#5339)
- Add backward cycling support for log view (using `<shift>-a` on status page) by [@&#8203;zaakiy](https://github.com/zaakiy) in [#&#8203;5346](jesseduffield/lazygit#5346)
- Show worktree name next to branch in branches list by [@&#8203;ruudk](https://github.com/ruudk) in [#&#8203;5340](jesseduffield/lazygit#5340)

##### Fixes 🔧

- Fix matching of lazygit-edit URLs without line numbers by [@&#8203;danielwe](https://github.com/danielwe) in [#&#8203;5311](jesseduffield/lazygit#5311)
- Fix [#&#8203;5302](jesseduffield/lazygit#5302): Create .git/info directory before writing exclude file by [@&#8203;cobyfrombrooklyn-bot](https://github.com/cobyfrombrooklyn-bot) in [#&#8203;5325](jesseduffield/lazygit#5325)
- Fix off-by-one error when calculating popup panel dimensions by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;5312](jesseduffield/lazygit#5312)
- Properly disable clicks in inactive views behind popups by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;5313](jesseduffield/lazygit#5313)
- Enable `{` and `}` to change diff context size in branches and tags panels in diffing mode by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;5258](jesseduffield/lazygit#5258)
- Fix diff display of custom pagers after screen mode change by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;5349](jesseduffield/lazygit#5349)

##### Maintenance ⚙️

- Bump github.com/cloudflare/circl from 1.6.1 to 1.6.3 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;5323](jesseduffield/lazygit#5323)

##### Docs 📖

- Fix typo: MacOS to macOS by [@&#8203;04cb](https://github.com/04cb) in [#&#8203;5335](jesseduffield/lazygit#5335)

##### I18n 🌎

- Update translations from Crowdin by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;5352](jesseduffield/lazygit#5352)

##### Other Changes

- Add Terra as an alternative Fedora install method by [@&#8203;Owen-sz](https://github.com/Owen-sz) in [#&#8203;5281](jesseduffield/lazygit#5281)

#### New Contributors

- [@&#8203;Owen-sz](https://github.com/Owen-sz) made their first contribution in [#&#8203;5281](jesseduffield/lazygit#5281)
- [@&#8203;danielwe](https://github.com/danielwe) made their first contribution in [#&#8203;5311](jesseduffield/lazygit#5311)
- [@&#8203;cobyfrombrooklyn-bot](https://github.com/cobyfrombrooklyn-bot) made their first contribution in [#&#8203;5325](jesseduffield/lazygit#5325)
- [@&#8203;04cb](https://github.com/04cb) made their first contribution in [#&#8203;5335](jesseduffield/lazygit#5335)
- [@&#8203;zaakiy](https://github.com/zaakiy) made their first contribution in [#&#8203;5346](jesseduffield/lazygit#5346)

**Full Changelog**: <jesseduffield/lazygit@v0.59.0...v0.60.0>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My42MS43IiwidXBkYXRlZEluVmVyIjoiNDMuNjEuNyIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6Om1pbm9yIl19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant