mirror of
https://codeberg.org/scip/tablizer.git
synced 2025-12-17 04:30:56 +01:00
using patched tiagomeol/go-clipboard/clipboard, fixes #37
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
// +build darwin
|
||||
|
||||
package lib
|
||||
|
||||
|
||||
func setprimary() {
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
// +build freebsd linux netbsd openbsd solaris dragonfly
|
||||
|
||||
package lib
|
||||
|
||||
import "github.com/atotto/clipboard"
|
||||
|
||||
func setprimary() {
|
||||
clipboard.Primary = true
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
// +build windows
|
||||
|
||||
package lib
|
||||
|
||||
|
||||
func setprimary() {
|
||||
}
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"log"
|
||||
"strings"
|
||||
|
||||
"github.com/atotto/clipboard"
|
||||
"github.com/tiagomelo/go-clipboard/clipboard"
|
||||
"github.com/tlinden/tablizer/cfg"
|
||||
)
|
||||
|
||||
@@ -43,8 +43,8 @@ func yankColumns(conf cfg.Config, data *Tabdata) {
|
||||
}
|
||||
|
||||
if len(yank) > 0 {
|
||||
setprimary()
|
||||
if err := clipboard.WriteAll(strings.Join(yank, " ")); err != nil {
|
||||
cb := clipboard.New(clipboard.ClipboardOptions{Primary: true})
|
||||
if err := cb.CopyText(strings.Join(yank, " ")); err != nil {
|
||||
log.Fatalln("error writing string to clipboard:", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/atotto/clipboard"
|
||||
"github.com/tiagomelo/go-clipboard/clipboard"
|
||||
"github.com/tlinden/tablizer/cfg"
|
||||
)
|
||||
|
||||
@@ -40,6 +40,8 @@ var yanktests = []struct {
|
||||
}
|
||||
|
||||
func DISABLED_TestYankColumns(t *testing.T) {
|
||||
cb := clipboard.New()
|
||||
|
||||
for _, testdata := range yanktests {
|
||||
testname := fmt.Sprintf("yank-%s-filter-%s",
|
||||
testdata.name, testdata.filter)
|
||||
@@ -56,7 +58,7 @@ func DISABLED_TestYankColumns(t *testing.T) {
|
||||
var writer bytes.Buffer
|
||||
printData(&writer, conf, &data)
|
||||
|
||||
got, err := clipboard.ReadAll() // hangs indefinetly
|
||||
got, err := cb.PasteText()
|
||||
if err != nil {
|
||||
t.Errorf("failed to fetch yanked text from clipboard")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user