on main help sign in
chore: add copy message
65b92b4Kujtim Hoxha
internal/tui/components/chat/messages/messages.go+1
@@ -104,6 +104,7 @@ func (m *messageCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
104 if err != nil {
104 if err != nil {
105 return m, util.ReportError(fmt.Errorf("failed to copy message content to clipboard: %w", err))
105 return m, util.ReportError(fmt.Errorf("failed to copy message content to clipboard: %w", err))
106 }
106 }
107+ return m, util.ReportInfo("Message copied to clipboard")
107 }
108 }
108 }
109 }
109 return m, nil
110 return m, nil
internal/tui/components/chat/messages/tool.go+2−2
@@ -202,7 +202,7 @@ func (m *toolCallCmp) copyTool() tea.Cmd {
202 if err != nil {
202 if err != nil {
203 return util.ReportError(fmt.Errorf("failed to copy tool content to clipboard: %w", err))
203 return util.ReportError(fmt.Errorf("failed to copy tool content to clipboard: %w", err))
204 }
204 }
205− return nil
205+ return util.ReportInfo("Tool content copied to clipboard")
206}
206}
207
207
208func (m *toolCallCmp) formatToolForCopy() string {
208func (m *toolCallCmp) formatToolForCopy() string {
@@ -640,7 +640,7 @@ func (m *toolCallCmp) formatAgentResultForCopy() string {
640 }
640 }
641
641
642 if m.result.Content != "" {
642 if m.result.Content != "" {
643− result.WriteString(fmt.Sprintf("```\n%s\n```", m.result.Content))
643+ result.WriteString(fmt.Sprintf("```markdown\n%s\n```", m.result.Content))
644 }
644 }
645
645
646 return result.String()
646 return result.String()
internal/tui/components/core/status/status.go+10−3
@@ -7,6 +7,7 @@ import (
7 tea "github.com/charmbracelet/bubbletea/v2"
7 tea "github.com/charmbracelet/bubbletea/v2"
8 "github.com/charmbracelet/crush/internal/tui/styles"
8 "github.com/charmbracelet/crush/internal/tui/styles"
9 "github.com/charmbracelet/crush/internal/tui/util"
9 "github.com/charmbracelet/crush/internal/tui/util"
10+ "github.com/charmbracelet/lipgloss/v2"
10 "github.com/charmbracelet/x/ansi"
11 "github.com/charmbracelet/x/ansi"
11)
12)
12
13
@@ -72,13 +73,19 @@ func (m *statusCmp) infoMsg() string {
72 switch m.info.Type {
73 switch m.info.Type {
73 case util.InfoTypeError:
74 case util.InfoTypeError:
74 infoType = t.S().Base.Background(t.Red).Padding(0, 1).Render("ERROR")
75 infoType = t.S().Base.Background(t.Red).Padding(0, 1).Render("ERROR")
76+ widthLeft := m.width - (lipgloss.Width(infoType) + 2)
77+ info := ansi.Truncate(m.info.Msg, widthLeft, "…")
75− message = t.S().Base.Background(t.Error).Width(m.width).Foreground(t.White).Padding(0, 1).Render(m.info.Msg)
78+ message = t.S().Base.Background(t.Error).Width(widthLeft+2).Foreground(t.White).Padding(0, 1).Render(info)
76 case util.InfoTypeWarn:
79 case util.InfoTypeWarn:
77 infoType = t.S().Base.Foreground(t.BgOverlay).Background(t.Yellow).Padding(0, 1).Render("WARNING")
80 infoType = t.S().Base.Foreground(t.BgOverlay).Background(t.Yellow).Padding(0, 1).Render("WARNING")
81+ widthLeft := m.width - (lipgloss.Width(infoType) + 2)
82+ info := ansi.Truncate(m.info.Msg, widthLeft, "…")
78− message = t.S().Base.Foreground(t.BgOverlay).Width(m.width).Background(t.Warning).Padding(0, 1).Render(m.info.Msg)
83+ message = t.S().Base.Foreground(t.BgOverlay).Width(widthLeft+2).Background(t.Warning).Padding(0, 1).Render(info)
79 default:
84 default:
80 infoType = t.S().Base.Foreground(t.BgOverlay).Background(t.Green).Padding(0, 1).Render("OKAY!")
85 infoType = t.S().Base.Foreground(t.BgOverlay).Background(t.Green).Padding(0, 1).Render("OKAY!")
86+ widthLeft := m.width - (lipgloss.Width(infoType) + 2)
87+ info := ansi.Truncate(m.info.Msg, widthLeft, "…")
81− message = t.S().Base.Background(t.Success).Width(m.width).Foreground(t.White).Padding(0, 1).Render(m.info.Msg)
88+ message = t.S().Base.Background(t.Success).Width(widthLeft+2).Foreground(t.White).Padding(0, 1).Render(info)
82 }
89 }
83 return ansi.Truncate(infoType+message, m.width, "…")
90 return ansi.Truncate(infoType+message, m.width, "…")
84}
91}