Use sort.Stable for sorting displayed messages

With sort.Sort, sometimes two messages with the same timestamp will switch
places every time the message list is redrawn
This commit is contained in:
a3v 2019-09-01 19:44:27 -04:00 committed by Drew DeVault
parent e4104a8674
commit 2257b29a82

View file

@ -96,7 +96,7 @@ func (ml *MessageList) Draw(ctx *ui.Context) {
) )
uids := store.Uids() uids := store.Uids()
sorter := msgSorter{uids: uids, store: store} sorter := msgSorter{uids: uids, store: store}
sort.Sort(&sorter) sort.Stable(&sorter)
for i := len(uids) - 1 - ml.scroll; i >= 0; i-- { for i := len(uids) - 1 - ml.scroll; i >= 0; i-- {
uid := uids[i] uid := uids[i]