on main help sign in
fix(ui): increase paste lines threshold (#1937)
158f7a9Carlos Alexandro Becker
internal/ui/model/ui.go+4−2
@@ -56,6 +56,9 @@ const (
56 compactModeHeightBreakpoint = 30
56 compactModeHeightBreakpoint = 30
57)
57)
58
58
59+// If pasted text has more than 2 newlines, treat it as a file attachment.
60+const pasteLinesThreshold = 10
61+
59// Session details panel max height.
62// Session details panel max height.
60const sessionDetailsMaxHeight = 20
63const sessionDetailsMaxHeight = 20
61
64
@@ -2680,8 +2683,7 @@ func (m *UI) handlePasteMsg(msg tea.PasteMsg) tea.Cmd {
2680 return nil
2683 return nil
2681 }
2684 }
2682
2685
2683− // If pasted text has more than 2 newlines, treat it as a file attachment.
2684− if strings.Count(msg.Content, "\n") > 2 {
2686+ if strings.Count(msg.Content, "\n") > pasteLinesThreshold {
2685 return func() tea.Msg {
2687 return func() tea.Msg {
2686 content := []byte(msg.Content)
2688 content := []byte(msg.Content)
2687 if int64(len(content)) > common.MaxAttachmentSize {
2689 if int64(len(content)) > common.MaxAttachmentSize {