MCPcopy Create free account
hub / github.com/B33pBeeps/redthread / copyNoteText

Method copyNoteText

internal/app/model.go:1013–1034  ·  view source on GitHub ↗

copyNoteText writes the title (if any) and body to the system clipboard, joined with a blank line. Updates the toast in place of error logs.

(title, body string)

Source from the content-addressed store, hash-verified

1011// copyNoteText writes the title (if any) and body to the system clipboard,
1012// joined with a blank line. Updates the toast in place of error logs.
1013func (m *model) copyNoteText(title, body string) {
1014 parts := []string{}
1015 if title != "" {
1016 parts = append(parts, title)
1017 }
1018 if body != "" {
1019 parts = append(parts, body)
1020 }
1021 if len(parts) == 0 {
1022 m.setToast("nothing to copy")
1023 return
1024 }
1025 joined := parts[0]
1026 if len(parts) > 1 {
1027 joined = parts[0] + "\n\n" + parts[1]
1028 }
1029 if err := clipboard.WriteAll(joined); err == nil {
1030 m.setToast("copied note")
1031 } else {
1032 m.setToast("clipboard unavailable")
1033 }
1034}
1035
1036// --- mouse handlers ---------------------------------------------------
1037

Callers 2

handleBoardKeyMethod · 0.95
handleEditKeyMethod · 0.95

Calls 1

setToastMethod · 0.95

Tested by

no test coverage detected