Преглед изворни кода

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

ayntgl пре 4 година
родитељ
комит
0dbc7d3fd5
1 измењених фајлова са 4 додато и 2 уклоњено
  1. 4 2
      discord.go

+ 4 - 2
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()
+		}
 	}
 }