parent
8d5fdf2833
commit
abfd789f9e
@ -57,6 +57,8 @@ Changed
|
|||||||
- Rapid hints can now also be used for the `normal` hint target, which can be
|
- Rapid hints can now also be used for the `normal` hint target, which can be
|
||||||
useful with javascript click handlers or checkboxes which don't actually open
|
useful with javascript click handlers or checkboxes which don't actually open
|
||||||
a new page.
|
a new page.
|
||||||
|
- `:zoom-in` or `:zoom-out` (`+`/`-`) with a too large count now zooms to the
|
||||||
|
smallest/largest zoom instead of doing nothing.
|
||||||
|
|
||||||
Fixed
|
Fixed
|
||||||
-----
|
-----
|
||||||
|
@ -213,7 +213,7 @@ class WebView(QWebView):
|
|||||||
"""Initialize the _zoom neighborlist."""
|
"""Initialize the _zoom neighborlist."""
|
||||||
levels = config.get('ui', 'zoom-levels')
|
levels = config.get('ui', 'zoom-levels')
|
||||||
self._zoom = usertypes.NeighborList(
|
self._zoom = usertypes.NeighborList(
|
||||||
levels, mode=usertypes.NeighborList.Modes.block)
|
levels, mode=usertypes.NeighborList.Modes.edge)
|
||||||
self._zoom.fuzzyval = config.get('ui', 'default-zoom')
|
self._zoom.fuzzyval = config.get('ui', 'default-zoom')
|
||||||
|
|
||||||
def _mousepress_backforward(self, e):
|
def _mousepress_backforward(self, e):
|
||||||
|
@ -65,7 +65,7 @@ class NeighborList(collections.abc.Sequence):
|
|||||||
_mode: The current mode.
|
_mode: The current mode.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
Modes = enum('Modes', ['block', 'exception'])
|
Modes = enum('Modes', ['edge', 'exception'])
|
||||||
|
|
||||||
def __init__(self, items=None, default=_UNSET, mode=Modes.exception):
|
def __init__(self, items=None, default=_UNSET, mode=Modes.exception):
|
||||||
"""Constructor.
|
"""Constructor.
|
||||||
@ -74,7 +74,7 @@ class NeighborList(collections.abc.Sequence):
|
|||||||
items: The list of items to iterate in.
|
items: The list of items to iterate in.
|
||||||
_default: The initially selected value.
|
_default: The initially selected value.
|
||||||
_mode: Behavior when the first/last item is reached.
|
_mode: Behavior when the first/last item is reached.
|
||||||
Modes.block: Stay on the selected item
|
Modes.edge: Go to the first/last item
|
||||||
Modes.exception: Raise an IndexError.
|
Modes.exception: Raise an IndexError.
|
||||||
"""
|
"""
|
||||||
if not isinstance(mode, self.Modes):
|
if not isinstance(mode, self.Modes):
|
||||||
@ -140,8 +140,13 @@ class NeighborList(collections.abc.Sequence):
|
|||||||
else:
|
else:
|
||||||
raise IndexError
|
raise IndexError
|
||||||
except IndexError:
|
except IndexError:
|
||||||
if self._mode == self.Modes.block:
|
if self._mode == self.Modes.edge:
|
||||||
new = self.curitem()
|
if offset == 0:
|
||||||
|
new = self.curitem()
|
||||||
|
elif offset > 0:
|
||||||
|
new = self.lastitem()
|
||||||
|
else:
|
||||||
|
new = self.firstitem()
|
||||||
elif self._mode == self.Modes.exception: # pragma: no branch
|
elif self._mode == self.Modes.exception: # pragma: no branch
|
||||||
raise
|
raise
|
||||||
else:
|
else:
|
||||||
|
@ -23,8 +23,21 @@ Feature: Zooming in and out
|
|||||||
# https://github.com/The-Compiler/qutebrowser/issues/1118
|
# https://github.com/The-Compiler/qutebrowser/issues/1118
|
||||||
Scenario: Zooming in with very big count
|
Scenario: Zooming in with very big count
|
||||||
When I run :zoom-in with count 99999999999
|
When I run :zoom-in with count 99999999999
|
||||||
Then the message "Zoom level: 100%" should be shown
|
Then the message "Zoom level: 120%" should be shown
|
||||||
And the zoom should be 100%
|
And the zoom should be 120%
|
||||||
|
|
||||||
|
# https://github.com/The-Compiler/qutebrowser/issues/1118
|
||||||
|
Scenario: Zooming out with very big count
|
||||||
|
When I run :zoom-out with count 99999999999
|
||||||
|
Then the message "Zoom level: 50%" should be shown
|
||||||
|
And the zoom should be 50%
|
||||||
|
|
||||||
|
# https://github.com/The-Compiler/qutebrowser/issues/1118
|
||||||
|
Scenario: Zooming in with very big count and snapping in
|
||||||
|
When I run :zoom-in with count 99999999999
|
||||||
|
And I run :zoom-out
|
||||||
|
Then the message "Zoom level: 110%" should be shown
|
||||||
|
And the zoom should be 110%
|
||||||
|
|
||||||
Scenario: Zooming out with count
|
Scenario: Zooming out with count
|
||||||
When I run :zoom-out with count 2
|
When I run :zoom-out with count 2
|
||||||
|
@ -172,9 +172,9 @@ class TestSingleItem:
|
|||||||
def neighborlist(self):
|
def neighborlist(self):
|
||||||
return usertypes.NeighborList([1], default=1)
|
return usertypes.NeighborList([1], default=1)
|
||||||
|
|
||||||
def test_first_block(self, neighborlist):
|
def test_first_edge(self, neighborlist):
|
||||||
"""Test out of bounds previtem() with mode=block."""
|
"""Test out of bounds previtem() with mode=edge."""
|
||||||
neighborlist._mode = usertypes.NeighborList.Modes.block
|
neighborlist._mode = usertypes.NeighborList.Modes.edge
|
||||||
neighborlist.firstitem()
|
neighborlist.firstitem()
|
||||||
assert neighborlist._idx == 0
|
assert neighborlist._idx == 0
|
||||||
assert neighborlist.previtem() == 1
|
assert neighborlist.previtem() == 1
|
||||||
@ -189,9 +189,9 @@ class TestSingleItem:
|
|||||||
neighborlist.previtem()
|
neighborlist.previtem()
|
||||||
assert neighborlist._idx == 0
|
assert neighborlist._idx == 0
|
||||||
|
|
||||||
def test_last_block(self, neighborlist):
|
def test_last_edge(self, neighborlist):
|
||||||
"""Test out of bounds nextitem() with mode=block."""
|
"""Test out of bounds nextitem() with mode=edge."""
|
||||||
neighborlist._mode = usertypes.NeighborList.Modes.block
|
neighborlist._mode = usertypes.NeighborList.Modes.edge
|
||||||
neighborlist.lastitem()
|
neighborlist.lastitem()
|
||||||
assert neighborlist._idx == 0
|
assert neighborlist._idx == 0
|
||||||
assert neighborlist.nextitem() == 1
|
assert neighborlist.nextitem() == 1
|
||||||
@ -207,15 +207,15 @@ class TestSingleItem:
|
|||||||
assert neighborlist._idx == 0
|
assert neighborlist._idx == 0
|
||||||
|
|
||||||
|
|
||||||
class TestBlockMode:
|
class TestEdgeMode:
|
||||||
|
|
||||||
"""Tests with mode=block."""
|
"""Tests with mode=edge."""
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def neighborlist(self):
|
def neighborlist(self):
|
||||||
return usertypes.NeighborList(
|
return usertypes.NeighborList(
|
||||||
[1, 2, 3, 4, 5], default=3,
|
[1, 2, 3, 4, 5], default=3,
|
||||||
mode=usertypes.NeighborList.Modes.block)
|
mode=usertypes.NeighborList.Modes.edge)
|
||||||
|
|
||||||
def test_first(self, neighborlist):
|
def test_first(self, neighborlist):
|
||||||
"""Test out of bounds previtem()."""
|
"""Test out of bounds previtem()."""
|
||||||
|
Loading…
Reference in New Issue
Block a user