mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-10-22 05:02:31 +00:00
Add a --clear-all flag to icat to clear images from scrollback as well
This commit is contained in:
parent
e2092d5e60
commit
9475780e9d
2 changed files with 21 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue