mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-18 14:34:52 +02:00
Get copy to primary selection working
This commit is contained in:
@@ -405,3 +405,17 @@ const (
|
||||
func (self *Loop) SetDefaultColor(which DefaultColor, val style.RGBA) {
|
||||
self.QueueWriteString(fmt.Sprintf("\033]%d;%s\033\\", int(which), val.AsRGBSharp()))
|
||||
}
|
||||
|
||||
func (self *Loop) copy_text_to(text, dest string) {
|
||||
self.QueueWriteString("\x1b]52;" + dest + ";")
|
||||
self.QueueWriteString(base64.StdEncoding.EncodeToString(utils.UnsafeStringToBytes(text)))
|
||||
self.QueueWriteString("\x1b\\")
|
||||
}
|
||||
|
||||
func (self *Loop) CopyTextToPrimarySelection(text string) {
|
||||
self.copy_text_to(text, "p")
|
||||
}
|
||||
|
||||
func (self *Loop) CopyTextToClipboard(text string) {
|
||||
self.copy_text_to(text, "c")
|
||||
}
|
||||
|
||||
@@ -152,3 +152,11 @@ func (ms *MouseSelection) LineFormatSuffix(line_pos LinePos, sgr string, y int)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (ms *MouseSelection) StartLine() LinePos {
|
||||
return ms.start.line
|
||||
}
|
||||
|
||||
func (ms *MouseSelection) EndLine() LinePos {
|
||||
return ms.end.line
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user