mirror of
https://github.com/zoriya/bubbles.git
synced 2026-08-04 20:26:08 +00:00
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
This commit is contained in:
+9
-12
@@ -1377,7 +1377,6 @@ func (m *Model) view() string {
|
|||||||
|
|
||||||
for wl, wrappedLine := range wrappedLines {
|
for wl, wrappedLine := range wrappedLines {
|
||||||
prompt := m.promptView(displayLine)
|
prompt := m.promptView(displayLine)
|
||||||
prompt = styles.computedPrompt().Render(prompt)
|
|
||||||
s.WriteString(style.Render(prompt))
|
s.WriteString(style.Render(prompt))
|
||||||
displayLine++
|
displayLine++
|
||||||
|
|
||||||
@@ -1462,16 +1461,15 @@ func (m Model) View() string {
|
|||||||
// promptView renders a single line of the prompt.
|
// promptView renders a single line of the prompt.
|
||||||
func (m Model) promptView(displayLine int) (prompt string) {
|
func (m Model) promptView(displayLine int) (prompt string) {
|
||||||
prompt = m.Prompt
|
prompt = m.Prompt
|
||||||
if m.promptFunc == nil {
|
if m.promptFunc != nil {
|
||||||
return prompt
|
prompt = m.promptFunc(PromptInfo{
|
||||||
}
|
LineNumber: displayLine,
|
||||||
prompt = m.promptFunc(PromptInfo{
|
Focused: m.focus,
|
||||||
LineNumber: displayLine,
|
})
|
||||||
Focused: m.focus,
|
width := lipgloss.Width(prompt)
|
||||||
})
|
if width < m.promptWidth {
|
||||||
width := lipgloss.Width(prompt)
|
prompt = fmt.Sprintf("%*s%s", m.promptWidth-width, "", prompt)
|
||||||
if width < m.promptWidth {
|
}
|
||||||
prompt = fmt.Sprintf("%*s%s", m.promptWidth-width, "", prompt)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return m.activeStyle().computedPrompt().Render(prompt)
|
return m.activeStyle().computedPrompt().Render(prompt)
|
||||||
@@ -1534,7 +1532,6 @@ func (m Model) placeholderView() string {
|
|||||||
|
|
||||||
// render prompt
|
// render prompt
|
||||||
prompt := m.promptView(i)
|
prompt := m.promptView(i)
|
||||||
prompt = styles.computedPrompt().Render(prompt)
|
|
||||||
s.WriteString(lineStyle.Render(prompt))
|
s.WriteString(lineStyle.Render(prompt))
|
||||||
|
|
||||||
// when show line numbers enabled:
|
// when show line numbers enabled:
|
||||||
|
|||||||
Reference in New Issue
Block a user