diff --git a/rtv/page.py b/rtv/page.py index 4c5c036..a5c8184 100644 --- a/rtv/page.py +++ b/rtv/page.py @@ -314,9 +314,6 @@ class Page(object): 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() window = self.term.stdscr.derwin( n_rows - self._row, n_cols, self._row, 0) diff --git a/rtv/submission.py b/rtv/submission.py index d7bf94c..411f532 100644 --- a/rtv/submission.py +++ b/rtv/submission.py @@ -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)