mirror of
https://github.com/charmbracelet/gum
synced 2026-03-14 13:45:45 +01:00
fix(filter): abort on ctrl+q (#721)
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
parent
cb61fe6c84
commit
63a3e8c8ce
1 changed files with 5 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ import (
|
|||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/charmbracelet/bubbles/key"
|
||||
"github.com/charmbracelet/huh"
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/charmbracelet/x/ansi"
|
||||
|
|
@ -35,6 +36,8 @@ func (o Options) Run() error {
|
|||
}
|
||||
|
||||
theme := huh.ThemeCharm()
|
||||
keymap := huh.NewDefaultKeyMap()
|
||||
keymap.Quit = key.NewBinding(key.WithKeys("ctrl+c", "ctrl+q"))
|
||||
options := huh.NewOptions(o.Options...)
|
||||
|
||||
theme.Focused.Base = lipgloss.NewStyle()
|
||||
|
|
@ -84,6 +87,7 @@ func (o Options) Run() error {
|
|||
WithWidth(width).
|
||||
WithShowHelp(o.ShowHelp).
|
||||
WithTheme(theme).
|
||||
WithKeyMap(keymap).
|
||||
WithTimeout(o.Timeout).
|
||||
Run()
|
||||
if err != nil {
|
||||
|
|
@ -109,6 +113,7 @@ func (o Options) Run() error {
|
|||
).
|
||||
WithWidth(width).
|
||||
WithTheme(theme).
|
||||
WithKeyMap(keymap).
|
||||
WithTimeout(o.Timeout).
|
||||
WithShowHelp(o.ShowHelp).
|
||||
Run()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue