commit 6ed5a57
delthas
·
2022-08-28 16:22:47 +0000 UTC
parent c3a6d9c
Always show the date of the top message Even if it is a continuation line. Fixes: https://todo.sr.ht/~taiite/senpai/98
1 files changed,
+20,
-15
+20,
-15
1@@ -757,23 +757,28 @@ func (bs *BufferList) DrawTimeline(screen tcell.Screen, x0, y0, nickColWidth int
2 continue
3 }
4
5- if yi >= y0 {
6- var showDate bool
7- if i == 0 || yi == y0 {
8- showDate = true
9- } else {
10- yb, mb, dd := b.lines[i-1].At.Local().Date()
11- ya, ma, da := b.lines[i].At.Local().Date()
12- showDate = yb != ya || mb != ma || dd != da
13- }
14- if showDate {
15- st := tcell.StyleDefault.Bold(true)
16- printDate(screen, x0, yi, st, line.At.Local())
17- } else if b.lines[i-1].At.Truncate(time.Minute) != line.At.Truncate(time.Minute) {
18- st := tcell.StyleDefault.Foreground(tcell.ColorGray)
19- printTime(screen, x0, yi, st, line.At.Local())
20+ var showDate bool
21+ if i == 0 || yi <= y0 {
22+ showDate = true
23+ } else {
24+ yb, mb, dd := b.lines[i-1].At.Local().Date()
25+ ya, ma, da := b.lines[i].At.Local().Date()
26+ showDate = yb != ya || mb != ma || dd != da
27+ }
28+ if showDate {
29+ st := tcell.StyleDefault.Bold(true)
30+ // as a special case, always draw the first visible message date, even if it is a continuation line
31+ yd := yi
32+ if yd < y0 {
33+ yd = y0
34 }
35+ printDate(screen, x0, yd, st, line.At.Local())
36+ } else if b.lines[i-1].At.Truncate(time.Minute) != line.At.Truncate(time.Minute) && yi >= y0 {
37+ st := tcell.StyleDefault.Foreground(tcell.ColorGray)
38+ printTime(screen, x0, yi, st, line.At.Local())
39+ }
40
41+ if yi >= y0 {
42 identSt := tcell.StyleDefault.
43 Foreground(line.HeadColor).
44 Reverse(line.Highlight)