Merge 2760accc67 into 7e3df43463
This commit is contained in:
commit
14aa4c621f
|
|
@ -255,6 +255,7 @@
|
||||||
|<<hints.dictionary,hints.dictionary>>|Dictionary file to be used by the word hints.
|
|<<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.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.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.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.min_chars,hints.min_chars>>|Minimum number of characters used for hint strings.
|
||||||
|<<hints.mode,hints.mode>>|Mode to use for hints.
|
|<<hints.mode,hints.mode>>|Mode to use for hints.
|
||||||
|
|
@ -264,7 +265,6 @@
|
||||||
|<<hints.radius,hints.radius>>|Rounding radius (in pixels) for the edges of hints.
|
|<<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.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.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.
|
|<<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.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.
|
|<<input.forward_unbound_keys,input.forward_unbound_keys>>|Which unbound keys to forward to the webview in normal mode.
|
||||||
|
|
@ -3359,6 +3359,15 @@ Type: <<types,Bool>>
|
||||||
|
|
||||||
Default: +pass:[true]+
|
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]]
|
||||||
=== hints.leave_on_load
|
=== hints.leave_on_load
|
||||||
Leave hint mode when starting a new page load.
|
Leave hint mode when starting a new page load.
|
||||||
|
|
@ -3528,14 +3537,6 @@ Default:
|
||||||
* +pass:[[src\]]+
|
* +pass:[[src\]]+
|
||||||
* +pass:[[href\]]+
|
* +pass:[[href\]]+
|
||||||
|
|
||||||
[[hints.uppercase]]
|
|
||||||
=== hints.uppercase
|
|
||||||
Make characters in hint strings uppercase.
|
|
||||||
|
|
||||||
Type: <<types,Bool>>
|
|
||||||
|
|
||||||
Default: +pass:[false]+
|
|
||||||
|
|
||||||
[[history_gap_interval]]
|
[[history_gap_interval]]
|
||||||
=== 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.
|
Maximum time (in minutes) between two history items for them to be considered being from the same browsing session.
|
||||||
|
|
|
||||||
|
|
@ -110,10 +110,13 @@ class HintLabel(QLabel):
|
||||||
matched: The part of the text which was typed.
|
matched: The part of the text which was typed.
|
||||||
unmatched: The part of the text which was not typed yet.
|
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']):
|
self._context.hint_mode in ['letter', 'word']):
|
||||||
matched = html.escape(matched.upper())
|
chars = config.val.hints.chars
|
||||||
unmatched = html.escape(unmatched.upper())
|
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:
|
else:
|
||||||
matched = html.escape(matched)
|
matched = html.escape(matched)
|
||||||
unmatched = html.escape(unmatched)
|
unmatched = html.escape(unmatched)
|
||||||
|
|
|
||||||
|
|
@ -1719,9 +1719,25 @@ hints.chars:
|
||||||
completions:
|
completions:
|
||||||
- ['asdfghjkl', "Home row"]
|
- ['asdfghjkl', "Home row"]
|
||||||
- ['aoeuidnths', "Home row (Dvorak)"]
|
- ['aoeuidnths', "Home row (Dvorak)"]
|
||||||
|
- ['hjkl', "Directional keys (Vim)"]
|
||||||
|
- ['hjklyubn', "Directional keys (roguelike)"]
|
||||||
- ['abcdefghijklmnopqrstuvwxyz', "All letters"]
|
- ['abcdefghijklmnopqrstuvwxyz', "All letters"]
|
||||||
desc: Characters used for hint strings.
|
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:
|
hints.dictionary:
|
||||||
default: /usr/share/dict/words
|
default: /usr/share/dict/words
|
||||||
type:
|
type:
|
||||||
|
|
@ -1875,11 +1891,6 @@ hints.selectors:
|
||||||
desc: CSS selectors used to determine which elements on a page should have
|
desc: CSS selectors used to determine which elements on a page should have
|
||||||
hints.
|
hints.
|
||||||
|
|
||||||
hints.uppercase:
|
|
||||||
default: false
|
|
||||||
type: Bool
|
|
||||||
desc: Make characters in hint strings uppercase.
|
|
||||||
|
|
||||||
hints.leave_on_load:
|
hints.leave_on_load:
|
||||||
default: false
|
default: false
|
||||||
type: Bool
|
type: Bool
|
||||||
|
|
|
||||||
|
|
@ -450,6 +450,7 @@ class YamlMigrations(QObject):
|
||||||
self._migrate_bindings_default()
|
self._migrate_bindings_default()
|
||||||
self._migrate_font_default_family()
|
self._migrate_font_default_family()
|
||||||
self._migrate_font_replacements()
|
self._migrate_font_replacements()
|
||||||
|
self._migrate_hints_uppercase()
|
||||||
|
|
||||||
self._migrate_bool('tabs.favicons.show', 'always', 'never')
|
self._migrate_bool('tabs.favicons.show', 'always', 'never')
|
||||||
self._migrate_bool('scrolling.bar', 'always', 'overlay')
|
self._migrate_bool('scrolling.bar', 'always', 'overlay')
|
||||||
|
|
@ -540,6 +541,23 @@ class YamlMigrations(QObject):
|
||||||
del self._settings['bindings.default']
|
del self._settings['bindings.default']
|
||||||
self.changed.emit()
|
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:
|
def _migrate_font_default_family(self) -> None:
|
||||||
old_name = 'fonts.monospace'
|
old_name = 'fonts.monospace'
|
||||||
new_name = 'fonts.default_family'
|
new_name = 'fonts.default_family'
|
||||||
|
|
|
||||||
|
|
@ -866,6 +866,40 @@ class TestYamlMigrations:
|
||||||
'content.media.video_capture']:
|
'content.media.video_capture']:
|
||||||
assert data[setting]['global'] == val
|
assert data[setting]['global'] == val
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('chars, uppercase', [
|
||||||
|
('aoeuidnths', True),
|
||||||
|
('abcdefghijklmnopqrstuvwxyz', True),
|
||||||
|
(None, True),
|
||||||
|
('aoeuidnths', False),
|
||||||
|
('abcdefghijklmnopqrstuvwxyz', False),
|
||||||
|
(None, False),
|
||||||
|
('aoeuidnths', None),
|
||||||
|
('abcdefghijklmnopqrstuvwxyz', None),
|
||||||
|
(None, None),
|
||||||
|
])
|
||||||
|
def test_hints_uppercase(self, yaml, autoconfig, chars, uppercase):
|
||||||
|
settings = {}
|
||||||
|
if chars is not None:
|
||||||
|
settings['hints.chars'] = {'global': chars}
|
||||||
|
if uppercase is not None:
|
||||||
|
settings['hints.uppercase'] = {'global': uppercase}
|
||||||
|
|
||||||
|
autoconfig.write(settings)
|
||||||
|
|
||||||
|
yaml.load()
|
||||||
|
yaml._save()
|
||||||
|
|
||||||
|
data = autoconfig.read()
|
||||||
|
if uppercase:
|
||||||
|
if 'hints.chars' in data:
|
||||||
|
labels = data['hints.chars']['global'].upper()
|
||||||
|
assert data['hints.labels']['global'] == labels
|
||||||
|
else:
|
||||||
|
labels = configdata.DATA['hints.chars'].default.upper()
|
||||||
|
assert data['hints.labels']['global'] == labels
|
||||||
|
else:
|
||||||
|
assert 'hints.labels' not in data
|
||||||
|
|
||||||
def test_empty_pattern(self, yaml, autoconfig):
|
def test_empty_pattern(self, yaml, autoconfig):
|
||||||
valid_pattern = 'https://example.com/*'
|
valid_pattern = 'https://example.com/*'
|
||||||
invalid_pattern = '*://*./*'
|
invalid_pattern = '*://*./*'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue