From bc222af2e2c76dec516e66ac96e1bce043be8987 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 27 Aug 2019 19:35:01 +0530 Subject: [PATCH] When dumping scrollback as ansi, reset SGR formatting at end of scrollback --- kitty/window.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kitty/window.py b/kitty/window.py index 220d711e3..c3b0b02a4 100644 --- a/kitty/window.py +++ b/kitty/window.py @@ -497,8 +497,11 @@ class Window: sanitizer = text_sanitizer(as_ansi, add_wrap_markers) h = list(map(sanitizer, h)) self.screen.historybuf.as_text(h.append, as_ansi, add_wrap_markers) - if not self.screen.linebuf.is_continued(0) and h: - h[-1] += '\n' + if h: + if not self.screen.linebuf.is_continued(0): + h[-1] += '\n' + if as_ansi: + h[-1] += '\x1b[m' lines = chain(h, lines) return ''.join(lines)