7 // For storing multi cursor clipboard contents
8 type multiClipboard map[Register][]string
10 var multi multiClipboard
12 func (c multiClipboard) getAllText(r Register) string {
18 buf := &bytes.Buffer{}
19 for _, s := range content {
25 func (c multiClipboard) getText(r Register, num int) string {
27 if content == nil || len(content) <= num {
34 // isValid checks if the text stored in this multi-clipboard is the same as the
35 // text stored in the system clipboard (provided as an argument), and therefore
36 // if it is safe to use the multi-clipboard for pasting instead of the system
38 func (c multiClipboard) isValid(r Register, clipboard string, ncursors int) bool {
40 if content == nil || len(content) != ncursors {
44 return clipboard == c.getAllText(r)
47 func (c multiClipboard) writeText(text string, r Register, num int, ncursors int) {
49 if content == nil || len(content) != ncursors {
50 content = make([]string, ncursors, ncursors)
62 multi = make(multiClipboard)