split: clamp minimum split size to 1

The split command allows delta size changes, which triggers a condition
where the split can overflow into the dirlist. Clamp the minimum size of
a split or vsplit to "1" to prevent the view from overflowing, or
completely covering the message list. A split of 0 will still clear the
split.

Reported-by: Koni Marti <koni.marti@gmail.com>
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
Tim Culverhouse 2022-10-20 11:03:53 -05:00 committed by Robin Jarry
parent 0cc56781dc
commit edd48c9981

View file

@ -57,6 +57,10 @@ func (Split) Execute(aerc *widgets.Aerc, args []string) error {
// toggling the split // toggling the split
n = 0 n = 0
} }
if n < 0 {
// Don't allow split to go negative
n = 1
}
if args[0] == "split" { if args[0] == "split" {
return acct.Split(n) return acct.Split(n)
} }