mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-06 01:05:48 +02:00
Export function to encode clipboard protocol chunk
This commit is contained in:
@@ -201,7 +201,7 @@ func unescape_metadata_value(k, x string) (ans string) {
|
||||
return x
|
||||
}
|
||||
|
||||
func encode_bytes(metadata map[string]string, payload []byte) string {
|
||||
func Encode_bytes(metadata map[string]string, payload []byte) string {
|
||||
ans := strings.Builder{}
|
||||
enc_payload := ""
|
||||
if len(payload) > 0 {
|
||||
@@ -228,7 +228,7 @@ func encode_bytes(metadata map[string]string, payload []byte) string {
|
||||
}
|
||||
|
||||
func encode(metadata map[string]string, payload string) string {
|
||||
return encode_bytes(metadata, utils.UnsafeStringToBytes(payload))
|
||||
return Encode_bytes(metadata, utils.UnsafeStringToBytes(payload))
|
||||
}
|
||||
|
||||
func error_from_status(status string) error {
|
||||
|
||||
@@ -95,7 +95,7 @@ func write_loop(inputs []*Input, opts *Options) (err error) {
|
||||
i := inputs[0]
|
||||
n, err := i.src.Read(buf[:])
|
||||
if n > 0 {
|
||||
waiting_for_write = lp.QueueWriteString(encode_bytes(make_metadata("wdata", i.mime_type), buf[:n]))
|
||||
waiting_for_write = lp.QueueWriteString(Encode_bytes(make_metadata("wdata", i.mime_type), buf[:n]))
|
||||
}
|
||||
if err != nil {
|
||||
if errors.Is(err, io.EOF) {
|
||||
|
||||
Reference in New Issue
Block a user