From 3736ae753a30344b3147bdd47f9d9c13f775dffe Mon Sep 17 00:00:00 2001 From: Nathaniel Nicandro Date: Sun, 6 Nov 2022 17:13:33 -0600 Subject: [PATCH] Prevent leaking ANSI sequences when inserting text/plain results * jupyter-mime.el (jupyter-insert): Do it. --- jupyter-mime.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jupyter-mime.el b/jupyter-mime.el index 64485cf..e83135d 100644 --- a/jupyter-mime.el +++ b/jupyter-mime.el @@ -549,6 +549,9 @@ width and height of the image." (cl-defmethod jupyter-insert ((_mime (eql :text/plain)) data &optional _metadata) + ;; Reset the context so that it doesn't leak into DATA if DATA has + ;; no ANSI sequences. + (setq ansi-color-context nil) (jupyter-insert-ansi-coded-text data) (insert "\n"))