From 59511a71e0f52d9799e360652630331c3d6b04b6 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Mon, 10 Mar 2025 15:18:55 -0400 Subject: [PATCH] fix(textinput): account for width when calculating cursor position --- textinput/textinput.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/textinput/textinput.go b/textinput/textinput.go index 52194e7..4a4c2c6 100644 --- a/textinput/textinput.go +++ b/textinput/textinput.go @@ -886,8 +886,12 @@ func (m Model) Cursor() *tea.Cursor { w := lipgloss.Width + promptWidth := w(m.promptView()) xOffset := m.Position() + - w(m.promptView()) + promptWidth + if m.width > 0 { + xOffset = min(xOffset, m.width+promptWidth) + } style := m.Styles.Cursor c := tea.NewCursor(xOffset, 0)