Replace hints.uppercase with hints.labels
This commit is contained in:
parent
ee40046faf
commit
234602cea4
|
|
@ -254,6 +254,7 @@
|
|||
|<<hints.dictionary,hints.dictionary>>|Dictionary file to be used by the word hints.
|
||||
|<<hints.find_implementation,hints.find_implementation>>|Which implementation to use to find elements to hint.
|
||||
|<<hints.hide_unmatched_rapid_hints,hints.hide_unmatched_rapid_hints>>|Hide unmatched hints in rapid mode.
|
||||
|<<hints.labels,hints.labels>>|Labels for hint characters.
|
||||
|<<hints.leave_on_load,hints.leave_on_load>>|Leave hint mode when starting a new page load.
|
||||
|<<hints.min_chars,hints.min_chars>>|Minimum number of characters used for hint strings.
|
||||
|<<hints.mode,hints.mode>>|Mode to use for hints.
|
||||
|
|
@ -263,7 +264,6 @@
|
|||
|<<hints.radius,hints.radius>>|Rounding radius (in pixels) for the edges of hints.
|
||||
|<<hints.scatter,hints.scatter>>|Scatter hint key chains (like Vimium) or not (like dwb).
|
||||
|<<hints.selectors,hints.selectors>>|CSS selectors used to determine which elements on a page should have hints.
|
||||
|<<hints.uppercase,hints.uppercase>>|Make characters in hint strings uppercase.
|
||||
|<<history_gap_interval,history_gap_interval>>|Maximum time (in minutes) between two history items for them to be considered being from the same browsing session.
|
||||
|<<input.escape_quits_reporter,input.escape_quits_reporter>>|Allow Escape to quit the crash reporter.
|
||||
|<<input.forward_unbound_keys,input.forward_unbound_keys>>|Which unbound keys to forward to the webview in normal mode.
|
||||
|
|
@ -3356,6 +3356,15 @@ Type: <<types,Bool>>
|
|||
|
||||
Default: +pass:[true]+
|
||||
|
||||
[[hints.labels]]
|
||||
=== hints.labels
|
||||
Labels for hint characters.
|
||||
To replace the deprecated `hints.uppercase` setting set `c.hints.labels = c.hints.chars.upper()` in `config.py`.
|
||||
|
||||
Type: <<types,UniqueCharString>>
|
||||
|
||||
Default: empty
|
||||
|
||||
[[hints.leave_on_load]]
|
||||
=== hints.leave_on_load
|
||||
Leave hint mode when starting a new page load.
|
||||
|
|
@ -3523,14 +3532,6 @@ Default:
|
|||
* +pass:[[src\]]+
|
||||
* +pass:[[href\]]+
|
||||
|
||||
[[hints.uppercase]]
|
||||
=== hints.uppercase
|
||||
Make characters in hint strings uppercase.
|
||||
|
||||
Type: <<types,Bool>>
|
||||
|
||||
Default: +pass:[false]+
|
||||
|
||||
[[history_gap_interval]]
|
||||
=== history_gap_interval
|
||||
Maximum time (in minutes) between two history items for them to be considered being from the same browsing session.
|
||||
|
|
|
|||
|
|
@ -118,10 +118,13 @@ class HintLabel(QLabel):
|
|||
matched: The part of the text which was typed.
|
||||
unmatched: The part of the text which was not typed yet.
|
||||
"""
|
||||
if (config.cache['hints.uppercase'] and
|
||||
if (config.cache['hints.labels'] and
|
||||
self._context.hint_mode in ['letter', 'word']):
|
||||
matched = html.escape(matched.upper())
|
||||
unmatched = html.escape(unmatched.upper())
|
||||
chars = config.val.hints.chars
|
||||
labels = config.val.hints.labels
|
||||
table = str.maketrans(dict(zip(chars, labels)))
|
||||
matched = html.escape(matched.translate(table))
|
||||
unmatched = html.escape(unmatched.translate(table))
|
||||
else:
|
||||
matched = html.escape(matched)
|
||||
unmatched = html.escape(unmatched)
|
||||
|
|
|
|||
|
|
@ -1621,9 +1621,25 @@ hints.chars:
|
|||
completions:
|
||||
- ['asdfghjkl', "Home row"]
|
||||
- ['aoeuidnths', "Home row (Dvorak)"]
|
||||
- ['hjkl', "Directional keys (Vim)"]
|
||||
- ['hjklyubn', "Directional keys (roguelike)"]
|
||||
- ['abcdefghijklmnopqrstuvwxyz', "All letters"]
|
||||
desc: Characters used for hint strings.
|
||||
|
||||
hints.labels:
|
||||
default:
|
||||
type:
|
||||
name: UniqueCharString
|
||||
none_ok: true
|
||||
completions:
|
||||
- ['←↓↑→', "Arrows for directional keys (Vim)"]
|
||||
- ['←↓↑→↖↗↙↘', "Arrows for directional keys (roguelike)"]
|
||||
desc: >-
|
||||
Labels for hint characters.
|
||||
|
||||
To replace the removed `hints.uppercase` setting, set `c.hints.labels =
|
||||
c.hints.chars.upper()` in `config.py`.
|
||||
|
||||
hints.dictionary:
|
||||
default: /usr/share/dict/words
|
||||
type:
|
||||
|
|
@ -1775,11 +1791,6 @@ hints.selectors:
|
|||
desc: CSS selectors used to determine which elements on a page should have
|
||||
hints.
|
||||
|
||||
hints.uppercase:
|
||||
default: false
|
||||
type: Bool
|
||||
desc: Make characters in hint strings uppercase.
|
||||
|
||||
hints.leave_on_load:
|
||||
default: false
|
||||
type: Bool
|
||||
|
|
|
|||
|
|
@ -463,6 +463,7 @@ class YamlMigrations(QObject):
|
|||
self._migrate_bindings_default()
|
||||
self._migrate_font_default_family()
|
||||
self._migrate_font_replacements()
|
||||
self._migrate_hints_uppercase()
|
||||
|
||||
self._migrate_bool('tabs.favicons.show', 'always', 'never')
|
||||
self._migrate_bool('scrolling.bar', 'always', 'overlay')
|
||||
|
|
@ -553,6 +554,23 @@ class YamlMigrations(QObject):
|
|||
del self._settings['bindings.default']
|
||||
self.changed.emit()
|
||||
|
||||
def _migrate_hints_uppercase(self) -> None:
|
||||
if 'hints.uppercase' not in self._settings:
|
||||
return
|
||||
|
||||
self._settings['hints.labels'] = {}
|
||||
|
||||
for scope, val in self._settings['hints.uppercase'].items():
|
||||
if val and 'hints.chars' in self._settings:
|
||||
labels = self._settings['hints.chars'][scope].upper()
|
||||
self._settings['hints.labels'][scope] = labels
|
||||
elif val and 'hints.chars' not in self._settings:
|
||||
labels = configdata.DATA['hints.chars'].default.upper()
|
||||
self._settings['hints.labels'][scope] = labels
|
||||
|
||||
del self._settings['hints.uppercase']
|
||||
self.changed.emit()
|
||||
|
||||
def _migrate_font_default_family(self) -> None:
|
||||
old_name = 'fonts.monospace'
|
||||
new_name = 'fonts.default_family'
|
||||
|
|
|
|||
Loading…
Reference in New Issue