Do not send history buf in alternate screen mode

This commit is contained in:
Kovid Goyal
2018-02-14 20:46:12 +05:30
parent 9c21610215
commit 807c8f9005
2 changed files with 8 additions and 1 deletions

View File

@@ -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)

View File

@@ -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