diff --git a/kitty/tab_bar.py b/kitty/tab_bar.py index a07f8dab2..bcb17c0b3 100644 --- a/kitty/tab_bar.py +++ b/kitty/tab_bar.py @@ -2,6 +2,7 @@ # vim:fileencoding=utf-8 # License: GPL v3 Copyright: 2018, Kovid Goyal +from functools import lru_cache from typing import Any, Dict, NamedTuple, Optional, Sequence, Set, Tuple from .config import build_ansi_color_table @@ -48,6 +49,16 @@ def as_rgb(x: int) -> int: template_failures: Set[str] = set() +@lru_cache() +def compile_template(template: str) -> Any: + try: + return compile('f"""' + template + '"""', '