Work in progress.
This commit is contained in:
19
rtv/page.py
19
rtv/page.py
@@ -328,8 +328,7 @@ class Page(object):
|
||||
# 4.) Otherwise, this should ensure that the bottom element is always
|
||||
# full visible and the cursor doesn't jump lines.
|
||||
|
||||
# Note: Should also disable drawing inverted if only one element
|
||||
# Note: If only one comment, add (Not enough space to display)
|
||||
# TODO: If only one comment, add (Not enough space to display)
|
||||
|
||||
n_rows, n_cols = self.term.stdscr.getmaxyx()
|
||||
window = self.term.stdscr.derwin(
|
||||
@@ -347,20 +346,24 @@ class Page(object):
|
||||
cancel_inverted = True
|
||||
current_row = (win_n_rows - 1) if inverted else 0
|
||||
available_rows = (win_n_rows - 1) if inverted else win_n_rows
|
||||
top_height = self.nav.top_height if not inverted else None
|
||||
top_item_height = None if inverted else self.nav.top_item_height
|
||||
for data in self.content.iterate(page_index, step, win_n_cols - 2):
|
||||
subwin_n_rows = min(available_rows, data['n_rows'])
|
||||
if top_height:
|
||||
subwin_n_rows = min(subwin_n_rows, top_height)
|
||||
subwin_inverted = inverted
|
||||
if top_item_height is not None:
|
||||
# Special case when top_item_height is given. This will only
|
||||
# be applied to the first item that is drawn.
|
||||
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']
|
||||
start = current_row - subwin_n_rows if inverted else current_row
|
||||
subwindow = window.derwin(
|
||||
subwin_n_rows, subwin_n_cols, start, data['offset'])
|
||||
attr = self._draw_item(subwindow, data, top_height or inverted)
|
||||
self._subwindows.append((subwindow, attr, subwin_n_rows))
|
||||
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
|
||||
current_row += step * (subwin_n_rows + 1)
|
||||
top_height = None
|
||||
if available_rows <= 0:
|
||||
# Indicate the page is full and we can keep the inverted screen.
|
||||
cancel_inverted = False
|
||||
|
||||
Reference in New Issue
Block a user