summaryrefslogtreecommitdiffstats
path: root/pkg/commands/oscommands
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2021-10-16 13:49:40 +1100
committerJesse Duffield <jessedduffield@gmail.com>2021-10-16 21:18:43 +1100
commit87e9d9bdc21ebb38727a04c9df7ef5aadc1eba84 (patch)
treec7d812f28c0ebe6b11407a1dbed0b313859e74e7 /pkg/commands/oscommands
parentb6454755caf6b90c935f986558f4f9ad085b1837 (diff)
minor changes
Diffstat (limited to 'pkg/commands/oscommands')
-rw-r--r--pkg/commands/oscommands/os.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/pkg/commands/oscommands/os.go b/pkg/commands/oscommands/os.go
index 5a35b9278..b146d9d8e 100644
--- a/pkg/commands/oscommands/os.go
+++ b/pkg/commands/oscommands/os.go
@@ -546,7 +546,9 @@ func RunLineOutputCmd(cmd *exec.Cmd, onLine func(line string) (bool, error)) err
}
func (c *OSCommand) CopyToClipboard(str string) error {
- c.LogCommand(fmt.Sprintf("Copying '%s' to clipboard", utils.TruncateWithEllipsis(str, 40)), false)
+ escaped := strings.Replace(str, "\n", "\\n", -1)
+ truncated := utils.TruncateWithEllipsis(escaped, 40)
+ c.LogCommand(fmt.Sprintf("Copying '%s' to clipboard", truncated), false)
return clipboard.WriteAll(str)
}