Fixed last char not being colored

This commit is contained in:
diamondburned (Forefront) 2020-06-05 15:49:34 -07:00
parent de5384bd32
commit 31a53c555e
2 changed files with 3 additions and 6 deletions

View File

@ -56,9 +56,6 @@ func (ch *Channel) JoinServer(container cchat.MessagesContainer) error {
ch.lastID++ ch.lastID++
return id return id
} }
var readID = func() uint32 {
return atomic.LoadUint32(&ch.lastID)
}
var randomMsg = func() Message { var randomMsg = func() Message {
msg := randomMessage(nextID()) msg := randomMessage(nextID())
lastAuthor = msg.author lastAuthor = msg.author
@ -90,9 +87,9 @@ func (ch *Channel) JoinServer(container cchat.MessagesContainer) error {
case <-ticker.C: case <-ticker.C:
container.CreateMessage(randomMsg()) container.CreateMessage(randomMsg())
case <-editTick.C: case <-editTick.C:
container.UpdateMessage(newRandomMessage(readID(), lastAuthor)) container.UpdateMessage(newRandomMessage(ch.lastID, lastAuthor))
case <-deleteTick.C: case <-deleteTick.C:
container.DeleteMessage(newEmptyMessage(readID(), lastAuthor)) container.DeleteMessage(newEmptyMessage(ch.lastID, lastAuthor))
case <-ch.done: case <-ch.done:
return return
} }

View File

@ -31,7 +31,7 @@ func NewRandomColored(str string) Colored {
} }
func (color Colored) Bounds() (start, end int) { func (color Colored) Bounds() (start, end int) {
return 0, color.strlen - 1 return 0, color.strlen
} }
func (color Colored) Color() uint32 { func (color Colored) Color() uint32 {