mirror of
https://github.com/zoriya/bubbles.git
synced 2026-08-16 01:43:21 +00:00
feat: real cursor in textinput (#727)
This commit is contained in:
@@ -207,8 +207,6 @@ func New(items []Item, delegate ItemDelegate, width, height int) Model {
|
||||
|
||||
filterInput := textinput.New()
|
||||
filterInput.Prompt = "Filter: "
|
||||
filterInput.PromptStyle = styles.FilterPrompt
|
||||
filterInput.Cursor.Style = styles.FilterCursor
|
||||
filterInput.CharLimit = 64
|
||||
filterInput.Focus()
|
||||
|
||||
|
||||
+10
-9
@@ -1,6 +1,7 @@
|
||||
package list
|
||||
|
||||
import (
|
||||
"github.com/charmbracelet/bubbles/v2/textinput"
|
||||
"github.com/charmbracelet/lipgloss/v2"
|
||||
)
|
||||
|
||||
@@ -12,11 +13,10 @@ const (
|
||||
// Styles contains style definitions for this list component. By default, these
|
||||
// values are generated by DefaultStyles.
|
||||
type Styles struct {
|
||||
TitleBar lipgloss.Style
|
||||
Title lipgloss.Style
|
||||
Spinner lipgloss.Style
|
||||
FilterPrompt lipgloss.Style
|
||||
FilterCursor lipgloss.Style
|
||||
TitleBar lipgloss.Style
|
||||
Title lipgloss.Style
|
||||
Spinner lipgloss.Style
|
||||
Filter textinput.Styles
|
||||
|
||||
// Default styling for matched characters in a filter. This can be
|
||||
// overridden by delegates.
|
||||
@@ -57,11 +57,12 @@ func DefaultStyles(isDark bool) (s Styles) {
|
||||
s.Spinner = lipgloss.NewStyle().
|
||||
Foreground(lightDark(lipgloss.Color("#8E8E8E"), lipgloss.Color("#747373")))
|
||||
|
||||
s.FilterPrompt = lipgloss.NewStyle().
|
||||
prompt := lipgloss.NewStyle().
|
||||
Foreground(lightDark(lipgloss.Color("#04B575"), lipgloss.Color("#ECFD65")))
|
||||
|
||||
s.FilterCursor = lipgloss.NewStyle().
|
||||
Foreground(lightDark(lipgloss.Color("#EE6FF8"), lipgloss.Color("#EE6FF8")))
|
||||
s.Filter = textinput.DefaultStyles(isDark)
|
||||
s.Filter.Cursor.Color = lightDark(lipgloss.Color("#EE6FF8"), lipgloss.Color("#EE6FF8"))
|
||||
s.Filter.Blurred.Prompt = prompt
|
||||
s.Filter.Focused.Prompt = prompt
|
||||
|
||||
s.DefaultFilterCharacterMatch = lipgloss.NewStyle().Underline(true)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user