mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-20 23:44:59 +02:00
icat: allow specifying image ids
This commit is contained in:
@@ -240,8 +240,16 @@ func main(cmd *cli.Command, o *Options, args []string) (rc int, err error) {
|
||||
if passthrough_mode != no_passthrough {
|
||||
use_unicode_placeholder = true
|
||||
}
|
||||
base_id := uint32(opts.ImageId)
|
||||
for num_of_items > 0 {
|
||||
imgd := <-output_channel
|
||||
if base_id != 0 {
|
||||
imgd.image_id = base_id
|
||||
base_id++
|
||||
if base_id == 0 {
|
||||
base_id++
|
||||
}
|
||||
}
|
||||
imgd.use_unicode_placeholder = use_unicode_placeholder
|
||||
imgd.passthrough_mode = passthrough_mode
|
||||
num_of_items--
|
||||
|
||||
@@ -313,19 +313,21 @@ func transmit_image(imgd *image_data) {
|
||||
if f == nil {
|
||||
f = transmit_stream
|
||||
}
|
||||
if imgd.use_unicode_placeholder {
|
||||
for imgd.image_id&0xFF000000 == 0 || imgd.image_id&0x00FFFF00 == 0 {
|
||||
// Generate a 32-bit image id using rejection sampling such that the most
|
||||
// significant byte and the two bytes in the middle are non-zero to avoid
|
||||
// collisions with applications that cannot represent non-zero most
|
||||
// significant bytes (which is represented by the third combining character)
|
||||
// or two non-zero bytes in the middle (which requires 24-bit color mode).
|
||||
imgd.image_id = next_random()
|
||||
}
|
||||
} else {
|
||||
if len(imgd.frames) > 1 {
|
||||
for imgd.image_number == 0 {
|
||||
imgd.image_number = next_random()
|
||||
if imgd.image_id == 0 {
|
||||
if imgd.use_unicode_placeholder {
|
||||
for imgd.image_id&0xFF000000 == 0 || imgd.image_id&0x00FFFF00 == 0 {
|
||||
// Generate a 32-bit image id using rejection sampling such that the most
|
||||
// significant byte and the two bytes in the middle are non-zero to avoid
|
||||
// collisions with applications that cannot represent non-zero most
|
||||
// significant bytes (which is represented by the third combining character)
|
||||
// or two non-zero bytes in the middle (which requires 24-bit color mode).
|
||||
imgd.image_id = next_random()
|
||||
}
|
||||
} else {
|
||||
if len(imgd.frames) > 1 {
|
||||
for imgd.image_number == 0 {
|
||||
imgd.image_number = next_random()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user