From d957f5d2821aae1a4e7ad9eb47c4b04c20050815 Mon Sep 17 00:00:00 2001 From: Kujtim Hoxha Date: Mon, 16 Jun 2025 11:06:31 +0200 Subject: [PATCH] feat: advanced keyboard --- cmd/root.go | 2 ++ go.mod | 11 ++++------- go.sum | 2 -- internal/tui/tui.go | 8 ++++++++ 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 0fb28c958b474dac3093deb94687bea3c9dce1b6..a29991e566e851181c332837f07200f1730fc249 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -117,6 +117,8 @@ to assist developers in writing, debugging, and understanding code directly from program := tea.NewProgram( tui.New(app), tea.WithAltScreen(), + tea.WithKeyReleases(), + tea.WithUniformKeyLayout(), ) // Setup the subscriptions, this will send services events to the TUI diff --git a/go.mod b/go.mod index 295e588a228ddbf51b640deef9455aef014fb6f3..510be94406b33df9f2acacff36987d38c2d76b0d 100644 --- a/go.mod +++ b/go.mod @@ -38,13 +38,6 @@ require ( github.com/stretchr/testify v1.10.0 ) -require ( - github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect - github.com/disintegration/gift v1.1.2 // indirect - github.com/dustin/go-humanize v1.0.1 // indirect - github.com/mattn/go-isatty v0.0.20 // indirect -) - require ( cloud.google.com/go v0.116.0 // indirect cloud.google.com/go/auth v0.13.0 // indirect @@ -68,6 +61,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.4 // indirect github.com/aws/aws-sdk-go-v2/service/sts v1.30.3 // indirect github.com/aws/smithy-go v1.20.3 // indirect + github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/aymerick/douceur v0.2.0 // indirect github.com/charmbracelet/colorprofile v0.3.1 // indirect github.com/charmbracelet/x/cellbuf v0.0.14-0.20250516160309-24eee56f89fa // indirect @@ -76,7 +70,9 @@ require ( github.com/charmbracelet/x/term v0.2.1 // indirect github.com/charmbracelet/x/windows v0.2.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/disintegration/gift v1.1.2 // indirect github.com/dlclark/regexp2 v1.11.4 // indirect + github.com/dustin/go-humanize v1.0.1 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect @@ -91,6 +87,7 @@ require ( github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/mfridman/interpolate v0.0.2 // indirect github.com/microcosm-cc/bluemonday v1.0.27 // indirect diff --git a/go.sum b/go.sum index bc037b574b8bce18c668c507aaec84f2e6cf17f4..91812419d46dbf3030ae03374c0664868317d0ca 100644 --- a/go.sum +++ b/go.sum @@ -70,8 +70,6 @@ github.com/charlievieth/fastwalk v1.0.11 h1:5sLT/q9+d9xMdpKExawLppqvXFZCVKf6JHnr github.com/charlievieth/fastwalk v1.0.11/go.mod h1:yGy1zbxog41ZVMcKA/i8ojXLFsuayX5VvwhQVoj9PBI= github.com/charmbracelet/bubbles/v2 v2.0.0-beta.1.0.20250607113720-eb5e1cf3b09e h1:99Ugtt633rqauFsXjZobZmtkNpeaWialfj8dl6COC6A= github.com/charmbracelet/bubbles/v2 v2.0.0-beta.1.0.20250607113720-eb5e1cf3b09e/go.mod h1:6HamsBKWqEC/FVHuQMHgQL+knPyvHH55HwJDHl/adMw= -github.com/charmbracelet/bubbletea/v2 v2.0.0-beta.3.0.20250602154956-43689cfc0174 h1:TlVW+df0rdU/osP0O8DIVS9WFOAzXe3nuiMwJR4n+CA= -github.com/charmbracelet/bubbletea/v2 v2.0.0-beta.3.0.20250602154956-43689cfc0174/go.mod h1:oOn1YZGZyJHxJfh4sFAna9vDzxJRNuErLETr/lnlB/I= github.com/charmbracelet/bubbletea/v2 v2.0.0-beta.3.0.20250609143341-c76fa36f1b94 h1:QIi50k+uNTJmp2sMs+33D1m/EWr/7OPTJ8x92AY3eOc= github.com/charmbracelet/bubbletea/v2 v2.0.0-beta.3.0.20250609143341-c76fa36f1b94/go.mod h1:oOn1YZGZyJHxJfh4sFAna9vDzxJRNuErLETr/lnlB/I= github.com/charmbracelet/colorprofile v0.3.1 h1:k8dTHMd7fgw4bnFd7jXTLZrSU/CQrKnL3m+AxCzDz40= diff --git a/internal/tui/tui.go b/internal/tui/tui.go index 125e33b3b794608c0069f7eb286971f0e51d8c14..a4c2e48f58e1cfc34b1ce12788885bd1731894d8 100644 --- a/internal/tui/tui.go +++ b/internal/tui/tui.go @@ -90,6 +90,14 @@ func (a *appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { var cmd tea.Cmd switch msg := msg.(type) { + case tea.KeyboardEnhancementsMsg: + logging.Info( + "Keyboard enhancements detected", + "Disambiguation", msg.SupportsKeyDisambiguation(), + "ReleaseKeys", msg.SupportsKeyReleases(), + "UniformKeys", msg.SupportsUniformKeyLayout(), + ) + return a, nil case tea.WindowSizeMsg: return a, a.handleWindowResize(msg)