From f9e8a4050ce5b502754934908d0e1691cc7ffc05 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 2 Feb 2020 21:02:34 +0530 Subject: [PATCH] Allow leading and trailing spaces in tab_title_template by using quotes Fixes #2332 --- kitty/config_data.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/kitty/config_data.py b/kitty/config_data.py index bf49e3ec8..df338fad4 100644 --- a/kitty/config_data.py +++ b/kitty/config_data.py @@ -798,11 +798,21 @@ def tab_fade(x): The separator between tabs in the tab bar when using :code:`separator` as the :opt:`tab_bar_style`.''')) +def tab_title_template(x): + if x: + for q in '\'"': + if x.startswith(q) and x.endswith(q): + x = x[1:-1] + break + return x + + def active_tab_title_template(x): + x = tab_title_template(x) return None if x == 'none' else x -o('tab_title_template', '{title}', long_text=_(''' +o('tab_title_template', '"{title}"', option_type=tab_title_template, long_text=_(''' A template to render the tab title. The default just renders the title. If you wish to include the tab-index as well, use something like: :code:`{index}: {title}`. Useful