diff options
author | Florian Bruhin <me@the-compiler.org> | 2019-12-26 21:51:11 +0100 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2019-12-26 21:51:11 +0100 |
commit | b70683d31c86490c6a33ece93ff596d8f9388a97 (patch) | |
tree | 01e5bf4c3ad5b5b2bcf67777e12ea64e68158add | |
parent | 86fca3e99ee4836f5f591831eb93a09ffb8231d2 (diff) | |
download | qutebrowser-b70683d31c86490c6a33ece93ff596d8f9388a97.tar.gz qutebrowser-b70683d31c86490c6a33ece93ff596d8f9388a97.zip |
Fix ampersands in tab tooltips
This moves the setTabToolTip call to a better place - the previous
update_tab_title call had various problems, such as replacing & by && (to avoid
Qt interpreting it as a QShortcut accelerator) and exiting early if
{current_title} isn't in the title format. None of those matter for the tab
tooltip text, though.
-rw-r--r-- | doc/changelog.asciidoc | 1 | ||||
-rw-r--r-- | qutebrowser/mainwindow/tabwidget.py | 12 |
2 files changed, 8 insertions, 5 deletions
diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index feb22cb5e..e2bab9b49 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -90,6 +90,7 @@ Fixed javascript being enabled for `qute://` and `chrome://` pages) anymore. - The `qute-lastpass` userscript now stops prompting for passwords when cancelling the password input. +- The tab hover text now shows ampersands (&) correctly. - Various improvements for URL/searchengine detection: - Strings with a dot but with characters not allowed in a URL (e.g. an underscore) are now not treated as URL anymore. diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index 6e3c00aad..25ecc69b8 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -116,7 +116,13 @@ class TabWidget(QTabWidget): def set_page_title(self, idx, title): """Set the tab title user data.""" - self.tabBar().set_tab_data(idx, 'page-title', title) + tabbar = self.tabBar() + + if config.cache['tabs.tooltips']: + # always show only plain title in tooltips + tabbar.setTabToolTip(idx, title) + + tabbar.set_tab_data(idx, 'page-title', title) self.update_tab_title(idx) def page_title(self, idx): @@ -153,10 +159,6 @@ class TabWidget(QTabWidget): if tabbar.tabText(idx) != title: tabbar.setTabText(idx, title) - if config.cache['tabs.tooltips']: - # always show only plain title in tooltips - tabbar.setTabToolTip(idx, fields['current_title']) - def get_tab_fields(self, idx): """Get the tab field data.""" tab = self.widget(idx) |