diff --git a/docs/changelog.rst b/docs/changelog.rst index 92795be01..f688204e2 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -93,6 +93,8 @@ Detailed list of changes - Wayland GNOME: Workaround bug in mutter causing double tap on titlebar to not always work (:iss:`8054`) +- clipboard kitten: Fix a bug causing kitten to hang in filter mode when input data size is not divisible by 3 and larger than 8KB (:iss:`8059`) + 0.37.0 [2024-10-30] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/kittens/clipboard/legacy.go b/kittens/clipboard/legacy.go index 6f270f145..0952b4b6a 100644 --- a/kittens/clipboard/legacy.go +++ b/kittens/clipboard/legacy.go @@ -139,19 +139,24 @@ func run_plain_text_loop(opts *Options) (err error) { buf := make([]byte, 8192) write_one_chunk := func() error { - n, err := data_src.Read(buf[:cap(buf)]) - if err != nil && !errors.Is(err, io.EOF) { + orig := enc_writer.last_written_id + for enc_writer.last_written_id == orig { + n, err := data_src.Read(buf[:cap(buf)]) + if n > 0 { + enc.Write(buf[:n]) + } + if err == nil { + continue + } + if errors.Is(err, io.EOF) { + enc.Close() + send_to_loop("\x1b\\") + after_read_from_stdin() + return nil + } send_to_loop("\x1b\\") return err } - if n > 0 { - enc.Write(buf[:n]) - } - if errors.Is(err, io.EOF) { - enc.Close() - send_to_loop("\x1b\\") - after_read_from_stdin() - } return nil }