Allow kittens to ask for wrap markers

This commit is contained in:
Kovid Goyal
2018-05-18 23:09:27 +05:30
parent bb06bfa627
commit 0e327f3d13
2 changed files with 8 additions and 4 deletions

View File

@@ -526,8 +526,12 @@ class Boss:
end_kitten = create_kitten_handler(kitten, orig_args)
args[0:0] = [config_dir, kitten]
type_of_input = end_kitten.type_of_input
if type_of_input in ('text', 'history', 'ansi', 'ansi-history'):
data = w.as_text(as_ansi='ansi' in type_of_input, add_history='history' in type_of_input).encode('utf-8')
if type_of_input in ('text', 'history', 'ansi', 'ansi-history', 'screen', 'screen-history', 'screen-ansi-history'):
data = w.as_text(
as_ansi='ansi' in type_of_input,
add_history='history' in type_of_input,
add_wrap_markers='screen' in type_of_input
).encode('utf-8')
elif type_of_input is None:
data = None
else:

View File

@@ -374,11 +374,11 @@ class Window:
self.screen.reset_callbacks()
self.screen = None
def as_text(self, as_ansi=False, add_history=False):
def as_text(self, as_ansi=False, add_history=False, add_wrap_markers=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
f(lines.append, as_ansi)
f(lines.append, as_ansi, add_wrap_markers)
if add_history:
h = []
self.screen.historybuf.as_text(h.append, as_ansi)