fix: scroll to end of text on channel select (#85)
This commit is contained in:
parent
5c6d596ac3
commit
cfee278be8
2 changed files with 4 additions and 1 deletions
|
|
@ -80,6 +80,8 @@ 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()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
3
ui.go
3
ui.go
|
|
@ -100,6 +100,8 @@ func onChannelsTreeSelected(n *tview.TreeNode) {
|
|||
selectedChannel.Messages = append(selectedChannel.Messages, ms[i])
|
||||
messagesView.Write(buildMessage(ms[i]))
|
||||
}
|
||||
// Scroll to the end of the text after the messages have been written to the TextView.
|
||||
messagesView.ScrollToEnd()
|
||||
|
||||
if len(ms) != 0 && isUnread(c) {
|
||||
session.ChannelMessageAck(c.ID, c.LastMessageID, "")
|
||||
|
|
@ -114,7 +116,6 @@ func newMessagesView() *tview.TextView {
|
|||
SetRegions(true).
|
||||
SetDynamicColors(true).
|
||||
SetWordWrap(true).
|
||||
ScrollToEnd().
|
||||
SetChangedFunc(func() {
|
||||
app.Draw()
|
||||
}).
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue