From b70683d31c86490c6a33ece93ff596d8f9388a97 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 26 Dec 2019 21:51:11 +0100 Subject: 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. --- doc/changelog.asciidoc | 1 + 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) -- cgit v1.2.3-54-g00ecf