mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-09-20 02:57:19 +03:00
Fix kitty-tool @ send-text not processing ANSI escapes
This commit is contained in:
parent
f9a22d0bc7
commit
15a7aeff4d
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user