Ignore tabs.last_close with tabs.tabs_are_windows

Closes #5695
Supersedes #5771
This commit is contained in:
Florian Bruhin 2020-12-22 14:29:15 +01:00
parent cd9c701a1b
commit 1c9bb926c6
5 changed files with 29 additions and 2 deletions

View File

@ -110,6 +110,8 @@ Changed
- The `importer.py` script doesn't use a browser argument anymore; instead its
`--input-format` switch can be used to configure the input format. The help also
was expanded to explain how to use it properly.
- If `tabs.tabs_are_windows` is set, the `tabs.last_close` setting is now
ignored and the window is always closed when using `:close` (`d`).
Fixed
~~~~~

View File

@ -3812,6 +3812,7 @@ Default: +pass:[3]+
[[tabs.last_close]]
=== tabs.last_close
How to behave when the last tab is closed.
If the `tabs.tabs_are_windows` setting is set, this is ignored and the behavior is always identical to the `close` value.
Type: <<types,String>>

View File

@ -1685,7 +1685,11 @@ tabs.last_close:
- startpage: "Load the start page."
- default-page: "Load the default page."
- close: "Close the window."
desc: How to behave when the last tab is closed.
desc: >-
How to behave when the last tab is closed.
If the `tabs.tabs_are_windows` setting is set, this is ignored and the behavior is
always identical to the `close` value.
tabs.mousewheel_switching:
default: true

View File

@ -411,7 +411,11 @@ class TabbedBrowser(QWidget):
add_undo: Whether the tab close can be undone.
new_undo: Whether the undo entry should be a new item in the stack.
"""
last_close = config.val.tabs.last_close
if config.val.tabs.tabs_are_windows:
last_close = 'close'
else:
last_close = config.val.tabs.last_close
count = self.widget.count()
if last_close == 'ignore' and count == 1:

View File

@ -6,6 +6,7 @@ Feature: Tab management
Background:
Given I clean up open tabs
And I set tabs.tabs_are_windows to false
And I clear the log
# :tab-close
@ -1415,6 +1416,21 @@ Feature: Tab management
- history:
- url: http://localhost:*/data/hello.txt
Scenario: Closing tab with tabs_are_windows
When I set tabs.tabs_are_windows to true
And I set tabs.last_close to ignore
And I open data/numbers/1.txt
And I open data/numbers/2.txt in a new tab
And I run :tab-close
And I wait for "removed: tabbed-browser" in the log
Then the session should look like:
windows:
- tabs:
- active: true
history:
- url: about:blank
- url: http://localhost:*/data/numbers/1.txt
# :tab-pin
Scenario: :tab-pin command