Fix a bug where pinned tabs were occasionally miscounted

Example case: :tab-only. This should cover other cases, but currently those
cases (such as :tab-only) do NOT have a warning message when popping up.
This commit is contained in:
Jay Kamat 2017-05-11 13:28:26 -07:00
parent 725bafea54
commit 3317834b36
No known key found for this signature in database
GPG Key ID: 5D2E399600F4F7B5
3 changed files with 10 additions and 7 deletions

View File

@ -220,9 +220,6 @@ class CommandDispatcher:
self._tabbed_browser.close_tab(tab) self._tabbed_browser.close_tab(tab)
tabbar.setSelectionBehaviorOnRemove(old_selection_behavior) tabbar.setSelectionBehaviorOnRemove(old_selection_behavior)
if tab.data.pinned:
tabbar.pinned_count -= 1
@cmdutils.register(instance='command-dispatcher', scope='window') @cmdutils.register(instance='command-dispatcher', scope='window')
@cmdutils.argument('count', count=True) @cmdutils.argument('count', count=True)
def tab_close(self, prev=False, next_=False, opposite=False, def tab_close(self, prev=False, next_=False, opposite=False,
@ -244,7 +241,8 @@ class CommandDispatcher:
next_, opposite) next_, opposite)
if tab.data.pinned and not force: if tab.data.pinned and not force:
message.confirm_async(title='Pinned Tab', message.confirm_async(
title='Pinned Tab',
text="Are you sure you want to close a pinned tab?", text="Are you sure you want to close a pinned tab?",
yes_action=close, default=False) yes_action=close, default=False)
else: else:

View File

@ -241,6 +241,10 @@ class TabbedBrowser(tabwidget.TabWidget):
if last_close == 'ignore' and count == 1: if last_close == 'ignore' and count == 1:
return return
# If we are removing a pinned tab, decrease count
if tab.data.pinned:
self.tabBar().pinned_count -= 1
self._remove_tab(tab, add_undo=add_undo) self._remove_tab(tab, add_undo=add_undo)
if count == 1: # We just closed the last tab above. if count == 1: # We just closed the last tab above.

View File

@ -163,6 +163,7 @@ def clean_open_tabs(quteproc):
quteproc.send_cmd(':tab-close --force') quteproc.send_cmd(':tab-close --force')
quteproc.wait_for_load_finished_url('about:blank') quteproc.wait_for_load_finished_url('about:blank')
@bdd.given('pdfjs is available') @bdd.given('pdfjs is available')
def pdfjs_available(): def pdfjs_available():
if not pdfjs.is_available(): if not pdfjs.is_available():