mirror of
https://github.com/Slug-Boi/cocommit.git
synced 2026-05-13 12:45:47 +00:00
refactor: add dynamic scaling to group amount
This commit is contained in:
@@ -8,73 +8,41 @@ require (
|
|||||||
github.com/charmbracelet/glamour v0.8.0
|
github.com/charmbracelet/glamour v0.8.0
|
||||||
github.com/charmbracelet/lipgloss v0.13.1
|
github.com/charmbracelet/lipgloss v0.13.1
|
||||||
github.com/charmbracelet/x/exp/teatest v0.0.0-20241024145942-ad25fd0d5a9e
|
github.com/charmbracelet/x/exp/teatest v0.0.0-20241024145942-ad25fd0d5a9e
|
||||||
|
github.com/charmbracelet/x/term v0.2.0
|
||||||
github.com/inancgumus/screen v0.0.0-20190314163918-06e984b86ed3
|
github.com/inancgumus/screen v0.0.0-20190314163918-06e984b86ed3
|
||||||
github.com/spf13/cobra v1.8.1
|
github.com/spf13/cobra v1.8.1
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
dagger.io/dagger v0.13.6 // indirect
|
|
||||||
github.com/99designs/gqlgen v0.17.55 // indirect
|
|
||||||
github.com/Khan/genqlient v0.7.0 // indirect
|
|
||||||
github.com/adrg/xdg v0.5.1 // indirect
|
|
||||||
github.com/alecthomas/chroma/v2 v2.14.0 // indirect
|
github.com/alecthomas/chroma/v2 v2.14.0 // indirect
|
||||||
github.com/atotto/clipboard v0.1.4 // indirect
|
github.com/atotto/clipboard v0.1.4 // indirect
|
||||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
||||||
github.com/aymanbagabas/go-udiff v0.2.0 // indirect
|
github.com/aymanbagabas/go-udiff v0.2.0 // indirect
|
||||||
github.com/aymerick/douceur v0.2.0 // indirect
|
github.com/aymerick/douceur v0.2.0 // indirect
|
||||||
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
|
|
||||||
github.com/charmbracelet/x/ansi v0.4.0 // indirect
|
github.com/charmbracelet/x/ansi v0.4.0 // indirect
|
||||||
github.com/charmbracelet/x/exp/golden v0.0.0-20240815200342-61de596daa2b // indirect
|
github.com/charmbracelet/x/exp/golden v0.0.0-20240815200342-61de596daa2b // indirect
|
||||||
github.com/charmbracelet/x/term v0.2.0 // indirect
|
|
||||||
github.com/dlclark/regexp2 v1.11.0 // indirect
|
github.com/dlclark/regexp2 v1.11.0 // indirect
|
||||||
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
|
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
|
||||||
github.com/go-logr/logr v1.4.2 // indirect
|
|
||||||
github.com/go-logr/stdr v1.2.2 // indirect
|
|
||||||
github.com/google/uuid v1.6.0 // indirect
|
|
||||||
github.com/gorilla/css v1.0.1 // indirect
|
github.com/gorilla/css v1.0.1 // indirect
|
||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect
|
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
github.com/mattn/go-localereader v0.0.1 // indirect
|
github.com/mattn/go-localereader v0.0.1 // indirect
|
||||||
github.com/mattn/go-runewidth v0.0.16 // indirect
|
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||||
github.com/microcosm-cc/bluemonday v1.0.27 // indirect
|
github.com/microcosm-cc/bluemonday v1.0.27 // indirect
|
||||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
|
||||||
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
|
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
|
||||||
github.com/muesli/cancelreader v0.2.2 // indirect
|
github.com/muesli/cancelreader v0.2.2 // indirect
|
||||||
github.com/muesli/reflow v0.3.0 // indirect
|
github.com/muesli/reflow v0.3.0 // indirect
|
||||||
github.com/muesli/termenv v0.15.3-0.20240618155329-98d742f6907a // indirect
|
github.com/muesli/termenv v0.15.3-0.20240618155329-98d742f6907a // indirect
|
||||||
github.com/rivo/uniseg v0.4.7 // indirect
|
github.com/rivo/uniseg v0.4.7 // indirect
|
||||||
github.com/sahilm/fuzzy v0.1.1 // indirect
|
github.com/sahilm/fuzzy v0.1.1 // indirect
|
||||||
github.com/sosodev/duration v1.3.1 // indirect
|
|
||||||
github.com/spf13/pflag v1.0.5 // indirect
|
github.com/spf13/pflag v1.0.5 // indirect
|
||||||
github.com/vektah/gqlparser/v2 v2.5.17 // indirect
|
|
||||||
github.com/yuin/goldmark v1.7.4 // indirect
|
github.com/yuin/goldmark v1.7.4 // indirect
|
||||||
github.com/yuin/goldmark-emoji v1.0.3 // indirect
|
github.com/yuin/goldmark-emoji v1.0.3 // indirect
|
||||||
go.opentelemetry.io/otel v1.27.0 // indirect
|
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.0.0-20240518090000-14441aefdf88 // indirect
|
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.3.0 // indirect
|
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.27.0 // indirect
|
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.27.0 // indirect
|
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.27.0 // indirect
|
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 // indirect
|
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.27.0 // indirect
|
|
||||||
go.opentelemetry.io/otel/log v0.3.0 // indirect
|
|
||||||
go.opentelemetry.io/otel/metric v1.27.0 // indirect
|
|
||||||
go.opentelemetry.io/otel/sdk v1.27.0 // indirect
|
|
||||||
go.opentelemetry.io/otel/sdk/log v0.3.0 // indirect
|
|
||||||
go.opentelemetry.io/otel/sdk/metric v1.27.0 // indirect
|
|
||||||
go.opentelemetry.io/otel/trace v1.27.0 // indirect
|
|
||||||
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
|
|
||||||
golang.org/x/crypto v0.27.0 // indirect
|
golang.org/x/crypto v0.27.0 // indirect
|
||||||
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
|
|
||||||
golang.org/x/net v0.29.0 // indirect
|
golang.org/x/net v0.29.0 // indirect
|
||||||
golang.org/x/sync v0.8.0 // indirect
|
golang.org/x/sync v0.8.0 // indirect
|
||||||
golang.org/x/sys v0.26.0 // indirect
|
golang.org/x/sys v0.26.0 // indirect
|
||||||
golang.org/x/term v0.24.0 // indirect
|
golang.org/x/term v0.24.0 // indirect
|
||||||
golang.org/x/text v0.19.0 // indirect
|
golang.org/x/text v0.19.0 // indirect
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect
|
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect
|
|
||||||
google.golang.org/grpc v1.65.0 // indirect
|
|
||||||
google.golang.org/protobuf v1.34.2 // indirect
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"github.com/Slug-Boi/cocommit/src/cmd/utils"
|
"github.com/Slug-Boi/cocommit/src/cmd/utils"
|
||||||
tea "github.com/charmbracelet/bubbletea"
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
"github.com/charmbracelet/lipgloss"
|
"github.com/charmbracelet/lipgloss"
|
||||||
|
"github.com/charmbracelet/x/term"
|
||||||
)
|
)
|
||||||
|
|
||||||
// sessionState is used to track which model is focused
|
// sessionState is used to track which model is focused
|
||||||
@@ -117,10 +118,16 @@ func (m mainModel) View() string {
|
|||||||
// then join vertically
|
// then join vertically
|
||||||
//TODO: Figure out what width is measured in and tie the number 5 to a variable that
|
//TODO: Figure out what width is measured in and tie the number 5 to a variable that
|
||||||
// is width_of_term/item_width
|
// is width_of_term/item_width
|
||||||
for len(squares) > 5 {
|
w, _, err := term.GetSize(0)
|
||||||
s += lipgloss.JoinHorizontal(lipgloss.Top, squares[:5]...)
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
// 30 is a magic number don't question it
|
||||||
|
cap := w / 30
|
||||||
|
for len(squares) > cap {
|
||||||
|
s += lipgloss.JoinHorizontal(lipgloss.Top, squares[:cap]...)
|
||||||
s += "\n"
|
s += "\n"
|
||||||
squares = squares[5:]
|
squares = squares[cap:]
|
||||||
}
|
}
|
||||||
|
|
||||||
s += lipgloss.JoinHorizontal(lipgloss.Top, squares...)
|
s += lipgloss.JoinHorizontal(lipgloss.Top, squares...)
|
||||||
|
|||||||
Reference in New Issue
Block a user