Merge pull request #4508 from beelzebielsk/master
Implement pinned.tab.frozen setting (issue #4400)
This commit is contained in:
commit
fdb4dd728f
@ -943,6 +943,10 @@ class AbstractTab(QWidget):
|
||||
evt.posted = True
|
||||
QApplication.postEvent(recipient, evt)
|
||||
|
||||
def navigation_blocked(self) -> bool:
|
||||
"""Test if navigation is allowed on the current tab."""
|
||||
return self.data.pinned and config.val.tabs.pinned.frozen
|
||||
|
||||
@pyqtSlot(QUrl)
|
||||
def _on_before_load_started(self, url: QUrl) -> None:
|
||||
"""Adjust the title if we are going to visit a URL soon."""
|
||||
|
@ -316,7 +316,7 @@ class CommandDispatcher:
|
||||
else:
|
||||
# Explicit count with a tab that doesn't exist.
|
||||
return
|
||||
elif curtab.data.pinned:
|
||||
elif curtab.navigation_blocked():
|
||||
message.info("Tab is pinned!")
|
||||
else:
|
||||
curtab.load_url(cur_url)
|
||||
|
@ -118,7 +118,7 @@ def printpage(tab: apitypes.Tab,
|
||||
@cmdutils.argument('tab', value=cmdutils.Value.cur_tab)
|
||||
def home(tab: apitypes.Tab) -> None:
|
||||
"""Open main startpage in current tab."""
|
||||
if tab.data.pinned:
|
||||
if tab.navigation_blocked():
|
||||
message.info("Tab is pinned!")
|
||||
else:
|
||||
tab.load_url(config.val.url.start_pages[0])
|
||||
|
@ -1768,6 +1768,11 @@ tabs.pinned.shrink:
|
||||
type: Bool
|
||||
desc: Shrink pinned tabs down to their contents.
|
||||
|
||||
tabs.pinned.frozen:
|
||||
type: Bool
|
||||
default: True
|
||||
desc: Force pinned tabs to stay at fixed URL.
|
||||
|
||||
tabs.wrap:
|
||||
default: true
|
||||
type: Bool
|
||||
|
@ -1289,6 +1289,14 @@ Feature: Tab management
|
||||
And the following tabs should be open:
|
||||
- data/numbers/1.txt (active) (pinned)
|
||||
|
||||
Scenario: :tab-pin open url with tabs.pinned.frozen = false
|
||||
When I set tabs.pinned.frozen to false
|
||||
And I open data/numbers/1.txt
|
||||
And I run :tab-pin
|
||||
And I open data/numbers/2.txt
|
||||
Then the following tabs should be open:
|
||||
- data/numbers/2.txt (active) (pinned)
|
||||
|
||||
Scenario: :home on a pinned tab
|
||||
When I open data/numbers/1.txt
|
||||
And I run :tab-pin
|
||||
@ -1297,6 +1305,16 @@ Feature: Tab management
|
||||
And the following tabs should be open:
|
||||
- data/numbers/1.txt (active) (pinned)
|
||||
|
||||
Scenario: :home on a pinned tab with tabs.pinned.frozen = false
|
||||
When I set url.start_pages to ["http://localhost:(port)/data/numbers/2.txt"]
|
||||
And I set tabs.pinned.frozen to false
|
||||
And I open data/numbers/1.txt
|
||||
And I run :tab-pin
|
||||
And I run :home
|
||||
Then data/numbers/2.txt should be loaded
|
||||
And the following tabs should be open:
|
||||
- data/numbers/2.txt (active) (pinned)
|
||||
|
||||
Scenario: Cloning a pinned tab
|
||||
When I open data/numbers/1.txt
|
||||
And I run :tab-pin
|
||||
|
Loading…
Reference in New Issue
Block a user