commit e6e8074

Antonio Mika  ·  2025-02-22 15:21:48 +0000 UTC
parent c96f063
Allow passing in console to vaxis
4 files changed,  +14, -1
M app.go
M go.mod
M app.go
+2, -0
1@@ -195,6 +195,8 @@ func NewApp(cfg Config) (app *App, err error) {
2 		},
3 		Colors:            cfg.Colors,
4 		LocalIntegrations: cfg.LocalIntegrations,
5+		WithTTY:           cfg.WithTTY,
6+		WithConsole:       cfg.WithConsole,
7 	})
8 	if err != nil {
9 		return
+4, -0
 1@@ -10,6 +10,7 @@ import (
 2 	"strings"
 3 
 4 	"git.sr.ht/~rockorager/vaxis"
 5+	"github.com/containerd/console"
 6 
 7 	"git.sr.ht/~delthas/senpai/ui"
 8 
 9@@ -116,6 +117,9 @@ type Config struct {
10 	Debug             bool
11 	Transient         bool
12 	LocalIntegrations bool
13+
14+	WithTTY     string
15+	WithConsole console.Console
16 }
17 
18 func DefaultHighlightPath() (string, error) {
M go.mod
+1, -1
 1@@ -5,6 +5,7 @@ go 1.18
 2 require (
 3 	codeberg.org/emersion/go-scfg v0.1.0
 4 	git.sr.ht/~rockorager/vaxis v0.12.1-0.20250218200016-0e88f197413a
 5+	github.com/containerd/console v1.0.4
 6 	github.com/delthas/go-libnp v0.0.0-20250105150050-96674b98150e
 7 	github.com/delthas/go-localeinfo v0.0.0-20240813094314-e5413e186769
 8 	github.com/disintegration/imaging v1.6.2
 9@@ -16,7 +17,6 @@ require (
10 )
11 
12 require (
13-	github.com/containerd/console v1.0.4 // indirect
14 	github.com/mattn/go-runewidth v0.0.16 // indirect
15 	github.com/mattn/go-sixel v0.0.5 // indirect
16 	github.com/soniakeys/quant v1.0.0 // indirect
+7, -0
 1@@ -12,6 +12,7 @@ import (
 2 
 3 	"git.sr.ht/~rockorager/vaxis"
 4 	"git.sr.ht/~rockorager/vaxis/widgets/align"
 5+	"github.com/containerd/console"
 6 
 7 	"git.sr.ht/~delthas/senpai/events"
 8 	"git.sr.ht/~delthas/senpai/irc"
 9@@ -29,6 +30,8 @@ type Config struct {
10 	MergeLine         func(former *Line, addition Line)
11 	Colors            ConfigColors
12 	LocalIntegrations bool
13+	WithConsole       console.Console
14+	WithTTY           string
15 }
16 
17 type ConfigColors struct {
18@@ -110,6 +113,8 @@ func New(config Config) (ui *UI, colors ConfigColors, err error) {
19 	vx, err = vaxis.New(vaxis.Options{
20 		DisableMouse: !config.Mouse,
21 		CSIuBitMask:  vaxis.CSIuDisambiguate | vaxis.CSIuReportEvents | vaxis.CSIuAlternateKeys | vaxis.CSIuAllKeys | vaxis.CSIuAssociatedText,
22+		WithTTY:      config.WithTTY,
23+		WithConsole:  config.WithConsole,
24 	})
25 	if err != nil {
26 		return
27@@ -120,6 +125,8 @@ func New(config Config) (ui *UI, colors ConfigColors, err error) {
28 		vx, err = vaxis.New(vaxis.Options{
29 			DisableMouse: !config.Mouse,
30 			CSIuBitMask:  vaxis.CSIuDisambiguate | vaxis.CSIuReportEvents | vaxis.CSIuAlternateKeys,
31+			WithTTY:      config.WithTTY,
32+			WithConsole:  config.WithConsole,
33 		})
34 		if err != nil {
35 			return