Added clipboard.
- Default implementation only copies to application memory. Is open for using external implementation.
This commit is contained in:
parent
fa7796a4ae
commit
71cdc234ee
23
ui/clipboard.go
Normal file
23
ui/clipboard.go
Normal file
@ -0,0 +1,23 @@
|
||||
package ui
|
||||
|
||||
type Clipboard interface {
|
||||
WriteText(t string) error
|
||||
ReadText() (string, error)
|
||||
}
|
||||
|
||||
var DefaultClipboard Clipboard = &clipboard{}
|
||||
|
||||
func SetClipboard(c Clipboard) { DefaultClipboard = c }
|
||||
|
||||
type clipboard struct {
|
||||
value string
|
||||
}
|
||||
|
||||
func (c *clipboard) WriteText(t string) error {
|
||||
c.value = t
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *clipboard) ReadText() (string, error) {
|
||||
return c.value, nil
|
||||
}
|
Loading…
Reference in New Issue
Block a user