Show (not enough space to display) for single comments that are too large.
This commit is contained in:
@@ -314,9 +314,6 @@ class Page(object):
|
|||||||
Loop through submissions and fill up the content page.
|
Loop through submissions and fill up the content page.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# TODO: If only one comment, add (Not enough space to display)
|
|
||||||
# TODO: Jumps up one space sometimes
|
|
||||||
|
|
||||||
n_rows, n_cols = self.term.stdscr.getmaxyx()
|
n_rows, n_cols = self.term.stdscr.getmaxyx()
|
||||||
window = self.term.stdscr.derwin(
|
window = self.term.stdscr.derwin(
|
||||||
n_rows - self._row, n_cols, self._row, 0)
|
n_rows - self._row, n_cols, self._row, 0)
|
||||||
|
|||||||
@@ -163,6 +163,14 @@ class SubmissionPage(Page):
|
|||||||
valid_rows = range(0, n_rows)
|
valid_rows = range(0, n_rows)
|
||||||
offset = 0 if not inverted else -(data['n_rows'] - 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
|
row = offset
|
||||||
if row in valid_rows:
|
if row in valid_rows:
|
||||||
|
|
||||||
@@ -186,7 +194,7 @@ class SubmissionPage(Page):
|
|||||||
text, attr = self.term.stickied
|
text, attr = self.term.stickied
|
||||||
self.term.add_line(win, text, attr=attr)
|
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:
|
if row in valid_rows:
|
||||||
self.term.add_line(win, text, row, 1)
|
self.term.add_line(win, text, row, 1)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user