diff options
author | Hubert Hirtz <hubert@hirtzfr.eu> | 2020-08-20 14:34:39 +0200 |
---|---|---|
committer | Hubert Hirtz <hubert@hirtzfr.eu> | 2020-08-20 14:34:39 +0200 |
commit | da8b686aa7fd20a3e61dbb9648ed897ff7574730 (patch) | |
tree | 88b208d94993928d6b67d7399beb56d0fb4a26fe | |
parent | doc: Update example with sway focus or something (diff) |
ui: 1-cell padding for highlight nicks
-rw-r--r-- | ui/buffers.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/ui/buffers.go b/ui/buffers.go index df9b716..21f2e08 100644 --- a/ui/buffers.go +++ b/ui/buffers.go @@ -220,7 +220,7 @@ func (b *buffer) DrawLines(screen tcell.Screen, width, height, nickColWidth int) break } - x0 := 5 + 1 + nickColWidth + 2 + x0 := 9 + nickColWidth line := &b.lines[i] nls := line.NewLines(width - x0) @@ -234,13 +234,16 @@ func (b *buffer) DrawLines(screen tcell.Screen, width, height, nickColWidth int) } head := truncate(line.head, nickColWidth, "\u2026") - x := 6 + nickColWidth - StringWidth(head) + x := 7 + nickColWidth - StringWidth(head) c := identColor(line.head) + st = st.Foreground(colorFromCode(c)) if line.isHighlight { st = st.Reverse(true) } + screen.SetContent(x-1, y0, ' ', nil, st) + screen.SetContent(7+nickColWidth, y0, ' ', nil, st) printString(screen, &x, y0, st.Foreground(colorFromCode(c)), head) - st = st.Reverse(false) + st = st.Reverse(false).Foreground(tcell.ColorDefault) x = x0 y := y0 @@ -358,7 +361,7 @@ func (bs *bufferList) AddLine(title string, line Line) { } else { b.lines = append(b.lines, line) if idx == bs.current && 0 < b.scrollAmt { - b.scrollAmt += len(line.NewLines(bs.width-8-bs.nickColWidth)) + 1 + b.scrollAmt += len(line.NewLines(bs.width-9-bs.nickColWidth)) + 1 } } |