summaryrefslogtreecommitdiff
path: root/ui/buffers.go
diff options
context:
space:
mode:
authorHubert Hirtz <hubert@hirtzfr.eu>2020-08-22 14:49:19 +0200
committerHubert Hirtz <hubert@hirtzfr.eu>2020-08-22 14:49:19 +0200
commit7e1cdf898b8b42997a6fcfe0212c2b3493489eee (patch)
treeea6b740c738fb0e7a53bbc2dd387097b23778f55 /ui/buffers.go
parentDon't send @+typing=done in the home buffer (diff)
Fix same messages being fetched with CHATHISTORY
The issue was that Message.Time() converted the timestamp to Local time, and this local timestamp was being used with UTC timestamps. Thus senpai now converts the time only during display. Moreover, to avoid missing messages in history (and at the cost of duplicates), the condition in bufferList.AddLines() as been modified.
Diffstat (limited to 'ui/buffers.go')
-rw-r--r--ui/buffers.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/ui/buffers.go b/ui/buffers.go
index f3605a6..c1426f9 100644
--- a/ui/buffers.go
+++ b/ui/buffers.go
@@ -230,7 +230,7 @@ func (b *buffer) DrawLines(screen tcell.Screen, width, height, nickColWidth int)
}
if i == 0 || b.lines[i-1].at.Truncate(time.Minute) != line.at.Truncate(time.Minute) {
- printTime(screen, 0, y0, st.Bold(true), line.at)
+ printTime(screen, 0, y0, st.Bold(true), line.at.Local())
}
head := truncate(line.head, nickColWidth, "\u2026")
@@ -383,9 +383,9 @@ func (bs *bufferList) AddLines(title string, lines []Line) {
limit := len(lines)
if 0 < len(b.lines) {
- firstLineTime := b.lines[0].at.Round(time.Millisecond)
- for i := len(lines) - 1; 0 <= i; i-- {
- if firstLineTime == lines[i].at.Round(time.Millisecond) {
+ firstLineTime := b.lines[0].at.Unix()
+ for i, l := range lines {
+ if firstLineTime < l.at.Unix() {
limit = i
break
}