Page down key bug fixed.

Duplicate code reduced.
This commit is contained in:
sangoh.hong 2019-01-08 20:55:06 +09:00
parent f7e24b2233
commit e608921992
2 changed files with 5 additions and 3 deletions

2
.gitignore vendored
View File

@ -47,3 +47,5 @@ _build
# web ui
node_modules/
bower_components/
.vscode/

View File

@ -124,6 +124,8 @@ class GlancesCursesBrowser(_GlancesCurses):
"""Set next page."""
if self._current_page + 1 < self._page_max:
self._current_page += 1
else:
self._current_page = 0
self.cursor_position = 0
def __catch_key(self, stats):
@ -288,9 +290,7 @@ class GlancesCursesBrowser(_GlancesCurses):
self.cursor = len(stats) - 1
start_line = self._page_max_lines * self._current_page
end_line = start_line + self._page_max_lines
if end_line > stats_len:
end_line = stats_len
end_line = start_line + self.get_pagelines(stats)
current_page = stats[start_line:end_line]