diff --git a/rtv/content.py b/rtv/content.py index f903c5b..41f192d 100644 --- a/rtv/content.py +++ b/rtv/content.py @@ -241,7 +241,11 @@ class SubmissionContent(BaseContent): """ data = self.get(index) - if data['type'] == 'Comment': + if data['type'] == 'Submission': + # Can't hide the submission! + pass + + elif data['type'] == 'Comment': cache = [data] count = 1 for d in self.iterate(index+1, 1, n_cols): @@ -260,11 +264,9 @@ class SubmissionContent(BaseContent): self._comment_data[index:index+len(cache)] = [comment] elif data['type'] == 'HiddenComment': - self._comment_data[index:index+1] = data['cache'] elif data['type'] == 'MoreComments': - with self._loader(): comments = data['object'].comments() comments = self.flatten_comments(comments, root_level=data['level']) diff --git a/rtv/page.py b/rtv/page.py index 0e66c1c..e6746a1 100644 --- a/rtv/page.py +++ b/rtv/page.py @@ -53,21 +53,28 @@ class Navigator(object): else: self.cursor_index += 1 if self.cursor_index >= n_windows - 1: - # We have reached the end of the page - flip the orientation - self.page_index += (self.step * self.cursor_index) - self.cursor_index = 0 - self.inverted = not self.inverted - redraw = True + # We have reached the end of the page + if self._is_valid(self.absolute_index): + # Flip the orientation + self.page_index += (self.step * self.cursor_index) + self.cursor_index = 0 + self.inverted = not self.inverted + redraw = True + else: + # Unless we are at the absolute end of the submission + self.cursor_index -= 1 # Revert + valid = False else: if self.cursor_index > 0: self.cursor_index -= 1 else: - if self._is_valid(self.page_index - self.step): + self.page_index -= self.step + if self._is_valid(self.absolute_index): # We have reached the beginning of the page - move the index - self.page_index -= self.step redraw = True else: - valid = False + self.page_index += self.step + valid = False # Revert return valid, redraw