Don't accept floats for :scroll-px.
This commit is contained in:
parent
71134f97e3
commit
40e2258ef3
@ -68,6 +68,7 @@ Changed
|
|||||||
finished. When set to `-1`, downloads are never removed.
|
finished. When set to `-1`, downloads are never removed.
|
||||||
- The `:follow-hint` command now optionally takes the keystring of a hint to
|
- The `:follow-hint` command now optionally takes the keystring of a hint to
|
||||||
follow.
|
follow.
|
||||||
|
- `:scroll-px` now doesn't take floats anymore, which made little sense.
|
||||||
|
|
||||||
Deprecated
|
Deprecated
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
|
@ -521,7 +521,7 @@ class CommandDispatcher:
|
|||||||
|
|
||||||
@cmdutils.register(instance='command-dispatcher', hide=True,
|
@cmdutils.register(instance='command-dispatcher', hide=True,
|
||||||
scope='window', count='count')
|
scope='window', count='count')
|
||||||
def scroll_px(self, dx: {'type': float}, dy: {'type': float}, count=1):
|
def scroll_px(self, dx: {'type': int}, dy: {'type': int}, count=1):
|
||||||
"""Scroll the current tab by 'count * dx/dy' pixels.
|
"""Scroll the current tab by 'count * dx/dy' pixels.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -538,8 +538,8 @@ class CommandDispatcher:
|
|||||||
@cmdutils.register(instance='command-dispatcher', hide=True,
|
@cmdutils.register(instance='command-dispatcher', hide=True,
|
||||||
scope='window', count='count')
|
scope='window', count='count')
|
||||||
def scroll(self,
|
def scroll(self,
|
||||||
direction: {'type': (str, float)},
|
direction: {'type': (str, int)},
|
||||||
dy: {'type': float, 'hide': True}=None,
|
dy: {'type': int, 'hide': True}=None,
|
||||||
count=1):
|
count=1):
|
||||||
"""Scroll the current tab in the given direction.
|
"""Scroll the current tab in the given direction.
|
||||||
|
|
||||||
@ -552,8 +552,8 @@ class CommandDispatcher:
|
|||||||
# pylint: disable=too-many-locals
|
# pylint: disable=too-many-locals
|
||||||
try:
|
try:
|
||||||
# Check for deprecated dx/dy form (like with scroll-px).
|
# Check for deprecated dx/dy form (like with scroll-px).
|
||||||
dx = float(direction)
|
dx = int(direction)
|
||||||
dy = float(dy)
|
dy = int(dy)
|
||||||
except (ValueError, TypeError):
|
except (ValueError, TypeError):
|
||||||
# Invalid values will get handled later.
|
# Invalid values will get handled later.
|
||||||
pass
|
pass
|
||||||
|
@ -46,6 +46,12 @@ Feature: Scrolling
|
|||||||
And I run :scroll-px 10 10
|
And I run :scroll-px 10 10
|
||||||
Then no crash should happen
|
Then no crash should happen
|
||||||
|
|
||||||
|
Scenario: :scroll-px with floats
|
||||||
|
# This used to be allowed, but doesn't make much sense.
|
||||||
|
When I run :scroll-px 2.5 2.5
|
||||||
|
Then the error "scroll-px: Argument dx: invalid int value: '2.5'" should be shown.
|
||||||
|
And the page should not be scrolled.
|
||||||
|
|
||||||
## :scroll
|
## :scroll
|
||||||
|
|
||||||
Scenario: Scrolling down
|
Scenario: Scrolling down
|
||||||
@ -94,6 +100,11 @@ Feature: Scrolling
|
|||||||
Then the warning ":scroll with dx/dy arguments is deprecated - use :scroll-px instead!" should be shown.
|
Then the warning ":scroll with dx/dy arguments is deprecated - use :scroll-px instead!" should be shown.
|
||||||
Then the page should be scrolled vertically.
|
Then the page should be scrolled vertically.
|
||||||
|
|
||||||
|
Scenario: :scroll with deprecated pixel argument (float)
|
||||||
|
When I run :scroll 2.5 2.5
|
||||||
|
Then the error "scroll: Argument dy: invalid int value: '2.5'" should be shown.
|
||||||
|
And the page should not be scrolled.
|
||||||
|
|
||||||
Scenario: Scrolling down and up with count
|
Scenario: Scrolling down and up with count
|
||||||
When I run :scroll down with count 2
|
When I run :scroll down with count 2
|
||||||
And I run :scroll up
|
And I run :scroll up
|
||||||
|
Loading…
Reference in New Issue
Block a user