diff --git a/kitty/fonts/core_text.py b/kitty/fonts/core_text.py index 6718fc0f2..b9e4735b4 100644 --- a/kitty/fonts/core_text.py +++ b/kitty/fonts/core_text.py @@ -29,7 +29,7 @@ def create_font_map(all_fonts: Iterable[CoreTextFont]) -> FontMap: ps = (x['postscript_name'] or '').lower() ans['family_map'].setdefault(f, []).append(x) ans['ps_map'].setdefault(ps, []).append(x) - ans['full_map'].setdefault(f + ' ' + s, []).append(x) + ans['full_map'].setdefault(f'{f} {s}', []).append(x) return ans @@ -45,7 +45,7 @@ def list_fonts() -> Generator[ListedFont, None, None]: for fd in coretext_all_fonts(): f = fd['family'] if f: - fn = (f + ' ' + (fd['style'] or '')).strip() + fn = f'{f} {fd.get("style", "")}'.strip() is_mono = bool(fd['monospace']) yield {'family': f, 'full_name': fn, 'postscript_name': fd['postscript_name'] or '', 'is_monospace': is_mono} diff --git a/kitty/fonts/fontconfig.py b/kitty/fonts/fontconfig.py index 763f8d333..01c3ba047 100644 --- a/kitty/fonts/fontconfig.py +++ b/kitty/fonts/fontconfig.py @@ -58,7 +58,7 @@ def list_fonts() -> Generator[ListedFont, None, None]: if fn_: fn = str(fn_) else: - fn = (f + ' ' + str(fd.get('style', ''))).strip() + fn = f'{f} {fd.get("style", "")}'.strip() is_mono = fd.get('spacing') in ('MONO', 'DUAL') yield {'family': f, 'full_name': fn, 'postscript_name': str(fd.get('postscript_name', '')), 'is_monospace': is_mono} diff --git a/kitty/fonts/list.py b/kitty/fonts/list.py index 7cbc65209..e56343823 100644 --- a/kitty/fonts/list.py +++ b/kitty/fonts/list.py @@ -28,13 +28,13 @@ def main(argv: Sequence[str]) -> None: groups = create_family_groups() for k in sorted(groups, key=lambda x: x.lower()): if isatty: - print('\033[1;32m' + k + '\033[m') + print(f'\033[1;32m{k}\033[m') else: print(k) for f in sorted(groups[k], key=lambda x: x['full_name'].lower()): p = f['full_name'] if isatty: - p = '\033[3m' + p + '\033[m' + p = f'\033[3m{p}\033[m' if psnames: p += ' ({})'.format(f['postscript_name']) print(' ', p) diff --git a/kitty/fonts/render.py b/kitty/fonts/render.py index 500acb950..e617897a2 100644 --- a/kitty/fonts/render.py +++ b/kitty/fonts/render.py @@ -515,7 +515,7 @@ def test_fallback_font(qtext: Optional[str] = None, bold: bool = False, italic: try: print(text, f) except UnicodeEncodeError: - sys.stdout.buffer.write((text + ' %s\n' % f).encode('utf-8')) + sys.stdout.buffer.write(f'{text} {f}\n'.encode('utf-8')) def showcase() -> None: diff --git a/kitty/rc/send_text.py b/kitty/rc/send_text.py index 1a658029c..8c623c197 100644 --- a/kitty/rc/send_text.py +++ b/kitty/rc/send_text.py @@ -107,20 +107,20 @@ Do not send text to the active window, even if it is one of the matched windows. if '\x04' in decoded_data: decoded_data = decoded_data[:decoded_data.index('\x04')] keep_going = False - ret['data'] = 'text:' + decoded_data + ret['data'] = f'text:{decoded_data}' yield ret else: while True: data = sys.stdin.buffer.read(limit) if not data: break - ret['data'] = 'base64:' + base64.standard_b64encode(data).decode('ascii') + ret['data'] = f'base64:{base64.standard_b64encode(data).decode("ascii")}' yield ret def chunks(text: str) -> CmdGenerator: data = parse_send_text_bytes(text).decode('utf-8') while data: - ret['data'] = 'text:' + data[:limit] + ret['data'] = f'text:{data[:limit]}' yield ret data = data[limit:] @@ -130,7 +130,7 @@ Do not send text to the active window, even if it is one of the matched windows. data = f.read(limit) if not data: break - ret['data'] = 'base64:' + base64.standard_b64encode(data).decode('ascii') + ret['data'] = f'base64:{base64.standard_b64encode(data).decode("ascii")}' yield ret sources = []