commit bf2a5cb
Hubert Hirtz
·
2021-11-05 07:39:34 +0000 UTC
parent 96340f8
Revert "Show the current channel topic at the top of the timeline" This reverts commit 96340f8c4d91f59f6e39767891f9bb52d7fad329 because of a bug in timeline rendering.
3 files changed,
+12,
-42
M
app.go
+0,
-2
1@@ -636,7 +636,6 @@ func (app *App) handleIRCEvent(netID string, ev interface{}) {
2 app.win.JumpBufferIndex(i)
3 }
4 if ev.Topic != "" {
5- app.win.SetTopic(netID, ev.Channel, ev.Topic)
6 app.printTopic(netID, ev.Channel)
7 }
8
9@@ -696,7 +695,6 @@ func (app *App) handleIRCEvent(netID string, ev interface{}) {
10 case irc.TopicChangeEvent:
11 topic := ui.IRCString(ev.Topic).String()
12 body := fmt.Sprintf("Topic changed to: %s", topic)
13- app.win.SetTopic(netID, ev.Channel, ev.Topic)
14 app.win.AddLine(netID, ev.Channel, ui.NotifyUnread, ui.Line{
15 At: msg.TimeOrNow(),
16 Head: "--",
+12,
-36
1@@ -179,7 +179,6 @@ type buffer struct {
2 unread bool
3
4 lines []Line
5- topic string
6
7 scrollAmt int
8 isAtTop bool
9@@ -207,7 +206,7 @@ func NewBufferList() BufferList {
10
11 func (bs *BufferList) ResizeTimeline(tlInnerWidth, tlHeight int) {
12 bs.tlInnerWidth = tlInnerWidth
13- bs.tlHeight = tlHeight - 2
14+ bs.tlHeight = tlHeight
15 }
16
17 func (bs *BufferList) To(i int) bool {
18@@ -359,15 +358,6 @@ func (bs *BufferList) AddLines(netID, title string, before, after []Line) {
19 }
20 }
21
22-func (bs *BufferList) SetTopic(netID, title string, topic string) {
23- idx := bs.idx(netID, title)
24- if idx < 0 {
25- return
26- }
27- b := &bs.list[idx]
28- b.topic = topic
29-}
30-
31 func (bs *BufferList) Current() (netID, title string) {
32 b := &bs.list[bs.current]
33 return b.netID, b.title
34@@ -544,22 +534,12 @@ func (bs *BufferList) DrawHorizontalBufferList(screen tcell.Screen, x0, y0, widt
35 }
36
37 func (bs *BufferList) DrawTimeline(screen tcell.Screen, x0, y0, nickColWidth int) {
38- clearArea(screen, x0, y0, bs.tlInnerWidth+nickColWidth+9, bs.tlHeight+2)
39+ clearArea(screen, x0, y0, bs.tlInnerWidth+nickColWidth+9, bs.tlHeight)
40
41 b := &bs.list[bs.current]
42-
43- xTopic := x0
44- printString(screen, &xTopic, y0, Styled(b.topic, tcell.StyleDefault))
45- y0++
46- for x := x0; x < x0+bs.tlInnerWidth+nickColWidth+9; x++ {
47- st := tcell.StyleDefault.Foreground(tcell.ColorGray)
48- screen.SetContent(x, y0, 0x2500, nil, st)
49- }
50- y0++
51-
52 yi := b.scrollAmt + y0 + bs.tlHeight
53 for i := len(b.lines) - 1; 0 <= i; i-- {
54- if yi < y0 {
55+ if yi < 0 {
56 break
57 }
58
59@@ -572,18 +552,16 @@ func (bs *BufferList) DrawTimeline(screen tcell.Screen, x0, y0, nickColWidth int
60 continue
61 }
62
63- if yi >= y0 {
64- if i == 0 || b.lines[i-1].At.Truncate(time.Minute) != line.At.Truncate(time.Minute) {
65- st := tcell.StyleDefault.Bold(true)
66- printTime(screen, x0, yi, st, line.At.Local())
67- }
68-
69- identSt := tcell.StyleDefault.
70- Foreground(line.HeadColor).
71- Reverse(line.Highlight)
72- printIdent(screen, x0+7, yi, nickColWidth, Styled(line.Head, identSt))
73+ if i == 0 || b.lines[i-1].At.Truncate(time.Minute) != line.At.Truncate(time.Minute) {
74+ st := tcell.StyleDefault.Bold(true)
75+ printTime(screen, x0, yi, st, line.At.Local())
76 }
77
78+ identSt := tcell.StyleDefault.
79+ Foreground(line.HeadColor).
80+ Reverse(line.Highlight)
81+ printIdent(screen, x0+7, yi, nickColWidth, Styled(line.Head, identSt))
82+
83 x := x1
84 y := yi
85 style := tcell.StyleDefault
86@@ -607,9 +585,7 @@ func (bs *BufferList) DrawTimeline(screen tcell.Screen, x0, y0, nickColWidth int
87 continue
88 }
89
90- if yi >= y0 {
91- screen.SetContent(x, y, r, nil, style)
92- }
93+ screen.SetContent(x, y, r, nil, style)
94 x += runeWidth(r)
95 }
96 }
M
ui/ui.go
+0,
-4
1@@ -225,10 +225,6 @@ func (ui *UI) JumpBufferNetwork(netID, sub string) bool {
2 return false
3 }
4
5-func (ui *UI) SetTopic(netID, buffer string, topic string) {
6- ui.bs.SetTopic(netID, buffer, topic)
7-}
8-
9 func (ui *UI) SetStatus(status string) {
10 ui.status = status
11 }