diff options
author | delthas <delthas@dille.cc> | 2021-07-14 00:13:46 +0200 |
---|---|---|
committer | Hubert Hirtz <hubert@hirtz.pm> | 2021-07-14 11:17:54 +0200 |
commit | 2c7bc6ac7a8adcb591a975fbc3ab3abe47fa99fa (patch) | |
tree | fc2d3f60fefd7c1b665a1d82b6202ca322b03767 /ui/buffers.go | |
parent | Automatically join channels on start (diff) |
Add notify types for fine-grained control of unread/highlight state
Namely, we want the unread light to show up only on actual messages, not
commands etc.
This opens the way for not showing an unread light when printing topic
on join.
Diffstat (limited to 'ui/buffers.go')
-rw-r--r-- | ui/buffers.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/ui/buffers.go b/ui/buffers.go index 6de3923..4726447 100644 --- a/ui/buffers.go +++ b/ui/buffers.go @@ -16,6 +16,14 @@ type point struct { Split bool } +type NotifyType int + +const ( + NotifyNone NotifyType = iota + NotifyUnread + NotifyHighlight +) + type Line struct { At time.Time Head string @@ -251,7 +259,7 @@ func (bs *BufferList) Remove(title string) (ok bool) { return } -func (bs *BufferList) AddLine(title string, highlight bool, line Line) { +func (bs *BufferList) AddLine(title string, notify NotifyType, line Line) { idx := bs.idx(title) if idx < 0 { return @@ -280,10 +288,10 @@ func (bs *BufferList) AddLine(title string, highlight bool, line Line) { } } - if !line.Mergeable && idx != bs.current { + if notify != NotifyNone && idx != bs.current { b.unread = true } - if highlight && idx != bs.current { + if notify == NotifyHighlight && idx != bs.current { b.highlights++ } } |