fix #37: make yank portable

This commit is contained in:
Thomas von Dein
2025-01-22 23:12:42 +01:00
parent 82f54c120d
commit e8f4fef41c
5 changed files with 28 additions and 3 deletions

View File

@@ -285,7 +285,7 @@ func yankColumns(conf cfg.Config, data *Tabdata) {
}
if yank != "" {
clipboard.Primary = true // unix
setprimary()
if err := clipboard.WriteAll(yank); err != nil {
log.Fatalln("error writing string to clipboard:", err)
}

8
lib/ya_darwin.go Normal file
View File

@@ -0,0 +1,8 @@
// +build darwin
package lib
import "github.com/atotto/clipboard"
func setprimary() {
}

9
lib/ya_unix.go Normal file
View File

@@ -0,0 +1,9 @@
// +build freebsd linux netbsd openbsd solaris dragonfly
package lib
import "github.com/atotto/clipboard"
func setprimary() {
clipboard.Primary = true
}

8
lib/ya_windows.go Normal file
View File

@@ -0,0 +1,8 @@
// +build windows
package lib
import "github.com/atotto/clipboard"
func setprimary() {
}