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
@@ -30,11 +30,7 @@ class ListBox(Scrollable):
def delete(self, idx: int, count: int = 1) -> None:
del self._items[idx : idx + count]
def _render_impl(self) -> None:
def _render_impl(self, h: int, w: int) -> None:
assert self._pad
h, w = self.getmaxyx()
for y, item in enumerate(self._items):
self._pad.addnstr(y, 0, item, min(len(item), w))
y, x = self.getbegyx()
self._pad.refresh(self._scroll_y, 0, y, x, y + h - 1, x + w - 1)