mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-25 17:52:02 +02:00
Merge branch 'fix/tab-title-template-f-string' of https://github.com/chriszarate/kitty
This commit is contained in:
@@ -58,7 +58,14 @@ def draw_title(draw_data: DrawData, screen: Screen, tab: TabBarData, index: int)
|
|||||||
if tab.is_active and draw_data.active_title_template is not None:
|
if tab.is_active and draw_data.active_title_template is not None:
|
||||||
template = draw_data.active_title_template
|
template = draw_data.active_title_template
|
||||||
try:
|
try:
|
||||||
title = template.format(title=tab.title, index=index, layout_name=tab.layout_name, num_windows=tab.num_windows)
|
eval_locals = {
|
||||||
|
'index': index,
|
||||||
|
'layout_name': tab.layout_name,
|
||||||
|
'num_windows': tab.num_windows,
|
||||||
|
'title': tab.title
|
||||||
|
}
|
||||||
|
compiled_template = compile('f"""' + template + '"""', '<tab_template>', 'eval')
|
||||||
|
title = eval(compiled_template, {'__builtins__': {}}, eval_locals)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if template not in template_failures:
|
if template not in template_failures:
|
||||||
template_failures.add(template)
|
template_failures.add(template)
|
||||||
|
|||||||
Reference in New Issue
Block a user