Show (not enough space to display) for single comments that are too large.

This commit is contained in:
Michael Lazar
2016-04-20 00:21:17 -07:00
parent 51a0dd33e4
commit 9e89dab0b3
2 changed files with 9 additions and 4 deletions

View File

@@ -163,6 +163,14 @@ class SubmissionPage(Page):
valid_rows = range(0, n_rows)
offset = 0 if not inverted else -(data['n_rows'] - n_rows)
# Cut off the comment if we are only displaying one comment on the
# screen and there still isn't enough space to fit it
split_body = data['split_body']
if data['n_rows'] > n_rows and len(self._subwindows) == 0:
cutoff = data['n_rows'] - n_rows + 1
split_body = split_body[:-cutoff]
split_body.append('(Not enough space to display)')
row = offset
if row in valid_rows:
@@ -186,7 +194,7 @@ class SubmissionPage(Page):
text, attr = self.term.stickied
self.term.add_line(win, text, attr=attr)
for row, text in enumerate(data['split_body'], start=offset+1):
for row, text in enumerate(split_body, start=offset+1):
if row in valid_rows:
self.term.add_line(win, text, row, 1)