change_font_size: allow multiplying/dividing the current font size in addition to incrementing it

Fixes #8616
This commit is contained in:
Kovid Goyal
2025-05-09 07:39:06 +05:30
parent e0e4e53e3b
commit 6a53897c17
6 changed files with 23 additions and 5 deletions

View File

@@ -4182,6 +4182,11 @@ To setup shortcuts for specific font sizes::
To setup shortcuts to change only the current OS window's font size::
map kitty_mod+f6 change_font_size current 10.0
To setup shortcuts to multiply/divide the font size:
map kitty_mod+f6 change_font_size all *2.0
map kitty_mod+f6 change_font_size all /2.0
''') # }}}

View File

@@ -199,7 +199,7 @@ def parse_change_font_size(func: str, rest: str) -> tuple[str, tuple[bool, str |
c_all = vals[0].lower() == 'all'
sign: str | None = None
amt = vals[1]
if amt[0] in '+-':
if amt[0] in '+-*/':
sign = amt[0]
amt = amt[1:]
return func, (c_all, sign, float(amt.strip()))