on main help sign in
fix(tui): editor: position completions correctly and account for padding
237dbdeAyman Bagabas
internal/tui/components/chat/editor/editor.go+3−2
@@ -361,8 +361,9 @@ func (m *editorCmp) startCompletions() tea.Msg {
361 })
361 })
362 }
362 }
363
363
364− x := m.textarea.Cursor().X + m.x + 1
364+ cur := m.textarea.Cursor()
365− y := m.textarea.Cursor().Y + m.y + 1
365+ x := cur.X + m.x // adjust for padding
366+ y := cur.Y + m.y + 1
366 return completions.OpenCompletionsMsg{
367 return completions.OpenCompletionsMsg{
367 Completions: completionItems,
368 Completions: completionItems,
368 X: x,
369 X: x,
internal/tui/components/completions/completions.go+1−1
@@ -43,7 +43,7 @@ type Completions interface {
43type completionsCmp struct {
43type completionsCmp struct {
44 width int
44 width int
45 height int // Height of the completions component`
45 height int // Height of the completions component`
46− x int // X position for the completions popup\
46+ x int // X position for the completions popup
47 y int // Y position for the completions popup
47 y int // Y position for the completions popup
48 open bool // Indicates if the completions are open
48 open bool // Indicates if the completions are open
49 keyMap KeyMap
49 keyMap KeyMap