Skip to content

V2 Regression: Blurred styles no longer apply on input fields #770

Description

@seanamos

Description

In V1, it used to be possible to apply styles to blurred input fields:

t := huh.ThemeCharm()
t.Blurred.TextInput.Text = lipgloss.NewStyle()....

In V2, these styles are no longer applied.
I've traced this to down to this code here, where there seems to have been an incomplete port to V2 (only sets focused styles):

huh/field_input.go

Lines 389 to 391 in e3315eb

st.Focused.Prompt = styles.TextInput.Prompt
st.Focused.Text = styles.TextInput.Text
st.Focused.Placeholder = styles.TextInput.Placeholder

versus the original:

	i.textinput.PlaceholderStyle = styles.TextInput.Placeholder
	i.textinput.PromptStyle = styles.TextInput.Prompt
	i.textinput.Cursor.Style = styles.TextInput.Cursor
	i.textinput.Cursor.TextStyle = styles.TextInput.CursorText
	i.textinput.TextStyle = styles.TextInput.Text

Compared with field_text:

huh/field_text.go

Lines 381 to 391 in e3315eb

if t.focused {
st.Focused.Placeholder = styles.TextInput.Placeholder
st.Focused.Text = styles.TextInput.Text
st.Focused.Prompt = styles.TextInput.Prompt
st.Focused.CursorLine = styles.TextInput.Text
} else {
st.Blurred.Placeholder = styles.TextInput.Placeholder
st.Blurred.Text = styles.TextInput.Text
st.Blurred.Prompt = styles.TextInput.Prompt
st.Blurred.CursorLine = styles.TextInput.Text
}

Version

v2.0.3

Environment

all

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions