diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-26 12:09:55 -0400 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-26 12:09:55 -0400 |
| commit | 706bf8ebef2acc91db3782966904f601bb1084ae (patch) | |
| tree | 1dae3f17d45f1be3239ad9cd795d4d00d6314162 /tests | |
| parent | ed8f4781d953fca0052765518a17cca15f2167ab (diff) | |
| download | dotemacs-706bf8ebef2acc91db3782966904f601bb1084ae.tar.gz dotemacs-706bf8ebef2acc91db3782966904f601bb1084ae.zip | |
feat(eat): reset SGR at newline to contain unterminated-color bleed
Claude Code and similar inline TUIs sometimes truncate a colored span without emitting a reset; the unterminated color then bleeds onto every following line in the EAT buffer. Advise eat-term-process-output to inject an SGR reset before each newline, containing the bleed to its own line. Validated in real EAT and via an ansi-color proxy: it contains the bleed and leaves per-line coloring intact, since programs re-open their color on each line. Gated by cj/eat-reset-sgr-at-newline (default on) so it can be disabled if a program ever carries one color across newlines without re-opening it.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test-term-tmux-history.el | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test-term-tmux-history.el b/tests/test-term-tmux-history.el index 13e3e1715..a5f5c93cd 100644 --- a/tests/test-term-tmux-history.el +++ b/tests/test-term-tmux-history.el @@ -305,5 +305,16 @@ the EAT window line-scrolls instead of recentering on full-frame redraws." (should (= scroll-margin 0)) (should (null auto-window-vscroll)))) +(ert-deftest test-term-eat-reset-sgr-at-newline () + "Normal: the SGR-reset advice injects a reset before each newline when enabled +\(containing an unterminated color), and passes output through unchanged when +disabled." + (let ((cj/eat-reset-sgr-at-newline t)) + (should (equal (cj/--eat-reset-sgr-at-newline (list (quote term) "a\nb\n")) + (list (quote term) "a\e[0m\nb\e[0m\n")))) + (let ((cj/eat-reset-sgr-at-newline nil)) + (should (equal (cj/--eat-reset-sgr-at-newline (list (quote term) "a\nb\n")) + (list (quote term) "a\nb\n"))))) + (provide 'test-term-tmux-history) ;;; test-term-tmux-history.el ends here |
