feat: increase paste lines as attachment threshold (#1936)

Carlos Alexandro Becker created

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

Change summary

internal/tui/components/chat/editor/editor.go | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

Detailed changes

internal/tui/components/chat/editor/editor.go 🔗

@@ -39,6 +39,9 @@ var (
 	errClipboardUnknownFormat       = fmt.Errorf("unknown clipboard format")
 )
 
+// If pasted text has more than 10 newlines, treat it as a file attachment.
+const pasteLinesThreshold = 10
+
 type Editor interface {
 	util.Model
 	layout.Sizeable
@@ -239,8 +242,7 @@ func (m *editorCmp) Update(msg tea.Msg) (util.Model, tea.Cmd) {
 		m.textarea.SetValue(msg.Text)
 		m.textarea.MoveToEnd()
 	case tea.PasteMsg:
-		// If pasted text has more than 2 newlines, treat it as a file attachment.
-		if strings.Count(msg.Content, "\n") > 2 {
+		if strings.Count(msg.Content, "\n") > pasteLinesThreshold {
 			content := []byte(msg.Content)
 			if len(content) > maxAttachmentSize {
 				return m, util.ReportWarn("Paste is too big (>5mb)")