summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/buffers.go14
-rw-r--r--ui/ui.go4
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++
}
}
diff --git a/ui/ui.go b/ui/ui.go
index 03a0aee..ef8fea6 100644
--- a/ui/ui.go
+++ b/ui/ui.go
@@ -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) {