mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-08-16 18:10:32 +03:00
icat: Add an option to leave the cursor to the right of the image
Fixes #7574
This commit is contained in:
parent
190566be8e
commit
5bb8378dc1
@ -76,6 +76,8 @@ Detailed list of changes
|
||||
|
||||
- Wayland: Fix specifying the output name for the panel kitten not working (:iss:`7573`)
|
||||
|
||||
- icat kitten: Add an option :option:`kitty +kitten icat --no-trailing-newline` to leave the cursor to the right of the image (:iss:`7574`)
|
||||
|
||||
|
||||
0.35.2 [2024-06-22]
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -292,7 +292,7 @@ func main(cmd *cli.Command, o *Options, args []string) (rc int, err error) {
|
||||
if imgd.err != nil {
|
||||
print_error("Failed to process \x1b[31m%s\x1b[39m: %s\r\n", imgd.source_name, imgd.err)
|
||||
} else {
|
||||
transmit_image(imgd)
|
||||
transmit_image(imgd, opts.NoTrailingNewline)
|
||||
if imgd.err != nil {
|
||||
print_error("Failed to transmit \x1b[31m%s\x1b[39m: %s\r\n", imgd.source_name, imgd.err)
|
||||
}
|
||||
|
@ -155,6 +155,12 @@
|
||||
The graphics protocol id to use for the created image. Normally, a random id is created if needed.
|
||||
This option allows control of the id. When multiple images are sent, sequential ids starting from the specified id
|
||||
are used. Valid ids are from 1 to 4294967295. Numbers outside this range are automatically wrapped.
|
||||
|
||||
|
||||
--no-trailing-newline -n
|
||||
type=bool-set
|
||||
By default, the cursor is moved to the next line after displaying an image. This option, prevents that. Should not be used
|
||||
when catting multiple images. Also has no effect when the :option:`--place` option is used.
|
||||
'''
|
||||
|
||||
help_text = (
|
||||
|
@ -278,7 +278,7 @@ func write_unicode_placeholder(imgd *image_data) {
|
||||
|
||||
var seen_image_ids *utils.Set[uint32]
|
||||
|
||||
func transmit_image(imgd *image_data) {
|
||||
func transmit_image(imgd *image_data, no_trailing_newline bool) {
|
||||
if seen_image_ids == nil {
|
||||
seen_image_ids = utils.NewSet[uint32](32)
|
||||
}
|
||||
@ -406,7 +406,7 @@ func transmit_image(imgd *image_data) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if imgd.move_to.x == 0 {
|
||||
if imgd.move_to.x == 0 && !no_trailing_newline {
|
||||
fmt.Println() // ensure cursor is on new line
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user