summaryrefslogtreecommitdiff
path: root/ui/buffers.go
diff options
context:
space:
mode:
Diffstat (limited to 'ui/buffers.go')
-rw-r--r--ui/buffers.go25
1 files changed, 22 insertions, 3 deletions
diff --git a/ui/buffers.go b/ui/buffers.go
index 69d1aa0..021ddb1 100644
--- a/ui/buffers.go
+++ b/ui/buffers.go
@@ -593,10 +593,29 @@ func (bs *BufferList) DrawVerticalBufferList(screen tcell.Screen, x0, y0, width,
}
}
-func (bs *BufferList) DrawHorizontalBufferList(screen tcell.Screen, x0, y0, width int) {
- x := x0
+func (bs *BufferList) DrawHorizontalBufferList(screen tcell.Screen, x0, y0, width int, offset *int) {
+ x := width
+ for i := len(bs.list) - 1; i >= 0; i-- {
+ b := &bs.list[i]
+ x--
+ if b.title == "" {
+ x -= stringWidth(b.netName)
+ } else {
+ x -= stringWidth(b.title)
+ }
+ if 0 < b.highlights {
+ x -= 2 + len(fmt.Sprintf("%d", b.highlights))
+ }
+ if x <= 10 {
+ break
+ }
+ if *offset > i {
+ *offset = i
+ }
+ }
+ x = x0
- for i, b := range bs.list {
+ for i, b := range bs.list[*offset:] {
if width <= x-x0 {
break
}