Use ${_monospace} for default hints font
This commit is contained in:
parent
016349941b
commit
7c17af3889
@ -2194,7 +2194,7 @@ Default: +pass:[8pt ${_monospace}]+
|
|||||||
=== hints
|
=== hints
|
||||||
Font used for the hints.
|
Font used for the hints.
|
||||||
|
|
||||||
Default: +pass:[bold 13px Monospace]+
|
Default: +pass:[bold 13px ${_monospace}]+
|
||||||
|
|
||||||
[[fonts-debug-console]]
|
[[fonts-debug-console]]
|
||||||
=== debug-console
|
=== debug-console
|
||||||
|
@ -322,6 +322,16 @@ def _transform_hint_color(val):
|
|||||||
return val
|
return val
|
||||||
|
|
||||||
|
|
||||||
|
def _transform_hint_font(val):
|
||||||
|
"""Transformer for fonts -> hints."""
|
||||||
|
match = re.fullmatch(r'(.*\d+p[xt]) Monospace', val)
|
||||||
|
if match:
|
||||||
|
# Close enough to the old default:
|
||||||
|
return match.group(1) + ' ${_monospace}'
|
||||||
|
else:
|
||||||
|
return val
|
||||||
|
|
||||||
|
|
||||||
class ConfigManager(QObject):
|
class ConfigManager(QObject):
|
||||||
|
|
||||||
"""Configuration manager for qutebrowser.
|
"""Configuration manager for qutebrowser.
|
||||||
@ -407,6 +417,7 @@ class ConfigManager(QObject):
|
|||||||
('colors', 'hints.bg'): _transform_hint_color,
|
('colors', 'hints.bg'): _transform_hint_color,
|
||||||
('colors', 'hints.fg'): _transform_hint_color,
|
('colors', 'hints.fg'): _transform_hint_color,
|
||||||
('colors', 'hints.fg.match'): _transform_hint_color,
|
('colors', 'hints.fg.match'): _transform_hint_color,
|
||||||
|
('fonts', 'hints'): _transform_hint_font,
|
||||||
}
|
}
|
||||||
|
|
||||||
changed = pyqtSignal(str, str)
|
changed = pyqtSignal(str, str)
|
||||||
|
@ -1305,7 +1305,7 @@ def data(readonly=False):
|
|||||||
"Font used for the downloadbar."),
|
"Font used for the downloadbar."),
|
||||||
|
|
||||||
('hints',
|
('hints',
|
||||||
SettingValue(typ.Font(), 'bold 13px Monospace'),
|
SettingValue(typ.Font(), 'bold 13px ${_monospace}'),
|
||||||
"Font used for the hints."),
|
"Font used for the hints."),
|
||||||
|
|
||||||
('debug-console',
|
('debug-console',
|
||||||
|
@ -256,6 +256,15 @@ class TestTransformers:
|
|||||||
def test_hint_color(self, val, expected):
|
def test_hint_color(self, val, expected):
|
||||||
assert config._transform_hint_color(val) == expected
|
assert config._transform_hint_color(val) == expected
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('val, expected', [
|
||||||
|
('bold 12pt Monospace', 'bold 12pt ${_monospace}'),
|
||||||
|
('23pt Monospace', '23pt ${_monospace}'),
|
||||||
|
('bold 12pt ${_monospace}', 'bold 12pt ${_monospace}'),
|
||||||
|
('bold 12pt Comic Sans MS', 'bold 12pt Comic Sans MS'),
|
||||||
|
])
|
||||||
|
def test_hint_font(self, val, expected):
|
||||||
|
assert config._transform_hint_font(val) == expected
|
||||||
|
|
||||||
|
|
||||||
class TestKeyConfigParser:
|
class TestKeyConfigParser:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user