summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/buffers.go22
-rw-r--r--ui/ui.go4
2 files changed, 16 insertions, 10 deletions
diff --git a/ui/buffers.go b/ui/buffers.go
index 0e398de..b11e734 100644
--- a/ui/buffers.go
+++ b/ui/buffers.go
@@ -33,6 +33,7 @@ type Line struct {
Head string
Body StyledString
HeadColor tcell.Color
+ Notify NotifyType
Highlight bool
Readable bool
Mergeable bool
@@ -366,7 +367,7 @@ func (bs *BufferList) mergeLine(former *Line, addition Line) (keepLine bool) {
return true
}
-func (bs *BufferList) AddLine(netID, title string, notify NotifyType, line Line) {
+func (bs *BufferList) AddLine(netID, title string, line Line) {
_, b := bs.at(netID, title)
if b == nil {
return
@@ -394,10 +395,10 @@ func (bs *BufferList) AddLine(netID, title string, notify NotifyType, line Line)
}
}
- if notify != NotifyNone && b != current {
+ if line.Notify != NotifyNone && b != current {
b.unread = true
}
- if notify == NotifyHighlight && b != current {
+ if line.Notify == NotifyHighlight && b != current {
b.highlights++
}
}
@@ -443,16 +444,21 @@ func (bs *BufferList) SetRead(netID, title string, timestamp time.Time) {
if b == nil {
return
}
+ clearRead := true
for i := len(b.lines) - 1; i >= 0; i-- {
line := &b.lines[i]
- if line.Readable {
- if !line.At.After(timestamp) {
- b.highlights = 0
- b.unread = false
- }
+ if !line.At.After(timestamp) {
+ break
+ }
+ if line.Readable && line.Notify != NotifyNone {
+ clearRead = false
break
}
}
+ if clearRead {
+ b.highlights = 0
+ b.unread = false
+ }
if b.read.Before(timestamp) {
b.read = timestamp
}
diff --git a/ui/ui.go b/ui/ui.go
index 1a0da91..859f32a 100644
--- a/ui/ui.go
+++ b/ui/ui.go
@@ -270,8 +270,8 @@ func (ui *UI) RemoveNetworkBuffers(netID string) {
ui.memberOffset = 0
}
-func (ui *UI) AddLine(netID, buffer string, notify NotifyType, line Line) {
- ui.bs.AddLine(netID, buffer, notify, line)
+func (ui *UI) AddLine(netID, buffer string, line Line) {
+ ui.bs.AddLine(netID, buffer, line)
}
func (ui *UI) AddLines(netID, buffer string, before, after []Line) {