From 3a18ad3d77baafa2e55f3352605acde5c08d9d7d Mon Sep 17 00:00:00 2001 From: dece Date: Mon, 31 May 2021 18:53:26 +0200 Subject: [PATCH] browser: make scroll step a config value --- bebop/browser/browser.py | 8 ++++---- bebop/config.py | 1 + bebop/help.py | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bebop/browser/browser.py b/bebop/browser/browser.py index 724a1fa..19f6825 100644 --- a/bebop/browser/browser.py +++ b/bebop/browser/browser.py @@ -189,19 +189,19 @@ class Browser: elif char == ord("r"): self.reload_page() 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"): self.scroll_whole_page_left() 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: self.scroll_whole_page_down() 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: self.scroll_whole_page_up() 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"): self.scroll_whole_page_right() elif char == ord("^"): diff --git a/bebop/config.py b/bebop/config.py index 742981a..86e83d7 100644 --- a/bebop/config.py +++ b/bebop/config.py @@ -28,6 +28,7 @@ DEFAULT_CONFIG = { "-out", "{cert_path}", "-subj", "/CN={common_name}", ], + "scroll_step": 3, } RENDER_MODES = ("fancy", "dumb") diff --git a/bebop/help.py b/bebop/help.py index e3cd9c1..3affc67 100644 --- a/bebop/help.py +++ b/bebop/help.py @@ -69,6 +69,7 @@ Here are the available options: * home (string): home page. * render_mode (string): default render mode to use ("fancy" or "dumb"). * 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: