diff options
author | delthas <delthas@dille.cc> | 2022-08-28 18:22:47 +0200 |
---|---|---|
committer | delthas <delthas@dille.cc> | 2022-08-28 18:22:47 +0200 |
commit | 6ed5a57e5ede8a6a9ee218cc21c51bc325b3b1ca (patch) | |
tree | f6a5813f61b9b0ca17cdc00657ffb11fe0b613b6 | |
parent | Highlight only on word boundaries (diff) |
Always show the date of the top message
Even if it is a continuation line.
Fixes: https://todo.sr.ht/~taiite/senpai/98
-rw-r--r-- | ui/buffers.go | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/ui/buffers.go b/ui/buffers.go index 5e2691c..75948af 100644 --- a/ui/buffers.go +++ b/ui/buffers.go @@ -757,23 +757,28 @@ func (bs *BufferList) DrawTimeline(screen tcell.Screen, x0, y0, nickColWidth int continue } - if yi >= y0 { - var showDate bool - if i == 0 || yi == y0 { - showDate = true - } else { - yb, mb, dd := b.lines[i-1].At.Local().Date() - ya, ma, da := b.lines[i].At.Local().Date() - showDate = yb != ya || mb != ma || dd != da - } - if showDate { - st := tcell.StyleDefault.Bold(true) - printDate(screen, x0, yi, st, line.At.Local()) - } else if b.lines[i-1].At.Truncate(time.Minute) != line.At.Truncate(time.Minute) { - st := tcell.StyleDefault.Foreground(tcell.ColorGray) - printTime(screen, x0, yi, st, line.At.Local()) + var showDate bool + if i == 0 || yi <= y0 { + showDate = true + } else { + yb, mb, dd := b.lines[i-1].At.Local().Date() + ya, ma, da := b.lines[i].At.Local().Date() + showDate = yb != ya || mb != ma || dd != da + } + if showDate { + st := tcell.StyleDefault.Bold(true) + // as a special case, always draw the first visible message date, even if it is a continuation line + yd := yi + if yd < y0 { + yd = y0 } + printDate(screen, x0, yd, st, line.At.Local()) + } else if b.lines[i-1].At.Truncate(time.Minute) != line.At.Truncate(time.Minute) && yi >= y0 { + st := tcell.StyleDefault.Foreground(tcell.ColorGray) + printTime(screen, x0, yi, st, line.At.Local()) + } + if yi >= y0 { identSt := tcell.StyleDefault. Foreground(line.HeadColor). Reverse(line.Highlight) |