The detail view renders with colour off, because ratatui draws styled spans and an escape sequence inside a paragraph is not one. `detail_of` asks for that with `content_trim(&content, false)`. Two paths ignored the argument and asked the terminal instead. `colorize_ordered` took no colour parameter at all and called `color_text`, which is `paint(.., should_use_colors())`, and `content_trim` routes every Implementation Plan line through it. In the TUI stdout is a terminal, so each numbered step arrived as ESC[36m, the number, ESC[0m, then the text: exactly the gap between the number and the step text where the reported artifact showed. `colorize_line` did the same for a hand-written line inside a Metadata section, and `colorize_bold` honoured its `enabled` flag on the early return and then asked `should_use_colors()` again for the bold run, which made the flag a lie in half the function. `colorize_ordered` now takes the decision and is private, `content_trim` being its only caller. `colorize_line` is deleted rather than given the argument: it was a `pub` alias for `colorize_bold` with one caller, and asking the terminal was the only thing it added, so `render_metadata_table` calls `colorize_bold` with the decision it already holds. Why this shipped, and the reason for the shape of the tests. The guard was an assert that the detail view holds no escape byte, and it could not fail: a test binary has no tty, so `should_use_colors()` was false and the leaking branch was never taken. An absence is now asserted alongside a presence, `content_trim(.., false)` carries no escape and `content_trim(.., true)` still colours, which pins the flag as the only thing that decides. A third test scans this file for `color_text` callers and fails on a new one; it also corrected the assumption this commit started from, since the remaining caller is `ambiguous` and not `display_ticket_items`. The visible symptom is a terminal artifact that no test here can see, since TestBackend applies cell updates and parses no escapes. What is proven is that the escapes are gone, and that the CLI still paints its plan numbers cyan in a pty, which is the condition the leak needed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
22 lines
615 B
TOML
22 lines
615 B
TOML
[package]
|
|
name = "worklane"
|
|
version = "0.8.4"
|
|
edition = "2024"
|
|
|
|
[dependencies]
|
|
clap = { version = "4", features = ["derive"] }
|
|
anyhow = "1"
|
|
uuid = { version = "1", features = ["v4"] }
|
|
chrono = { version = "0.4", features = ["serde"] }
|
|
libc = "0.2"
|
|
# unstable-rendered-line-info for Paragraph::line_count, which is how the detail view
|
|
# knows where its text ends. Counting the wrapping by hand would only agree with the
|
|
# widget until one of us changed.
|
|
ratatui = { version = "0.29", features = ["unstable-rendered-line-info"] }
|
|
crossterm = "0.28"
|
|
|
|
[dev-dependencies]
|
|
assert_cmd = "2"
|
|
assert_fs = "1"
|
|
tempfile = "3"
|