summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoritz Poldrack <git@moritz.sh>2022-12-17 22:28:58 +0100
committerRobin Jarry <robin@jarry.cc>2022-12-19 11:57:44 +0100
commitc6587e592d08fc47117b7448491204c775783e4b (patch)
tree917395b8ae223e5cfcebfc6ec643192eb5c5c3f9
parent723ab8d9f373d35f629e1b3c9ec68fa8983aafd4 (diff)
downloadaerc-c6587e592d08fc47117b7448491204c775783e4b.tar.gz
aerc-c6587e592d08fc47117b7448491204c775783e4b.zip
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 <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r--CHANGELOG.md2
-rw-r--r--commands/account/split.go8
-rw-r--r--doc/aerc.1.scd6
3 files changed, 14 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7d505bcf..3a42fa52 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -31,6 +31,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- `pgp-provider` now defaults to `auto`. It will use the system `gpg` unless
the internal keyring exists and contains at least one key.
+- calling `:split` or `:vsplit` without specifying a size, now attempts to use
+ the terminal size to determine a useful split-size.
### Fixed
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
diff --git a/doc/aerc.1.scd b/doc/aerc.1.scd
index ad18c984..949eb6ee 100644
--- a/doc/aerc.1.scd
+++ b/doc/aerc.1.scd
@@ -382,7 +382,8 @@ message list, the message in the message viewer, etc).
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. Also see *:vsplit*.
+ remove the split. If not specified, _<n>_ is set to an estimation based
+ on the user's terminal. Also see *:vsplit*.
*:sort* [[*-r*] _<criterion>_]...
Sorts the message list by the given criteria. *-r* sorts the
@@ -426,7 +427,8 @@ message list, the message in the message viewer, etc).
calling *:vsplit* _0_, or just *:vsplit*. The split can be toggled by
calling split with the same (absolute) size repeatedly. For example,
*:vsplit* _10_ will create a split. Calling *:vsplit* _10_ again will
- remove the split. Also see *:split*.
+ remove the split. If not specified, _<n>_ is set to an estimation based
+ on the user's terminal. Also see *:split*.
## MESSAGE VIEW COMMANDS