diff --git a/internal/tui/components/chat/messages/messages.go b/internal/tui/components/chat/messages/messages.go index 7b6cc058ea0746639092f244ccf4b60d06101aec..7b6a0c20073347ba3ec9ab272dad35e95b7abb40 100644 --- a/internal/tui/components/chat/messages/messages.go +++ b/internal/tui/components/chat/messages/messages.go @@ -104,6 +104,7 @@ func (m *messageCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) { if err != nil { return m, util.ReportError(fmt.Errorf("failed to copy message content to clipboard: %w", err)) } + return m, util.ReportInfo("Message copied to clipboard") } } return m, nil diff --git a/internal/tui/components/chat/messages/tool.go b/internal/tui/components/chat/messages/tool.go index e4b578275a8d208925057aac2e5c0028fb8fc8c7..3d756e52ce996be2cfe7d189bba38a632e6c52d9 100644 --- a/internal/tui/components/chat/messages/tool.go +++ b/internal/tui/components/chat/messages/tool.go @@ -202,7 +202,7 @@ func (m *toolCallCmp) copyTool() tea.Cmd { if err != nil { return util.ReportError(fmt.Errorf("failed to copy tool content to clipboard: %w", err)) } - return nil + return util.ReportInfo("Tool content copied to clipboard") } func (m *toolCallCmp) formatToolForCopy() string { @@ -640,7 +640,7 @@ func (m *toolCallCmp) formatAgentResultForCopy() string { } if m.result.Content != "" { - result.WriteString(fmt.Sprintf("```\n%s\n```", m.result.Content)) + result.WriteString(fmt.Sprintf("```markdown\n%s\n```", m.result.Content)) } return result.String() diff --git a/internal/tui/components/core/status/status.go b/internal/tui/components/core/status/status.go index 4cbe8727f41f2a8c0f866b635573036735434781..b01873a22b18f87d798757bb5a6ba799ae0e7a81 100644 --- a/internal/tui/components/core/status/status.go +++ b/internal/tui/components/core/status/status.go @@ -7,6 +7,7 @@ import ( tea "github.com/charmbracelet/bubbletea/v2" "github.com/charmbracelet/crush/internal/tui/styles" "github.com/charmbracelet/crush/internal/tui/util" + "github.com/charmbracelet/lipgloss/v2" "github.com/charmbracelet/x/ansi" ) @@ -72,13 +73,19 @@ func (m *statusCmp) infoMsg() string { switch m.info.Type { case util.InfoTypeError: infoType = t.S().Base.Background(t.Red).Padding(0, 1).Render("ERROR") - message = t.S().Base.Background(t.Error).Width(m.width).Foreground(t.White).Padding(0, 1).Render(m.info.Msg) + widthLeft := m.width - (lipgloss.Width(infoType) + 2) + info := ansi.Truncate(m.info.Msg, widthLeft, "…") + message = t.S().Base.Background(t.Error).Width(widthLeft+2).Foreground(t.White).Padding(0, 1).Render(info) case util.InfoTypeWarn: infoType = t.S().Base.Foreground(t.BgOverlay).Background(t.Yellow).Padding(0, 1).Render("WARNING") - message = t.S().Base.Foreground(t.BgOverlay).Width(m.width).Background(t.Warning).Padding(0, 1).Render(m.info.Msg) + widthLeft := m.width - (lipgloss.Width(infoType) + 2) + info := ansi.Truncate(m.info.Msg, widthLeft, "…") + message = t.S().Base.Foreground(t.BgOverlay).Width(widthLeft+2).Background(t.Warning).Padding(0, 1).Render(info) default: infoType = t.S().Base.Foreground(t.BgOverlay).Background(t.Green).Padding(0, 1).Render("OKAY!") - message = t.S().Base.Background(t.Success).Width(m.width).Foreground(t.White).Padding(0, 1).Render(m.info.Msg) + widthLeft := m.width - (lipgloss.Width(infoType) + 2) + info := ansi.Truncate(m.info.Msg, widthLeft, "…") + message = t.S().Base.Background(t.Success).Width(widthLeft+2).Foreground(t.White).Padding(0, 1).Render(info) } return ansi.Truncate(infoType+message, m.width, "…") }