~taiite/public-inbox

senpai: Make buffers indexed, and refer to indexes with /BUFFER v2 SUPERSEDED

delthas: 1
 Make buffers indexed, and refer to indexes with /BUFFER

 2 files changed, 10 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~taiite/public-inbox/patches/23821/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH senpai v2] Make buffers indexed, and refer to indexes with /BUFFER Export this patch

Fixes: #29
---
Also, make the number grey :)

 commands.go   | 7 +++++++
 ui/buffers.go | 4 +++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/commands.go b/commands.go
index b9ac392..f36fa58 100644
--- a/commands.go
+++ b/commands.go
@@ -2,6 +2,7 @@ package senpai

import (
	"fmt"
	"strconv"
	"strings"
	"time"

@@ -491,6 +492,12 @@ func (app *App) handleInput(buffer, content string) error {

func commandDoBuffer(app *App, buffer string, args []string) error {
	name := args[0]
	i, err := strconv.Atoi(name)
	if err == nil {
		if app.win.JumpBufferIndex(i) {
			return nil
		}
	}
	if !app.win.JumpBuffer(args[0]) {
		return fmt.Errorf("none of the buffers match %q", name)
	}
diff --git a/ui/buffers.go b/ui/buffers.go
index 6de3923..2703485 100644
--- a/ui/buffers.go
+++ b/ui/buffers.go
@@ -1,6 +1,7 @@
package ui

import (
	"fmt"
	"strings"
	"time"

@@ -404,7 +405,8 @@ func (bs *BufferList) DrawVerticalBufferList(screen tcell.Screen, x0, y0, width,
		if i == bs.clicked {
			st = st.Reverse(true)
		}
		title := truncate(b.title, width, "\u2026")
		printString(screen, &x, y, Styled(fmt.Sprintf("%d:", i), st.Foreground(tcell.ColorGrey)))
		title := truncate(b.title, width-(x-x0), "\u2026")
		printString(screen, &x, y, Styled(title, st))
		if 0 < b.highlights {
			st = st.Foreground(tcell.ColorRed).Reverse(true)
-- 
2.30.0