From 25c3aff30165040d515eed660d57eb5711d58ac4 Mon Sep 17 00:00:00 2001 From: ayn2op Date: Thu, 1 Oct 2026 23:19:50 -0400 Subject: [PATCH] refactor(ui): update to tview's scroll bar symbols --- go.mod | 2 +- go.sum | 4 ++-- internal/config/config.toml | 4 ++-- internal/config/theme.go | 14 +++++++++----- internal/ui/chat/messageslist/model.go | 7 +++---- internal/ui/picker/picker.go | 7 +++---- 6 files changed, 20 insertions(+), 18 deletions(-) diff --git a/go.mod b/go.mod index 865b71b..3565e68 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/andybalholm/brotli v1.2.6 github.com/ayn2op/arikawa/v3 v3.0.0-20260929021956-7d0802bf4d7c github.com/ayn2op/ningen/v3 v3.0.1-0.20260929010920-29794d5fa70e - github.com/ayn2op/tview v0.0.0-20261002025820-724059fe8d9e + github.com/ayn2op/tview v0.0.0-20261002032137-fee8a1bb43e9 github.com/bogdanfinn/fhttp v0.6.9 github.com/bogdanfinn/tls-client v1.16.0 github.com/gdamore/tcell/v3 v3.5.0 diff --git a/go.sum b/go.sum index a317989..664e63f 100644 --- a/go.sum +++ b/go.sum @@ -14,8 +14,8 @@ github.com/ayn2op/arikawa/v3 v3.0.0-20260929021956-7d0802bf4d7c h1:Qkl3W5RXzUQUR github.com/ayn2op/arikawa/v3 v3.0.0-20260929021956-7d0802bf4d7c/go.mod h1:SHqcr+EmZKeNtVKZybHJn4HNz+ufA1XbeKNSTigBCEE= github.com/ayn2op/ningen/v3 v3.0.1-0.20260929010920-29794d5fa70e h1:QAei/IVEyZV7GcpkpcFUh37+QRqwrt57z7OT3ciHrhI= github.com/ayn2op/ningen/v3 v3.0.1-0.20260929010920-29794d5fa70e/go.mod h1:RsvYiMzi4Si1F7vmml5NCL2DaKIZXkNUQC7QlGTMtCw= -github.com/ayn2op/tview v0.0.0-20261002025820-724059fe8d9e h1:K+m6V66PQw7xngvJECWgq4yyETmSpkLgqs7VZd0Xpbw= -github.com/ayn2op/tview v0.0.0-20261002025820-724059fe8d9e/go.mod h1:oRPTSZgaEJPhv3dmmNvo6grBq/BemrLG3wFQLMTZJkY= +github.com/ayn2op/tview v0.0.0-20261002032137-fee8a1bb43e9 h1:qjFlX3emG/YCLMbnHOEwC2qrc91uD4cueWM5oyP3hCA= +github.com/ayn2op/tview v0.0.0-20261002032137-fee8a1bb43e9/go.mod h1:oRPTSZgaEJPhv3dmmNvo6grBq/BemrLG3wFQLMTZJkY= github.com/bdandy/go-errors v1.2.2 h1:WdFv/oukjTJCLa79UfkGmwX7ZxONAihKu4V0mLIs11Q= github.com/bdandy/go-errors v1.2.2/go.mod h1:NkYHl4Fey9oRRdbB1CoC6e84tuqQHiqrOcZpqFEkBxM= github.com/bdandy/go-socks4 v1.2.3 h1:Q6Y2heY1GRjCtHbmlKfnwrKVU/k81LS8mRGLRlmDlic= diff --git a/internal/config/config.toml b/internal/config/config.toml index 435f8b2..893c3e6 100644 --- a/internal/config/config.toml +++ b/internal/config/config.toml @@ -302,8 +302,8 @@ offline_style = { foreground = "gray" } [theme.scroll_bar] visibility = "auto" -# "minimal" or "box_drawing" -glyph_set = "box_drawing" +# "minimal", "box_drawing", "vertical", or "double_vertical" +symbol_set = "box_drawing" track_style = { attributes = "dim" } thumb_style = {} diff --git a/internal/config/theme.go b/internal/config/theme.go index f5d7cec..7d1b4bd 100644 --- a/internal/config/theme.go +++ b/internal/config/theme.go @@ -137,18 +137,22 @@ func (bw *BorderSetWrapper) UnmarshalTOML(val any) error { return nil } -type GlyphSetWrapper struct{ scrollbar.GlyphSet } +type SymbolSetWrapper struct{ scrollbar.SymbolSet } -func (gw *GlyphSetWrapper) UnmarshalTOML(val any) error { +func (sw *SymbolSetWrapper) UnmarshalTOML(val any) error { s, ok := val.(string) if !ok { return errInvalidType } switch s { case "minimal": - gw.GlyphSet = scrollbar.MinimalGlyphSet() + sw.SymbolSet = scrollbar.SymbolSet{Thumb: "█", Begin: "▲", End: "▼"} case "box_drawing", "boxdrawing", "box": - gw.GlyphSet = scrollbar.BoxDrawingGlyphSet() + sw.SymbolSet = scrollbar.SymbolSet{Track: "│", Thumb: "█", Begin: "▲", End: "▼"} + case "vertical": + sw.SymbolSet = scrollbar.SymbolSetVertical() + case "double_vertical": + sw.SymbolSet = scrollbar.SymbolSetDoubleVertical() default: return fmt.Errorf("unknown value: %q", s) } @@ -252,7 +256,7 @@ type ( ScrollBarTheme struct { Visibility ScrollBarVisibilityWrapper `toml:"visibility"` - GlyphSet GlyphSetWrapper `toml:"glyph_set"` + SymbolSet SymbolSetWrapper `toml:"symbol_set"` TrackStyle StyleWrapper `toml:"track_style"` ThumbStyle StyleWrapper `toml:"thumb_style"` } diff --git a/internal/ui/chat/messageslist/model.go b/internal/ui/chat/messageslist/model.go index 3cf2162..f23a88f 100644 --- a/internal/ui/chat/messageslist/model.go +++ b/internal/ui/chat/messageslist/model.go @@ -82,10 +82,9 @@ func NewModel(cfg *config.Config, state *ningen.State) Model { ml.selectionState.ScrollToEnd() ml.scrollBarVisibility = cfg.Theme.ScrollBar.Visibility.ScrollBarVisibility ml.scrollBar = scrollbar.New(). - TrackStyle(cfg.Theme.ScrollBar.TrackStyle.Style). - ThumbStyle(cfg.Theme.ScrollBar.ThumbStyle.Style). - GlyphSet(cfg.Theme.ScrollBar.GlyphSet.GlyphSet). - Arrows(scrollbar.ArrowsBoth) + SymbolSet(cfg.Theme.ScrollBar.SymbolSet.SymbolSet). + Style(cfg.Theme.ScrollBar.TrackStyle.Style). + ThumbStyle(cfg.Theme.ScrollBar.ThumbStyle.Style) return ml } diff --git a/internal/ui/picker/picker.go b/internal/ui/picker/picker.go index 5417906..0dffd83 100644 --- a/internal/ui/picker/picker.go +++ b/internal/ui/picker/picker.go @@ -28,10 +28,9 @@ func (Model) Init() tview.Cmd { return nil } func (m Model) View(onSelect func(picker.Item) tview.Msg, onCancel tview.Msg) tview.Element { cfg := m.cfg bar := scrollbar.New(). - TrackStyle(cfg.Theme.ScrollBar.TrackStyle.Style). - ThumbStyle(cfg.Theme.ScrollBar.ThumbStyle.Style). - GlyphSet(cfg.Theme.ScrollBar.GlyphSet.GlyphSet). - Arrows(scrollbar.ArrowsBoth) + SymbolSet(cfg.Theme.ScrollBar.SymbolSet.SymbolSet). + Style(cfg.Theme.ScrollBar.TrackStyle.Style). + ThumbStyle(cfg.Theme.ScrollBar.ThumbStyle.Style) p := picker.New(m.items, &m.searchState). ScrollBar(bar, cfg.Theme.ScrollBar.Visibility.ScrollBarVisibility). Keybind(bindKeys(cfg.Keybinds.Picker)).