termpix 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/termpix/protocols.rb +8 -22
- data/lib/termpix/version.rb +1 -1
- data/lib/termpix.rb +1 -3
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 02dd8d6eb36d91f8db048b0302303bd720fbe246d0934bae5f31a4062a11f00a
|
|
4
|
+
data.tar.gz: 55745158a3f0657c3457c422ce8fd1bf33b7201132c921274c18ede7c49d9830
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4871c317ab480d3df29ef922958f44fce76fddb54cd6f37d2539ce940ea3229fa754c49479fd2b0865f4b255b559a6663454a244d118b638add4e3e7341144c9
|
|
7
|
+
data.tar.gz: ce9f36b37d5f3e8c56c1aa5c6027da0a6b3849dc65a457465547b160f0038dc5d22268d5aea2c4cd245b2d2be390ba7d8c55b89a985655f2ee443be52cd6fe12
|
data/lib/termpix/protocols.rb
CHANGED
|
@@ -7,7 +7,7 @@ module Termpix
|
|
|
7
7
|
# Uses Unicode placeholder mode (U=1) for curses/TUI compatibility
|
|
8
8
|
# Images are tied to placeholder characters that curses manages as text
|
|
9
9
|
module Kitty
|
|
10
|
-
@
|
|
10
|
+
@active_image_ids = []
|
|
11
11
|
@image_cache = {} # path -> image_id mapping
|
|
12
12
|
|
|
13
13
|
def self.display(image_path, x:, y:, max_width:, max_height:)
|
|
@@ -32,8 +32,6 @@ module Termpix
|
|
|
32
32
|
image_id = 1 if image_id == 0
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
old_image_id = @current_image_id
|
|
36
|
-
|
|
37
35
|
unless @image_cache[cache_key]
|
|
38
36
|
# Transmit the image with scaling
|
|
39
37
|
escaped = Shellwords.escape(image_path)
|
|
@@ -50,11 +48,8 @@ module Termpix
|
|
|
50
48
|
chunks.each_with_index do |chunk, idx|
|
|
51
49
|
more = idx < chunks.length - 1 ? 1 : 0
|
|
52
50
|
if idx == 0
|
|
53
|
-
# First chunk: specify format (f=100 for PNG), action (a=t for transmit)
|
|
54
|
-
# i=image_id, m=more_chunks
|
|
55
51
|
print "\e_Ga=t,f=100,i=#{image_id},m=#{more};#{chunk}\e\\"
|
|
56
52
|
else
|
|
57
|
-
# Continuation chunks
|
|
58
53
|
print "\e_Gm=#{more};#{chunk}\e\\"
|
|
59
54
|
end
|
|
60
55
|
end
|
|
@@ -63,30 +58,21 @@ module Termpix
|
|
|
63
58
|
@image_cache[cache_key] = image_id
|
|
64
59
|
end
|
|
65
60
|
|
|
66
|
-
# Position cursor and
|
|
67
|
-
#
|
|
68
|
-
# Don't specify c/r - let kitty use image's native size (already scaled by ImageMagick)
|
|
69
|
-
print "\e[#{y};#{x}H" # Move cursor to position
|
|
61
|
+
# Position cursor and place the image (keep existing images)
|
|
62
|
+
print "\e[#{y};#{x}H"
|
|
70
63
|
print "\e_Ga=p,i=#{image_id},C=1\e\\"
|
|
71
64
|
$stdout.flush
|
|
72
65
|
|
|
73
|
-
|
|
74
|
-
if old_image_id && old_image_id != image_id
|
|
75
|
-
print "\e_Ga=d,d=i,i=#{old_image_id}\e\\"
|
|
76
|
-
$stdout.flush
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
@current_image_id = image_id
|
|
66
|
+
@active_image_ids << image_id unless @active_image_ids.include?(image_id)
|
|
80
67
|
true
|
|
81
68
|
end
|
|
82
69
|
|
|
83
70
|
def self.clear
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
print "\e_Ga=d,d=i,i=#{@current_image_id}\e\\"
|
|
87
|
-
$stdout.flush
|
|
88
|
-
@current_image_id = nil
|
|
71
|
+
@active_image_ids.each do |id|
|
|
72
|
+
print "\e_Ga=d,d=i,i=#{id}\e\\"
|
|
89
73
|
end
|
|
74
|
+
$stdout.flush unless @active_image_ids.empty?
|
|
75
|
+
@active_image_ids.clear
|
|
90
76
|
true
|
|
91
77
|
end
|
|
92
78
|
|
data/lib/termpix/version.rb
CHANGED
data/lib/termpix.rb
CHANGED
|
@@ -31,11 +31,10 @@ module Termpix
|
|
|
31
31
|
return false
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
@current_image = image_path
|
|
35
34
|
true
|
|
36
35
|
end
|
|
37
36
|
|
|
38
|
-
# Clear
|
|
37
|
+
# Clear all displayed images
|
|
39
38
|
def clear(x: 0, y: 0, width: 80, height: 24, term_width: 80, term_height: 24)
|
|
40
39
|
return false unless @protocol
|
|
41
40
|
|
|
@@ -48,7 +47,6 @@ module Termpix
|
|
|
48
47
|
Protocols::W3m.clear(x: x, y: y, width: width, height: height, term_width: term_width, term_height: term_height)
|
|
49
48
|
end
|
|
50
49
|
|
|
51
|
-
@current_image = nil
|
|
52
50
|
true
|
|
53
51
|
end
|
|
54
52
|
|
metadata
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: termpix
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Geir Isene
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-03-
|
|
11
|
+
date: 2026-03-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
|
-
description: 'Termpix v0.4.
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
description: 'Termpix v0.4.1: Kitty protocol now supports multiple simultaneous images.
|
|
14
|
+
Track array of active image IDs instead of single image. clear() removes all active
|
|
15
|
+
images at once.'
|
|
16
16
|
email: g@isene.com
|
|
17
17
|
executables: []
|
|
18
18
|
extensions: []
|