From 15a7aeff4d8cefb03f776dfe4206011b12be9904 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 25 Nov 2022 21:09:51 +0530 Subject: [PATCH] Fix kitty-tool @ send-text not processing ANSI escapes --- tools/cmd/at/send_text.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/cmd/at/send_text.go b/tools/cmd/at/send_text.go index 762bdced1..620c884a5 100644 --- a/tools/cmd/at/send_text.go +++ b/tools/cmd/at/send_text.go @@ -7,6 +7,8 @@ import ( "errors" "io" "kitty/tools/tui/loop" + "kitty/tools/utils" + "kitty/tools/utils/shlex" "os" "strings" ) @@ -19,13 +21,16 @@ func parse_send_text(io_data *rc_io_data, args []string) error { generators := make([]func(io_data *rc_io_data) (bool, error), 0, 1) if len(args) > 0 { + for i, arg := range args { + args[i] = shlex.ExpandANSICEscapes(arg) + } text := strings.Join(args, " ") text_gen := func(io_data *rc_io_data) (bool, error) { limit := len(text) if limit > 2048 { limit = 2048 } - set_payload_data(io_data, "text:"+text[:limit]) + set_payload_data(io_data, "base64:"+base64.StdEncoding.EncodeToString(utils.UnsafeStringToBytes(text[:limit]))) text = text[limit:] return len(text) == 0, nil }