aboutsummaryrefslogtreecommitdiffstats
path: root/commands/msg
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2022-12-09 08:03:35 -0600
committerRobin Jarry <robin@jarry.cc>2022-12-14 11:24:49 +0100
commit9c56417892736af67d5c67d34b6d59458e27fe27 (patch)
tree26ade43533be82d00eb813046ac08e8249d20fc6 /commands/msg
parentd79458f464abccdb43e7d14753577698667ec81c (diff)
downloadaerc-9c56417892736af67d5c67d34b6d59458e27fe27.tar.gz
findNextNonDeleted: set next to nil if last message
The introduction of the iterator means the "next" non-deleted message is never nil, it will always be equal to the previous message (meaning there is only one message left and it is the one we are deleting). In this case, deliberately set next to nil so that the remove tab on delete logic works properly. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
Diffstat (limited to 'commands/msg')
-rw-r--r--commands/msg/delete.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/commands/msg/delete.go b/commands/msg/delete.go
index 6c786257..9a07e509 100644
--- a/commands/msg/delete.go
+++ b/commands/msg/delete.go
@@ -110,6 +110,9 @@ func findNextNonDeleted(deleted []uint32, store *lib.MessageStore) *models.Messa
}
}
if next == nil || previous == next {
+ // If previous == next, this is the last
+ // message. Set next to nil either way
+ next = nil
break
}
stepFn()