commit c5b92f7
Hubert Hirtz
·
2020-10-19 13:49:46 +0000 UTC
parent 94b025d
Allow moving the timeline to the right
1 files changed,
+10,
-10
+10,
-10
1@@ -169,7 +169,7 @@ type buffer struct {
2 isAtTop bool
3 }
4
5-func (b *buffer) DrawLines(screen tcell.Screen, width, height, nickColWidth int) {
6+func (b *buffer) DrawLines(screen tcell.Screen, x0, width, height, nickColWidth int) {
7 st := tcell.StyleDefault
8 for x := 0; x < width; x++ {
9 for y := 0; y < height; y++ {
10@@ -183,38 +183,38 @@ func (b *buffer) DrawLines(screen tcell.Screen, width, height, nickColWidth int)
11 break
12 }
13
14- x0 := 9 + nickColWidth
15+ x1 := x0 + 9 + nickColWidth
16
17 line := &b.lines[i]
18- nls := line.NewLines(width - x0)
19+ nls := line.NewLines(width - x1)
20 y0 -= len(nls) + 1
21 if height <= y0 {
22 continue
23 }
24
25 if i == 0 || b.lines[i-1].At.Truncate(time.Minute) != line.At.Truncate(time.Minute) {
26- printTime(screen, 0, y0, st.Bold(true), line.At.Local())
27+ printTime(screen, x0, y0, st.Bold(true), line.At.Local())
28 }
29
30 head := truncate(line.Head, nickColWidth, "\u2026")
31- x := 7 + nickColWidth - StringWidth(head)
32+ x := x0 + 7 + nickColWidth - StringWidth(head)
33 st = st.Foreground(colorFromCode(line.HeadColor))
34 if line.Highlight {
35 st = st.Reverse(true)
36 }
37 screen.SetContent(x-1, y0, ' ', nil, st)
38- screen.SetContent(7+nickColWidth, y0, ' ', nil, st)
39+ screen.SetContent(x0+7+nickColWidth, y0, ' ', nil, st)
40 printString(screen, &x, y0, st, head)
41 st = st.Reverse(false).Foreground(tcell.ColorDefault)
42
43- x = x0
44+ x = x1
45 y := y0
46
47 var sb StyleBuffer
48 sb.Reset()
49 for i, r := range line.Body {
50 if 0 < len(nls) && i == nls[0] {
51- x = x0
52+ x = x1
53 y++
54 nls = nls[1:]
55 if height < y {
56@@ -222,7 +222,7 @@ func (b *buffer) DrawLines(screen tcell.Screen, width, height, nickColWidth int)
57 }
58 }
59
60- if y != y0 && x == x0 && IsSplitRune(r) {
61+ if y != y0 && x == x1 && IsSplitRune(r) {
62 continue
63 }
64
65@@ -416,7 +416,7 @@ func (bs *BufferList) idx(title string) int {
66 }
67
68 func (bs *BufferList) Draw(screen tcell.Screen) {
69- bs.list[bs.current].DrawLines(screen, bs.width, bs.height-3, bs.nickColWidth)
70+ bs.list[bs.current].DrawLines(screen, 0, bs.width, bs.height-3, bs.nickColWidth)
71 bs.drawStatusBar(screen, bs.height-3)
72 bs.drawTitleList(screen, bs.height-1)
73 }