mirror of
https://github.com/diamondburned/cchat-mock.git
synced 2025-02-06 08:56:54 +00:00
Fixed last char not being colored
This commit is contained in:
parent
de5384bd32
commit
31a53c555e
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue