Skip to content

Commit 76fe014

Browse files
committed
Fix copying the whole session to the clipboard
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
1 parent 14daf0e commit 76fe014

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

pkg/tui/components/messages/messages.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ func (m *model) copySelectionToClipboard() tea.Cmd {
847847
_ = clipboard.WriteAll(selectedText)
848848
return nil
849849
},
850-
notification.SuccessCmd("Text copied to clipboard"),
850+
notification.SuccessCmd("Text copied to clipboard."),
851851
)
852852
}
853853

pkg/tui/tui.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,14 @@ func (a *appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
221221
return a, notification.SuccessCmd("Conversation is empty; nothing copied.")
222222
}
223223

224-
if err := clipboard.WriteAll(transcript); err != nil {
225-
return a, notification.ErrorCmd("Failed to copy conversation: " + err.Error())
226-
}
227-
228-
return a, notification.SuccessCmd("Conversation copied to clipboard.")
224+
return a, tea.Sequence(
225+
tea.SetClipboard(transcript),
226+
func() tea.Msg {
227+
_ = clipboard.WriteAll(transcript)
228+
return nil
229+
},
230+
notification.SuccessCmd("Conversation copied to clipboard."),
231+
)
229232

230233
case messages.ToggleYoloMsg:
231234
sess := a.application.Session()

0 commit comments

Comments
 (0)