Skip to content

Commit

Permalink
Cleanup some code
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Sep 15, 2024
1 parent 33e4a0f commit 7537fa0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 6 additions & 2 deletions kittens/clipboard/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,11 @@ func unescape_metadata_value(k, x string) (ans string) {

func encode_bytes(metadata map[string]string, payload []byte) string {
ans := strings.Builder{}
ans.Grow(2048)
enc_payload := ""
if len(payload) > 0 {
enc_payload = base64.StdEncoding.EncodeToString(payload)
}
ans.Grow(2048 + len(enc_payload))
ans.WriteString("\x1b]")
ans.WriteString(OSC_NUMBER)
ans.WriteString(";")
Expand All @@ -217,7 +221,7 @@ func encode_bytes(metadata map[string]string, payload []byte) string {
}
if len(payload) > 0 {
ans.WriteString(";")
ans.WriteString(base64.StdEncoding.EncodeToString(payload))
ans.WriteString(enc_payload)
}
ans.WriteString("\x1b\\")
return ans.String()
Expand Down
2 changes: 0 additions & 2 deletions kittens/clipboard/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,6 @@ func run_set_loop(opts *Options, args []string) (err error) {
return fmt.Errorf("Could not guess MIME type for %s use the --mime option to specify a MIME type", arg)
}
to_process[i] = inputs[i]
if to_process[i].is_stream {
}
}
return write_loop(to_process, opts)
}

0 comments on commit 7537fa0

Please sign in to comment.