on main help sign in
fix(tui): editor: make sure we move the cursor to the end of input
commit77e46cf415c70a084a3ccba9b0697d239e835a02 authorAyman Bagabas <ayman.bagabas@gmail.com> dateThu 10 Jul 2025, 12:31 (1 year ago) parent6a0282e
1 file changed+4−3
internal/tui/components/chat/editor/editor.go+4−3
internal/tui/components/chat/editor/editor.go+4−3
@@ -187,6 +187,7 @@ func (m *editorCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
187187 }
188188 case openEditorMsg:
189189 m.textarea.SetValue(msg.Text)
190+ m.textarea.MoveToEnd()
190191 case tea.KeyPressMsg:
191192 switch {
192193 // Completions
@@ -389,11 +390,11 @@ func NewEditorCmp(app *app.App) util.Model {
389390 t := styles.CurrentTheme()
390391 ta := textarea.New()
391392 ta.SetStyles(t.S().TextArea)
392− ta.SetPromptFunc(4, func(lineIndex int, focused bool) string {
393− if lineIndex == 0 {
393+ ta.SetPromptFunc(4, func(info textarea.PromptInfo) string {
394+ if info.LineNumber == 0 {
394395 return " > "
395396 }
396− if focused {
397+ if info.Focused {
397398 return t.S().Base.Foreground(t.GreenDark).Render("::: ")
398399 } else {
399400 return t.S().Muted.Render("::: ")