summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorHubert Hirtz <hubert@hirtz.pm>2021-11-05 08:39:34 +0100
committerHubert Hirtz <hubert@hirtz.pm>2021-11-05 08:39:47 +0100
commitbf2a5cb9226893275e5a0e8a3eade809c188e255 (patch)
tree04720412a27c7aee575c38f084881febe061acb0 /ui
parentShow the current channel topic at the top of the timeline (diff)
Revert "Show the current channel topic at the top of the timeline"
This reverts commit 96340f8c4d91f59f6e39767891f9bb52d7fad329 because of a bug in timeline rendering.
Diffstat (limited to 'ui')
-rw-r--r--ui/buffers.go48
-rw-r--r--ui/ui.go4
2 files changed, 12 insertions, 40 deletions
diff --git a/ui/buffers.go b/ui/buffers.go
index a087a81..3e13302 100644
--- a/ui/buffers.go
+++ b/ui/buffers.go
@@ -179,7 +179,6 @@ type buffer struct {
unread bool
lines []Line
- topic string
scrollAmt int
isAtTop bool
@@ -207,7 +206,7 @@ func NewBufferList() BufferList {
func (bs *BufferList) ResizeTimeline(tlInnerWidth, tlHeight int) {
bs.tlInnerWidth = tlInnerWidth
- bs.tlHeight = tlHeight - 2
+ bs.tlHeight = tlHeight
}
func (bs *BufferList) To(i int) bool {
@@ -359,15 +358,6 @@ func (bs *BufferList) AddLines(netID, title string, before, after []Line) {
}
}
-func (bs *BufferList) SetTopic(netID, title string, topic string) {
- idx := bs.idx(netID, title)
- if idx < 0 {
- return
- }
- b := &bs.list[idx]
- b.topic = topic
-}
-
func (bs *BufferList) Current() (netID, title string) {
b := &bs.list[bs.current]
return b.netID, b.title
@@ -544,22 +534,12 @@ func (bs *BufferList) DrawHorizontalBufferList(screen tcell.Screen, x0, y0, widt
}
func (bs *BufferList) DrawTimeline(screen tcell.Screen, x0, y0, nickColWidth int) {
- clearArea(screen, x0, y0, bs.tlInnerWidth+nickColWidth+9, bs.tlHeight+2)
+ clearArea(screen, x0, y0, bs.tlInnerWidth+nickColWidth+9, bs.tlHeight)
b := &bs.list[bs.current]
-
- xTopic := x0
- printString(screen, &xTopic, y0, Styled(b.topic, tcell.StyleDefault))
- y0++
- for x := x0; x < x0+bs.tlInnerWidth+nickColWidth+9; x++ {
- st := tcell.StyleDefault.Foreground(tcell.ColorGray)
- screen.SetContent(x, y0, 0x2500, nil, st)
- }
- y0++
-
yi := b.scrollAmt + y0 + bs.tlHeight
for i := len(b.lines) - 1; 0 <= i; i-- {
- if yi < y0 {
+ if yi < 0 {
break
}
@@ -572,18 +552,16 @@ func (bs *BufferList) DrawTimeline(screen tcell.Screen, x0, y0, nickColWidth int
continue
}
- if yi >= y0 {
- if i == 0 || b.lines[i-1].At.Truncate(time.Minute) != line.At.Truncate(time.Minute) {
- st := tcell.StyleDefault.Bold(true)
- printTime(screen, x0, yi, st, line.At.Local())
- }
-
- identSt := tcell.StyleDefault.
- Foreground(line.HeadColor).
- Reverse(line.Highlight)
- printIdent(screen, x0+7, yi, nickColWidth, Styled(line.Head, identSt))
+ if i == 0 || b.lines[i-1].At.Truncate(time.Minute) != line.At.Truncate(time.Minute) {
+ st := tcell.StyleDefault.Bold(true)
+ printTime(screen, x0, yi, st, line.At.Local())
}
+ identSt := tcell.StyleDefault.
+ Foreground(line.HeadColor).
+ Reverse(line.Highlight)
+ printIdent(screen, x0+7, yi, nickColWidth, Styled(line.Head, identSt))
+
x := x1
y := yi
style := tcell.StyleDefault
@@ -607,9 +585,7 @@ func (bs *BufferList) DrawTimeline(screen tcell.Screen, x0, y0, nickColWidth int
continue
}
- if yi >= y0 {
- screen.SetContent(x, y, r, nil, style)
- }
+ screen.SetContent(x, y, r, nil, style)
x += runeWidth(r)
}
}
diff --git a/ui/ui.go b/ui/ui.go
index 3df80ea..cda5a06 100644
--- a/ui/ui.go
+++ b/ui/ui.go
@@ -225,10 +225,6 @@ func (ui *UI) JumpBufferNetwork(netID, sub string) bool {
return false
}
-func (ui *UI) SetTopic(netID, buffer string, topic string) {
- ui.bs.SetTopic(netID, buffer, topic)
-}
-
func (ui *UI) SetStatus(status string) {
ui.status = status
}