fix: do not scroll to end if any message is selected (#90)

This commit is contained in:
ayntgl 2021-10-29 16:00:39 +04:00 • committed by GitHub
parent db764b3cef
commit 0dbc7d3fd5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -103,8 +103,10 @@ func onSessionMessageCreate(_ *discordgo.Session, m *discordgo.MessageCreate) {
} else {
selectedChannel.Messages = append(selectedChannel.Messages, m.Message)
messagesView.Write(buildMessage(m.Message))
// Scroll to the end of the text after the message has been written to the TextView.
messagesView.ScrollToEnd()
// Scroll to the end of the text if any message is selected.
if len(messagesView.GetHighlights()) != 0 {
messagesView.ScrollToEnd()
}
}
}