Get file mode transmission working for unmodified PNG

This commit is contained in:
Kovid Goyal
2023-01-01 12:01:20 +05:30
parent ce4c71c465
commit 5562a4d52f
6 changed files with 125 additions and 23 deletions

View File

@@ -14,14 +14,25 @@ import (
"kitty/tools/tui/loop"
"kitty/tools/utils"
"kitty/tools/utils/shm"
)
var _ = fmt.Print
func MakeTemp() (*os.File, error) {
func CreateTemp() (*os.File, error) {
return os.CreateTemp("", "tty-graphics-protocol-*")
}
func CreateTempInRAM() (*os.File, error) {
if shm.SHM_DIR != "" {
f, err := os.CreateTemp(shm.SHM_DIR, "tty-graphics-protocol-*")
if err == nil {
return f, err
}
}
return CreateTemp()
}
// Enums {{{
type GRT_a int
@@ -523,7 +534,7 @@ func (self *GraphicsCommand) AsAPC(payload []byte) string {
}
func (self *GraphicsCommand) WriteWithPayloadTo(o io.StringWriter, payload []byte) (err error) {
const compression_threshold = 1024
const compression_threshold = 2048
if len(payload) == 0 {
return self.serialize_to(o, "")
}