diff --git a/kittens/icat/main.go b/kittens/icat/main.go index 6b84c070e..f348570b0 100644 --- a/kittens/icat/main.go +++ b/kittens/icat/main.go @@ -4,6 +4,7 @@ package icat import ( "fmt" + "math" "os" "runtime" "strconv" @@ -229,6 +230,20 @@ func main(cmd *cli.Command, o *Options, args []string) (rc int, err error) { return 1, err } } + switch { + case opts.ClearAll: + cc := &graphics.GraphicsCommand{} + cc.SetAction(graphics.GRT_action_delete).SetDelete(graphics.GRT_free_by_range).SetLeftEdge(0).SetTopEdge(math.MaxUint32) + if err = cc.WriteWithPayloadTo(os.Stdout, nil); err != nil { + return 1, err + } + case opts.Clear: + cc := &graphics.GraphicsCommand{} + cc.SetAction(graphics.GRT_action_delete).SetDelete(graphics.GRT_free_visible) + if err = cc.WriteWithPayloadTo(os.Stdout, nil); err != nil { + return 1, err + } + } if screen_size.Xpixel == 0 || screen_size.Ypixel == 0 { return 1, fmt.Errorf("Terminal does not support reporting screen sizes in pixels, use a terminal such as kitty, WezTerm, Konsole, etc. that does.") } diff --git a/kittens/icat/main.py b/kittens/icat/main.py index c571a500a..244d7fc1d 100644 --- a/kittens/icat/main.py +++ b/kittens/icat/main.py @@ -54,6 +54,12 @@ this cannot work with terminal multiplexers such as tmux since only the multiplexer can know the position of the screen. +--clear-all +type=bool-set +Remove all images from screen and scrollback. Note that with terminal +multiplexers like tmux, this will move images from all panes. + + --transfer-mode type=choices choices=detect,file,stream,memory