@@ -66,9 +66,12 @@ const (
66 compactModeHeightBreakpoint = 30
66 compactModeHeightBreakpoint = 30
69−// If pasted text has more than 2 newlines, treat it as a file attachment.
69+// If pasted text has more than 10 newlines, treat it as a file attachment.
70const pasteLinesThreshold = 10
70const pasteLinesThreshold = 10
72+// If pasted text has more than 1000 columns, treat it as a file attachment.
73+const pasteColsThreshold = 1000
72// Session details panel max height.
75// Session details panel max height.
73const sessionDetailsMaxHeight = 20
76const sessionDetailsMaxHeight = 20
@@ -3160,7 +3163,7 @@ func (m *UI) handlePasteMsg(msg tea.PasteMsg) tea.Cmd {
3160 return nil
3163 return nil
3163− if strings.Count(msg.Content, "\n") > pasteLinesThreshold {
3166+ if hasPasteExceededThreshold(msg) {
3164 return func() tea.Msg {
3167 return func() tea.Msg {
3165 content := []byte(msg.Content)
3168 content := []byte(msg.Content)
3166 if int64(len(content)) > common.MaxAttachmentSize {
3169 if int64(len(content)) > common.MaxAttachmentSize {
@@ -3218,6 +3221,22 @@ func (m *UI) handlePasteMsg(msg tea.PasteMsg) tea.Cmd {
3218 return tea.Batch(cmds...)
3221 return tea.Batch(cmds...)
3224+func hasPasteExceededThreshold(msg tea.PasteMsg) bool {
3229+ for line := range strings.SplitSeq(msg.Content, "\n") {
3231+ colCount = max(colCount, len(line))
3233+ if lineCount > pasteLinesThreshold || colCount > pasteColsThreshold {
3221// handleFilePathPaste handles a pasted file path.
3240// handleFilePathPaste handles a pasted file path.
3222func (m *UI) handleFilePathPaste(path string) tea.Cmd {
3241func (m *UI) handleFilePathPaste(path string) tea.Cmd {
3223 return func() tea.Msg {
3242 return func() tea.Msg {