Wrap text in submission page PAGER output

This commit is contained in:
jupart
2017-11-13 09:46:31 -05:00
parent 1cb2ee16ec
commit a30fdbd1b3
2 changed files with 14 additions and 4 deletions

View File

@@ -20,7 +20,7 @@ from tempfile import NamedTemporaryFile
import six
from kitchen.text.display import textual_width_chop
from . import exceptions, mime_parsers
from . import exceptions, mime_parsers, content
from .theme import Theme
from .objects import LoadScreen
@@ -552,7 +552,7 @@ class Terminal(object):
with self.suspend():
webbrowser.open_new_tab(url)
def open_pager(self, data):
def open_pager(self, data, wrap=False):
"""
View a long block of text using the system's default pager.
@@ -561,6 +561,14 @@ class Terminal(object):
pager = os.getenv('PAGER') or 'less'
command = shlex.split(pager)
if wrap:
data_lines = content.Content.wrap_text(data, wrap)
data = ''
for line in data_lines:
data += line + '\n'
try:
with self.suspend():
_logger.debug('Running command: %s', command)