tui-td 0.2.8 → 0.2.9
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/CHANGELOG.md +13 -0
- data/lib/tui_td/cli.rb +12 -2
- data/lib/tui_td/driver.rb +28 -4
- data/lib/tui_td/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e0062b5242a5e1ec97546b733761ce7a7fe559ee85d2e413cdce25798fa0861d
|
|
4
|
+
data.tar.gz: 2fbf22c11937739e51bc303d4ddbaedd6edb1015ef829046dc9d42bc5a1f2bf8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 306311eefc1fc30811cd630ac23f35f02ce7d14250c9bdd1cc63a7508a199193af475947fed85bc24198b3060903ce38b392f056ddba326fc22741b3ba28568c
|
|
7
|
+
data.tar.gz: 90bcfdd7d9f9f9357758deb5f7ebb8b3a7f20ca919f398909ecd03801106998fcf190c5341141324ec427618e9a32ad40cfbc117ae7bb474b5421e1677b4980e
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 0.2.9
|
|
4
|
+
|
|
5
|
+
- Fix: `wait_for_stable` uses parsed terminal grid comparison instead of raw byte arrival, preventing interactive TUIs that repaint cell-by-cell (e.g., glow) from timing out
|
|
6
|
+
- Fix: `cmd_capture` catches timeout for interactive TUIs and proceeds with whatever was rendered
|
|
7
|
+
- New tests for `driver.rb` (39), `cli.rb` (19), and `mcp/server.rb` (27) — 85 new tests total
|
|
8
|
+
|
|
9
|
+
## 0.2.8
|
|
10
|
+
|
|
11
|
+
- Unicode bitmap font in screenshot renderer: 2766 glyphs from GNU Unifont 17.0.04 covering Latin, Greek, Cyrillic, Arabic, Turkish, Math, Arrows, Box Drawing, Symbols, and Dingbats
|
|
12
|
+
- Cairo renderer as optional fallback for characters not in Unifont (e.g. CJK), with 3x supersampling and box-filter downsampling for sharp edges
|
|
13
|
+
- Rendering priority: Spleen (ASCII 33–126) → Unifont (127+, 2766 glyphs) → Cairo (fallback)
|
|
14
|
+
- Full test coverage for Unifont glyphs and Cairo renderer
|
|
15
|
+
|
|
3
16
|
## 0.2.7
|
|
4
17
|
|
|
5
18
|
- Screenshot rendering for 23 special characters: blocks (▀ ▄ █), triangles (▲ ▼), arrows (↑ ↓ → ←), half blocks (▌ ▐)
|
data/lib/tui_td/cli.rb
CHANGED
|
@@ -211,8 +211,18 @@ module TUITD
|
|
|
211
211
|
cmd = args.join(" ")
|
|
212
212
|
|
|
213
213
|
driver = Driver.new(cmd, **globals.slice(:rows, :cols, :timeout, :chdir))
|
|
214
|
-
|
|
215
|
-
|
|
214
|
+
begin
|
|
215
|
+
driver.start
|
|
216
|
+
rescue TimeoutError
|
|
217
|
+
# Interactive TUI that never stabilizes (e.g., glow without -p).
|
|
218
|
+
# Proceed with whatever was rendered before the timeout.
|
|
219
|
+
driver.refresh
|
|
220
|
+
end
|
|
221
|
+
begin
|
|
222
|
+
driver.wait_for_stable
|
|
223
|
+
rescue TimeoutError
|
|
224
|
+
# Ignored — already have rendered state from start
|
|
225
|
+
end
|
|
216
226
|
|
|
217
227
|
case globals[:format]
|
|
218
228
|
when :json
|
data/lib/tui_td/driver.rb
CHANGED
|
@@ -96,17 +96,28 @@ module TUITD
|
|
|
96
96
|
refresh_state!
|
|
97
97
|
end
|
|
98
98
|
|
|
99
|
-
# Wait for output to stabilize (
|
|
99
|
+
# Wait for output to stabilize (grid content unchanged for N milliseconds)
|
|
100
100
|
def wait_for_stable(stable_ms: 300)
|
|
101
101
|
deadline = monotonic + @timeout
|
|
102
102
|
last_change = monotonic
|
|
103
|
+
last_grid = nil
|
|
103
104
|
|
|
104
105
|
loop do
|
|
105
106
|
raise TimeoutError, "Timeout waiting for stable output" if monotonic > deadline
|
|
106
107
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
had_data = read_available!
|
|
109
|
+
process_alive = process_alive?
|
|
110
|
+
|
|
111
|
+
if had_data
|
|
112
|
+
current_grid = parse_grid_snapshot
|
|
113
|
+
if current_grid != last_grid
|
|
114
|
+
last_grid = current_grid
|
|
115
|
+
last_change = monotonic
|
|
116
|
+
end
|
|
117
|
+
elsif !process_alive
|
|
118
|
+
# Process exited and no more data — final state reached
|
|
119
|
+
break
|
|
120
|
+
elsif last_grid && (monotonic - last_change) * 1000 >= stable_ms
|
|
110
121
|
break
|
|
111
122
|
end
|
|
112
123
|
|
|
@@ -246,6 +257,19 @@ module TUITD
|
|
|
246
257
|
end
|
|
247
258
|
end
|
|
248
259
|
|
|
260
|
+
def parse_grid_snapshot
|
|
261
|
+
@output_mutex.synchronize do
|
|
262
|
+
ANSIParser.parse(@output_buffer, @rows, @cols)[:rows]
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
def process_alive?
|
|
267
|
+
return false unless @pid
|
|
268
|
+
Process.waitpid(@pid, Process::WNOHANG).nil?
|
|
269
|
+
rescue Errno::ECHILD
|
|
270
|
+
false
|
|
271
|
+
end
|
|
272
|
+
|
|
249
273
|
def monotonic
|
|
250
274
|
Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
251
275
|
end
|
data/lib/tui_td/version.rb
CHANGED