ui/curses: add scrollbars

This commit is contained in:
rr-
2019-01-03 23:23:47 +01:00
parent 3fdc2459ca
commit 871144bf0c
3 changed files with 27 additions and 14 deletions
+1 -5
View File
@@ -44,9 +44,8 @@ class DataTable(Scrollable):
return idx
return None
def _render_impl(self) -> None:
def _render_impl(self, h: int, w: int) -> None:
assert self._pad
h, w = self.getmaxyx()
if self._align_right:
for y, row in enumerate(self._items):
self._pad.move(y, 0)
@@ -64,8 +63,5 @@ class DataTable(Scrollable):
y, col2_x, row[1], min(len(row[1]), w - col2_x)
)
y, x = self.getbegyx()
self._pad.refresh(self._scroll_y, 0, y, x, y + h - 1, x + w - 1)
def _get_col_width(self, x: int) -> int:
return max([len(row[0]) for row in self._items] + [0])