mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-13 20:04:25 +02:00
support static boxes that go outside the available size
This commit is contained in:
@@ -96,6 +96,11 @@ func ArrangeWindows(root *Box, x0, y0, width, height int) map[string]Dimensions
|
|||||||
var boxSize int
|
var boxSize int
|
||||||
if child.isStatic() {
|
if child.isStatic() {
|
||||||
boxSize = child.Size
|
boxSize = child.Size
|
||||||
|
// assuming that only one static child can have a size greater than the
|
||||||
|
// available space. In that case we just crop the size to what's available
|
||||||
|
if boxSize > availableSize {
|
||||||
|
boxSize = availableSize
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO: consider more evenly distributing the remainder
|
// TODO: consider more evenly distributing the remainder
|
||||||
boxSize = unitSize * child.Weight
|
boxSize = unitSize * child.Weight
|
||||||
|
@@ -179,6 +179,27 @@ func TestArrangeWindows(t *testing.T) {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"Box with static child with size too large",
|
||||||
|
&Box{Direction: COLUMN, Children: []*Box{{Size: 11, Window: "static"}, {Weight: 1, Window: "dynamic1"}, {Weight: 2, Window: "dynamic2"}}},
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
10,
|
||||||
|
10,
|
||||||
|
func(result map[string]Dimensions) {
|
||||||
|
assert.EqualValues(
|
||||||
|
t,
|
||||||
|
result,
|
||||||
|
map[string]Dimensions{
|
||||||
|
"static": {X0: 0, X1: 9, Y0: 0, Y1: 9},
|
||||||
|
// not sure if X0: 10, X1: 9 makes any sense, but testing this in the
|
||||||
|
// actual GUI it seems harmless
|
||||||
|
"dynamic1": {X0: 10, X1: 9, Y0: 0, Y1: 9},
|
||||||
|
"dynamic2": {X0: 10, X1: 9, Y0: 0, Y1: 9},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
|
Reference in New Issue
Block a user