Allow empty string for tabs -> title-format

This commit is contained in:
Florian Bruhin 2016-08-19 08:30:10 +02:00
parent 3d1859b13e
commit a40dd7edf6
3 changed files with 5 additions and 2 deletions

View File

@ -96,6 +96,7 @@ Changed
it caused some issues and then never re-applied.
- Sending a command to an existing instance (via "qutebrowser :reload") now
doesn't mark it as urgent anymore.
- `tabs -> title-format` now treats an empty string as valid.
Deprecated
~~~~~~~~~~

View File

@ -650,7 +650,8 @@ def data(readonly=False):
('title-format',
SettingValue(typ.FormatString(
fields=['perc', 'perc_raw', 'title', 'title_sep', 'index',
'id', 'scroll_pos', 'host']), '{index}: {title}'),
'id', 'scroll_pos', 'host'], none_ok=True),
'{index}: {title}'),
"The format to use for the tab title. The following placeholders "
"are defined:\n\n"
"* `{perc}`: The percentage as a string like `[10%]`.\n"

View File

@ -106,7 +106,8 @@ class TabWidget(QTabWidget):
fields['index'] = idx + 1
fmt = config.get('tabs', 'title-format')
self.tabBar().setTabText(idx, fmt.format(**fields))
title = '' if fmt is None else fmt.format(**fields)
self.tabBar().setTabText(idx, title)
def get_tab_fields(self, idx):
"""Get the tab field data."""