Skip to content

Commit d2b2217

Browse files
committed
fix(textarea): apply prompt style on all lines, including fillers
If promptFunc was nil, promptView() woudl return a raw prompt without styling, causing filler lines to not receive styling. This fixes the behavior. 💘 Generated with Crush Assisted-by: Crush:glm-5.2
1 parent 0dafc72 commit d2b2217

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

‎textarea/textarea.go‎

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,7 +1377,6 @@ func (m *Model) view() string {
13771377

13781378
for wl, wrappedLine := range wrappedLines {
13791379
prompt := m.promptView(displayLine)
1380-
prompt = styles.computedPrompt().Render(prompt)
13811380
s.WriteString(style.Render(prompt))
13821381
displayLine++
13831382

@@ -1462,16 +1461,15 @@ func (m Model) View() string {
14621461
// promptView renders a single line of the prompt.
14631462
func (m Model) promptView(displayLine int) (prompt string) {
14641463
prompt = m.Prompt
1465-
if m.promptFunc == nil {
1466-
return prompt
1467-
}
1468-
prompt = m.promptFunc(PromptInfo{
1469-
LineNumber: displayLine,
1470-
Focused: m.focus,
1471-
})
1472-
width := lipgloss.Width(prompt)
1473-
if width < m.promptWidth {
1474-
prompt = fmt.Sprintf("%*s%s", m.promptWidth-width, "", prompt)
1464+
if m.promptFunc != nil {
1465+
prompt = m.promptFunc(PromptInfo{
1466+
LineNumber: displayLine,
1467+
Focused: m.focus,
1468+
})
1469+
width := lipgloss.Width(prompt)
1470+
if width < m.promptWidth {
1471+
prompt = fmt.Sprintf("%*s%s", m.promptWidth-width, "", prompt)
1472+
}
14751473
}
14761474

14771475
return m.activeStyle().computedPrompt().Render(prompt)
@@ -1534,7 +1532,6 @@ func (m Model) placeholderView() string {
15341532

15351533
// render prompt
15361534
prompt := m.promptView(i)
1537-
prompt = styles.computedPrompt().Render(prompt)
15381535
s.WriteString(lineStyle.Render(prompt))
15391536

15401537
// when show line numbers enabled:

0 commit comments

Comments
 (0)