commit da8b686

Hubert Hirtz  ·  2020-08-20 12:34:39 +0000 UTC
parent 77e7723
ui: 1-cell padding for highlight nicks
1 files changed,  +7, -4
+7, -4
 1@@ -220,7 +220,7 @@ func (b *buffer) DrawLines(screen tcell.Screen, width, height, nickColWidth int)
 2 			break
 3 		}
 4 
 5-		x0 := 5 + 1 + nickColWidth + 2
 6+		x0 := 9 + nickColWidth
 7 
 8 		line := &b.lines[i]
 9 		nls := line.NewLines(width - x0)
10@@ -234,13 +234,16 @@ func (b *buffer) DrawLines(screen tcell.Screen, width, height, nickColWidth int)
11 		}
12 
13 		head := truncate(line.head, nickColWidth, "\u2026")
14-		x := 6 + nickColWidth - StringWidth(head)
15+		x := 7 + nickColWidth - StringWidth(head)
16 		c := identColor(line.head)
17+		st = st.Foreground(colorFromCode(c))
18 		if line.isHighlight {
19 			st = st.Reverse(true)
20 		}
21+		screen.SetContent(x-1, y0, ' ', nil, st)
22+		screen.SetContent(7+nickColWidth, y0, ' ', nil, st)
23 		printString(screen, &x, y0, st.Foreground(colorFromCode(c)), head)
24-		st = st.Reverse(false)
25+		st = st.Reverse(false).Foreground(tcell.ColorDefault)
26 
27 		x = x0
28 		y := y0
29@@ -358,7 +361,7 @@ func (bs *bufferList) AddLine(title string, line Line) {
30 	} else {
31 		b.lines = append(b.lines, line)
32 		if idx == bs.current && 0 < b.scrollAmt {
33-			b.scrollAmt += len(line.NewLines(bs.width-8-bs.nickColWidth)) + 1
34+			b.scrollAmt += len(line.NewLines(bs.width-9-bs.nickColWidth)) + 1
35 		}
36 	}
37