Making a few things more clear.

This commit is contained in:
Michael Lazar
2016-10-31 13:56:08 -07:00
parent 6a395216a3
commit e96db6e7ac
4 changed files with 13 additions and 13 deletions

View File

@@ -340,15 +340,15 @@ class SubmissionContent(Content):
data['split_title'] = self.wrap_text(data['title'], width=n_cols-2)
data['split_text'] = self.wrap_text(data['text'], width=n_cols-2)
data['n_rows'] = len(data['split_title'] + data['split_text']) + 5
data['offset'] = 0
data['h_offset'] = 0
else:
data = self._comment_data[index]
indent_level = min(data['level'], self.max_indent_level)
data['offset'] = indent_level * self.indent_size
data['h_offset'] = indent_level * self.indent_size
if data['type'] == 'Comment':
width = min(n_cols - data['offset'], self._max_comment_cols)
width = min(n_cols - data['h_offset'], self._max_comment_cols)
data['split_body'] = self.wrap_text(data['body'], width=width)
data['n_rows'] = len(data['split_body']) + 1
else:
@@ -626,7 +626,7 @@ class SubredditContent(Content):
data['split_title'] = data['split_title'][:self.max_title_rows-1]
data['split_title'].append('(Not enough space to display)')
data['n_rows'] = len(data['split_title']) + 3
data['offset'] = 0
data['h_offset'] = 0
return data
@@ -700,6 +700,6 @@ class SubscriptionContent(Content):
data = self._subscription_data[index]
data['split_title'] = self.wrap_text(data['title'], width=n_cols)
data['n_rows'] = len(data['split_title']) + 1
data['offset'] = 0
data['h_offset'] = 0
return data

View File

@@ -455,10 +455,10 @@ class Page(object):
subwin_n_rows = min(subwin_n_rows, top_item_height)
subwin_inverted = True
top_item_height = None
subwin_n_cols = win_n_cols - data['offset']
subwin_n_cols = win_n_cols - data['h_offset']
start = current_row - subwin_n_rows + 1 if inverted else current_row
subwindow = window.derwin(
subwin_n_rows, subwin_n_cols, start, data['offset'])
subwin_n_rows, subwin_n_cols, start, data['h_offset'])
attr = self._draw_item(subwindow, data, subwin_inverted)
self._subwindows.append((subwindow, attr))
available_rows -= (subwin_n_rows + 1) # Add one for the blank line

View File

@@ -162,9 +162,9 @@ class SubmissionPage(Page):
@SubmissionController.register(Command('DELETE'))
@logged_in
def delete_comment(self):
"Delete a comment as long as it is not the current submission"
"Delete the selected comment"
if self.nav.absolute_index != -1:
if self.get_selected_item()['type'] == 'Comment':
self.delete_item()
else:
self.term.flash()