mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 14:18:26 +02:00
Add a --clear-all flag to icat to clear images from scrollback as well
This commit is contained in:
@@ -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.")
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user