|
4 | 4 | from dataclasses import dataclass, field |
5 | 5 | from typing import Literal, Protocol, Self |
6 | 6 |
|
7 | | -from .utils import ANSI_ESCAPE_SEQUENCE, THEME, StyleRef, str_width |
| 7 | +from _colorize import ANSIColors |
| 8 | + |
8 | 9 | from .types import CursorXY |
| 10 | +from .utils import ANSI_ESCAPE_SEQUENCE, THEME, StyleRef, str_width |
9 | 11 |
|
10 | 12 | type RenderStyle = StyleRef | str | None |
11 | 13 | type LineUpdateKind = Literal[ |
@@ -55,7 +57,7 @@ def _style_escape(style: StyleRef) -> str: |
55 | 57 |
|
56 | 58 |
|
57 | 59 | def _update_terminal_state(state: str, escape: str) -> str: |
58 | | - if escape in {"\x1b[0m", "\x1b[m"}: |
| 60 | + if escape in {ANSIColors.RESET, "\x1b[m"}: |
59 | 61 | return "" |
60 | 62 | return state + escape |
61 | 63 |
|
@@ -344,14 +346,14 @@ def render_cells( |
344 | 346 | target_escape += visual_style |
345 | 347 | if target_escape != active_escape: |
346 | 348 | if active_escape: |
347 | | - rendered.append("\x1b[0m") |
| 349 | + rendered.append(ANSIColors.RESET) |
348 | 350 | if target_escape: |
349 | 351 | rendered.append(target_escape) |
350 | 352 | active_escape = target_escape |
351 | 353 | rendered.append(cell.text) |
352 | 354 |
|
353 | 355 | if active_escape: |
354 | | - rendered.append("\x1b[0m") |
| 356 | + rendered.append(ANSIColors.RESET) |
355 | 357 | return "".join(rendered) |
356 | 358 |
|
357 | 359 |
|
|
0 commit comments