From c6587e592d08fc47117b7448491204c775783e4b Mon Sep 17 00:00:00 2001 From: Moritz Poldrack Date: Sat, 17 Dec 2022 22:28:58 +0100 Subject: split: use a sensible default width Guessing a width/height with v?split is rather bothersome, using a sensible value based on the user's terminal would be preferable. This also prevents confusion when running :v?split without a number seemingly does not open a split. Initialize width as half the width of the message list and height as an eight of the message list. Signed-off-by: Moritz Poldrack Acked-by: Robin Jarry --- commands/account/split.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'commands/account') diff --git a/commands/account/split.go b/commands/account/split.go index 080d0b1b..daf1f0f0 100644 --- a/commands/account/split.go +++ b/commands/account/split.go @@ -31,6 +31,14 @@ func (Split) Execute(aerc *widgets.Aerc, args []string) error { return errors.New("No account selected") } n := 0 + if acct.SplitSize() == 0 { + if args[0] == "split" { + n = aerc.SelectedAccount().Messages().Height() / 4 + } else { + n = aerc.SelectedAccount().Messages().Width() / 2 + } + } + var err error if len(args) > 1 { delta := false -- cgit