diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/buffers.go | 14 | ||||
-rw-r--r-- | ui/ui.go | 4 |
2 files changed, 13 insertions, 5 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++ } } @@ -136,8 +136,8 @@ func (ui *UI) RemoveBuffer(title string) { _ = ui.bs.Remove(title) } -func (ui *UI) AddLine(buffer string, highlight bool, line Line) { - ui.bs.AddLine(buffer, highlight, line) +func (ui *UI) AddLine(buffer string, notify NotifyType, line Line) { + ui.bs.AddLine(buffer, notify, line) } func (ui *UI) AddLines(buffer string, lines []Line) { |