From c94e06ccd28b4cef78625e70e085e5e60ac92e1a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 8 Jan 2019 07:31:54 +0530 Subject: [PATCH] hints kitten: Start hints numbering at one instead of zero by default. Added an option ``--hints-offset`` to control it. Fixes #1289 Fixes #1290 --- docs/changelog.rst | 3 +++ kittens/hints/main.py | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 468ad8857..b0ba8056b 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -6,6 +6,9 @@ Changelog 0.13.3 [future] ------------------------------ +- hints kitten: Start hints numbering at one instead of zero by default. Added + an option ``--hints-offset`` to control it. (:iss:`1289`) + - Fix a regression in the previous release that broke using ``background`` for :opt:`cursor_text_color` (:iss:`1288`) diff --git a/kittens/hints/main.py b/kittens/hints/main.py index f9f47534c..f71e0f8ea 100644 --- a/kittens/hints/main.py +++ b/kittens/hints/main.py @@ -315,8 +315,9 @@ def run(args, text): return largest_index = all_marks[-1].index + offset = max(0, args.hints_offset) for m in all_marks: - m.index = largest_index - m.index + m.index = largest_index - m.index + offset index_map = {m.index: m for m in all_marks} except Exception: import traceback @@ -378,6 +379,13 @@ default=auto choices=auto,always,never Add trailing space after matched text. Defaults to auto, which adds the space when used together with --multiple. + + +--hints-offset +default=1 +type=int +The offset (from zero) at which to start hint numbering. Note that only numbers +greater than zero are respected. '''.format(','.join(sorted(URL_PREFIXES))).format help_text = 'Select text from the screen using the keyboard. Defaults to searching for URLs.' usage = ''