browser: make scroll step a config value

This commit is contained in:
dece 2021-05-31 18:53:26 +02:00
parent 16903190c8
commit 3a18ad3d77
3 changed files with 6 additions and 4 deletions

View file

@ -189,19 +189,19 @@ class Browser:
elif char == ord("r"): elif char == ord("r"):
self.reload_page() self.reload_page()
elif char == ord("h") or char == curses.KEY_LEFT: elif char == ord("h") or char == curses.KEY_LEFT:
self.scroll_page_horizontally(-3) self.scroll_page_horizontally(-self.config["scroll_step"])
elif char == ord("H"): elif char == ord("H"):
self.scroll_whole_page_left() self.scroll_whole_page_left()
elif char == ord("j") or char == curses.KEY_DOWN: elif char == ord("j") or char == curses.KEY_DOWN:
self.scroll_page_vertically(3) self.scroll_page_vertically(self.config["scroll_step"])
elif char == ord("J") or char == curses.KEY_NPAGE: elif char == ord("J") or char == curses.KEY_NPAGE:
self.scroll_whole_page_down() self.scroll_whole_page_down()
elif char == ord("k") or char == curses.KEY_UP: elif char == ord("k") or char == curses.KEY_UP:
self.scroll_page_vertically(-3) self.scroll_page_vertically(-self.config["scroll_step"])
elif char == ord("K") or char == curses.KEY_PPAGE: elif char == ord("K") or char == curses.KEY_PPAGE:
self.scroll_whole_page_up() self.scroll_whole_page_up()
elif char == ord("l") or char == curses.KEY_RIGHT: elif char == ord("l") or char == curses.KEY_RIGHT:
self.scroll_page_horizontally(3) self.scroll_page_horizontally(self.config["scroll_step"])
elif char == ord("L"): elif char == ord("L"):
self.scroll_whole_page_right() self.scroll_whole_page_right()
elif char == ord("^"): elif char == ord("^"):

View file

@ -28,6 +28,7 @@ DEFAULT_CONFIG = {
"-out", "{cert_path}", "-out", "{cert_path}",
"-subj", "/CN={common_name}", "-subj", "/CN={common_name}",
], ],
"scroll_step": 3,
} }
RENDER_MODES = ("fancy", "dumb") RENDER_MODES = ("fancy", "dumb")

View file

@ -69,6 +69,7 @@ Here are the available options:
* home (string): home page. * home (string): home page.
* render_mode (string): default render mode to use ("fancy" or "dumb"). * render_mode (string): default render mode to use ("fancy" or "dumb").
* generate_client_cert_command (see note 3): command to generate a client cert. * generate_client_cert_command (see note 3): command to generate a client cert.
* scroll_step (int): number of lines/columns to scroll in one step.
Notes: Notes: