From 0dbc7d3fd5b0a28e60b1f27f2db1bd60ba13d030 Mon Sep 17 00:00:00 2001 From: ayntgl <90600421+ayntgl@users.noreply.github.com> Date: Fri, 29 Oct 2021 16:00:39 +0400 Subject: [PATCH] fix: do not scroll to end if any message is selected (#90) --- discord.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/discord.go b/discord.go index 4932317..8e99c66 100644 --- a/discord.go +++ b/discord.go @@ -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() + } } }