瀏覽代碼

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