@@ -1928,12 +1928,8 @@ func (m *UI) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor {
1929 if m.textarea.Focused() {
1929 if m.textarea.Focused() {
1930 cur := m.textarea.Cursor()
1930 cur := m.textarea.Cursor()
1931− cur.X++ // Adjust for app margins
1931+ cur.X++ // Adjust for app margins
1932− cur.Y += m.layout.editor.Min.Y
1932+ cur.Y += m.layout.editor.Min.Y + 1 // Offset for attachments row
1933− // Offset for attachment row if present.
1934− if len(m.attachments.List()) > 0 {
1937 return cur
1933 return cur
@@ -2223,7 +2219,10 @@ func (m *UI) updateSize() {
2224 m.chat.SetSize(m.layout.main.Dx(), m.layout.main.Dy())
2220 m.chat.SetSize(m.layout.main.Dx(), m.layout.main.Dy())
2225 m.textarea.SetWidth(m.layout.editor.Dx())
2221 m.textarea.SetWidth(m.layout.editor.Dx())
2222+ // TODO: Abstract the textarea and attachments into a single editor
2223+ // component so we don't have to manually account for the attachments
2226− m.textarea.SetHeight(m.layout.editor.Dy())
2225+ m.textarea.SetHeight(m.layout.editor.Dy() - 2) // Account for top margin/attachments and bottom margin
2227 m.renderPills()
2226 m.renderPills()
2229 // Handle different app states
2228 // Handle different app states
@@ -2375,14 +2374,6 @@ func (m *UI) generateLayout(w, h int) uiLayout {
2378− if !uiLayout.editor.Empty() {
2379− // Add editor margins 1 top and bottom
2380− if len(m.attachments.List()) == 0 {
2381− uiLayout.editor.Min.Y += 1
2383− uiLayout.editor.Max.Y -= 1
2386 return uiLayout
2377 return uiLayout
@@ -2686,14 +2677,15 @@ func (m *UI) randomizePlaceholders() {
2687// renderEditorView renders the editor view with attachments if any.
2678// renderEditorView renders the editor view with attachments if any.
2688func (m *UI) renderEditorView(width int) string {
2679func (m *UI) renderEditorView(width int) string {
2680+ var attachmentsView string
2689− if len(m.attachments.List()) == 0 {
2681+ if len(m.attachments.List()) > 0 {
2690− return m.textarea.View()
2682+ attachmentsView = m.attachments.Render(width)
2692− return lipgloss.JoinVertical(
2684+ return strings.Join([]string{
2693− lipgloss.Top,
2685+ attachmentsView,
2694− m.attachments.Render(width),
2695 m.textarea.View(),
2686 m.textarea.View(),
2696− )
2687+ "", // margin at bottom of editor
2699// cacheSidebarLogo renders and caches the sidebar logo at the specified width.
2691// cacheSidebarLogo renders and caches the sidebar logo at the specified width.