charmbracelet / charmbracelet/bubbles

textinput: Initial letter only shown in placeholder

Open
#779 5 comments 10 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
8.9k
Forks
457
Avg merge
1d 18h
Merged PRs (30d)
5

Description

**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
```go
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

Contributor guide

Open the contributing guide

Research direction

Start with the official textinputs example and the textinput module's rendering path, comparing behavior with the v0.20.0 and v0.21.0 versions. Done means the full placeholder values render as "Nickname", "Email", and "Password" rather than only their first characters.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.