From 807c8f9005fceab1c5a339f5bc43a42405492094 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 14 Feb 2018 20:46:12 +0530 Subject: [PATCH] Do not send history buf in alternate screen mode --- kitty/screen.c | 7 +++++++ kitty/window.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/kitty/screen.c b/kitty/screen.c index ae2b3bf20..9a4a10cf5 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -1577,6 +1577,12 @@ reset_dirty(Screen *self) { Py_RETURN_NONE; } +static PyObject* +is_using_alternate_linebuf(Screen *self) { + if (self->linebuf == self->alt_linebuf) Py_RETURN_TRUE; + Py_RETURN_FALSE; +} + WRAP1E(cursor_back, 1, -1) WRAP1B(erase_in_line, 0) WRAP1B(erase_in_display, 0) @@ -1813,6 +1819,7 @@ static PyMethodDef methods[] = { MND(reset_mode, METH_VARARGS) MND(reset, METH_NOARGS) MND(reset_dirty, METH_NOARGS) + MND(is_using_alternate_linebuf, METH_NOARGS) MND(is_main_linebuf, METH_NOARGS) MND(cursor_back, METH_VARARGS) MND(erase_in_line, METH_VARARGS) diff --git a/kitty/window.py b/kitty/window.py index 944360cbc..c451e314f 100644 --- a/kitty/window.py +++ b/kitty/window.py @@ -318,7 +318,7 @@ class Window: def as_text(self, as_ansi=False, add_history=False): lines = [] self.screen.as_text(lines.append, as_ansi) - if add_history: + if add_history and not self.screen.is_using_alternate_linebuf(): h = [] self.screen.historybuf.as_text(h.append, as_ansi) lines = h + lines