Allow viewing the current contents of the alternate screen in a new window.

Fixes #933
This commit is contained in:
Kovid Goyal
2018-09-09 15:32:05 +05:30
parent 1dcf3f2afb
commit e5a7ba4f22
4 changed files with 28 additions and 4 deletions
+6 -3
View File
@@ -436,10 +436,13 @@ class Window:
self.screen.reset_callbacks()
self.screen = None
def as_text(self, as_ansi=False, add_history=False, add_wrap_markers=False):
def as_text(self, as_ansi=False, add_history=False, add_wrap_markers=False, alternate_screen=False):
lines = []
add_history = add_history and not self.screen.is_using_alternate_linebuf()
f = self.screen.as_text_non_visual if add_history else self.screen.as_text
add_history = add_history and not self.screen.is_using_alternate_linebuf() and not alternate_screen
if alternate_screen:
f = self.screen.as_text_alternate
else:
f = self.screen.as_text_non_visual if add_history else self.screen.as_text
f(lines.append, as_ansi, add_wrap_markers)
if add_history:
h = []