Allow leading and trailing spaces in tab_title_template by using quotes

Fixes #2332
This commit is contained in:
Kovid Goyal 2020-02-02 21:02:34 +05:30
parent ce308286df
commit f9e8a4050c
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -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