mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-14 09:36:24 -04:00
Let a popup panel have an odd width
The left and the right edge of a popup panel were each derived by halving the panel's width, so a panel that asked for an odd width lost a column and came out one column left of centre. Resizing the window then moved the panel's right edge only every other column, and left a gap of one column between the panel and where it should end half of the time. Derive the right edge from the left one and the width instead, the way the branch above already does it for a popup that has a parent. This also means that a panel of an odd width is now as wide as the width its text was wrapped to. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d0fa50d4ef
commit
7253a45c21
|
|
@ -118,13 +118,12 @@ func (self *ConfirmationHelper) getPopupPanelDimensionsAux(contentWidth int, con
|
|||
y0 += 1
|
||||
return x0, y0, x0 + panelWidth - 1, y0 + panelHeight - 1
|
||||
}
|
||||
return width/2 - panelWidth/2,
|
||||
height/2 - panelHeight/2 - panelHeight%2,
|
||||
// Currently, X1/Y1 of a gocui view is one less than you would expect based on its
|
||||
// width/height, so we need to subtract 1 here. See
|
||||
// https://github.com/jesseduffield/lazygit/commit/f6f2a52dee8bba3ebd7e3b34b4b7c7d3e3795f3e
|
||||
width/2 + panelWidth/2 - 1,
|
||||
height/2 + panelHeight/2 - 1
|
||||
x0 := (width - panelWidth) / 2
|
||||
y0 := height/2 - panelHeight/2 - panelHeight%2
|
||||
// Currently, X1/Y1 of a gocui view is one less than you would expect based on its
|
||||
// width/height, so we need to subtract 1 here. See
|
||||
// https://github.com/jesseduffield/lazygit/commit/f6f2a52dee8bba3ebd7e3b34b4b7c7d3e3795f3e
|
||||
return x0, y0, x0 + panelWidth - 1, y0 + panelHeight - 1
|
||||
}
|
||||
|
||||
const (
|
||||
|
|
|
|||
Loading…
Reference in a new issue