diff --git a/kittens/diff/config.py b/kittens/diff/config.py index 324ced793..60decee9b 100644 --- a/kittens/diff/config.py +++ b/kittens/diff/config.py @@ -73,7 +73,7 @@ def parse_scroll_by(func, rest): @func_with_args('scroll_to') def parse_scroll_to(func, rest): rest = rest.lower() - if rest not in {'start', 'end', 'next-change', 'prev-change'}: + if rest not in {'start', 'end', 'next-change', 'prev-change', 'next-page', 'prev-page'}: rest = 'start' return func, rest diff --git a/kittens/diff/diff.conf b/kittens/diff/diff.conf index 088834e2b..a9794d2fd 100644 --- a/kittens/diff/diff.conf +++ b/kittens/diff/diff.conf @@ -47,6 +47,9 @@ map down scroll_by 1 map up scroll_by -1 map home scroll_to start map end scroll_to end +map page_down scroll_to next-page +map page_up scroll_to prev-page +map space scroll_to next-page map n scroll_to next-change map p scroll_to prev-change map a change_context all diff --git a/kittens/diff/main.py b/kittens/diff/main.py index c315f5ddd..1bda390bb 100644 --- a/kittens/diff/main.py +++ b/kittens/diff/main.py @@ -76,7 +76,10 @@ class DiffHandler(Handler): where = args[0] if 'change' in where: return self.scroll_to_next_change(backwards='prev' in where) - amt = len(self.diff_lines) * (1 if 'end' in where else -1) + if 'page' in where: + amt = self.num_lines * (1 if 'next' in where else -1) + else: + amt = len(self.diff_lines) * (1 if 'end' in where else -1) return self.scroll_lines(amt) if func == 'change_context': new_ctx = self.current_context_count diff --git a/kitty/config_utils.py b/kitty/config_utils.py index 7518decfb..35abb695a 100644 --- a/kitty/config_utils.py +++ b/kitty/config_utils.py @@ -204,13 +204,15 @@ def parse_kittens_shortcut(sc): mods = resolved_mods is_text = False rkey = parts[-1] - if text_match(rkey) is None: + tkey = text_match(rkey) + if tkey is None: rkey = rkey.upper() rkey = config_key_map.get(rkey) if rkey is None: raise ValueError('Unknown shortcut key: {}'.format(sc)) else: is_text = True + rkey = tkey return mods, rkey, is_text diff --git a/kitty/key_encoding.py b/kitty/key_encoding.py index d88a828d1..e13887d7c 100644 --- a/kitty/key_encoding.py +++ b/kitty/key_encoding.py @@ -258,6 +258,8 @@ text_keys = string.ascii_uppercase + string.ascii_lowercase + string.digits + '` def text_match(key): + if key.upper() == 'SPACE': + return ' ' if key not in text_keys: return return key