File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66
77 "github.com/charmbracelet/bubbles/textinput"
88 tea "github.com/charmbracelet/bubbletea"
9+ "github.com/charmbracelet/lipgloss"
910)
1011
1112type Widget struct {
@@ -75,7 +76,11 @@ func (w *Widget) Resize(size orvyn.Size) {
7576 // Bubbles' View() always renders the cursor as one extra column past
7677 // the value, so reserve 1 column on top of the prompt width. Without
7778 // the constant -1 the box grows by one column once a value is typed.
78- w .Model .Width -= 1 + len (w .Model .Prompt )
79+ // Measure the prompt in display columns (matching Bubbles' own
80+ // lipgloss.Width), not bytes: a multi-byte rune such as 'Ǥ' is 2 bytes
81+ // but 1 column, and len() would over-subtract and shrink the box.
82+ promptWidth := lipgloss .Width (w .Model .PromptStyle .Render (w .Model .Prompt ))
83+ w .Model .Width -= 1 + promptWidth
7984 }
8085
8186 // For the Bubbles textinput to process the update
You can’t perform that action at this time.
0 commit comments