aboutsummaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2022-12-21 17:01:37 -0600
committerMoritz Poldrack <git@moritz.sh>2022-12-25 18:11:08 +0100
commit6b8e0b19d35a4aa3e1d300f4d25a463755589c6e (patch)
tree73bc22b6b7b349694ab7b3a145f83a24122533f2 /commands
parenta4d7b5fc96bc2b28a18400f127b710464a143067 (diff)
downloadaerc-6b8e0b19d35a4aa3e1d300f4d25a463755589c6e.tar.gz
split: refactor to prevent stuck splits
Refactor split logic (again...) to prevent stuck splits. Use callback from msgstore.Select to tell the split which message to display. This keeps the account from having to track displayed messages, which prevents race conditions in certain situations. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
Diffstat (limited to 'commands')
-rw-r--r--commands/account/split.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/commands/account/split.go b/commands/account/split.go
index daf1f0f0..6641641b 100644
--- a/commands/account/split.go
+++ b/commands/account/split.go
@@ -51,10 +51,8 @@ func (Split) Execute(aerc *widgets.Aerc, args []string) error {
}
if delta {
n = acct.SplitSize() + n
- // Maintain split direction when using deltas
- if acct.SplitSize() > 0 {
- args[0] = acct.SplitDirection()
- }
+ acct.SetSplitSize(n)
+ return nil
}
}
if n == acct.SplitSize() {
@@ -66,8 +64,11 @@ func (Split) Execute(aerc *widgets.Aerc, args []string) error {
// Don't allow split to go negative
n = 1
}
- if args[0] == "split" {
+ switch args[0] {
+ case "split":
return acct.Split(n)
+ case "vsplit":
+ return acct.Vsplit(n)
}
- return acct.Vsplit(n)
+ return nil
}