From 0d5443b36e4cf3f74b8334b4734ded7176c026be Mon Sep 17 00:00:00 2001 From: inwit Date: Thu, 28 Sep 2023 21:23:19 +0200 Subject: split: add an alias for horizontal split To date, there are two orthogonal commands named :vsplit and :split, which create a vertical and a horizontal split, respectively. Add a :hsplit alias for the latter. Signed-Off-By: inwit Acked-by: Robin Jarry Reviewed-by: Moritz Poldrack --- app/account.go | 2 +- commands/account/split.go | 8 ++++---- doc/aerc.1.scd | 11 ++++++----- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/app/account.go b/app/account.go index c7abde6f..312ba89b 100644 --- a/app/account.go +++ b/app/account.go @@ -547,7 +547,7 @@ func (acct *AccountView) updateSplitView(msg *models.MessageInfo) { } acct.split = NewMessageViewer(acct, view) switch acct.splitDir { - case "split": + case "split", "hsplit": acct.grid.AddChild(acct.split).At(1, 1) case "vsplit": acct.grid.AddChild(acct.split).At(0, 2) diff --git a/commands/account/split.go b/commands/account/split.go index ddc79e2f..4a17b8b2 100644 --- a/commands/account/split.go +++ b/commands/account/split.go @@ -15,7 +15,7 @@ func init() { } func (Split) Aliases() []string { - return []string{"split", "vsplit"} + return []string{"split", "vsplit", "hsplit"} } func (Split) Complete(args []string) []string { @@ -24,7 +24,7 @@ func (Split) Complete(args []string) []string { func (Split) Execute(args []string) error { if len(args) > 2 { - return errors.New("Usage: [v]split n") + return errors.New("Usage: [v|h]split n") } acct := app.SelectedAccount() if acct == nil { @@ -51,7 +51,7 @@ func (Split) Execute(args []string) error { } n, err = strconv.Atoi(args[1]) if err != nil { - return errors.New("Usage: [v]split n") + return errors.New("Usage: [v|h]split n") } if delta { n = acct.SplitSize() + n @@ -69,7 +69,7 @@ func (Split) Execute(args []string) error { n = 1 } switch args[0] { - case "split": + case "split", "hsplit": return acct.Split(n) case "vsplit": return acct.Vsplit(n) diff --git a/doc/aerc.1.scd b/doc/aerc.1.scd index 4456e0e9..d981e014 100644 --- a/doc/aerc.1.scd +++ b/doc/aerc.1.scd @@ -462,15 +462,16 @@ message list, the message in the message viewer, etc). Selects the __\th message in the message list (and scrolls it into view if necessary). +*:hsplit* [[_+_|_-_]__] *:split* [[_+_|_-_]__] Creates a horizontal split, showing __ messages and a message view below the message list. If a _+_ or _-_ is prepended, the message list size will grow or shrink accordingly. The split can be cleared by - calling *:split* _0_, or just *:split*. The split can be toggled by - calling split with the same (absolute) size repeatedly. For example, - *:split* _10_ will create a split. Calling *:split* _10_ again will - remove the split. If not specified, __ is set to an estimation based - on the user's terminal. Also see *:vsplit*. + calling *:[h]split* _0_, or just *:[h]split*. The split can be toggled + by calling split with the same (absolute) size repeatedly. For example, + *:[h]split* _10_ will create a split. Calling *:[h]split* _10_ again + will remove the split. If not specified, __ is set to an estimation + based on the user's terminal. Also see *:vsplit*. *:sort* [[*-r*] __]... Sorts the message list by the given criteria. *-r* sorts the -- cgit v1.2.3-54-g00ecf