| 2266 | static size_t renderer_utf8_need(unsigned char c) { |
| 2267 | if (c < 0x80) return 1; |
| 2268 | if (c >= 0xc2 && c <= 0xdf) return 2; |
| 2269 | if (c >= 0xe0 && c <= 0xef) return 3; |
| 2270 | if (c >= 0xf0 && c <= 0xf4) return 4; |
| 2271 | return 1; |
| 2272 | } |
| 2273 | |
| 2274 | static bool renderer_has_text_attrs(agent_token_renderer *r) { |
| 2275 | return r->in_think || r->md_bold || r->md_italic || |
| 2276 | r->md_inline_code || r->md_code_block; |
| 2277 | } |
| 2278 | |
| 2279 | static void renderer_set_text_attrs(agent_token_renderer *r) { |
| 2280 | if (!r->use_color) return; |
| 2281 | if (r->in_think) { |
| 2282 | renderer_set_grey(r); |
| 2283 | return; |
no test coverage detected