hints kitten: Start hints numbering at one instead of zero by default. Added an option `--hints-offset` to control it.

Fixes #1289
Fixes #1290
This commit is contained in:
Kovid Goyal 2019-01-08 07:31:54 +05:30
parent ea37799fb0
commit c94e06ccd2
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 12 additions and 1 deletions

View File

@ -6,6 +6,9 @@ Changelog
0.13.3 [future] 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 - Fix a regression in the previous release that broke using ``background`` for
:opt:`cursor_text_color` (:iss:`1288`) :opt:`cursor_text_color` (:iss:`1288`)

View File

@ -315,8 +315,9 @@ def run(args, text):
return return
largest_index = all_marks[-1].index largest_index = all_marks[-1].index
offset = max(0, args.hints_offset)
for m in all_marks: 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} index_map = {m.index: m for m in all_marks}
except Exception: except Exception:
import traceback import traceback
@ -378,6 +379,13 @@ default=auto
choices=auto,always,never choices=auto,always,never
Add trailing space after matched text. Defaults to auto, which adds the space Add trailing space after matched text. Defaults to auto, which adds the space
when used together with --multiple. 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 '''.format(','.join(sorted(URL_PREFIXES))).format
help_text = 'Select text from the screen using the keyboard. Defaults to searching for URLs.' help_text = 'Select text from the screen using the keyboard. Defaults to searching for URLs.'
usage = '' usage = ''