diff options
author | Hubert Hirtz <hubert@hirtzfr.eu> | 2020-08-04 11:53:45 +0200 |
---|---|---|
committer | Hubert Hirtz <hubert@hirtzfr.eu> | 2020-08-04 11:53:45 +0200 |
commit | 65852518bfc1ec61d3aa0a39fc25a837c6cf150c (patch) | |
tree | 2abb99a9ff13c2f07bf6b7c512c0d8b119e63de4 /ui/buffers.go | |
parent | Show channels as bold on unread messages (diff) |
Show nick highlights
Diffstat (limited to 'ui/buffers.go')
-rw-r--r-- | ui/buffers.go | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/ui/buffers.go b/ui/buffers.go index 068894e..0592b65 100644 --- a/ui/buffers.go +++ b/ui/buffers.go @@ -334,7 +334,7 @@ func (bs *bufferList) Remove(title string) (ok bool) { return } -func (bs *bufferList) AddLine(title string, line Line) { +func (bs *bufferList) AddLine(title string, line Line, isHighlight bool) { idx := bs.idx(title) if idx < 0 { return @@ -359,6 +359,9 @@ func (bs *bufferList) AddLine(title string, line Line) { if !line.isStatus && idx != bs.current { b.unread = true } + if isHighlight && idx != bs.current { + b.highlights++ + } } func (bs *bufferList) AddLines(title string, lines []Line) { @@ -504,7 +507,7 @@ func (bs *bufferList) drawTitleList(screen tcell.Screen, y int) { for _, b := range bs.list { width := StringWidth(b.title) if 0 < b.highlights { - width += int(math.Log10(float64(b.highlights))) + 1 + width += int(math.Log10(float64(b.highlights))) + 3 } widths = append(widths, width) } @@ -529,7 +532,11 @@ func (bs *bufferList) drawTitleList(screen tcell.Screen, y int) { printString(screen, &x, y, st, b.title) if 0 < b.highlights { st = st.Foreground(tcell.ColorRed).Reverse(true) + screen.SetContent(x, y, ' ', nil, st) + x++ printNumber(screen, &x, y, st, b.highlights) + screen.SetContent(x, y, ' ', nil, st) + x++ } x += 2 i = (i + 1) % len(bs.list) @@ -547,7 +554,11 @@ func (bs *bufferList) drawTitleList(screen tcell.Screen, y int) { printString(screen, &x, y, st, b.title) if 0 < b.highlights { st = st.Foreground(tcell.ColorRed).Reverse(true) + screen.SetContent(x, y, ' ', nil, st) + x++ printNumber(screen, &x, y, st, b.highlights) + screen.SetContent(x, y, ' ', nil, st) + x++ } x -= widths[i] i = (i - 1 + len(bs.list)) % len(bs.list) |