Skip to content

textinput: Initial letter only shown in placeholder #779

Open
@ItzAfroBoy

Description

@ItzAfroBoy

Describe the bug
The placeholder value only shows the placeholder's first character when rendered, no matter the property's value length. This first appeared in v0.21.0

Setup
Please complete the following information along with version numbers, if applicable.

  • OS: macOS (15.3.2)
  • Shell: zsh (omz)
  • Terminal Emulator: kitty (0.41.1)
  • Locale: en_GB.UTF-8

To Reproduce
Steps to reproduce the behavior:

  • Use the textinput module (example code will work for reproduction, but I found this in my project)
  • Build & run the code

Source Code
[Official example code (https://github.com/charmbracelet/bubbletea/blob/main/examples/textinputs/main.go).
Here is a snippet showing the placeholder values being set

for i := range m.inputs {
	t = textinput.New()
	t.Cursor.Style = cursorStyle
	t.CharLimit = 32

	switch i {
	case 0:
		t.Placeholder = "Nickname"
		t.Focus()
		t.PromptStyle = focusedStyle
		t.TextStyle = focusedStyle
	case 1:
		t.Placeholder = "Email"
		t.CharLimit = 64
	case 2:
		t.Placeholder = "Password"
		t.EchoMode = textinput.EchoPassword
		t.EchoCharacter = '•'
	}

	m.inputs[i] = t
}

Expected behavior
The placeholder should render the full value. In the example code, this should be:

  • Nickname
  • Email
  • Password

Screenshots
These are with my values: They are supposed to be "Artist" & "Title".
It instead shows "A" & "T".
Image

Additional context
The current fix is to revert to v0.20.0, and the bug does not appear

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions